diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 000000000..bfe22cb03 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "master", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index f1cc959ed..000000000 --- a/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -node_modules -dist -build -tests -tutorials -.github -.env -docker -.editorconfig -.eslintrc.json -.git -.npmrc -env_example diff --git a/.eslintrc.json b/.eslintrc.json index 4f22d36f5..6fde28d96 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,5 +1,6 @@ { - "plugins": ["jest", "sonarjs", "unused-imports"], + "root": true, + "plugins": ["jest", "sonarjs"], "globals": { "process": "readonly" }, @@ -7,14 +8,25 @@ "browser": true, "es6": true }, - "extends": ["plugin:sonarjs/recommended", "eslint:recommended", "plugin:jest/recommended", "airbnb-base"], - "parser": "babel-eslint", + "extends": [ + "plugin:sonarjs/recommended", + "eslint:recommended", + "plugin:jest/recommended", + "airbnb-base" + ], "parserOptions": { - "ecmaVersion": 2018, + "ecmaVersion": 2022, "sourceType": "module" }, "rules": { - "no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }], + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ], "no-use-before-define": [ "error", { @@ -23,17 +35,17 @@ "variables": true } ], - "unused-imports/no-unused-imports": "error", - "no-void": "off", - "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], "import/no-extraneous-dependencies": "off", - "import/prefer-default-export": "off", "class-methods-use-this": "off", "no-return-await": "off", - "no-bitwise": ["error", { "allow": ["~"] }], "no-plusplus": "off", - "no-restricted-properties": "off", + "no-void": "off", "max-len": "off", + "no-underscore-dangle": ["error", { "enforceInMethodNames": false }], + "max-classes-per-file": "off", + "import/prefer-default-export": "off", + "import/no-unresolved": "off", + "no-useless-constructor": "off", "no-console": "off", "no-else-return": "off", "no-restricted-syntax": [ diff --git a/.github/workflows/cheqd-sdk-tests.yml b/.github/workflows/cheqd-sdk-tests.yml new file mode 100644 index 000000000..f9395c876 --- /dev/null +++ b/.github/workflows/cheqd-sdk-tests.yml @@ -0,0 +1,17 @@ +name: Cheqd blockchain modules tests + +on: [pull_request] +jobs: + test: + runs-on: ubuntu-latest + env: + CHEQD_MNEMONIC: "steak come surprise obvious remain black trouble measure design volume retreat float coach amused match album moment radio stuff crack orphan ranch dose endorse" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: "20.x" + - run: yarn install --frozen-lockfile --ignore-scripts + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: CHEQD_MNEMONIC=$CHEQD_MNEMONIC turbo run test-with-node --filter @docknetwork/cheqd-blockchain-modules diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/credential-sdk-tests.yml similarity index 50% rename from .github/workflows/unit-tests.yml rename to .github/workflows/credential-sdk-tests.yml index 805c58b09..eaa3dce2b 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/credential-sdk-tests.yml @@ -1,14 +1,15 @@ -name: Unit tests +name: Credential SDK tests on: [pull_request] jobs: - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" - run: yarn install --frozen-lockfile --ignore-scripts - - run: yarn build - - run: yarn test + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run test --filter @docknetwork/credential-sdk diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/dock-sdk-tests.yml similarity index 51% rename from .github/workflows/integration-tests.yml rename to .github/workflows/dock-sdk-tests.yml index 8cd1969c5..7f43aa628 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/dock-sdk-tests.yml @@ -1,4 +1,4 @@ -name: Integration tests +name: Dock blockchain modules tests on: [pull_request] jobs: @@ -10,10 +10,11 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: "18.x" + node-version: "20.x" - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test-with-node + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run test-with-node --filter @docknetwork/dock-blockchain-modules mainnet: runs-on: ubuntu-latest env: @@ -22,19 +23,22 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: "18.x" + node-version: "20.x" - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test-with-node + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run test-with-node --filter @docknetwork/dock-blockchain-modules testnet: runs-on: ubuntu-latest env: CONFIG_DOCK_NODE_IMAGE_TAG: "testnet" + DisableTrustRegistryParticipantsTests: true steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: "18.x" + node-version: "20.x" - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test-with-node + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run test-with-node --filter @docknetwork/dock-blockchain-modules diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a89f9aa4c..2a1dc3a64 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,20 +15,20 @@ jobs: - name: Setup Node JS uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" - name: Install and Build 🔧 # Only need to install jsdoc package here and then run docs script run: | yarn install --frozen-lockfile --ignore-scripts - yarn docs + turbo run docs - name: Setup mdBook uses: peaceiris/actions-mdbook@v1 with: - mdbook-version: 'latest' + mdbook-version: "latest" - name: Generate mdBook - run: yarn mdbook + run: turbo run mdbook - name: Install SSH Client 🔑 uses: webfactory/ssh-agent@v0.4.1 diff --git a/.github/workflows/run-examples.yml b/.github/workflows/examples.yml similarity index 52% rename from .github/workflows/run-examples.yml rename to .github/workflows/examples.yml index d602fe50f..20f4f7e23 100644 --- a/.github/workflows/run-examples.yml +++ b/.github/workflows/examples.yml @@ -5,33 +5,39 @@ jobs: master: runs-on: ubuntu-latest env: - CONFIG_DOCK_NODE_IMAGE_TAG: 'master' + CONFIG_DOCK_NODE_IMAGE_TAG: "master" steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" - run: yarn install --frozen-lockfile --ignore-scripts - - run: yarn examples-with-node + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run examples-with-node mainnet: runs-on: ubuntu-latest env: - CONFIG_DOCK_NODE_IMAGE_TAG: 'mainnet' + CONFIG_DOCK_NODE_IMAGE_TAG: "mainnet" steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" - run: yarn install --frozen-lockfile --ignore-scripts - - run: yarn examples-with-node + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run examples-with-node testnet: runs-on: ubuntu-latest env: - CONFIG_DOCK_NODE_IMAGE_TAG: 'testnet' + CONFIG_DOCK_NODE_IMAGE_TAG: "testnet" steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" - run: yarn install --frozen-lockfile --ignore-scripts - - run: yarn examples-with-node + - run: npm install -g turbo@2.0.5 + - run: turbo telemetry disable + - run: turbo run examples-with-node diff --git a/.github/workflows/integration-tests-ipfs.yml b/.github/workflows/integration-tests-ipfs.yml deleted file mode 100644 index 35a96ec4b..000000000 --- a/.github/workflows/integration-tests-ipfs.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: IPFS tests - -on: [pull_request] -jobs: - master: - runs-on: ubuntu-latest - env: - CONFIG_DOCK_NODE_IMAGE_TAG: 'master' - steps: - - uses: actions/checkout@v2 - - uses: ibnesayeed/setup-ipfs@0.6.0 - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - with: - run_daemon: true - - uses: actions/setup-node@v1 - with: - node-version: '20.x' - - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test-ipfs-with-node - mainnet: - runs-on: ubuntu-latest - env: - CONFIG_DOCK_NODE_IMAGE_TAG: 'mainnet' - steps: - - uses: actions/checkout@v2 - - uses: ibnesayeed/setup-ipfs@0.6.0 - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - with: - run_daemon: true - - uses: actions/setup-node@v1 - with: - node-version: '20.x' - - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test-ipfs-with-node - testnet: - runs-on: ubuntu-latest - env: - CONFIG_DOCK_NODE_IMAGE_TAG: 'testnet' - steps: - - uses: actions/checkout@v2 - - uses: ibnesayeed/setup-ipfs@0.6.0 - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - with: - run_daemon: true - - uses: actions/setup-node@v1 - with: - node-version: '20.x' - - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test-ipfs-with-node diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b7453cae..00f690615 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,10 +12,11 @@ jobs: - name: Setup node uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" - name: Install, lint, type check and generate docs # Not uploading the docs. run: | yarn install --frozen-lockfile --ignore-scripts - yarn lint - yarn docs + npm install -g turbo@2.0.5 + turbo run lint --parallel + turbo run docs --parallel diff --git a/.github/workflows/npm-audit.yml b/.github/workflows/npm-audit.yml index 4b27e93b7..42b36d11c 100644 --- a/.github/workflows/npm-audit.yml +++ b/.github/workflows/npm-audit.yml @@ -11,13 +11,13 @@ on: - ".github/workflows/**" schedule: - - cron: '0 0 * * 0' # Every sunday at midnight + - cron: "0 0 * * 0" # Every sunday at midnight jobs: audit: runs-on: ubuntu-latest env: - NODE_VERSION: 18.x + NODE_VERSION: 20.x AVOID_LICENSES: "AGPL;GPL;AGPL-3.0" IGNORE_PACKAGES: "" diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index ddcd059e3..3699a3c47 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,23 +1,19 @@ -name: NPM Publish +name: npm Publish on: release: types: [published] jobs: - build: + build-and-publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: - node-version: '18.x' + node-version: "20.x" registry-url: https://registry.npmjs.org/ - run: yarn install --frozen-lockfile --ignore-scripts - - run: yarn build - - run: cp -rf package.json dist - - run: node scripts/set_export_paths.js - - run: cp -rf README.md dist - - run: cd dist && npm publish --access public + - run: yarn changeset publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.gitignore b/.gitignore index 562a473dc..cc92e0671 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,34 @@ -node_modules -dist -build -out -npm-debug.log -yarn-error.log +_book/ +build/ +dist/ +build-*/ +coverage/ +node_modules/ +tmp/ +out/ +/import_map.json +/mod.ts +NOTES.md +.zed +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local +.npmrc +.rpt2_cache +.yarn/* +.turbo* +!.yarn/releases +!.yarn/plugins +.pnp.* +.vscode/ +.idea/ +cc-test-reporter +turbo-debug.log* +npm-debug.log* package-lock.json -.idea -.env -.vscode +tsconfig*buildinfo +yarn-debug.log* +yarn-error.log* +out/ diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 43c97e719..000000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 017c0cdf2..000000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 2533cc045..70f5de9bd 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,17 @@ -# Dock SDK +# `Dock` SDK monorepository -A Javascript library for working with Verifiable Credentials, DIDs, Claim Deduction and more. Built with PolkadotJS, for use with the [Dock Substrate Node](https://github.com/docknetwork/dock-substrate) or our public main/test networks. +Features five packages, such as -## Install or build -- Run `yarn add @docknetwork/sdk` or `npm install @docknetwork/sdk` to install the package from npm -- When building from source: - - Run `yarn` to install the dependencies - - Run `yarn build` to create a distribution version. +- [`@docknetwork/credential-sdk`](./packages/credential-sdk) - An API-agnostic Javascript library for working with Verifiable Credentials, DIDs, Claim Deduction, and more. +- [`@docknetwork/dock-blockchain-api`](./packages/dock-blockchain-api) - A Javascript library built with PolkadotJS, for use with the [Dock Substrate Node](https://github.com/docknetwork/dock-substrate) or our public main/test networks. +- [`@docknetwork/dock-blockchain-modules`](./packages/dock-blockchain-modules) - A JavaScript library designed for handling credential SDK elements (DIDS, Accumulators, etc) on the Dock blockchain. +- [`@docknetwork/cheqd-blockchain-api`](./packages/cheqd-blockchain-api) - A Javascript library built atop of `@cheqd/sdk` that allows to interact with the `Cheqd` blockchain. +- [`@docknetwork/cheqd-blockchain-modules`](./packages/cheqd-blockchain-modules) - A JavaScript library created for managing credential SDK components such as DIDs and accumulators etc on the Cheqd blockchain. -![Build Status](https://github.com/docknetwork/client-sdk/workflows/CI/badge.svg "Build Status") +You are welcome to explore the [tutorials](./tutorials) and [examples](./examples) to get a basic understanding. -## Documentation -Have a look at the [concepts and tutorials](https://docknetwork.github.io/sdk/tutorials). These are generated from markdown -present over [here](./tutorials/src). Files prefixed with `concepts` describe the concepts and files prefixed with -`tutorials` have a tutorial on using the API. -Checkout the [API reference](https://docknetwork.github.io/sdk/reference) +In essence, the architecture is structured as follows: - -## Examples -The example scripts present in [example directory](./example) are meant to demonstrate a complete feature. The following -commands demonstrate different features. -- Run example to create a new DID, register it, update its key and remove the DID. - ``` - yarn dock-did-example - ``` - -- Run example to resolve DID - ``` - yarn did-resolver-example - ``` - -- Run example to see revocation - ``` - yarn revocation-example - ``` - -- Run example to see verifiable credentials - ``` - yarn vcdm-example - ``` - -## Connecting -Use Dock's substrate node: https://github.com/docknetwork/dock-substrate - -Running dev node: -``` -./target/release/dock-node --base-path /tmp/alice --chain local_poa_testnet --alice --port 30333 --ws-port 9944 --rpc-port 9933 --telemetry-url 'wss://telemetry.polkadot.io/submit/ 0' -``` - -**Use the `mainnet` tag of this repo when interacting with mainnet as the `master` branch isn't guaranteed to be mainnet compatible.** - -## Test and example Configuration -Configuration variables like websocket endpoint for node `FullNodeEndpoint`, URI for account to pay for extrinsics `TestAccountURI` -and keyring type `TestKeyringType` can be set as environment variables (or in an .env file). If they are not set, default values as -specified in file [test-constants.js](./tests/test-constants.js) are used. -The scripts read parameters from `.env` file. The available parameters are shown in an example env file [env_example](env_example) - -## Test - -Run unit tests with `yarn test`. - -Run a single unit test module with `yarn test `. - -Run e2e integrations tests with `yarn test-integration` (required node to be running) - -You can run tests against a temporary node in docker like so: - -``` -./scripts/with_docker_test_node -yarn test-integration -``` - -or with the alias: - -``` -yarn test-with-node -``` - -and examples can be similarly run with: - -``` -yarn examples-with-node -``` - -## Linting and type checking -We use JSDoc and TypeScript for static type checking during the CI process. PRs must pass linting and type checking to be accepted. -You can run via: `yarn lint --fix` and `yarn type-check` +- The fundamentals of VC, including types, cryptography, and abstract modules, are housed in `@docknetwork/credential-sdk`. +- Specific implementations for the `Dock` and `Cheqd` blockchain modules can be found in `@docknetwork/dock-blockchain-modules` and `@docknetwork/cheqd-blockchain-modules`, respectively. +- Basic blockchain connectors for the `Dock` and `Cheqd` blockchain are available through `@docknetwork/dock-blockchain-api` and `@docknetwork/cheqd-blockchain-api`. diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index ddd7489f6..000000000 --- a/babel.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - plugins: ["@babel/plugin-transform-modules-commonjs"], - presets: [ - [ - "@babel/preset-env", - { - targets: { - node: "current", - }, - }, - ], - ], -}; diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 000000000..ac7171eb0 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,13 @@ +{ + "plugins": ["@babel/plugin-transform-modules-commonjs"], + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "node": "current" + } + } + ] + ] +} diff --git a/docker/staking_payouts/Dockerfile b/docker/staking_payouts/Dockerfile deleted file mode 100644 index e90ab26a2..000000000 --- a/docker/staking_payouts/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:16.6.0-buster AS builder -WORKDIR /usr/app - -COPY . . - -RUN yarn -RUN yarn build-scripts - -FROM public.ecr.aws/lambda/nodejs:16 - -COPY --from=builder [ "/usr/app/build/*", "./" ] - -CMD [ "staking_payouts.handler" ] diff --git a/env_example b/env_example deleted file mode 100644 index 6155f9888..000000000 --- a/env_example +++ /dev/null @@ -1,17 +0,0 @@ -# This is an example .env file to show different params - -# The node to connect to for sending RPC commands -FullNodeEndpoint = "ws://127.0.0.1:9944" - -# Whether connecting to a testnet or mainnet. Possible values are `test` and `main` -Network = "test" - -# Various account details -EndowedSecretURI = "//Ferdie" -EndowedAddress = "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL -SudoSecretURI = "//Alice" -SudoAddress = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" - -# EVM specific parameters -MinGasPrice = 50 -MaxGas = 400000000 \ No newline at end of file diff --git a/example/blob.js b/example/blob.js deleted file mode 100644 index 82c3ea4b7..000000000 --- a/example/blob.js +++ /dev/null @@ -1,104 +0,0 @@ -import { randomAsHex } from "@polkadot/util-crypto"; -import { u8aToString } from "@polkadot/util"; - -import { DockAPI } from "../src/index"; -import { DockBlobIdByteSize } from "../src/modules/blob"; -import { DockDid, DidKeypair } from "../src/did"; - -// The following can be tweaked depending on where the node is running and what -// account is to be used for sending the transaction. -import { FullNodeEndpoint, TestAccountURI } from "../tests/test-constants"; -import { DidKey, VerificationRelationship } from "../src/public-keys"; - -async function writeAndReadBlob(dock, blobValue, dockDID, pair) { - const blobId = randomAsHex(DockBlobIdByteSize); - console.log("Writing blob with id ", blobId, "and value", blobValue); - - const blob = { - id: blobId, - blob: blobValue, - }; - - await dock.blob.new(blob, dockDID, pair, { didModule: dock.did }, false); - - console.log("Blob written, reading from chain..."); - - return dock.blob.get(blobId); -} - -async function createAuthorDID(dock, pair) { - // Generate a DID to be used as author - const dockDID = DockDid.random(); - console.log("Creating new author DID", dockDID); - - // Create an author DID to write with - const publicKey = pair.publicKey(); - const didKey = new DidKey(publicKey, new VerificationRelationship()); - await dock.did.new(dockDID, [didKey], [], false); - return dockDID; -} - -async function connectToNode() { - console.log("Connecting to the node..."); - const dock = new DockAPI(); - await dock.init({ - address: FullNodeEndpoint, - }); - - console.log("Setting sdk account..."); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - return dock; -} - -async function main() { - // Connect to the node - const dock = await connectToNode(); - - // Generate keypair for DID - const pair = DidKeypair.fromApi(dock); - - // Generate a DID to be used as author - const dockDID = await createAuthorDID(dock, pair); - - // Write blob as json - const blobValueJSON = { jsonStorage: true }; - const chainBlobJSON = await writeAndReadBlob( - dock, - blobValueJSON, - dockDID, - pair, - ); - const blobJSONFromChain = chainBlobJSON[1]; - console.log("Resulting blob JSON from chain:", blobJSONFromChain); - - // Write blob as string - const blobValue = "hello blob storage!"; - const chainBlob = await writeAndReadBlob(dock, blobValue, dockDID, pair); - const blobStrFromChain = u8aToString(chainBlob[1]); - console.log("Resulting blob string from chain:", blobStrFromChain); - - // Write blob as array - const blobValueArray = new Uint8Array([1, 2, 3]); - const chainBlobArray = await writeAndReadBlob( - dock, - blobValueArray, - dockDID, - pair, - ); - const blobArrayFromChain = chainBlobArray[1]; - console.log("Resulting blob array from chain:", blobArrayFromChain); - - // Finalize - console.log("All done, disconnecting..."); - await dock.disconnect(); -} - -main() - .then(() => { - process.exit(0); - }) - .catch((error) => { - console.error("Error occurred somewhere, it was caught!", error); - process.exit(1); - }); diff --git a/example/chain-ops.js b/example/chain-ops.js deleted file mode 100644 index 79211efe3..000000000 --- a/example/chain-ops.js +++ /dev/null @@ -1,160 +0,0 @@ -import assert from 'assert'; -import { DockAPI } from '../src/index'; -import { - getLastBlock, getBlockNo, blockNumberToHash, getBlock, getBalance, getAllExtrinsicsFromBlock, getTransferExtrinsicsFromBlock, - getAllEventsFromBlock, getLastFinalizedBlock, generateAccount, transferMicroDock, transferDock, validateAddress, getTransferEventsFromBlock, -} from '../src/utils/chain-ops'; - -require('dotenv').config(); - -const { FullNodeEndpoint } = process.env; - -function validateAddresses() { - if (!validateAddress('3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8LG', 'main')) { - throw new Error('Cannot validate 3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8LG as mainnet address'); - } - - if (!validateAddress('375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsjX', 'test')) { - throw new Error('Cannot validate 375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsjX as testnet address'); - } - - if (validateAddress('3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8L', 'main')) { - throw new Error('Validated incorrect address 3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8L as mainnet address'); - } - - if (validateAddress('375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsX', 'test')) { - throw new Error('Validated incorrect address 375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsX as testnet address'); - } -} - -async function accountGenerationExamples() { - // With random seed - // @ts-ignore - const [uri1, address1] = await generateAccount({ type: 'ed25519', network: 'test' }); - console.info(`Generated random seed ${uri1} for ed25519 account with address ${address1}`); - - // @ts-ignore - const [uri2, address2] = await generateAccount({ type: 'sr25519', network: 'main' }); - console.info(`Generated random seed ${uri2} for sr25519 account with address ${address2}`); - - // @ts-ignore - const [uri3, address3] = await generateAccount({ type: 'ecdsa', network: 'main' }); - console.info(`Generated random seed ${uri3} for ecdsa account with address ${address3}`); - - // With hex seed - // @ts-ignore - const [, address4] = await generateAccount({ secretUri: '0x67826291fd8ce9941e19e2e0d97ad16cd467f40aee9c29898570f9b28645d7c2', type: 'sr25519', network: 'main' }); - console.info(`Generated sr25519 account with address ${address4} using given hex seed`); - - // With secret phrase - // @ts-ignore - const [, address5] = await generateAccount({ secretUri: '//file upper fever frog achieve side catalog flash age bright mirror split', type: 'ed25519', network: 'main' }); - console.info(`Generated ed25519 account with address ${address5} using given secret phrase`); -} - -async function printLastBlockNo(api) { - const block = await getLastBlock(api); - const num = getBlockNo(block); - console.info(`Last block number is ${num}`); - return num; -} - -async function printLastFinalizedBlockNo(api) { - const block = await getLastFinalizedBlock(api); - const num = getBlockNo(block); - console.info(`Last finalized block number is ${num}`); - return num; -} - -async function printBlock(api, blockNo) { - const blockByNum = await getBlock(api, blockNo); - const blockHash = await blockNumberToHash(api, blockNo); - const blockByHash = await getBlock(api, blockHash); - assert(blockByNum.header.number.toNumber() === blockByHash.header.number.toNumber(), 'Blocks received by hash and number are different'); - console.info(`Block is ${blockByNum}`); - return blockByNum; -} - -async function printBalance(api, address) { - const bal = await getBalance(api, address); - console.info(`Balance of ${address} is ${bal}`); -} - -async function printExtrinsicsOfBlock(api, blockNumberOrHash) { - console.info(await getAllExtrinsicsFromBlock(api, blockNumberOrHash)); -} - -async function printSuccessfulExtrinsicsOfBlock(api, blockNumberOrHash) { - console.info(await getAllExtrinsicsFromBlock(api, blockNumberOrHash, false)); -} - -async function printTransfersOfBlock(api, blockNumberOrHash) { - console.info(await getTransferExtrinsicsFromBlock(api, blockNumberOrHash, true, false)); -} - -async function printAllEventsFromBlock(api, blockNumberOrHash) { - const evs = await getAllEventsFromBlock(api, blockNumberOrHash); - console.info(`${evs.length} events found`); - console.info(evs); -} - -async function printTransferEventsFromBlock(api, blockNumberOrHash) { - const evs = await getTransferEventsFromBlock(api, blockNumberOrHash); - console.info(`${evs.length} events found`); - console.info(evs); -} - -async function doTokenTransfer(api) { - const recip = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; - const [, , keypair] = await generateAccount({ secretUri: '//Alice', type: 'sr25519', network: 'test' }); - - // Transfer tokens - const txnHash = await transferDock(api, keypair, recip, 2.5); - console.info(`Gave 2.5 Docks in transaction hash ${txnHash}`); - - // Prepare a transfer transaction with micro tokens but do not send - const txn = await transferMicroDock(api, keypair, recip, 500, false); - console.info(`Transfer transaction with 500 microDocks ${txn}`); - console.info(`Transfer transaction with 500 microDocks as hex encoded ${txn.toHex()}`); -} - -async function main() { - const dock = new DockAPI(); - await dock.init({ - address: FullNodeEndpoint, - }); - - validateAddresses(); - - await accountGenerationExamples(); - - await printLastFinalizedBlockNo(dock.api); - - const num = await printLastBlockNo(dock.api); - - await printBlock(dock.api, num); - - const address = '3HrYxW57kbFnd5FryoKVzBrX2arG1N3S32v7DLTY4kcawEKC'; - await printBalance(dock.api, address); - - await printExtrinsicsOfBlock(dock.api, '0xeb2f1392566dfb562dde9177647d4488b911bc78981383f69cba0731a9b57a2b'); - - await printSuccessfulExtrinsicsOfBlock(dock.api, '0x6542f888924e33e438715f9fbfd002653486f4d579290a66a227fa4e03275419'); - - await printTransfersOfBlock(dock.api, 3467189); - - await printAllEventsFromBlock(dock.api, '0xeb2f1392566dfb562dde9177647d4488b911bc78981383f69cba0731a9b57a2b'); - - await printTransferEventsFromBlock(dock.api, '0xeb2f1392566dfb562dde9177647d4488b911bc78981383f69cba0731a9b57a2b'); - - await doTokenTransfer(dock.api); -} - -main() - .then(() => { - process.exit(0); - }) - .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); - process.exit(1); - }); diff --git a/example/create_master_proposal.js b/example/create_master_proposal.js deleted file mode 100644 index 44b3678dd..000000000 --- a/example/create_master_proposal.js +++ /dev/null @@ -1,30 +0,0 @@ -// Example script creates a json-encoded proposal for master to vote on. - -import { u8aToHex, hexToU8a } from '@polkadot/util'; -import { randomAsU8a } from '@polkadot/util-crypto'; -import { connect } from '../scripts/helpers'; - -require('dotenv').config(); - -main().catch((e) => { - console.error(e); - process.exit(1); -}).then(() => { - process.exit(0); -}); - -async function main() { - const { FullNodeEndpoint } = process.env; - - const nc = (await connect(FullNodeEndpoint)).api; - - const proposal = nc.tx.system.setStorage([ - [u8aToHex(randomAsU8a(32)), u8aToHex(randomAsU8a(32))], - ]); - const jprop = proposal.method.toJSON(); - - // Bug in polkadot-js makes hex-encoded call index unparsable so we convert to an array. - jprop.callIndex = [...hexToU8a(jprop.callIndex)]; - - console.log(JSON.stringify(jprop)); -} diff --git a/example/dock-did.js b/example/dock-did.js deleted file mode 100644 index 22bf3210d..000000000 --- a/example/dock-did.js +++ /dev/null @@ -1,175 +0,0 @@ -// Import some utils from Polkadot JS -import { randomAsHex } from "@polkadot/util-crypto"; - -// Import Dock API -import { u8aToHex } from "@polkadot/util"; -import dock, { PublicKeySr25519 } from "../src/index"; -import { DockDid, DidKeypair } from "../src/did"; - -// The following can be tweaked depending on where the node is running and what -// account is to be used for sending the transaction. -import { FullNodeEndpoint, TestAccountURI } from "../tests/test-constants"; -import { DidKey, VerificationRelationship } from "../src/public-keys"; -import { ServiceEndpointType } from "../src/modules/did/service-endpoint"; - -// DID will be generated randomly -const dockDID = DockDid.random(); - -// Generate first key with this seed. The key type is Sr25519 -const firstKeySeed = randomAsHex(32); - -// Generate second key (for update) with this seed. The key type is Ed25519 -const secondKeySeed = randomAsHex(32); - -// This function assumes the DID has been written. -async function removeDID() { - console.log("Removing DID now."); - - // Sign the DID removal with this key pair as this is the current key of the DID - const pair = new DidKeypair( - dock.keyring.addFromUri(firstKeySeed, null, "sr25519"), - 1, - ); - - return dock.did.remove(dockDID, dockDID, pair, undefined, false); -} - -// This function assumes the DID has been written. -async function addServiceEndpoint() { - console.log("Add new service endpoint now."); - - // Sign key update with this key pair as this is the current key of the DID - const pair = new DidKeypair( - dock.keyring.addFromUri(firstKeySeed, null, "sr25519"), - 1, - ); - - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - const encoder = new TextEncoder(); - const spIdText = `${dockDID}#linked-domain`; - const spId = u8aToHex(encoder.encode(spIdText)); - const originsText = ["https://foo.example.com"]; - const origins = originsText.map((u) => u8aToHex(encoder.encode(u))); - return dock.did.addServiceEndpoint( - spId, - spType, - origins, - dockDID, - dockDID, - pair, - undefined, - false, - ); -} - -// This function assumes the DID has been written. -async function addController() { - console.log("Add new controller now."); - - // Sign key update with this key pair as this is the current key of the DID - const pair = new DidKeypair( - dock.keyring.addFromUri(firstKeySeed, null, "sr25519"), - 1, - ); - - const newController = DockDid.random(); - - return dock.did.addControllers( - [newController], - dockDID, - dockDID, - pair, - undefined, - false, - ); -} - -// This function assumes the DID has been written. -async function addKey() { - console.log("Add new key now."); - - // Sign key update with this key pair as this is the current key of the DID - const pair = new DidKeypair( - dock.keyring.addFromUri(firstKeySeed, null, "sr25519"), - 1, - ); - - // Update DID key to the following - const newPair = new DidKeypair( - dock.keyring.addFromUri(secondKeySeed, null, "ed25519"), - 1, - ); - // the following function will figure out the correct PublicKey type from the `type` property of `newPair` - const newPk = newPair.publicKey(); - - const vr = new VerificationRelationship(); - vr.setAuthentication(); - const newDidKey = new DidKey(newPk, vr); - - return dock.did.addKeys( - [newDidKey], - dockDID, - dockDID, - pair, - undefined, - false, - ); -} - -async function getDIDDoc() { - console.log("Getting DID now."); - // Check if DID exists - const result = await dock.did.getDocument(dockDID); - console.log("DID Document:", JSON.stringify(result, null, 2)); - return result; -} - -// Called when connected to the node -function registerNewDID() { - // Generate keys for the DID. - const firstPair = dock.keyring.addFromUri(firstKeySeed, null, "sr25519"); - const publicKey = PublicKeySr25519.fromKeyringPair(firstPair); - - // The controller is same as the DID - const didKey = new DidKey(publicKey, new VerificationRelationship()); - - console.log("Submitting new DID", dockDID, publicKey); - - return dock.did.new(dockDID, [didKey], [], false); -} - -// Initialize Dock API, connect to the node and start working with it -// It will create a new DID with a key, then update the key to another one and then remove the DID -dock - .init({ - address: [FullNodeEndpoint], - }) - .then(() => { - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - return registerNewDID(); - }) - .then(getDIDDoc) - .then(addKey) - .then(getDIDDoc) - .then(addController) - .then(addServiceEndpoint) - .then(getDIDDoc) - .then(removeDID) - .then(async () => { - try { - await dock.did.getDocument(dockDID); - throw new Error( - "The call to get the DID document should have failed but did not fail. This means the remove DID call has not worked.", - ); - } catch (e) { - // The call to get the DID document has failed since the DID has been removed - console.log("Example ran successfully"); - process.exit(0); - } - }) - .catch((error) => { - console.error("Error occurred somewhere, it was caught!", error); - process.exit(1); - }); diff --git a/example/open-badges.js b/example/open-badges.js deleted file mode 100644 index 7840b6241..000000000 --- a/example/open-badges.js +++ /dev/null @@ -1,73 +0,0 @@ -import VerifiableCredential from '../src/verifiable-credential'; -import { DIDKeyResolver } from '../src/resolver'; - -// Sample credential data from https://gist.githubusercontent.com/ottonomy/6f72f5055220cfa8c6926e1a753f1870/raw/e7882e4a6eebb503359cce4bdc8978331d47544c/asu-tln-unconference-example-credential.json -const credentialJSON = { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json", - "https://w3id.org/security/suites/ed25519-2020/v1" - ], - "type": [ - "VerifiableCredential", - "OpenBadgeCredential" - ], - "issuer": { - "type": "Profile", - "id": "did:key:z6MkoowWdLogChc6mRp18YcKBd2yYTNnQLeHdiT73wjL1h6z", - "name": "Trusted Learner Network (TLN) Unconference Issuer", - "url": "https://tln.asu.edu/", - "image": { - "id": "https://plugfest3-assets-20230928.s3.amazonaws.com/TLN+Gold+Circle.png", - "type": "Image" - } - }, - "issuanceDate": "2024-04-04T16:43:31.485Z", - "name": "2024 TLN Unconference Change Agent", - "credentialSubject": { - "type": "AchievementSubject", - "id": "did:key:7af28a8b2b9684073a0884aacd8c31eb5908baf4a1ba7e2ca60582bf585c68ad", - "achievement": { - "id": "https://tln.asu.edu/achievement/369435906932948", - "type": "Achievement", - "name": "2024 TLN Unconference Change Agent", - "description": "This credential certifies attendance, participation, and knowledge-sharing at the 2024 Trusted Learner Network (TLN) Unconference.", - "criteria": { - "type": "Criteria", - "narrative": "* Demonstrates initiative and passion for digital credentialing\n* Shares knowledge, skills and experience to broaden and deepen the community's collective understanding and competency\n* Engages in complex problems by collaborating with others\n* Creates connections and builds coalition to advance the ecosystem" - } - } - }, - "id": "https://tln.asu.edu/achievement/369435906932948", - "proof": { - "type": "Ed25519Signature2020", - "created": "2024-04-04T16:43:31Z", - "verificationMethod": "did:key:z6MkoowWdLogChc6mRp18YcKBd2yYTNnQLeHdiT73wjL1h6z#z6MkoowWdLogChc6mRp18YcKBd2yYTNnQLeHdiT73wjL1h6z", - "proofPurpose": "assertionMethod", - "proofValue": "z23JQwSmJKnWXw1HWDMBv1yoZDVyfUsRWihQFsrSLpb8cENqbuqpdnaSY72VmCkY3WQ4GovpNRZPNLRaatXeDJE8G" - } -}; - -const resolver = new DIDKeyResolver(); - -async function main() { - // Incrementally build a verifiable credential - const credential = VerifiableCredential.fromJSON(credentialJSON); - - // Verify the credential - const verifyResult = await credential.verify({ - resolver, - compactProof: true, - }); - if (verifyResult.verified) { - console.log('Credential has been verified! Result:', verifyResult); - } else { - console.error('Credential could not be verified!. Got error', verifyResult.error); - process.exit(1); - } - - // Exit - process.exit(0); -} - -main(); diff --git a/example/revocation.js b/example/revocation.js deleted file mode 100644 index e68f4a513..000000000 --- a/example/revocation.js +++ /dev/null @@ -1,149 +0,0 @@ -import { randomAsHex } from "@polkadot/util-crypto"; - -import dock from "../src/index"; -import { DockDid, DidKeypair, DockDidOrDidMethodKey } from "../src/did"; - -import { OneOfPolicy, createRandomRegistryId } from "../src/utils/revocation"; - -// The following can be tweaked depending on where the node is running and what -// account is to be used for sending the transaction. -import { FullNodeEndpoint, TestAccountURI } from "../tests/test-constants"; -import { DidKey, VerificationRelationship } from "../src/public-keys"; - -// Create a random registry id -const registryId = createRandomRegistryId(); - -// Create a new controller DID, the DID will be registered on the network and own the registry -const controllerDID = DockDid.random(); -const controllerSeed = randomAsHex(32); - -// Create revoke IDs -const revokeId = randomAsHex(32); - -async function createRegistry() { - // Create a list of controllers - const controllers = new Set(); - - controllers.add(controllerDID); - - // Create a registry policy - const policy = new OneOfPolicy(controllers); - console.log( - `Creating a registry with owner DID (${controllerDID}) with policy type:`, - policy.constructor.name, - ); - await dock.revocation.newRegistry(registryId, policy, false, false); - console.log("Created registry"); -} - -async function removeRegistry(pair) { - console.log("Removing registry..."); - - await dock.revocation.removeRegistryWithOneOfPolicy( - registryId, - controllerDID, - pair, - { didModule: dock.did }, - false, - ); - - console.log("Registry removed. All done."); -} - -async function unrevoke(pair) { - console.log("Trying to undo the revocation (unrevoke) of id:", revokeId); - const extrinsic = await dock.revocation.unrevokeCredentialWithOneOfPolicy( - registryId, - revokeId, - controllerDID, - pair, - { didModule: dock.did }, - false, - ); - await extrinsic; -} - -async function revoke(pair) { - console.log("Trying to revoke id:", revokeId); - const extrinsic = await dock.revocation.revokeCredentialWithOneOfPolicy( - registryId, - revokeId, - controllerDID, - pair, - { didModule: dock.did }, - false, - ); - await extrinsic; -} - -async function main() { - console.log("Connected to node, creating account..."); - - // We need an account to sign transactions with - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // The DID should be written before creating a registry - const pair = new DidKeypair( - dock.keyring.addFromUri(controllerSeed, null, "sr25519"), - 1, - ); - - // Set our controller DID and associated keypair to be used for generating proof - console.log( - `Creating controller DID (${controllerDID}) using sr25519 pair from seed (${controllerSeed})...`, - ); - - // The controller is same as the DID - const publicKey = pair.publicKey(); - const didKey = new DidKey(publicKey, new VerificationRelationship()); - await dock.did.new(controllerDID, [didKey], [], false); - - // Create a registry - await createRegistry(); - - // Revoke - await revoke(pair); - - // Check if revocation was a success - const isRevoked = await dock.revocation.getIsRevoked(registryId, revokeId); - if (isRevoked) { - console.log("Revocation success. Trying to unrevoke..."); - - // Try to unrevoke - await unrevoke(pair); - - // Check if unrevoke worked - const isUnrevoked = !(await dock.revocation.getIsRevoked( - registryId, - revokeId, - )); - if (isUnrevoked) { - console.log("Unrevoke success!"); - } else { - console.error("Unable to unrevoke, something went wrong."); - } - } else { - console.error("Revocation failed"); - } - - // Cleanup, remove the registry - await removeRegistry(pair); - - // Disconnect from the node - await dock.disconnect(); - - // Exit - process.exit(0); -} - -// Initialise Dock API, connect to the node and start working with it -dock - .init({ - address: FullNodeEndpoint, - }) - .then(main) - .catch((error) => { - console.error("Error occurred somewhere, it was caught!", error); - process.exit(1); - }); diff --git a/example/schema.js b/example/schema.js deleted file mode 100644 index 28b976ab6..000000000 --- a/example/schema.js +++ /dev/null @@ -1,159 +0,0 @@ -import { randomAsHex } from "@polkadot/util-crypto"; -import Schema from "../src/modules/schema"; - -import { DockAPI } from "../src/index"; -import { DockDid, DidKeypair } from "../src/did"; -import VerifiableCredential from "../src/verifiable-credential"; -import { Ed25519VerKeyName } from "../src/utils/vc/crypto/constants"; -import { getKeyDoc } from "../src/utils/vc/helpers"; - -import { - UniversalResolver, - DockResolver, - WildcardMultiResolver, -} from "../src/resolver"; - -// The following can be tweaked depending on where the node is running and what -// account is to be used for sending the transaction. -import { FullNodeEndpoint, TestAccountURI } from "../tests/test-constants"; -import { registerNewDIDUsingPair } from "../tests/integration/helpers"; - -import { DidKey, VerificationRelationship } from "../src/public-keys"; - -async function createAuthorDID(dock, pair) { - // Generate a DID to be used as author - const dockDID = DockDid.random(); - console.log("Creating new author DID", dockDID); - - // Create an author DID to write with - const publicKey = pair.publicKey(); - const didKey = new DidKey(publicKey, new VerificationRelationship()); - await dock.did.new(dockDID, [didKey], [], false); - return dockDID; -} - -async function main() { - console.log("Connecting to the node..."); - const dock = new DockAPI(); - await dock.init({ - address: FullNodeEndpoint, - }); - - console.log("Setting sdk account..."); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - const keySeed = randomAsHex(32); - const subjectKeySeed = randomAsHex(32); - - // Generate first key with this seed. The key type is Sr25519 - const pair = new DidKeypair( - dock.keyring.addFromUri(keySeed, null, "ed25519"), - 1, - ); - - // Generate a DID to be used as author - const dockDID = await createAuthorDID(dock, pair); - - // Properly format a keyDoc to use for signing - const keyDoc = getKeyDoc(dockDID, pair, Ed25519VerKeyName); - - const subjectPair = new DidKeypair( - dock.keyring.addFromUri(subjectKeySeed), - 1, - ); - const subjectDID = DockDid.random(); - await registerNewDIDUsingPair(dock, subjectDID, subjectPair); - - console.log("Creating a new schema..."); - const schema = new Schema(); - await schema.setJSONSchema({ - $schema: "http://json-schema.org/draft-07/schema#", - description: "Dock Schema Example", - type: "object", - properties: { - id: { - type: "string", - }, - emailAddress: { - type: "string", - format: "email", - }, - alumniOf: { - type: "string", - }, - }, - required: ["emailAddress", "alumniOf"], - additionalProperties: false, - }); - - console.log("The schema is:", JSON.stringify(schema.toJSON(), null, 2)); - console.log("Writing schema to the chain with blob id of", schema.id, "..."); - - await schema.writeToChain(dock, dockDID, pair, undefined, false); - - console.log(`Schema written, reading from chain (${schema.id})...`); - - const result = await Schema.get(schema.id, dock); - console.log("Result from chain:", result); - - const universalResolverUrl = "https://uniresolver.io"; - const resolver = new WildcardMultiResolver([ - new DockResolver(dock), - new UniversalResolver(universalResolverUrl), - ]); - - console.log("Creating a verifiable credential and assigning its schema..."); - const vc = new VerifiableCredential("https://example.com/credentials/187"); - vc.setSchema(result.id, "JsonSchemaValidator2018"); - vc.addContext("https://www.w3.org/2018/credentials/examples/v1"); - vc.addContext({ - emailAddress: "https://schema.org/email", - alumniOf: "https://schema.org/alumniOf", - }); - vc.addType("AlumniCredential"); - vc.addSubject({ - id: String(subjectDID), - alumniOf: "Example University", - emailAddress: "abc@example.com", - }); - await vc.sign(keyDoc); - - console.log("Verifying the credential:", vc); - const { verified, error } = await vc.verify({ - resolver, - compactProof: false, - }); - if (!verified) { - throw error || new Error("Verification failed"); - } - - console.log("Credential verified, mutating the subject and trying again..."); - vc.addSubject({ - id: "uuid:0x0", - thisWillFail: true, - }); - - try { - await vc.verify({ - resolver, - compactProof: false, - }); - throw new Error( - "Verification succeeded, but it shouldn't have. This is a bug.", - ); - } catch (e) { - console.log("Verification failed as expected:", e); - } - - console.log("All done, disconnecting..."); - await dock.disconnect(); -} - -main() - .then(() => { - process.exit(0); - }) - .catch((error) => { - console.error("Error occurred somewhere, it was caught!", error); - process.exit(1); - }); diff --git a/example/schemas/bol.js b/example/schemas/bol.js deleted file mode 100644 index 791995e4a..000000000 --- a/example/schemas/bol.js +++ /dev/null @@ -1,68 +0,0 @@ -export default { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Detailed shipment document provided by the carrier to the receiver of products.', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - address: { - type: 'object', - properties: { - address: { - type: 'string', - }, - latitude: { - type: 'number', - minimum: -90, - maximum: 90, - }, - longitude: { - type: 'number', - minimum: -180, - maximum: 180, - }, - }, - }, - }, - properties: { - productIdentifier: { - type: 'string', - format: 'uuid', - }, - bolNumber: { - type: 'string', - }, - carrier: { $ref: '#/$defs/uri' }, - recipient: { $ref: '#/$defs/uri' }, - transportType: { - type: 'string', - }, - originAddress: { $ref: '#/$defs/address' }, - deliveryAddress: { $ref: '#/$defs/address' }, - valuePerItem: { - type: 'number', - minimum: 0, - maximum: 1000, - }, - totalOrderValue: { - type: 'number', - minimum: 0, - maximum: 1000000, - }, - freightChargeTerms: { - type: 'string', - }, - expectedDeliveryDates: { - type: 'string', - format: 'date', - }, - comment: { - type: 'string', - }, - }, - required: ['productIdentifier', 'bolNumber', 'carrier', 'recipient', 'transportType', 'originAddress', 'deliveryAddress', - 'valuePerItem', 'totalOrderValue', 'freightChargeTerms', 'expectedDeliveryDates'], - additionalProperties: true, -}; diff --git a/example/schemas/immunity_event_record.js b/example/schemas/immunity_event_record.js deleted file mode 100644 index 82904b5ba..000000000 --- a/example/schemas/immunity_event_record.js +++ /dev/null @@ -1,44 +0,0 @@ -import proofOfHealthCoreSchema from './proof_of_health_core'; - -const schema = { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Show if immunity by vaccination or testing', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - }, - properties: { - eventType: { - type: 'string', - enum: ['vaccination', 'antibody test'], - }, - eventTime: { - type: 'string', - format: 'date-time', - }, - eventBy: { - type: 'string', - }, - eventFacility: { - type: 'string', - }, - eventName: { - type: 'string', - enum: ['X-trans-23 vaccine', 'Serological Assay COVID-19'], - }, - potencyDate: { - type: 'string', - format: 'date', - }, - }, - required: ['firstName', 'firstInitial', 'lastName', 'lastInitial', 'photo', 'biometricTemplate', 'yearOfBirth', - 'eventType', 'eventTime', 'eventBy', 'eventFacility', 'eventName', 'potencyDate'], -}; - -// TODO: Use `$ref` instead. Some of the changes already done in other branch. -const properties = { ...proofOfHealthCoreSchema.properties, ...schema.properties }; -schema.properties = properties; -export default schema; diff --git a/example/schemas/infection_diagnosis.js b/example/schemas/infection_diagnosis.js deleted file mode 100644 index 9ff601f22..000000000 --- a/example/schemas/infection_diagnosis.js +++ /dev/null @@ -1,51 +0,0 @@ -import proofOfHealthCoreSchema from './proof_of_health_core'; - -const schema = { - $schema: 'http://json-schema.org/draft-07/schema#', - // TODO: Use a proper id once blob integration is done in SDK - description: 'Diagnosis with viral infection on a particular date', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - }, - properties: { - diagnosisCode: { - type: 'string', - enum: ['CodeA', 'CodeB', 'CodeC'], - }, - diagnosisTime: { - type: 'string', - format: 'date-time', - }, - diagnosisLocation: { - type: 'string', - }, - diagnosedBy: { - type: 'string', - }, - diagnosisFacility: { - type: 'string', - }, - diagnosisMethods: { - type: 'array', - minItems: 1, - items: { - type: 'string', - }, - }, - declaredSafeDate: { - type: 'string', - format: 'date', - }, - }, - required: ['firstName', 'firstInitial', 'lastName', 'lastInitial', 'photo', 'biometricTemplate', 'yearOfBirth', - 'diagnosisCode', 'diagnosisTime', 'diagnosisLocation', 'diagnosedBy', 'diagnosisFacility', 'diagnosisMethods', 'declaredSafeDate'], -}; - -// TODO: Use `$ref` instead. Some of the changes already done in other branch. -const properties = { ...proofOfHealthCoreSchema.properties, ...schema.properties }; -schema.properties = properties; -export default schema; diff --git a/example/schemas/non_infection_check.js b/example/schemas/non_infection_check.js deleted file mode 100644 index c74e8046f..000000000 --- a/example/schemas/non_infection_check.js +++ /dev/null @@ -1,49 +0,0 @@ -import proofOfHealthCoreSchema from './proof_of_health_core'; - -const schema = { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Found virus free after testing', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - }, - properties: { - virus: { - type: 'array', - minItems: 1, - items: { - type: 'string', - }, - }, - checkTime: { - type: 'string', - format: 'date-time', - }, - checkLocation: { - type: 'string', - }, - checkedBy: { - type: 'string', - }, - checkFacility: { - type: 'string', - }, - diagnosisMethods: { - type: 'array', - minItems: 1, - items: { - type: 'string', - }, - }, - }, - required: ['firstName', 'firstInitial', 'lastName', 'lastInitial', 'photo', 'biometricTemplate', 'yearOfBirth', - 'virus', 'checkTime', 'checkLocation', 'checkedBy', 'checkFacility', 'diagnosisMethods'], -}; - -// TODO: Use `$ref` instead. Some of the changes already done in other branch. -const properties = { ...proofOfHealthCoreSchema.properties, ...schema.properties }; -schema.properties = properties; -export default schema; diff --git a/example/schemas/pr_card.js b/example/schemas/pr_card.js deleted file mode 100644 index 1ce5ad544..000000000 --- a/example/schemas/pr_card.js +++ /dev/null @@ -1,47 +0,0 @@ -export default { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Permanent Resident Card', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - }, - properties: { - id: { $ref: '#/$defs/uri' }, - type: { - type: 'array', - items: { type: 'string' }, - }, - givenName: { - type: 'string', - }, - familyName: { - type: 'string', - }, - gender: { - type: 'string', - }, - image: { $ref: '#/$defs/uri' }, - lprCategory: { - type: 'string', - }, - commuterClassification: { - type: 'string', - }, - lprNumber: { - type: 'string', - }, - residentSince: { - type: 'string', - format: 'date', - }, - birthDate: { - type: 'string', - format: 'date', - }, - }, - required: ['id', 'type', 'givenName', 'familyName', 'gender', 'image', 'lprCategory', - 'commuterClassification', 'lprNumber', 'residentSince', 'birthDate'], -}; diff --git a/example/schemas/proof_of_health_core.js b/example/schemas/proof_of_health_core.js deleted file mode 100644 index 18f518ff4..000000000 --- a/example/schemas/proof_of_health_core.js +++ /dev/null @@ -1,48 +0,0 @@ -export default { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Common fields of proof of health schemas', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - }, - properties: { - firstName: { - type: 'string', - }, - firstInitial: { - type: 'string', - }, - lastName: { - type: 'string', - }, - lastInitial: { - type: 'string', - }, - yearOfBirth: { - type: 'integer', - minimum: 1920, - maximum: 2015, - }, - photo: { $ref: '#/$defs/uri' }, - biometricTemplate: { - type: 'object', - minProperties: 1, - properties: { - fingerprint: { - type: 'string', - }, - retina: { - type: 'string', - }, - voice: { - type: 'string', - }, - }, - additionalProperties: false, - }, - }, - required: ['firstName', 'firstInitial', 'lastName', 'lastInitial', 'photo', 'biometricTemplate', 'yearOfBirth'], -}; diff --git a/example/schemas/qp_inbond.js b/example/schemas/qp_inbond.js deleted file mode 100644 index f97501b51..000000000 --- a/example/schemas/qp_inbond.js +++ /dev/null @@ -1,76 +0,0 @@ -export default { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Permit document for import/export of shipments that have not been cleared by US Customs.', - type: 'object', - $defs: { - uri: { - type: 'string', - format: 'uri', - }, - address: { - type: 'object', - properties: { - address: { - type: 'string', - }, - latitude: { - type: 'number', - minimum: -90, - maximum: 90, - }, - longitude: { - type: 'number', - minimum: -180, - maximum: 180, - }, - }, - }, - }, - properties: { - productIdentifier: { - type: 'string', - format: 'uuid', - }, - inBondNumber: { - type: 'string', - }, - inBondType: { - type: 'string', - }, - portOfEntry: { - type: 'string', - }, - irsNumber: { - type: 'string', - }, - carrier: { $ref: '#/$defs/uri' }, - recipient: { $ref: '#/$defs/uri' }, - transportType: { - type: 'string', - }, - originAddress: { $ref: '#/$defs/address' }, - deliveryAddress: { $ref: '#/$defs/address' }, - bolNumber: { - type: 'string', - }, - valuePerItem: { - type: 'number', - minimum: 0, - maximum: 1000, - }, - totalOrderValue: { - type: 'number', - minimum: 0, - maximum: 1000000, - }, - expectedDeliveryDates: { - type: 'string', - format: 'date', - }, - comment: { - type: 'string', - }, - }, - required: ['productIdentifier', 'inBondNumber', 'inBondType', 'portOfEntry', 'irsNumber', 'bolNumber', 'carrier', 'recipient', 'transportType', 'originAddress', 'deliveryAddress', 'valuePerItem', 'totalOrderValue', 'comment', 'expectedDeliveryDates'], - additionalProperties: false, -}; diff --git a/example/vcdm.js b/example/vcdm.js deleted file mode 100644 index e2fc52c5c..000000000 --- a/example/vcdm.js +++ /dev/null @@ -1,166 +0,0 @@ -import { randomAsHex } from "@polkadot/util-crypto"; - -import dock from "../src/index"; -import VerifiableCredential from "../src/verifiable-credential"; -import VerifiablePresentation from "../src/verifiable-presentation"; -import { DockDid, DidKeypair, DockDidOrDidMethodKey } from "../src/did"; -import { registerNewDIDUsingPair } from "../tests/integration/helpers"; -import { - createRandomRegistryId, - OneOfPolicy, - buildDockCredentialStatus, -} from "../src/utils/revocation"; -import { FullNodeEndpoint, TestAccountURI } from "../tests/test-constants"; -import { getKeyDoc } from "../src/utils/vc/helpers"; -import { DockResolver } from "../src/resolver"; - -// Both issuer and holder have DIDs -const issuerDID = DockDid.random(); -const issuerSeed = randomAsHex(32); - -const holderDID = DockDid.random(); -const holderSeed = randomAsHex(32); - -const registryId = createRandomRegistryId(); - -// Sample credential data -const credentialId = "http://example.edu/credentials/1986"; -const credentialContext = "https://www.w3.org/2018/credentials/examples/v1"; -const credentialType = "AlumniCredential"; -const credentialSubject = { - id: String(holderDID), - alumniOf: "Example University", -}; -const credentialStatus = buildDockCredentialStatus(registryId); -const credentialIssuanceDate = "2020-03-18T19:23:24Z"; -const credentialExpirationDate = "2999-03-18T19:23:24Z"; - -const presentationId = "http://example.edu/credentials/2803"; -const challenge = randomAsHex(32); -const domain = "example domain"; - -const resolver = new DockResolver(dock); - -/** - * Register issuer and holder DIDs - * @returns {Promise} - */ -async function setup() { - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // Register issuer DID - console.log("Registering issuer DID..."); - const pair = new DidKeypair( - dock.keyring.addFromUri(issuerSeed, null, "ed25519"), - 1, - ); - await registerNewDIDUsingPair(dock, issuerDID, pair); - - // Register holder DID - console.log("Registering holder DID..."); - const pair1 = new DidKeypair( - dock.keyring.addFromUri(holderSeed, null, "ed25519"), - 1, - ); - await registerNewDIDUsingPair(dock, holderDID, pair1); - - // Create a new policy - const policy = new OneOfPolicy(); - policy.addOwner(DockDid.from(issuerDID)); - - // Add a new revocation registry with above policy - console.log("Creating registry..."); - await dock.revocation.newRegistry(registryId, policy, false, false); - - console.log("Issuer has created registry with id", registryId); -} - -async function main() { - await setup(); - - // Incrementally build a verifiable credential - const credential = new VerifiableCredential(credentialId); - try { - credential.addContext(credentialContext); - credential.addType(credentialType); - credential.addSubject(credentialSubject); - credential.setStatus(credentialStatus); - credential.setIssuanceDate(credentialIssuanceDate); - credential.setExpirationDate(credentialExpirationDate); - - console.log("Credential created:", credential.toJSON()); - - // Sign the credential to get the proof - console.log("Issuer will sign the credential now"); - const issuerKey = getKeyDoc( - issuerDID, - dock.keyring.addFromUri(issuerSeed, null, "ed25519"), - "Ed25519VerificationKey2018", - ); - const signedCredential = await credential.sign(issuerKey); - console.log("Credential signed, verifying..."); - - // Verify the credential - const verifyResult = await signedCredential.verify({ - resolver, - compactProof: true, - }); - if (verifyResult.verified) { - console.log("Credential has been verified! Result:", verifyResult); - - console.log("Holder creating presentation..."); - - const presentation = new VerifiablePresentation(presentationId); - presentation.addCredential(credential); - - console.log("Holder signing presentation", presentation.toJSON()); - const holderKey = getKeyDoc( - holderDID, - dock.keyring.addFromUri(holderSeed, null, "ed25519"), - "Ed25519VerificationKey2018", - ); - await presentation.sign(holderKey, challenge, domain, resolver); - console.log("Signed presentation", presentation.toJSON()); - - const ver = await presentation.verify({ - challenge, - domain, - resolver, - compactProof: true, - }); - - if (ver.verified) { - console.log("Presentation has been verified! Result:", ver); - } else { - console.error( - "Presentation could not be verified!. Got error", - ver.error, - ); - process.exit(1); - } - } else { - console.error( - "Credential could not be verified!. Got error", - verifyResult.error, - ); - process.exit(1); - } - } catch (e) { - console.error("Error creating credential", e); - process.exit(1); - } - - // Exit - process.exit(0); -} - -dock - .init({ - address: FullNodeEndpoint, - }) - .then(main) - .catch((error) => { - console.error("Error occurred somewhere, it was caught!", error); - process.exit(1); - }); diff --git a/examples/CHANGELOG.md b/examples/CHANGELOG.md new file mode 100644 index 000000000..566a5e030 --- /dev/null +++ b/examples/CHANGELOG.md @@ -0,0 +1,10 @@ +# @docknetwork/sdk-examples + +## 0.1.1 + +### Patch Changes + +- Updated dependencies + - @docknetwork/dock-blockchain-modules@0.1.1 + - @docknetwork/dock-blockchain-api@0.1.1 + - @docknetwork/credential-sdk@0.1.1 diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..a5a264cdc --- /dev/null +++ b/examples/README.md @@ -0,0 +1,25 @@ +# Examples + +- Run example to create a new DID, register it, update its key and remove the DID. + +```bash +yarn dock-did-example +``` + +- Run example to resolve DID + +```bash +yarn did-resolver-example +``` + +- Run example to see revocation + +```bash +yarn revocation-example +``` + +- Run exbashample to see verifiable credentials + +```bash +yarn vcdm-example +``` diff --git a/example/anchor.js b/examples/anchor.js similarity index 66% rename from example/anchor.js rename to examples/anchor.js index e939196f0..d4b447235 100644 --- a/example/anchor.js +++ b/examples/anchor.js @@ -29,55 +29,53 @@ import { create_proof, construct, verify_proof } from 'mrklt'; /* eslint-disable camelcase */ import assert from 'assert'; -import BLAKE2b from 'blake2b'; -import { randomAsU8a } from '@polkadot/util-crypto'; -import { u8aToHex, u8aToU8a } from '@polkadot/util'; -import { connect, keypair } from '../scripts/helpers'; +import { randomAsU8a } from '@docknetwork/credential-sdk/utils'; -import { FullNodeEndpoint, TestAccountURI } from '../tests/test-constants'; - -const conn = connect(FullNodeEndpoint); +import { Anchor } from '@docknetwork/credential-sdk/types/anchor'; +import { DockAPI } from '@docknetwork/dock-blockchain-api'; +import { DockAnchorModule } from '@docknetwork/dock-blockchain-modules'; async function main() { + const dock = new DockAPI(); + const anchor = new DockAnchorModule(dock); + + await dock.init({ + address: process.env.FullNodeEndpoint || 'ws://127.0.0.1:9944', + }); + const account = dock.keyring.addFromUri( + process.env.TestAccountURI || '//Alice', + ); + dock.setAccount(account); + // batched const docHashes = [ utf8('{"example": "document"}'), utf8('{"example": 2}'), randomAsU8a(), utf8('{"example": 4}'), - ].map(blake2b256); - const proofs = await anchorBatched(docHashes); - assert(await checkBatched(docHashes[0], proofs[0]) !== null); - assert(await checkBatched(docHashes[0], proofs[1]) === null); + ].map((bytes) => Anchor.hash(bytes).bytes); + const proofs = await anchorBatched(anchor, docHashes); + assert((await checkBatched(anchor, docHashes[0], proofs[0])) !== null); + assert((await checkBatched(anchor, docHashes[0], proofs[1])) === null); // single - const single = blake2b256(randomAsU8a()); - assert(await checkBatched(single, []) === null); - await anchorBatched([single]); - assert(await checkBatched(single, []) !== null); + const single = Anchor.hash(randomAsU8a()).bytes; + assert((await checkBatched(anchor, single, [])) === null); + await anchorBatched(anchor, [single]); + assert((await checkBatched(anchor, single, [])) !== null); // Benchmarks runBenchmarks(); } -// Post a value to the anchors module. -async function anchor(hash) { - const nc = (await conn).api; - await signExtrinsic(nc.tx.anchor.deploy(u8aToHex(u8aToU8a(hash)))) - .then(sendExtrinsic); - assert((await check(hash)) !== null); -} - // Check to see at which block a value was anchored. Return the block when the hash was // anchored. If the value is not anchored, return null. -async function check(hash) { - const nc = (await conn).api; - const opt = await nc.query.anchor.anchors(u8aToHex(u8aToU8a(blake2b256(hash)))); - assert(opt.isNone !== opt.isSome); - if (opt.isNone) { +async function check(anchor, hash) { + try { + return +(await anchor.get(hash)); + } catch { return null; } - return opt.unwrap().toNumber(); } // Run some benchmarks to measure time for proof generation and verification. @@ -96,13 +94,17 @@ function runBenchmarks() { // Generate only 1 proof as call to proof generation recreates the tree function benchSingleProofCreation(count) { /* eslint-disable no-unused-vars */ - const data = Array(count).fill(undefined).map((_, __) => randomAsU8a()); + const data = Array(count) + .fill(undefined) + .map((_, __) => randomAsU8a()); const start = new Date().getTime(); - const hashes = data.map(blake2b256); + const hashes = data.map((bytes) => Anchor.hash(bytes).bytes); const pl = pack32(hashes); create_proof(0, pl); const time = new Date().getTime() - start; - console.log(`Time to generate tree of size ${count} and create a proof is ${time} msec`); + console.log( + `Time to generate tree of size ${count} and create a proof is ${time} msec`, + ); } function bench(count) { @@ -114,9 +116,11 @@ function bench(count) { function timeProofGeneration(count) { /* eslint-disable no-unused-vars */ - const data = Array(count).fill(undefined).map((_, __) => randomAsU8a()); + const data = Array(count) + .fill(undefined) + .map((_, __) => randomAsU8a()); const start = new Date().getTime(); - const hashes = data.map(blake2b256); + const hashes = data.map((bytes) => Anchor.hash(bytes).bytes); const [root, proofs] = buildMerkleTreeAndProofs(hashes); const end = new Date().getTime(); return [root, hashes, proofs, end - start]; @@ -142,9 +146,9 @@ function buildMerkleTreeAndProofs(leafHashes) { // in the order they we submitted. // // This function will fail if the input is an empty list. -async function anchorBatched(leafHashes) { +async function anchorBatched(anchor, leafHashes) { const [root, proofs] = buildMerkleTreeAndProofs(leafHashes); - await anchor(root); + await anchor.deploy(root); return proofs; } @@ -152,9 +156,9 @@ async function anchorBatched(leafHashes) { // // Check a hash against its merkle proof to find when its parent merkle tree root was anchored. // If the merkle root was never anchored, return null. -async function checkBatched(hash, proof) { +async function checkBatched(anchor, hash, proof) { const root = verify_proof(hash, proof); - return check(root); + return await check(anchor, root); } // encode a string as utf8 @@ -162,13 +166,6 @@ function utf8(str) { return new TextEncoder().encode(str); } -// hash a byte array using blake2b-256 -function blake2b256(bs) { - const h = BLAKE2b(32); - h.update(u8aToU8a(bs)); - return h.digest(); -} - // pack a list of hashed leaves into a single byte array function pack32(leaves) { for (const leaf of leaves) { @@ -180,41 +177,6 @@ function pack32(leaves) { return ret; } -// MUTATING -// sign extrinsic as test account -async function signExtrinsic(extrinsic) { - const key = await keypair(TestAccountURI); - await extrinsic.signAsync(key); - return extrinsic; -} - -// submit extrinsic and wait for it to finalize -async function sendExtrinsic(extrinsic) { - return await new Promise((resolve, reject) => { - try { - let unsubFunc = null; - return extrinsic.send(({ events = [], status }) => { - if (status.isFinalized) { - unsubFunc(); - resolve({ - events, - status, - }); - } - }) - .catch((error) => { - reject(error); - }) - .then((unsub) => { - unsubFunc = unsub; - }); - } catch (error) { - reject(error); - } - return this; - }); -} - main() .then(() => process.exit(0)) .catch((e) => { diff --git a/example/bbs-dock.js b/examples/bbs-dock.js similarity index 85% rename from example/bbs-dock.js rename to examples/bbs-dock.js index affc5b3da..9b197aba4 100644 --- a/example/bbs-dock.js +++ b/examples/bbs-dock.js @@ -1,14 +1,18 @@ -import { initializeWasm } from '@docknetwork/crypto-wasm-ts'; -import { DIDResolver } from '../src/resolver'; -import Bls12381G2KeyPairDock2022 from '../src/utils/vc/crypto/Bls12381G2KeyPairDock2022'; -import { issueCredential, verifyCredential } from '../src/utils/vc'; +import { initializeWasm } from '@docknetwork/credential-sdk/crypto'; +import { DIDResolver } from '@docknetwork/credential-sdk/resolver'; +import Bls12381G2KeyPairDock2022 from '@docknetwork/credential-sdk/vc/crypto/Bls12381G2KeyPairDock2022'; +import { + issueCredential, + verifyCredential, +} from '@docknetwork/credential-sdk/vc'; import stringify from 'json-stringify-deterministic'; const keypairOpts = { id: 'did:example:489398593#keys-1', controller: 'did:example:489398593', privateKeyBase58: '23fKPbbSJ7tCJVDYynRZQ1wPs6GannD2dEMjKZnFtKxy', - publicKeyBase58: 'przwNdX6Bn5TzwmX56fYKQr6vk5U2DsfJJHZJQzr1Sxd9oJUg1rEEoUP7Bz33WNpykvkkqoTByMwnceCx9yvTW8CG1V5XpSwHPSN222cwMe9xr4mViyLWkKtoraybEPeLHT', + publicKeyBase58: + 'przwNdX6Bn5TzwmX56fYKQr6vk5U2DsfJJHZJQzr1Sxd9oJUg1rEEoUP7Bz33WNpykvkkqoTByMwnceCx9yvTW8CG1V5XpSwHPSN222cwMe9xr4mViyLWkKtoraybEPeLHT', }; class ExampleDIDResolver extends DIDResolver { @@ -115,7 +119,11 @@ async function signAndVerify(credentialJSON) { // Sign and print the results console.log('Signing credential:', JSON.stringify(credentialJSON, null, 2)); - const signedCred = await issueCredential({ keypair: keyPair, type: keyPair.type }, credentialJSON, resolver); + const signedCred = await issueCredential( + { keypair: keyPair, type: keyPair.type }, + credentialJSON, + resolver, + ); console.log('Signed credential:', JSON.stringify(signedCred, null, 2)); // Verify the credential diff --git a/examples/blob.js b/examples/blob.js new file mode 100644 index 000000000..96ccbf984 --- /dev/null +++ b/examples/blob.js @@ -0,0 +1,120 @@ +import { DockAPI } from '@docknetwork/dock-blockchain-api'; +import { DockCoreModules } from '@docknetwork/dock-blockchain-modules'; + +// The following can be tweaked depending on where the node is running and what +// account is to be used for sending the transaction. +import { + DidKey, + VerificationRelationship, + DockBlobId, + DockDid, + DIDDocument, +} from '@docknetwork/credential-sdk/types'; +import { + Ed25519Keypair, + DidKeypair, +} from '@docknetwork/credential-sdk/keypairs'; + +async function writeAndReadBlob(blobModule, blobValue, did, pair) { + const blobId = DockBlobId.random(); + console.log('Writing blob with id ', blobId, 'and value', blobValue); + + const blob = { + id: blobId, + blob: blobValue, + }; + + await blobModule.new(blob, did, pair); + + console.log('Blob written, reading from chain...'); + + return await blobModule.get(blobId); +} + +async function createAuthorDID(didModule, pair) { + // Generate a DID to be used as author + const dockDID = DockDid.random(); + console.log('Creating new author DID', dockDID); + + // Create an author DID to write with + const publicKey = pair.publicKey(); + const didKey = new DidKey(publicKey, new VerificationRelationship()); + await didModule.createDocument(DIDDocument.create(dockDID, [didKey])); + + return dockDID; +} + +async function connectToNode() { + console.log('Connecting to the node...'); + const dock = new DockAPI(); + await dock.init({ + address: process.env.FullNodeEndpoint || 'ws://127.0.0.1:9944', + }); + + console.log('Setting sdk account...'); + const account = dock.keyring.addFromUri( + process.env.TestAccountURI || '//Alice', + ); + dock.setAccount(account); + return dock; +} + +async function main() { + // Connect to the node + const dock = await connectToNode(); + const modules = new DockCoreModules(dock); + + const keyPair = Ed25519Keypair.random(); + + // Generate a DID to be used as author + const dockDID = await createAuthorDID(modules.did, keyPair); + + // Generate keypair for DID + const pair = new DidKeypair([dockDID, 1], keyPair); + + // Write blob as json + const blobValueJSON = { jsonStorage: true }; + const chainBlobJSON = await writeAndReadBlob( + modules.blob, + blobValueJSON, + dockDID, + pair, + ); + const blobJSONFromChain = chainBlobJSON[1]; + console.log('Resulting blob JSON from chain:', blobJSONFromChain); + + // Write blob as string + const blobValue = 'hello blob storage!'; + const chainBlob = await writeAndReadBlob( + modules.blob, + blobValue, + dockDID, + pair, + ); + const blobStrFromChain = chainBlob[1].toString(); + console.log('Resulting blob string from chain:', blobStrFromChain); + + // Write blob as array + const blobValueArray = new Uint8Array([1, 2, 3]); + const chainBlobArray = await writeAndReadBlob( + modules.blob, + blobValueArray, + dockDID, + pair, + ); + const blobArrayFromChain = chainBlobArray[1]; + console.log('Resulting blob array from chain:', blobArrayFromChain); + + // Finalize + console.log('All done, disconnecting...'); + await dock.disconnect(); +} + +main() + .then(() => { + process.exit(0); + }) + .catch((error) => { + console.error('Error occurred somewhere, it was caught!', error); + process.exit(1); + }); diff --git a/examples/chain-ops.js b/examples/chain-ops.js new file mode 100644 index 000000000..c0ac07ac5 --- /dev/null +++ b/examples/chain-ops.js @@ -0,0 +1,241 @@ +import assert from 'assert'; +import { DockAPI } from '@docknetwork/dock-blockchain-api'; +import { + getLastBlock, + getBlockNo, + blockNumberToHash, + getBlock, + getBalance, + getAllExtrinsicsFromBlock, + getTransferExtrinsicsFromBlock, + getAllEventsFromBlock, + getLastFinalizedBlock, + generateAccount, + transferMicroDock, + transferDock, + validateAddress, + getTransferEventsFromBlock, +} from '@docknetwork/dock-blockchain-api/utils'; + +require('dotenv').config(); + +const { FullNodeEndpoint } = process.env; + +function validateAddresses() { + if ( + !validateAddress('3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8LG', 'main') + ) { + throw new Error( + 'Cannot validate 3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8LG as mainnet address', + ); + } + + if ( + !validateAddress('375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsjX', 'test') + ) { + throw new Error( + 'Cannot validate 375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsjX as testnet address', + ); + } + + if ( + validateAddress('3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8L', 'main') + ) { + throw new Error( + 'Validated incorrect address 3Fc793dfkwsiTpLNStqvXA5JapNyPrr5pQLngwifEB1zc8L as mainnet address', + ); + } + + if ( + validateAddress('375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsX', 'test') + ) { + throw new Error( + 'Validated incorrect address 375J3PbYjaD252gBAWVRfJwD5Hs7iQrHUDhGUGs2ujJgjsX as testnet address', + ); + } +} + +async function accountGenerationExamples() { + // With random seed + // @ts-ignore + const [uri1, address1] = await generateAccount({ + type: 'ed25519', + network: 'test', + }); + console.info( + `Generated random seed ${uri1} for ed25519 account with address ${address1}`, + ); + + // @ts-ignore + const [uri2, address2] = await generateAccount({ + type: 'sr25519', + network: 'main', + }); + console.info( + `Generated random seed ${uri2} for sr25519 account with address ${address2}`, + ); + + // @ts-ignore + const [uri3, address3] = await generateAccount({ + type: 'ecdsa', + network: 'main', + }); + console.info( + `Generated random seed ${uri3} for ecdsa account with address ${address3}`, + ); + + // With hex seed + // @ts-ignore + const [, address4] = await generateAccount({ + secretUri: + '0x67826291fd8ce9941e19e2e0d97ad16cd467f40aee9c29898570f9b28645d7c2', + type: 'sr25519', + network: 'main', + }); + console.info( + `Generated sr25519 account with address ${address4} using given hex seed`, + ); + + // With secret phrase + // @ts-ignore + const [, address5] = await generateAccount({ + secretUri: + '//file upper fever frog achieve side catalog flash age bright mirror split', + type: 'ed25519', + network: 'main', + }); + console.info( + `Generated ed25519 account with address ${address5} using given secret phrase`, + ); +} + +async function printLastBlockNo(api) { + const block = await getLastBlock(api); + const num = getBlockNo(block); + console.info(`Last block number is ${num}`); + return num; +} + +async function printLastFinalizedBlockNo(api) { + const block = await getLastFinalizedBlock(api); + const num = getBlockNo(block); + console.info(`Last finalized block number is ${num}`); + return num; +} + +async function printBlock(api, blockNo) { + const blockByNum = await getBlock(api, blockNo); + const blockHash = await blockNumberToHash(api, blockNo); + const blockByHash = await getBlock(api, blockHash); + assert( + blockByNum.header.number.toNumber() + === blockByHash.header.number.toNumber(), + 'Blocks received by hash and number are different', + ); + console.info(`Block is ${blockByNum}`); + return blockByNum; +} + +async function printBalance(api, address) { + const bal = await getBalance(api, address); + console.info(`Balance of ${address} is ${bal}`); +} + +async function printExtrinsicsOfBlock(api, blockNumberOrHash) { + console.info(await getAllExtrinsicsFromBlock(api, blockNumberOrHash)); +} + +async function printSuccessfulExtrinsicsOfBlock(api, blockNumberOrHash) { + console.info(await getAllExtrinsicsFromBlock(api, blockNumberOrHash, false)); +} + +async function printTransfersOfBlock(api, blockNumberOrHash) { + console.info( + await getTransferExtrinsicsFromBlock(api, blockNumberOrHash, true, false), + ); +} + +async function printAllEventsFromBlock(api, blockNumberOrHash) { + const evs = await getAllEventsFromBlock(api, blockNumberOrHash); + console.info(`${evs.length} events found`); + console.info(evs); +} + +async function printTransferEventsFromBlock(api, blockNumberOrHash) { + const evs = await getTransferEventsFromBlock(api, blockNumberOrHash); + console.info(`${evs.length} events found`); + console.info(evs); +} + +async function doTokenTransfer(api) { + const recip = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; + const [, , keypair] = await generateAccount({ + secretUri: '//Alice', + type: 'sr25519', + network: 'test', + }); + + // Transfer tokens + const txnHash = await transferDock(api, keypair, recip, 2.5); + console.info(`Gave 2.5 Docks in transaction hash ${txnHash}`); + + // Prepare a transfer transaction with micro tokens but do not send + const txn = await transferMicroDock(api, keypair, recip, 500, false); + console.info(`Transfer transaction with 500 microDocks ${txn}`); + console.info( + `Transfer transaction with 500 microDocks as hex encoded ${txn.toHex()}`, + ); +} + +async function main() { + const dock = new DockAPI(); + await dock.init({ + address: FullNodeEndpoint, + }); + + validateAddresses(); + + await accountGenerationExamples(); + + await printLastFinalizedBlockNo(dock.api); + + const num = await printLastBlockNo(dock.api); + + await printBlock(dock.api, num); + + const address = '3HrYxW57kbFnd5FryoKVzBrX2arG1N3S32v7DLTY4kcawEKC'; + await printBalance(dock.api, address); + + await printExtrinsicsOfBlock( + dock.api, + '0xeb2f1392566dfb562dde9177647d4488b911bc78981383f69cba0731a9b57a2b', + ); + + await printSuccessfulExtrinsicsOfBlock( + dock.api, + '0x6542f888924e33e438715f9fbfd002653486f4d579290a66a227fa4e03275419', + ); + + await printTransfersOfBlock(dock.api, 3467189); + + await printAllEventsFromBlock( + dock.api, + '0xeb2f1392566dfb562dde9177647d4488b911bc78981383f69cba0731a9b57a2b', + ); + + await printTransferEventsFromBlock( + dock.api, + '0xeb2f1392566dfb562dde9177647d4488b911bc78981383f69cba0731a9b57a2b', + ); + + await doTokenTransfer(dock.api); +} + +main() + .then(() => { + process.exit(0); + }) + .catch((error) => { + console.error('Error occurred somewhere, it was caught!', error); + process.exit(1); + }); diff --git a/example/claim-deduction.js b/examples/claim-deduction.js similarity index 90% rename from example/claim-deduction.js rename to examples/claim-deduction.js index 0508317f7..d5b83bae4 100644 --- a/example/claim-deduction.js +++ b/examples/claim-deduction.js @@ -1,7 +1,10 @@ import jsonld from 'jsonld'; import deepEqual from 'deep-equal'; import assert from 'assert'; -import { acceptCompositeClaims, proveCompositeClaims } from '../src/utils/cd'; +import { + acceptCompositeClaims, + proveCompositeClaims, +} from '@docknetwork/credential-sdk/rdf-and-cd'; const frobs = 'https://example.com/frobs'; // a made-up property @@ -34,7 +37,8 @@ const samplePresentation = { type: ['VerifiablePresentation'], verifiableCredential: [sampleCredential], id: 'uuid:6fbb4dd7-9e48-4179-8ba9-c9c750aef4ef', - holder: 'did:dock:0xeed04b38f07cf2f6aacbbb6694806e6931fd15732a25dbb579d8a3d8e245b360', + holder: + 'did:dock:0xeed04b38f07cf2f6aacbbb6694806e6931fd15732a25dbb579d8a3d8e245b360', }; const sampleRules = [ @@ -106,13 +110,18 @@ async function accept(presentation) { async function withProof(presentation) { const expanded = await jsonld.expand(presentation); const ret = JSON.parse(JSON.stringify(presentation)); // defensive copy - const proof = await proveCompositeClaims(expanded, [sampleToProve], sampleRules); + const proof = await proveCompositeClaims( + expanded, + [sampleToProve], + sampleRules, + ); ret['https://www.dock.io/rdf2020#logicV1'] = proof; return ret; } // this is a dummy function, see ./examples/vcdm.js for an example of verification -async function verify(_presentation) { // eslint-disable-line no-unused-vars +async function verify(_presentation) { + // eslint-disable-line no-unused-vars // dummy body return { verified: true }; } diff --git a/examples/dock-did.js b/examples/dock-did.js new file mode 100644 index 000000000..5a1e4ab36 --- /dev/null +++ b/examples/dock-did.js @@ -0,0 +1,158 @@ +import { + DockDid, + DIDDocument, + DidKey, + VerificationRelationship, + LinkedDomains, + ServiceEndpoint, +} from '@docknetwork/credential-sdk/types'; +import { DockAPI } from '@docknetwork/dock-blockchain-api'; +import { DockDIDModule } from '@docknetwork/dock-blockchain-modules'; + +// The following can be tweaked depending on where the node is running and what +// account is to be used for sending the transaction. +import { + Ed25519Keypair, + DidKeypair, +} from '@docknetwork/credential-sdk/keypairs'; + +// DID will be generated randomly +const dockDID = DockDid.random(); + +const dock = new DockAPI(); +const didModule = new DockDIDModule(dock); + +// Generate first key with this seed. The key type is Sr25519 +const firstKeyPair = Ed25519Keypair.random(); + +// Generate second key (for update) with this seed. The key type is Ed25519 +const secondKeyPair = Ed25519Keypair.random(); + +// This function assumes the DID has been written. +async function removeDID() { + console.log('Removing DID now.'); + + // Sign the DID removal with this key pair as this is the current key of the DID + const pair = new DidKeypair([dockDID, 1], firstKeyPair); + + return await didModule.removeDocument(dockDID, pair); +} + +// This function assumes the DID has been written. +async function addServiceEndpoint() { + console.log('Add new service endpoint now.'); + + // Sign key update with this key pair as this is the current key of the DID + const pair = new DidKeypair([dockDID, 1], firstKeyPair); + + const newEndpoint = new ServiceEndpoint(new LinkedDomains(), [ + 'https://foo.example.com', + ]); + const doc = await didModule.getDocument(dockDID); + + doc.addServiceEndpoint( + `${dockDID}#linked-domain`, + newEndpoint, + dockDID, + pair, + ); + + return await didModule.updateDocument(doc, pair); +} + +// This function assumes the DID has been written. +async function addController() { + console.log('Add new controller now.'); + + // Sign key update with this key pair as this is the current key of the DID + const pair = new DidKeypair([dockDID, 1], firstKeyPair); + + const newController = DockDid.random(); + + const doc = await didModule.getDocument(dockDID); + + doc.addController(newController); + + return await didModule.updateDocument(doc, pair); +} + +// This function assumes the DID has been written. +async function addKey() { + console.log('Add new key now.'); + + // Sign key update with this key pair as this is the current key of the DID + const pair = new DidKeypair([dockDID, 1], firstKeyPair); + + // Update DID key to the following + const newPair = new DidKeypair([dockDID, 2], secondKeyPair); + // the following function will figure out the correct PublicKey type from the `type` property of `newPair` + const newPk = newPair.publicKey(); + + const vr = new VerificationRelationship(); + vr.setAuthentication(); + const newDidKey = new DidKey(newPk, vr); + + const document = await didModule.getDocument(dockDID); + + document.addKey([dockDID, 2], newDidKey); + + return await didModule.updateDocument(document, pair); +} + +async function getDIDDoc() { + console.log('Getting DID now.'); + // Check if DID exists + const result = await didModule.getDocument(dockDID); + console.log('DID Document:', JSON.stringify(result, null, 2)); + return result; +} + +// Called when connected to the node +async function registerNewDID() { + // The controller is same as the DID + const didKey = new DidKey( + firstKeyPair.publicKey(), + new VerificationRelationship(), + ); + + console.log('Submitting new DID', dockDID, firstKeyPair.publicKey()); + + return await didModule.createDocument(DIDDocument.create(dockDID, [didKey])); +} + +// Initialize Dock API, connect to the node and start working with it +// It will create a new DID with a key, then update the key to another one and then remove the DID +dock + .init({ + address: [process.env.FullNodeEndpoint || 'ws://127.0.0.1:9944'], + }) + .then(() => { + const account = dock.keyring.addFromUri( + process.env.TestAccountURI || '//Alice', + ); + dock.setAccount(account); + return registerNewDID(); + }) + .then(getDIDDoc) + .then(addKey) + .then(getDIDDoc) + .then(addController) + .then(addServiceEndpoint) + .then(getDIDDoc) + .then(removeDID) + .then(async () => { + try { + await didModule.getDocument(dockDID); + throw new Error( + 'The call to get the DID document should have failed but did not fail. This means the remove DID call has not worked.', + ); + } catch (e) { + // The call to get the DID document has failed since the DID has been removed + console.log('Example ran successfully'); + process.exit(0); + } + }) + .catch((error) => { + console.error('Error occurred somewhere, it was caught!', error); + process.exit(1); + }); diff --git a/examples/loader.mjs b/examples/loader.mjs new file mode 100644 index 000000000..5ff5be1fd --- /dev/null +++ b/examples/loader.mjs @@ -0,0 +1,26 @@ +const solutions = [ + (s) => s, + (s) => `${s}/index.js`, + (s) => `${s}.js`, + (s) => `${s}/lib/index.js`, +]; + +export async function resolve(specifier, context, defaultResolve) { + for (const solve of solutions) { + const resolvedPath = solve(specifier); + + try { + return await defaultResolve(resolvedPath, context, defaultResolve); + } catch (err) { + if ( + err.code !== "ERR_MODULE_NOT_FOUND" && + err.code !== "ERR_PACKAGE_PATH_NOT_EXPORTED" && + err.code !== "ERR_UNSUPPORTED_DIR_IMPORT" + ) { + console.error(`Error resolving path: ${resolvedPath}`, err); + } + } + } + + throw new Error(`Module not found: ${specifier}`); +} diff --git a/examples/open-badges.js b/examples/open-badges.js new file mode 100644 index 000000000..f1f7d5fa5 --- /dev/null +++ b/examples/open-badges.js @@ -0,0 +1,77 @@ +import { VerifiableCredential } from '@docknetwork/credential-sdk/vc'; +import { DIDKeyResolver } from '@docknetwork/credential-sdk/resolver'; + +// Sample credential data from https://gist.githubusercontent.com/ottonomy/6f72f5055220cfa8c6926e1a753f1870/raw/e7882e4a6eebb503359cce4bdc8978331d47544c/asu-tln-unconference-example-credential.json +const credentialJSON = { + '@context': [ + 'https://www.w3.org/2018/credentials/v1', + 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json', + 'https://w3id.org/security/suites/ed25519-2020/v1', + ], + type: ['VerifiableCredential', 'OpenBadgeCredential'], + issuer: { + type: 'Profile', + id: 'did:key:z6MkoowWdLogChc6mRp18YcKBd2yYTNnQLeHdiT73wjL1h6z', + name: 'Trusted Learner Network (TLN) Unconference Issuer', + url: 'https://tln.asu.edu/', + image: { + id: 'https://plugfest3-assets-20230928.s3.amazonaws.com/TLN+Gold+Circle.png', + type: 'Image', + }, + }, + issuanceDate: '2024-04-04T16:43:31.485Z', + name: '2024 TLN Unconference Change Agent', + credentialSubject: { + type: 'AchievementSubject', + id: 'did:key:7af28a8b2b9684073a0884aacd8c31eb5908baf4a1ba7e2ca60582bf585c68ad', + achievement: { + id: 'https://tln.asu.edu/achievement/369435906932948', + type: 'Achievement', + name: '2024 TLN Unconference Change Agent', + description: + 'This credential certifies attendance, participation, and knowledge-sharing at the 2024 Trusted Learner Network (TLN) Unconference.', + criteria: { + type: 'Criteria', + narrative: + "* Demonstrates initiative and passion for digital credentialing\n* Shares knowledge, skills and experience to broaden and deepen the community's collective understanding and competency\n* Engages in complex problems by collaborating with others\n* Creates connections and builds coalition to advance the ecosystem", + }, + }, + }, + id: 'https://tln.asu.edu/achievement/369435906932948', + proof: { + type: 'Ed25519Signature2020', + created: '2024-04-04T16:43:31Z', + verificationMethod: + 'did:key:z6MkoowWdLogChc6mRp18YcKBd2yYTNnQLeHdiT73wjL1h6z#z6MkoowWdLogChc6mRp18YcKBd2yYTNnQLeHdiT73wjL1h6z', + proofPurpose: 'assertionMethod', + proofValue: + 'z23JQwSmJKnWXw1HWDMBv1yoZDVyfUsRWihQFsrSLpb8cENqbuqpdnaSY72VmCkY3WQ4GovpNRZPNLRaatXeDJE8G', + }, +}; + +const resolver = new DIDKeyResolver(); + +async function main() { + // Incrementally build a verifiable credential + const credential = VerifiableCredential.fromJSON(credentialJSON); + + // Verify the credential + const verifyResult = await credential.verify({ + resolver, + compactProof: true, + }); + if (verifyResult.verified) { + console.log('Credential has been verified! Result:', verifyResult); + } else { + console.error( + 'Credential could not be verified!. Got error', + verifyResult.error, + ); + process.exit(1); + } + + // Exit + process.exit(0); +} + +main(); diff --git a/examples/package.json b/examples/package.json new file mode 100644 index 000000000..341a42f5e --- /dev/null +++ b/examples/package.json @@ -0,0 +1,35 @@ +{ + "name": "@docknetwork/sdk-examples", + "private": true, + "type": "module", + "version": "0.1.1", + "scripts": { + "bbs-dock-example": "babel-node --loader=./loader.mjs ./bbs-dock.js", + "claim-deduction-example": "babel-node --loader=./loader.mjs ./claim-deduction.js", + "open-badges-example": "babel-node --loader=./loader.mjs ./open-badges.js", + "schema-validation-example": "babel-node --loader=./loader.mjs ./schema-validation.js", + "standard-schemas-example": "babel-node --loader=./loader.mjs ./standard-schemas.js", + "dock-did-example": "babel-node --loader=./loader.mjs ./dock-did.js", + "did-resolver-example": "babel-node --loader=./loader.mjs ./resolver.js", + "schema-example": "babel-node --loader=./loader.mjs ./schema.js", + "blob-example": "babel-node --loader=./loader.mjs ./blob.js", + "anchor-example": "babel-node --loader=./loader.mjs ./anchor.js", + "examples": "yarn bbs-dock-example && yarn claim-deduction-example && yarn open-badges-example && yarn schema-validation-example && yarn standard-schemas-example && yarn dock-did-example && yarn did-resolver-example && yarn schema-example && yarn blob-example && yarn anchor-example", + "examples-with-node": "../scripts/with_dock_docker_test_node yarn examples", + "lint": "eslint \"*.js\"" + }, + "dependencies": { + "@docknetwork/credential-sdk": "0.1.1", + "@docknetwork/dock-blockchain-api": "0.1.1", + "@docknetwork/dock-blockchain-modules": "0.1.1" + }, + "devDependencies": { + "babel-eslint": "^10.1.0", + "eslint": "^8.0.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-sonarjs": "0.5.0", + "eslint-plugin-unused-imports": "^3.0.0" + } +} diff --git a/example/resolver.js b/examples/resolver.js similarity index 52% rename from example/resolver.js rename to examples/resolver.js index 56331cdc2..a792de926 100644 --- a/example/resolver.js +++ b/examples/resolver.js @@ -1,38 +1,46 @@ /* eslint-disable max-classes-per-file */ -import { randomAsHex } from "@polkadot/util-crypto"; -import ethr from "ethr-did-resolver"; -import { DockAPI } from "../src/index"; -import { DockDid, NoDIDError, DidKeypair } from "../src/did"; +import ethr from 'ethr-did-resolver'; +import { DockAPI } from '@docknetwork/dock-blockchain-api'; +import { + DockDid, + DidKey, + DIDDocument, +} from '@docknetwork/credential-sdk/types'; +import { NoDIDError } from '@docknetwork/credential-sdk/modules/did'; import { DIDResolver, DIDKeyResolver, UniversalResolver, WILDCARD, DockDIDResolver, -} from "../src/resolver"; +} from '@docknetwork/credential-sdk/resolver'; +import { DockDIDModule } from '@docknetwork/dock-blockchain-modules'; // The following can be tweaked depending on where the node is running and what // account is to be used for sending the transaction. -import { FullNodeEndpoint, TestAccountURI } from "../tests/test-constants"; -import { registerNewDIDUsingPair } from "../tests/integration/helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from '@docknetwork/credential-sdk/keypairs'; -const universalResolverUrl = "https://uniresolver.io"; +const universalResolverUrl = 'https://uniresolver.io'; // Infura's Ethereum provider for the main net const ethereumProviderConfig = { networks: [ { - name: "mainnet", - rpcUrl: "https://mainnet.infura.io/v3/05f321c3606e44599c54dbc92510e6a9", + name: 'mainnet', + rpcUrl: 'https://mainnet.infura.io/v3/05f321c3606e44599c54dbc92510e6a9', }, ], }; const dock = new DockAPI(); +const didModule = new DockDIDModule(dock); // Custom ethereum resolver class class EtherResolver extends DIDResolver { - static METHOD = "ethr"; + static METHOD = 'ethr'; constructor(config) { super(); @@ -54,30 +62,31 @@ class EtherResolver extends DIDResolver { * @returns {Promise} */ async function createDockDID() { - const account = dock.keyring.addFromUri(TestAccountURI); + const account = dock.keyring.addFromUri( + process.env.TestAccountURI || '//Alice', + ); dock.setAccount(account); const dockDID = DockDid.random(); - const pair = new DidKeypair( - dock.keyring.addFromUri(randomAsHex(32), null, "sr25519"), - 1, + const pair = new DidKeypair([dockDID, 1], Ed25519Keypair.random()); + await didModule.createDocument( + DIDDocument.create(dockDID, [new DidKey(pair.publicKey())], []), ); - await registerNewDIDUsingPair(dock, dockDID, pair); return String(dockDID); } async function main() { - console.log("Connecting to the node..."); + console.log('Connecting to the node...'); await dock.init({ - address: FullNodeEndpoint, + address: process.env.FullNodeEndpoint || 'ws://127.0.0.1:9944', }); - console.log("Creating DID resolvers..."); + console.log('Creating DID resolvers...'); const resolvers = [ new DIDKeyResolver(), // did:key resolver - new DockDIDResolver(dock), // Prebuilt resolver + new DockDIDResolver(didModule), // Prebuilt resolver new EtherResolver(ethereumProviderConfig), // Custom resolver ]; @@ -90,31 +99,31 @@ async function main() { ...resolvers, ]); - console.log("Building DIDs list..."); + console.log('Building DIDs list...'); const dockDID = await createDockDID(); const didsToTest = [ dockDID, - "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6", - "did:ethr:0xabcabc03e98e0dc2b855be647c39abe984193675", + 'did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6', + 'did:ethr:0xabcabc03e98e0dc2b855be647c39abe984193675', ]; - console.log("Resolving", didsToTest.length, "dids..."); + console.log('Resolving', didsToTest.length, 'dids...'); return Promise.all( didsToTest.map(async (did) => { const document = await resolver.resolve(did); - console.log("Resolved DID", did, document); + console.log('Resolved DID', did, document); }), ); } main() .then(() => { - console.log("Example ran successfully"); + console.log('Example ran successfully'); process.exit(0); }) .catch((error) => { - console.error("Error occurred somewhere, it was caught!", error); + console.error('Error occurred somewhere, it was caught!', error); process.exit(1); }); diff --git a/example/schema-validation.js b/examples/schema-validation.js similarity index 93% rename from example/schema-validation.js rename to examples/schema-validation.js index d9a007a10..e8a5e4022 100644 --- a/example/schema-validation.js +++ b/examples/schema-validation.js @@ -1,4 +1,4 @@ -import Schema from '../src/modules/schema'; +import { Schema } from '@docknetwork/credential-sdk/modules/schema'; // BOL Schema, its valid import bolSchema from './schemas/bol'; diff --git a/examples/schema.js b/examples/schema.js new file mode 100644 index 000000000..d46f2f990 --- /dev/null +++ b/examples/schema.js @@ -0,0 +1,164 @@ +import { randomAsHex } from '@docknetwork/credential-sdk/utils'; + +import { DockAPI } from '@docknetwork/dock-blockchain-api'; +import { + DockDid, + DIDDocument, + DidKey, + VerificationRelationship, +} from '@docknetwork/credential-sdk/types'; +import { Schema } from '@docknetwork/credential-sdk/modules'; +import { DockCoreModules } from '@docknetwork/dock-blockchain-modules'; +import { + VerifiableCredential, + getKeyDoc, +} from '@docknetwork/credential-sdk/vc'; +import { + Ed25519Keypair, + DidKeypair, +} from '@docknetwork/credential-sdk/keypairs'; + +import { + UniversalResolver, + DockResolver, + WildcardMultiResolver, +} from '@docknetwork/credential-sdk/resolver'; + +const dock = new DockAPI(); +const modules = new DockCoreModules(dock); +const blobModule = modules.blob; +const didModule = modules.did; + +async function createDID(did, pair) { + console.log('Creating new author DID', did); + + // Create an author DID to write with + const publicKey = pair.publicKey(); + const didKey = new DidKey(publicKey, new VerificationRelationship()); + await didModule.createDocument(DIDDocument.create(did, [didKey])); +} + +async function main() { + console.log('Connecting to the node...'); + await dock.init({ + address: process.env.FullNodeEndpoint || 'ws://127.0.0.1:9944', + }); + + console.log('Setting sdk account...'); + const account = dock.keyring.addFromUri( + process.env.TestAccountURI || '//Alice', + ); + dock.setAccount(account); + + const keySeed = randomAsHex(32); + const subjectKeySeed = randomAsHex(32); + + // Generate a DID to be used as author + const dockDID = DockDid.random(); + // Generate first key with this seed. The key type is Ed25519 + const pair = new DidKeypair([dockDID, 1], new Ed25519Keypair(keySeed)); + await createDID(dockDID, pair); + + // Properly format a keyDoc to use for signing + const keyDoc = getKeyDoc(dockDID, pair); + + const subjectDID = DockDid.random(); + const subjectPair = new DidKeypair( + [subjectDID, 1], + new Ed25519Keypair(subjectKeySeed), + ); + await createDID(subjectDID, subjectPair); + + console.log('Creating a new schema...'); + const schema = new Schema(); + await schema.setJSONSchema({ + $schema: 'http://json-schema.org/draft-07/schema#', + description: 'Dock Schema Example', + type: 'object', + properties: { + id: { + type: 'string', + }, + emailAddress: { + type: 'string', + format: 'email', + }, + alumniOf: { + type: 'string', + }, + }, + required: ['emailAddress', 'alumniOf'], + additionalProperties: false, + }); + + console.log('The schema is:', JSON.stringify(schema.toJSON(), null, 2)); + console.log('Writing schema to the chain with blob id of', schema.id, '...'); + + await schema.writeToChain(blobModule, dockDID, pair); + + console.log(`Schema written, reading from chain (${schema.id})...`); + + const result = await Schema.get(schema.id, blobModule); + console.log('Result from chain:', result); + + const universalResolverUrl = 'https://uniresolver.io'; + const resolver = new WildcardMultiResolver([ + new DockResolver(modules), + new UniversalResolver(universalResolverUrl), + ]); + + console.log('Creating a verifiable credential and assigning its schema...'); + const vc = new VerifiableCredential('https://example.com/credentials/187'); + vc.setSchema(result.id, 'JsonSchemaValidator2018'); + vc.addContext('https://www.w3.org/2018/credentials/examples/v1'); + vc.addContext({ + emailAddress: 'https://schema.org/email', + alumniOf: 'https://schema.org/alumniOf', + }); + vc.addType('AlumniCredential'); + vc.addSubject({ + id: String(subjectDID), + alumniOf: 'Example University', + emailAddress: 'abc@example.com', + }); + await vc.sign(keyDoc); + + console.log('Verifying the credential:', vc); + const { verified, error } = await vc.verify({ + resolver, + compactProof: false, + }); + if (!verified) { + throw error || new Error('Verification failed'); + } + + console.log('Credential verified, mutating the subject and trying again...'); + vc.addSubject({ + id: 'uuid:0x0', + thisWillFail: true, + }); + + try { + await vc.verify({ + resolver, + compactProof: false, + }); + throw new Error( + "Verification succeeded, but it shouldn't have. This is a bug.", + ); + } catch (e) { + console.log('Verification failed as expected:', e); + } + + console.log('All done, disconnecting...'); + await dock.disconnect(); +} + +main() + .then(() => { + process.exit(0); + }) + .catch((error) => { + console.error('Error occurred somewhere, it was caught!', error); + process.exit(1); + }); diff --git a/examples/schemas/bol.js b/examples/schemas/bol.js new file mode 100644 index 000000000..edeb6fd7c --- /dev/null +++ b/examples/schemas/bol.js @@ -0,0 +1,80 @@ +export default { + $schema: "http://json-schema.org/draft-07/schema#", + description: + "Detailed shipment document provided by the carrier to the receiver of products.", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + address: { + type: "object", + properties: { + address: { + type: "string", + }, + latitude: { + type: "number", + minimum: -90, + maximum: 90, + }, + longitude: { + type: "number", + minimum: -180, + maximum: 180, + }, + }, + }, + }, + properties: { + productIdentifier: { + type: "string", + format: "uuid", + }, + bolNumber: { + type: "string", + }, + carrier: { $ref: "#/$defs/uri" }, + recipient: { $ref: "#/$defs/uri" }, + transportType: { + type: "string", + }, + originAddress: { $ref: "#/$defs/address" }, + deliveryAddress: { $ref: "#/$defs/address" }, + valuePerItem: { + type: "number", + minimum: 0, + maximum: 1000, + }, + totalOrderValue: { + type: "number", + minimum: 0, + maximum: 1000000, + }, + freightChargeTerms: { + type: "string", + }, + expectedDeliveryDates: { + type: "string", + format: "date", + }, + comment: { + type: "string", + }, + }, + required: [ + "productIdentifier", + "bolNumber", + "carrier", + "recipient", + "transportType", + "originAddress", + "deliveryAddress", + "valuePerItem", + "totalOrderValue", + "freightChargeTerms", + "expectedDeliveryDates", + ], + additionalProperties: true, +}; diff --git a/example/schemas/health_worker_passport.js b/examples/schemas/health_worker_passport.js similarity index 53% rename from example/schemas/health_worker_passport.js rename to examples/schemas/health_worker_passport.js index c55de091f..71d75aa08 100644 --- a/example/schemas/health_worker_passport.js +++ b/examples/schemas/health_worker_passport.js @@ -1,78 +1,85 @@ export default { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Health Care Worker Passport', - type: 'object', + $schema: "http://json-schema.org/draft-07/schema#", + description: "Health Care Worker Passport", + type: "object", $defs: { uri: { - type: 'string', - format: 'uri', + type: "string", + format: "uri", }, }, properties: { firstName: { - type: 'string', + type: "string", }, lastName: { - type: 'string', + type: "string", }, - photo: { $ref: '#/$defs/uri' }, + photo: { $ref: "#/$defs/uri" }, biometricTemplate: { - type: 'object', + type: "object", minProperties: 1, properties: { fingerprint: { - type: 'string', + type: "string", }, retina: { - type: 'string', + type: "string", }, voice: { - type: 'string', + type: "string", }, }, additionalProperties: false, }, degreeHeld: { - type: 'array', + type: "array", minItems: 1, items: { - type: 'object', + type: "object", minProperties: 1, properties: { institution: { - type: 'string', + type: "string", }, degree: { - type: 'string', + type: "string", }, }, additionalProperties: true, }, }, licenses: { - type: 'array', + type: "array", minItems: 1, items: { - type: 'object', + type: "object", minProperties: 4, properties: { licenseName: { - type: 'string', + type: "string", }, licenser: { - type: 'string', + type: "string", }, licensedFor: { - type: 'string', + type: "string", }, expiresDate: { - type: 'string', - format: 'date', + type: "string", + format: "date", }, }, additionalProperties: true, }, }, }, - required: ['firstName', 'lastName', 'photo', 'biometricTemplate', 'degreeHeld', 'licenses'], + required: [ + "firstName", + "lastName", + "photo", + "biometricTemplate", + "degreeHeld", + "licenses", + ], }; diff --git a/examples/schemas/immunity_event_record.js b/examples/schemas/immunity_event_record.js new file mode 100644 index 000000000..4a23e8851 --- /dev/null +++ b/examples/schemas/immunity_event_record.js @@ -0,0 +1,60 @@ +import proofOfHealthCoreSchema from "./proof_of_health_core"; + +const schema = { + $schema: "http://json-schema.org/draft-07/schema#", + description: "Show if immunity by vaccination or testing", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + }, + properties: { + eventType: { + type: "string", + enum: ["vaccination", "antibody test"], + }, + eventTime: { + type: "string", + format: "date-time", + }, + eventBy: { + type: "string", + }, + eventFacility: { + type: "string", + }, + eventName: { + type: "string", + enum: ["X-trans-23 vaccine", "Serological Assay COVID-19"], + }, + potencyDate: { + type: "string", + format: "date", + }, + }, + required: [ + "firstName", + "firstInitial", + "lastName", + "lastInitial", + "photo", + "biometricTemplate", + "yearOfBirth", + "eventType", + "eventTime", + "eventBy", + "eventFacility", + "eventName", + "potencyDate", + ], +}; + +// TODO: Use `$ref` instead. Some of the changes already done in other branch. +const properties = { + ...proofOfHealthCoreSchema.properties, + ...schema.properties, +}; +schema.properties = properties; +export default schema; diff --git a/examples/schemas/infection_diagnosis.js b/examples/schemas/infection_diagnosis.js new file mode 100644 index 000000000..a1eb9a929 --- /dev/null +++ b/examples/schemas/infection_diagnosis.js @@ -0,0 +1,68 @@ +import proofOfHealthCoreSchema from "./proof_of_health_core"; + +const schema = { + $schema: "http://json-schema.org/draft-07/schema#", + // TODO: Use a proper id once blob integration is done in SDK + description: "Diagnosis with viral infection on a particular date", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + }, + properties: { + diagnosisCode: { + type: "string", + enum: ["CodeA", "CodeB", "CodeC"], + }, + diagnosisTime: { + type: "string", + format: "date-time", + }, + diagnosisLocation: { + type: "string", + }, + diagnosedBy: { + type: "string", + }, + diagnosisFacility: { + type: "string", + }, + diagnosisMethods: { + type: "array", + minItems: 1, + items: { + type: "string", + }, + }, + declaredSafeDate: { + type: "string", + format: "date", + }, + }, + required: [ + "firstName", + "firstInitial", + "lastName", + "lastInitial", + "photo", + "biometricTemplate", + "yearOfBirth", + "diagnosisCode", + "diagnosisTime", + "diagnosisLocation", + "diagnosedBy", + "diagnosisFacility", + "diagnosisMethods", + "declaredSafeDate", + ], +}; + +// TODO: Use `$ref` instead. Some of the changes already done in other branch. +const properties = { + ...proofOfHealthCoreSchema.properties, + ...schema.properties, +}; +schema.properties = properties; +export default schema; diff --git a/examples/schemas/non_infection_check.js b/examples/schemas/non_infection_check.js new file mode 100644 index 000000000..9bfddbb00 --- /dev/null +++ b/examples/schemas/non_infection_check.js @@ -0,0 +1,65 @@ +import proofOfHealthCoreSchema from "./proof_of_health_core"; + +const schema = { + $schema: "http://json-schema.org/draft-07/schema#", + description: "Found virus free after testing", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + }, + properties: { + virus: { + type: "array", + minItems: 1, + items: { + type: "string", + }, + }, + checkTime: { + type: "string", + format: "date-time", + }, + checkLocation: { + type: "string", + }, + checkedBy: { + type: "string", + }, + checkFacility: { + type: "string", + }, + diagnosisMethods: { + type: "array", + minItems: 1, + items: { + type: "string", + }, + }, + }, + required: [ + "firstName", + "firstInitial", + "lastName", + "lastInitial", + "photo", + "biometricTemplate", + "yearOfBirth", + "virus", + "checkTime", + "checkLocation", + "checkedBy", + "checkFacility", + "diagnosisMethods", + ], +}; + +// TODO: Use `$ref` instead. Some of the changes already done in other branch. +const properties = { + ...proofOfHealthCoreSchema.properties, + ...schema.properties, +}; +schema.properties = properties; +export default schema; diff --git a/examples/schemas/pr_card.js b/examples/schemas/pr_card.js new file mode 100644 index 000000000..79bc13d81 --- /dev/null +++ b/examples/schemas/pr_card.js @@ -0,0 +1,58 @@ +export default { + $schema: "http://json-schema.org/draft-07/schema#", + description: "Permanent Resident Card", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + }, + properties: { + id: { $ref: "#/$defs/uri" }, + type: { + type: "array", + items: { type: "string" }, + }, + givenName: { + type: "string", + }, + familyName: { + type: "string", + }, + gender: { + type: "string", + }, + image: { $ref: "#/$defs/uri" }, + lprCategory: { + type: "string", + }, + commuterClassification: { + type: "string", + }, + lprNumber: { + type: "string", + }, + residentSince: { + type: "string", + format: "date", + }, + birthDate: { + type: "string", + format: "date", + }, + }, + required: [ + "id", + "type", + "givenName", + "familyName", + "gender", + "image", + "lprCategory", + "commuterClassification", + "lprNumber", + "residentSince", + "birthDate", + ], +}; diff --git a/examples/schemas/proof_of_health_core.js b/examples/schemas/proof_of_health_core.js new file mode 100644 index 000000000..4065ded00 --- /dev/null +++ b/examples/schemas/proof_of_health_core.js @@ -0,0 +1,56 @@ +export default { + $schema: "http://json-schema.org/draft-07/schema#", + description: "Common fields of proof of health schemas", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + }, + properties: { + firstName: { + type: "string", + }, + firstInitial: { + type: "string", + }, + lastName: { + type: "string", + }, + lastInitial: { + type: "string", + }, + yearOfBirth: { + type: "integer", + minimum: 1920, + maximum: 2015, + }, + photo: { $ref: "#/$defs/uri" }, + biometricTemplate: { + type: "object", + minProperties: 1, + properties: { + fingerprint: { + type: "string", + }, + retina: { + type: "string", + }, + voice: { + type: "string", + }, + }, + additionalProperties: false, + }, + }, + required: [ + "firstName", + "firstInitial", + "lastName", + "lastInitial", + "photo", + "biometricTemplate", + "yearOfBirth", + ], +}; diff --git a/examples/schemas/qp_inbond.js b/examples/schemas/qp_inbond.js new file mode 100644 index 000000000..4e2fddcef --- /dev/null +++ b/examples/schemas/qp_inbond.js @@ -0,0 +1,93 @@ +export default { + $schema: "http://json-schema.org/draft-07/schema#", + description: + "Permit document for import/export of shipments that have not been cleared by US Customs.", + type: "object", + $defs: { + uri: { + type: "string", + format: "uri", + }, + address: { + type: "object", + properties: { + address: { + type: "string", + }, + latitude: { + type: "number", + minimum: -90, + maximum: 90, + }, + longitude: { + type: "number", + minimum: -180, + maximum: 180, + }, + }, + }, + }, + properties: { + productIdentifier: { + type: "string", + format: "uuid", + }, + inBondNumber: { + type: "string", + }, + inBondType: { + type: "string", + }, + portOfEntry: { + type: "string", + }, + irsNumber: { + type: "string", + }, + carrier: { $ref: "#/$defs/uri" }, + recipient: { $ref: "#/$defs/uri" }, + transportType: { + type: "string", + }, + originAddress: { $ref: "#/$defs/address" }, + deliveryAddress: { $ref: "#/$defs/address" }, + bolNumber: { + type: "string", + }, + valuePerItem: { + type: "number", + minimum: 0, + maximum: 1000, + }, + totalOrderValue: { + type: "number", + minimum: 0, + maximum: 1000000, + }, + expectedDeliveryDates: { + type: "string", + format: "date", + }, + comment: { + type: "string", + }, + }, + required: [ + "productIdentifier", + "inBondNumber", + "inBondType", + "portOfEntry", + "irsNumber", + "bolNumber", + "carrier", + "recipient", + "transportType", + "originAddress", + "deliveryAddress", + "valuePerItem", + "totalOrderValue", + "comment", + "expectedDeliveryDates", + ], + additionalProperties: false, +}; diff --git a/example/standard_schemas.js b/examples/standard-schemas.js similarity index 94% rename from example/standard_schemas.js rename to examples/standard-schemas.js index 88668f3d2..53de7d042 100644 --- a/example/standard_schemas.js +++ b/examples/standard-schemas.js @@ -1,10 +1,11 @@ /* eslint sonarjs/no-duplicate-string: 0 */ -import Schema from '../src/modules/schema'; -import { expandJSONLD } from '../src/utils/vc'; -import { validateCredentialSchema } from '../src/utils/vc/schema'; +import { Schema } from '@docknetwork/credential-sdk/modules/schema'; +import { + expandJSONLD, + validateCredentialSchema, +} from '@docknetwork/credential-sdk/vc'; import prCardSchema from './schemas/pr_card'; -// import healthWorkerPassportSchema from './schemas/health_worker_passport'; import infectionDiagnosisSchema from './schemas/infection_diagnosis'; import immunityEventRecordSchema from './schemas/immunity_event_record'; import noInfectionSchema from './schemas/non_infection_check'; @@ -15,16 +16,10 @@ const credPRCard = { 'https://www.w3.org/2018/credentials/v1', 'https://w3id.org/citizenship/v1', ], - type: [ - 'VerifiableCredential', - 'PermanentResidentCard', - ], + type: ['VerifiableCredential', 'PermanentResidentCard'], credentialSubject: { id: 'did:key:z6Mkte9e5E2GRozAgYyhktX7eTt9woCR4yJLnaqC88FQCSyY', - type: [ - 'PermanentResident', - 'Person', - ], + type: ['PermanentResident', 'Person'], givenName: 'JOHN', familyName: 'SMITH', gender: 'Male', @@ -178,7 +173,8 @@ async function validateSchema(schema, credential) { await Schema.validateSchema(schema); console.log('Validating credential against schema...'); - await validateCredentialSchema(credential, schema); + const expanded = await expandJSONLD(credential); + await validateCredentialSchema(expanded, schema, credential['@context']); console.log('Success!'); } diff --git a/package.json b/package.json index 7041b48ad..7bb5b39a4 100644 --- a/package.json +++ b/package.json @@ -1,135 +1,22 @@ { - "name": "@docknetwork/sdk", - "version": "9.3.0", - "main": "index.js", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/docknetwork/sdk" - }, - "engines": { - "node": ">=18.0.0" - }, + "name": "root", + "private": true, + "workspaces": [ + "packages/*", + "examples" + ], + "dependencies": {}, "devDependencies": { + "turbo": "2.0.5", + "@changesets/cli": "^2.x.x", "@babel/cli": "^7.24.1", "@babel/core": "^7.24.3", "@babel/node": "^7.23.9", "@babel/plugin-transform-modules-commonjs": "^7.24.1", - "@babel/preset-env": "^7.24.3", - "@comunica/actor-init-sparql-rdfjs": "^1.22.3", - "@comunica/types": "^1.0.0", - "@helia/strings": "^3.0.1", - "@rollup/plugin-alias": "^4.0.2", - "@rollup/plugin-commonjs": "^24.0.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-wasm": "^5.1.0", - "@types/jest": "^29.5.12", - "aws-sdk": "^2.1057.0", - "babel-eslint": "^10.1.0", - "babel-jest": "^29.7.0", - "eslint": "^6.8.0", - "eslint-config-airbnb-base": "^14.1.0", - "eslint-plugin-import": "^2.20.2", - "eslint-plugin-jest": "^24.5.0", - "eslint-plugin-sonarjs": "0.5.0", - "eslint-plugin-unused-imports": "^3.0.0", - "eth-revert-reason": "^1.0.3", - "ethers": "^5.4", - "ethr-did-resolver": "^2.2.0", - "glob": "^7.1.6", - "helia": "^4.0.1", - "jest": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jsdoc": "^3.6.3", - "jsdoc-typeof-plugin": "^1.0.0", - "node-datachannel": "^0.5.4", - "parity-scale-codec": "^0.5.3", - "r1csfile": "0.0.41", - "ramda": "^0.27.2", - "rollup": "2.78.0", - "rollup-plugin-copy": "^3.4.0", - "rollup-plugin-multi-input": "^1.3.2", - "rollup-plugin-node-polyfills": "^0.2.1", - "rollup-plugin-terser": "^7.0.2", - "rxjs": "^7.4.0", - "typescript": "5.0.4", - "web3": "^1.7.5" + "@babel/preset-env": "^7.24.3" }, + "packageManager": "yarn@1.22.22", "scripts": { - "exc": "npx babel-node", - "bbs-dock-example": "npx babel-node example/bbs-dock.js", - "dock-did-example": "npx babel-node example/dock-did.js", - "staking_payouts": "npx babel-node scripts/staking_payouts.js", - "did-resolver-example": "npx babel-node example/resolver.js", - "revocation-example": "npx babel-node example/revocation.js", - "vcdm-example": "npx babel-node example/vcdm.js", - "open-badges-example": "npx babel-node example/open-badges.js", - "standard-schemas-example": "npx babel-node example/standard_schemas.js", - "schema-example": "npx babel-node example/schema.js", - "schema-validation-example": "npx babel-node example/schema-validation.js", - "blob-example": "npx babel-node example/blob.js", - "txn-pricing": "npx babel-node scripts/txn-pricing.js", - "claim-deduction-example": "npx babel-node example/claim-deduction.js", - "anchor-example": "npx babel-node example/anchor.js", - "test-examples": "yarn dock-did-example && yarn did-resolver-example && yarn revocation-example && yarn vcdm-example && yarn standard-schemas-example && yarn schema-example && yarn schema-validation-example && yarn blob-example && yarn claim-deduction-example && yarn anchor-example && yarn bbs-dock-example && yarn open-badges-example", - "get-did": "npx babel-node scripts/get_did_doc.js", - "upgrade_with_sudo": "npx babel-node scripts/runtime_upgrade_with_sudo.js", - "onboard_with_sudo": "npx babel-node scripts/onboard_validator_with_sudo.js", - "lint": "eslint \"src/**/*.js\"", - "lint-examples": "eslint \"{src,example}/**/*.js\"", - "lint-scripts": "eslint \"scripts/**/*.js\"", - "lint-tests": "eslint \"{tests/unit,tests/integration}/**/*.js\"", - "build": "rollup -c", - "build-scripts": "rollup -c rollup.scripts.config.mjs", - "watch": "rollup -c -w", - "test": "yarn jest --verbose ./tests/unit", - "test-integration": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=production jest --verbose --runInBand --forceExit ./tests/integration", - "test-ipfs": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=production jest --verbose --runInBand --forceExit ./tests/ipfs", - "test-eth": "NODE_ENV=production jest --verbose --runInBand tests/integration/eth", - "docs": "mkdir out && touch out/.nojekyll && jsdoc src -r -c .jsdoc -d out/reference", - "dev-node": "./scripts/run_node_in_docker --dev --rpc-external --ws-external --rpc-cors=all", - "test-with-node": "./scripts/with_docker_test_node yarn test-integration", - "test-ipfs-with-node": "./scripts/with_docker_test_node yarn test-ipfs", - "test-eth-with-node": "./scripts/with_docker_test_node yarn test-eth", - "examples-with-node": "./scripts/with_docker_test_node yarn test-examples", - "test-with-all-nodes": "./scripts/with_all_docker_test_nodes yarn test-integration", - "test-eth-with-all-nodes": "./scripts/with_all_docker_test_nodes yarn test-eth", - "examples-with-all-nodes": "./scripts/with_all_docker_test_nodes yarn test-examples", - "mdbook": "mdbook build tutorials --dest-dir ../out/tutorials", - "type-check": "tsc --allowJs --checkJs --noEmit --moduleResolution node --resolveJsonModule --target ES6 --skipLibCheck true --allowSyntheticDefaultImports true" - }, - "resolutions": { - "@polkadot/api": "10.12.4" - }, - "dependencies": { - "@digitalcredentials/vc-status-list": "^8.0.0", - "@docknetwork/crypto-wasm-ts": "0.66.0", - "@docknetwork/node-types": "^0.17.0", - "@juanelas/base64": "^1.0.5", - "@polkadot/api": "10.12.4", - "@sphereon/ssi-sdk-ext.did-resolver-jwk": "^0.24.0", - "@transmute/json-web-signature": "^0.7.0-unstable.80", - "base64url": "3.0.1", - "blake2b": "2.1.4", - "bs58": "5.0.0", - "cross-fetch": "3.1.6", - "deep-equal": "2.0.5", - "dotenv": "16.0.1", - "elliptic": "6.5.4", - "flat": "^5.0.2", - "js-sha256": "0.9.0", - "json-canonicalize": "1.0.4", - "json-stringify-deterministic": "^1.0.11", - "jsonld": "^5.0.0", - "jsonld-signatures": "^9.3.1", - "jsonschema": "1.4.1", - "key-did-resolver": "^1.4.0", - "mrklt": "^0.2.0", - "multiformats": "^9.5.4", - "n3": "1.16.2", - "pako": "^2.1.0", - "rify": "^0.7.1", - "semver": "^7.6.0" + "publish-packages": "changeset version && changeset publish" } } diff --git a/packages/cheqd-blockchain-api/CHANGELOG.md b/packages/cheqd-blockchain-api/CHANGELOG.md new file mode 100644 index 000000000..828c4fa47 --- /dev/null +++ b/packages/cheqd-blockchain-api/CHANGELOG.md @@ -0,0 +1,7 @@ +# @docknetwork/cheqd-blockchain-api + +## 0.1.1 + +### Minor Changes + +- Improved READMEs diff --git a/packages/cheqd-blockchain-api/README.md b/packages/cheqd-blockchain-api/README.md new file mode 100644 index 000000000..ff36a946b --- /dev/null +++ b/packages/cheqd-blockchain-api/README.md @@ -0,0 +1,22 @@ +# @docknetwork/cheqd-blockchain-api + +This JavaScript library is developed on top of the `@cheqd/sdk` and provides a suite of tools and functionalities to seamlessly interact with the Cheqd blockchain. +It simplifies the process of connecting with the Cheqd network, enabling developers to efficiently manage digital identities and verifiable credentials within decentralized ecosystems. + +## Initialize + +```javascript +import { CheqdAPI } from "@docknetwork/cheqd-blockchain-api"; + +const cheqd = new CheqdAPI(); +cheqd.init(...); +``` + +## Use + +```javascript +import { CheqdCoreModules } from "@docknetwork/cheqd-blockchain-modules"; + +const modules = new CheqdCoreModules(cheqd); +... +``` diff --git a/packages/cheqd-blockchain-api/index.js b/packages/cheqd-blockchain-api/index.js new file mode 100644 index 000000000..38c47a249 --- /dev/null +++ b/packages/cheqd-blockchain-api/index.js @@ -0,0 +1 @@ +module.exports = require("./dist/cjs/index.cjs"); diff --git a/packages/cheqd-blockchain-api/jest.config.js b/packages/cheqd-blockchain-api/jest.config.js new file mode 100644 index 000000000..9e9e64202 --- /dev/null +++ b/packages/cheqd-blockchain-api/jest.config.js @@ -0,0 +1,23 @@ +export default { + bail: true, + moduleNameMapper: {}, + clearMocks: true, + testTimeout: 30000, + testEnvironment: "./tests/test-environment", + transform: { + "^.+\\.(ts|js)$": ["babel-jest", { rootMode: "upward" }], + }, + transformIgnorePatterns: [ + "/node_modules/(?!@polkadot|@babel|multiformats|@docknetwork|@stablelib|@cheqd|file-type)", + ], + workerIdleMemoryLimit: "1G", + verbose: true, + globals: { + Uint8Array, + Uint32Array, + ArrayBuffer, + TextDecoder, + TextEncoder, + Buffer, + }, +}; diff --git a/packages/cheqd-blockchain-api/package.json b/packages/cheqd-blockchain-api/package.json new file mode 100644 index 000000000..825f27db0 --- /dev/null +++ b/packages/cheqd-blockchain-api/package.json @@ -0,0 +1,89 @@ +{ + "name": "@docknetwork/cheqd-blockchain-api", + "version": "0.1.1", + "license": "MIT", + "main": "./dist/esm/index.js", + "type": "module", + "files": [ + "dist", + "index.js" + ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "default": "./dist/esm/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*", + "default": "./dist/esm/*" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/docknetwork/sdk" + }, + "engines": { + "node": ">=20.0.0" + }, + "devDependencies": { + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.3", + "@babel/node": "^7.23.9", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.3", + "@comunica/actor-init-sparql-rdfjs": "^1.22.3", + "@comunica/types": "^1.0.0", + "@helia/strings": "^3.0.1", + "@rollup/plugin-alias": "^4.0.2", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-wasm": "^5.1.0", + "@types/jest": "^29.5.12", + "aws-sdk": "^2.1057.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^29.7.0", + "eslint": "^8.0.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-sonarjs": "0.5.0", + "eslint-plugin-unused-imports": "^3.0.0", + "eth-revert-reason": "^1.0.3", + "ethers": "^5.4", + "ethr-did-resolver": "^2.2.0", + "glob": "^7.1.6", + "helia": "^4.0.1", + "jest": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jsdoc": "^3.6.3", + "jsdoc-typeof-plugin": "^1.0.0", + "node-datachannel": "^0.5.4", + "parity-scale-codec": "^0.5.3", + "r1csfile": "0.0.41", + "ramda": "^0.27.2", + "rollup": "2.78.0", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-multi-input": "^1.3.2", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2", + "rxjs": "^7.4.0", + "typescript": "5.0.4" + }, + "scripts": { + "exc": "babel-node", + "lint": "eslint \"src/**/*.js\"", + "build": "rollup -c", + "watch": "rollup -c -w", + "docs": "rm -rf out && mkdir out && touch out/.nojekyll && jsdoc src -r -c ../../.jsdoc -d out/reference", + "type-check": "tsc --allowJs --checkJs --noEmit --moduleResolution node --resolveJsonModule --target ES6 --skipLibCheck true --allowSyntheticDefaultImports true" + }, + "resolutions": { + "@polkadot/api": "10.12.4" + }, + "dependencies": { + "@cheqd/sdk": "^4.0.4" + } +} diff --git a/packages/cheqd-blockchain-api/rollup.config.mjs b/packages/cheqd-blockchain-api/rollup.config.mjs new file mode 100644 index 000000000..779150c18 --- /dev/null +++ b/packages/cheqd-blockchain-api/rollup.config.mjs @@ -0,0 +1,40 @@ +import json from "@rollup/plugin-json"; +import multiInput from "rollup-plugin-multi-input"; +import commonjs from "@rollup/plugin-commonjs"; +import { terser } from "rollup-plugin-terser"; +// import { wasm } from '@rollup/plugin-wasm'; +// import pkg from './package.json'; + +export default async function () { + return [ + { + plugins: [ + multiInput(), + json(), + // terser(), + commonjs(), + // Temporarily disabled, not sure if required + // since rify is a node module doesnt seem to work + // but would be nice to try embed it + // wasm({ + // sync: ['*.wasm'], + // }), + ], + input: ["src/**/*.js"], + output: [ + { + sourcemap: true, + dir: "dist/esm", + format: "esm", + entryFileNames: "[name].js", + }, + { + sourcemap: true, + dir: "dist/cjs", + format: "cjs", + entryFileNames: "[name].cjs", + }, + ], + }, + ]; +} diff --git a/packages/cheqd-blockchain-api/src/index.js b/packages/cheqd-blockchain-api/src/index.js new file mode 100644 index 000000000..0ff3bebc5 --- /dev/null +++ b/packages/cheqd-blockchain-api/src/index.js @@ -0,0 +1,179 @@ +import { ApiProvider } from '@docknetwork/credential-sdk/modules/common'; +import { + maybeToJSON, + maybeToJSONString, +} from '@docknetwork/credential-sdk/utils'; +import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing'; +import { DIDModule, ResourceModule, createCheqdSDK } from '@cheqd/sdk'; +import { + MsgCreateDidDocPayload, + MsgUpdateDidDocPayload, + MsgDeactivateDidDocPayload, + protobufPackage as didProtobufPackage, +} from '@cheqd/ts-proto/cheqd/did/v2/index'; +import { + MsgCreateResourcePayload, + protobufPackage as resourceProtobufPackage, +} from '@cheqd/ts-proto/cheqd/resource/v2/index'; + +export class CheqdAPI extends ApiProvider { + /** + * Creates a new instance of the CheqdAPI object, call init to initialize + * @constructor + */ + constructor() { + super(); + } + + static Fees = { + MsgCreateDidDoc: DIDModule.fees.DefaultCreateDidDocFee, + MsgUpdateDidDoc: DIDModule.fees.DefaultUpdateDidDocFee, + MsgDeactivateDidDoc: DIDModule.fees.DefaultDeactivateDidDocFee, + MsgCreateResource: ResourceModule.fees.DefaultCreateResourceDefaultFee, + }; + + static Prefixes = { + MsgCreateDidDoc: didProtobufPackage, + MsgUpdateDidDoc: didProtobufPackage, + MsgDeactivateDidDoc: didProtobufPackage, + MsgCreateResource: resourceProtobufPackage, + }; + + static Payloads = { + MsgCreateDidDoc: MsgCreateDidDocPayload, + MsgUpdateDidDoc: MsgUpdateDidDocPayload, + MsgDeactivateDidDoc: MsgDeactivateDidDocPayload, + MsgCreateResource: MsgCreateResourcePayload, + }; + + /** + * Initializes `CheqdAPI` with the supplied url and mnemonic. + * @param {object} configuration + * @param {string} [configuration.url] + * @param {string} [configuration.mnemonic] + * @returns {this} + */ + async init({ url, mnemonic } = {}) { + const wallet = mnemonic + && (await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { + prefix: 'cheqd', + })); + const options = { + modules: [DIDModule, ResourceModule], + rpcUrl: url, + wallet, + }; + this.ensureNotInitialized(); + + const sdk = await createCheqdSDK(options); + this.ensureNotInitialized().sdk = sdk; + + return this; + } + + /** + * @returns {void} + */ + async disconnect() { + delete this.sdk; + } + + /** + * @returns {boolean} + */ + get isInitialized() { + return this.sdk != null; + } + + /** + * Converts payload of the supplied method to bytes. + * + * @param {string} method + * @param {object} payload + * @returns {Promise} + */ + async stateChangeBytes(method, payload) { + const { [method]: Payload } = this.constructor.Payloads; + if (Payload == null) { + throw new Error( + `Can't find payload constructor for the provided method \`${method}\``, + ); + } + const jsonPayload = maybeToJSON(payload); + const sdkPayload = Payload.fromPartial(jsonPayload); + + try { + return Payload.encode(sdkPayload).finish(); + } catch (err) { + throw new Error( + `Failed to encode payload \`${maybeToJSONString(sdkPayload)}\`: ${err}`, + ); + } + } + + /** + * Signs and sends supplied transaction with the supplied configuration. + * + * @param {object} tx + * @param {object} configuration + * @param {string} configuration.from + * @param {object} configuration.fee + * @returns {Promise<*>} + */ + async signAndSend(tx, { from, fee, memo } = {}) { + const sender = from ?? (await this.sdk.options.wallet.getAccounts())[0].address; + const { typeUrl } = tx; + + const prefix = this.constructor.Prefixes[typeUrl]; + const amount = fee ?? this.constructor.Fees[typeUrl]; + const payment = { + amount: [amount], + gas: '3600000', // TODO: dynamically calculate needed amount + payer: sender, + }; + + const txJSON = tx.toJSON(); + txJSON.typeUrl = `/${prefix}.${typeUrl}`; + + const res = await this.sdk.signer.signAndBroadcast( + sender, + [txJSON], + payment, + memo ?? '', + ); + + if (res.code) { + console.error(res); + + throw new Error(`Error: ${JSON.stringify(res)}`); + } + + return res; + } + + /** + * Ensures that the SDK is initialized, throws an error otherwise. + * + * @returns {this} + */ + ensureInitialized() { + if (!this.isInitialized) { + throw new Error('SDK is not initialized.'); + } + + return this; + } + + /** + * Ensures that the SDK is not initialized, throws an error otherwise. + * + * @returns {this} + */ + ensureNotInitialized() { + if (this.isInitialized) { + throw new Error('SDK is already initialized.'); + } + + return this; + } +} diff --git a/packages/cheqd-blockchain-modules/.npmignore b/packages/cheqd-blockchain-modules/.npmignore new file mode 100644 index 000000000..a35bd89d5 --- /dev/null +++ b/packages/cheqd-blockchain-modules/.npmignore @@ -0,0 +1,10 @@ +src/ +scripts/ +jest.config.js +rollup.config.mjs +out/ +node_modules/ +.vscode/ +.turbo/ +tests/ +*.log diff --git a/packages/cheqd-blockchain-modules/CHANGELOG.md b/packages/cheqd-blockchain-modules/CHANGELOG.md new file mode 100644 index 000000000..ef845b0cb --- /dev/null +++ b/packages/cheqd-blockchain-modules/CHANGELOG.md @@ -0,0 +1,12 @@ +# @docknetwork/cheqd-blockchain-modules + +## 0.1.1 + +### Minor Changes + +- Improved READMEs + +### Patch Changes + +- Updated dependencies + - @docknetwork/credential-sdk@0.1.1 diff --git a/packages/cheqd-blockchain-modules/README.md b/packages/cheqd-blockchain-modules/README.md new file mode 100644 index 000000000..9a0582961 --- /dev/null +++ b/packages/cheqd-blockchain-modules/README.md @@ -0,0 +1,84 @@ +# @docknetwork/cheqd-blockchain-modules + +A JavaScript library created for managing credential SDK components such as DIDs and accumulators etc on the Cheqd blockchain. + +## Setup + +Before using any module on the Cheqd blockchain, the initial setup is required to configure the necessary API connections and cryptographic elements. This setup is shared across all modules to ensure seamless interoperability and efficient management of Decentralized Identifiers (DIDs) and attestations. + +### Initialization + +```javascript +import { CheqdAPI } from '@docknetwork/cheqd-blockchain-api'; +import { CheqdTestnetDid } from '@docknetwork/credential-sdk/types'; +import { Ed25519Keypair, DidKeypair } from '@docknetwork/credential-sdk/keypairs'; + +// Initialize the Cheqd API connection +const cheqd = new CheqdAPI(); +await cheqd.init(...); + +// Create a random DID on the Cheqd Testnet +const did = CheqdTestnetDid.random(); + +// Generate a random Ed25519 keypair +const keyPair = Ed25519Keypair.random(); + +// Create a DidKeypair using the generated DID and keypair +const didKeypair = new DidKeypair([did, 1], keyPair); +``` + +## DID + +The `CheqdDIDModule` handles Decentralized Identifiers (DIDs) specifically on the Cheqd blockchain network. By extending from `AbstractDIDModule`, it utilizes Cheqd-specific functionalities to manage DID documents effectively. + +### Example + +```javascript +import { CheqdDIDModule } from "@docknetwork/cheqd-blockchain-modules"; + +// Initialize the DID module using the shared setup +const didModule = new CheqdDIDModule(cheqd); + +// Create a DID document +const document = DIDDocument.create(did, [didKeypair.didKey()]); + +// Create the DID document on the blockchain +await didModule.createDocument(document, didKeypair); + +// Validate that the created document matches the expected JSON +expect((await didModule.getDocument(did)).toJSON()).toEqual(document.toJSON()); +``` + +## Attest + +The `CheqdAttestModule` is a specialized extension of the `AbstractAttestModule` focused on managing attestations for Decentralized Identifiers (DIDs) on the Cheqd network. + +### Example + +```javascript +import { CheqdDIDModule } from "@docknetwork/cheqd-blockchain-modules"; + +// Initialize the Attest module using the shared setup +const attestModule = new CheqdAttestModule(cheqd); + +// Define an Intersected Resource Identifier (IRI) for testing +const iri = "test"; + +// Set a claim for the given DID and DID keypair +await attestModule.setClaim(iri, did, didKeypair); + +// Verify that the attestations on the document match the expected IRI +expect((await attestModule.getDocument(did)).attests.toJSON()).toEqual(iri); +``` + +## TODO: + +- Accumulator +- Anchor +- Blob +- OffchainSignatures +- BBS +- BBSPlus +- PS +- StatusListCredential +- TrustRegistry diff --git a/packages/cheqd-blockchain-modules/index.js b/packages/cheqd-blockchain-modules/index.js new file mode 100644 index 000000000..38c47a249 --- /dev/null +++ b/packages/cheqd-blockchain-modules/index.js @@ -0,0 +1 @@ +module.exports = require("./dist/cjs/index.cjs"); diff --git a/packages/cheqd-blockchain-modules/jest.config.js b/packages/cheqd-blockchain-modules/jest.config.js new file mode 100644 index 000000000..2ea2cbf97 --- /dev/null +++ b/packages/cheqd-blockchain-modules/jest.config.js @@ -0,0 +1,43 @@ +export default { + bail: true, + moduleNameMapper: { + "^@docknetwork/credential-sdk/(.*)$": + "/../credential-sdk/dist/esm/$1", + "^@docknetwork/dock-blockchain-api/(.*)$": + "/../dock-blockchain-api/dist/esm/$1", + "^@docknetwork/cheqd-blockchain-api/(.*)$": + "/../cheqd-blockchain-api/dist/esm/$1", + "^@docknetwork/dock-blockchain-modules/(.*)$": + "/../dock-blockchain-modules/dist/esm/$1", + "^@docknetwork/dock-blockchain-api$": + "/../dock-blockchain-api/dist/esm/index.js", + "^@docknetwork/cheqd-blockchain-api$": + "/../cheqd-blockchain-api/dist/esm/index.js", + "^@docknetwork/dock-blockchain-modules$": + "/../dock-blockchain-modules/dist/esm/index.js", + "^@cheqd/sdk(.*)$": "/../../node_modules/@cheqd/sdk/build/esm/$1", + "^uint8arrays$": "/../../node_modules/uint8arrays/dist/src", + "^file-type$": "/../../node_modules/file-type/index.js", + "^multiformats/(.*)$": + "/../../node_modules/multiformats/dist/src/$1", + }, + clearMocks: true, + testTimeout: 30000, + testEnvironment: "./tests/test-environment", + transform: { + "^.+\\.(ts|js)$": ["babel-jest", { rootMode: "upward" }], + }, + transformIgnorePatterns: [ + "/node_modules/(?!@polkadot|@babel|multiformats|@docknetwork|@stablelib|@cheqd|file-type|uint8arrays|multiformats|strtok3|peek-readable|token-types|uint8array-extra)", + ], + workerIdleMemoryLimit: "1G", + verbose: true, + globals: { + Uint8Array, + Uint32Array, + ArrayBuffer, + TextDecoder, + TextEncoder, + Buffer, + }, +}; diff --git a/packages/cheqd-blockchain-modules/package.json b/packages/cheqd-blockchain-modules/package.json new file mode 100644 index 000000000..db132cc7c --- /dev/null +++ b/packages/cheqd-blockchain-modules/package.json @@ -0,0 +1,77 @@ +{ + "name": "@docknetwork/cheqd-blockchain-modules", + "version": "0.1.1", + "type": "module", + "license": "MIT", + "main": "./dist/esm/index.js", + "files": [ + "dist", + "index.js" + ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "default": "./dist/esm/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*", + "default": "./dist/esm/*" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/docknetwork/sdk" + }, + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@docknetwork/credential-sdk": "0.1.1" + }, + "devDependencies": { + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.3", + "@babel/node": "^7.23.9", + "@babel/plugin-syntax-import-attributes": "^7.25.6", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.3", + "@docknetwork/cheqd-blockchain-api": "0.1.1", + "@rollup/plugin-alias": "^4.0.2", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-wasm": "^5.1.0", + "@types/jest": "^29.5.12", + "aws-sdk": "^2.1057.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^29.7.0", + "eslint": "^8.0.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-sonarjs": "0.5.0", + "eslint-plugin-unused-imports": "^3.0.0", + "file-type": "^19.5.0", + "jest": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jsdoc": "^3.6.3", + "jsdoc-typeof-plugin": "^1.0.0", + "rollup": "2.78.0", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-multi-input": "^1.3.2", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2" + }, + "scripts": { + "build": "rollup -c", + "lint": "eslint \"src/**/*.js\"", + "docs": "rm -rf out && mkdir out && touch out/.nojekyll && jsdoc src -r -c ../../.jsdoc -d out/reference", + "dev-node": "CHEQD_MNEMONIC=$CHEQD_MNEMONIC ../../scripts/run_cheqd_node_in_docker --dev --rpc-external --ws-external --rpc-cors=all", + "test": "NODE_ENV=production jest --verbose --runInBand --forceExit ./tests/*", + "test-with-node": "CHEQD_MNEMONIC=$CHEQD_MNEMONIC ../../scripts/with_cheqd_docker_test_node yarn test", + "prepublishOnly": "yarn build" + } +} diff --git a/packages/cheqd-blockchain-modules/rollup.config.mjs b/packages/cheqd-blockchain-modules/rollup.config.mjs new file mode 100644 index 000000000..cad8cbf4b --- /dev/null +++ b/packages/cheqd-blockchain-modules/rollup.config.mjs @@ -0,0 +1,37 @@ +import json from "@rollup/plugin-json"; +import multiInput from "rollup-plugin-multi-input"; +import commonjs from "@rollup/plugin-commonjs"; + +export default async function () { + return [ + { + plugins: [ + multiInput(), + json(), + // terser(), + commonjs(), + // Temporarily disabled, not sure if required + // since rify is a node module doesnt seem to work + // but would be nice to try embed it + // wasm({ + // sync: ['*.wasm'], + // }), + ], + input: ["src/**/*.js"], + output: [ + { + sourcemap: true, + dir: "dist/esm", + format: "esm", + entryFileNames: "[name].js", + }, + { + sourcemap: true, + dir: "dist/cjs", + format: "cjs", + entryFileNames: "[name].cjs", + }, + ], + }, + ]; +} diff --git a/packages/cheqd-blockchain-modules/src/attest/internal.js b/packages/cheqd-blockchain-modules/src/attest/internal.js new file mode 100644 index 000000000..59a63fa2e --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/attest/internal.js @@ -0,0 +1,52 @@ +import { CheqdDid, Iri } from '@docknetwork/credential-sdk/types'; +import { TypedUUID, option } from '@docknetwork/credential-sdk/types/generic'; +import { CheqdCreateResource, createInternalCheqdModule } from '../common'; + +const methods = { + setClaim: (iri, targetDid) => new CheqdCreateResource( + targetDid.value, + TypedUUID.random(), + '1.0', + [], + 'Attestation', + 'attest', + Iri.from(iri), + ), +}; + +export default class CheqdInternalAttestModule extends createInternalCheqdModule( + methods, +) { + static Prop = 'resource'; + + static MsgNames = { + setClaim: 'MsgCreateResource', + }; + + async attest(did, attestId) { + const stringDid = CheqdDid.from(did).toEncodedString(); + const stringAttestId = String(TypedUUID.from(attestId)); + const item = await this.query.resource(stringDid, stringAttestId); + + return option(Iri).from(item?.resource?.data); + } + + async attestId(did) { + let resources = []; + let paginationKey; + + do { + // eslint-disable-next-line no-await-in-loop + const res = await this.query.collectionResources( + CheqdDid.from(did).toEncodedString(), + paginationKey, + ); + resources = resources.concat( + res.resources.filter((resource) => resource.resourceType === 'attest'), + ); + ({ paginationKey } = res); + } while (!resources.length && paginationKey != null); + + return resources.find((resource) => !resource.nextVersionId)?.id; + } +} diff --git a/packages/cheqd-blockchain-modules/src/attest/module.js b/packages/cheqd-blockchain-modules/src/attest/module.js new file mode 100644 index 000000000..d4c5d655c --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/attest/module.js @@ -0,0 +1,34 @@ +import AbstractAttestModule from '@docknetwork/credential-sdk/modules/attest/module'; +import { injectCheqd } from '../common'; +import CheqdInternalAttestModule from './internal'; + +export default class CheqdAttestModule extends injectCheqd( + AbstractAttestModule, +) { + static CheqdOnly = CheqdInternalAttestModule; + + /** + * Fetches the DIDs attestations IRI from the chain + * @param {*} did + * @return {Promise} The DID's attestation, if any + */ + async getAttests(did) { + const id = await this.cheqdOnly.attestId(did); + if (id == null) { + return null; + } + + return await this.cheqdOnly.attest(did, id); + } + + /** + * Creates an attestation claim on chain for a specific DID + * @param iri + * @param did + * @param signingKeyRef + * @param params + */ + async setClaimTx(iri, targetDid, didKeypair) { + return await this.cheqdOnly.tx.setClaim(iri, targetDid, didKeypair); + } +} diff --git a/packages/cheqd-blockchain-modules/src/common/builders.js b/packages/cheqd-blockchain-modules/src/common/builders.js new file mode 100644 index 000000000..d5e3c187f --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/common/builders.js @@ -0,0 +1,132 @@ +import { VerificationMethodSignature } from '@docknetwork/credential-sdk/types'; +import { CheqdPayloadWithTypeUrl } from './payload'; + +/** + * Creates DID method transaction builder. + */ +export const createDIDMethodTx = (fnName) => { + const obj = { + async [fnName](...args) { + const { root } = this; + + const [didKeypairs] = args.slice(-1); + + const payload = root.payload[fnName].apply(this.root, args); + const bytes = await root.apiProvider.stateChangeBytes( + root.constructor.MsgNames[fnName], + payload, + ); + + const signatures = [] + .concat(didKeypairs) + .map((didKeypair) => VerificationMethodSignature.fromDidKeypair(didKeypair, bytes)); + + const value = { + payload, + signatures, + }; + + return new CheqdPayloadWithTypeUrl( + root.constructor.MsgNames[fnName], + value, + ); + }, + }; + + return obj[fnName]; +}; + +/** + * Creates a call. + */ +export const createCall = (fnName) => { + const obj = { + async [fnName](...args) { + const { root } = this; + const tx = await root.tx[fnName]( + ...args.slice(0, root.payload[fnName].length), + ); + + return await root.signAndSend(tx, args[root.payload[fnName].length]); + }, + }; + + return obj[fnName]; +}; + +/** + * Creates a transaction builder for account method with the given name. + */ +export const createAccountTx = (fnName) => { + const obj = { + async [fnName](...args) { + return await this.root.rawTx[fnName]( + ...this.root.payload[fnName].apply(this.root, args), + ); + }, + }; + + return obj[fnName]; +}; + +class Root { + constructor(root) { + this.root = root; + } +} + +export function createInternalCheqdModule( + methods = Object.create(null), + baseClass = class CheqdModuleBaseClass {}, +) { + const name = `internalCheqdModule(${baseClass.name})`; + class RootPayload extends (baseClass.RootPayload ?? Root) {} + class RootModule extends (baseClass.RootModule ?? Root) {} + class RootSender extends (baseClass.RootSender ?? Root) {} + + const obj = { + [name]: class extends baseClass { + static Prop; + + static RootPayload = RootPayload; + + static RootModule = RootModule; + + static RootSender = RootSender; + + constructor(apiProvider) { + super(apiProvider); + + this.apiProvider = apiProvider; + } + + get query() { + return this.apiProvider.sdk.querier[this.constructor.Prop]; + } + + get tx() { + return new RootModule(this); + } + + get send() { + return new RootSender(this); + } + + get payload() { + return new RootPayload(this); + } + + async signAndSend(extrinsic, params) { + return await this.apiProvider.signAndSend(extrinsic, params); + } + }, + }; + + for (const [key, payload] of Object.entries(methods)) { + RootPayload.prototype[key] = payload; + RootModule.prototype[key] = createDIDMethodTx(key); + RootSender.prototype[key] = createCall(key); + } + + return obj[name]; +} diff --git a/packages/cheqd-blockchain-modules/src/common/cheqd-api-provider.js b/packages/cheqd-blockchain-modules/src/common/cheqd-api-provider.js new file mode 100644 index 000000000..12a2b1408 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/common/cheqd-api-provider.js @@ -0,0 +1,27 @@ +import { ApiProvider } from '@docknetwork/credential-sdk/modules/common'; +import { ensureInstanceOf } from '@docknetwork/credential-sdk/utils/type-helpers'; + +class CheqdApiProvider extends ApiProvider { + constructor(cheqd) { + super(); + this.cheqd = ensureInstanceOf(cheqd, ApiProvider); + } + + get sdk() { + return this.cheqd.ensureInitialized().sdk; + } + + get fees() { + return this.cheqd.fees; + } + + async stateChangeBytes(name, payload) { + return await this.cheqd.stateChangeBytes(name, payload); + } + + async signAndSend(transaction, params) { + return await this.cheqd.signAndSend(transaction, params); + } +} + +export default CheqdApiProvider; diff --git a/packages/cheqd-blockchain-modules/src/common/index.js b/packages/cheqd-blockchain-modules/src/common/index.js new file mode 100644 index 000000000..eaf357e89 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/common/index.js @@ -0,0 +1,4 @@ +export * from './builders'; +export * from './payload'; +export { default as injectCheqd } from './inject-cheqd'; +export { default as CheqdApiProvider } from './cheqd-api-provider'; diff --git a/packages/cheqd-blockchain-modules/src/common/inject-cheqd.js b/packages/cheqd-blockchain-modules/src/common/inject-cheqd.js new file mode 100644 index 000000000..035b53f59 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/common/inject-cheqd.js @@ -0,0 +1,28 @@ +import { withExtendedStaticProperties } from '@docknetwork/credential-sdk/utils/inheritance'; +import CheqdAPIProvider from './cheqd-api-provider'; + +export default function injectDock(klass) { + const name = `withCheqd(${klass.name})`; + + const obj = { + [name]: class extends klass { + /** + * Associated class which's only available when interacting with the dock blockchain. + * Instance of this class is assigned to `cheqdOnly` property of the object. + */ + static CheqdOnly; + + static ApiProvider = CheqdAPIProvider; + + constructor(dock) { + const apiProvider = new CheqdAPIProvider(dock); + + super(apiProvider); + + this.cheqdOnly = new this.constructor.CheqdOnly(apiProvider); + } + }, + }; + + return withExtendedStaticProperties(['CheqdOnly'], obj[name]); +} diff --git a/packages/cheqd-blockchain-modules/src/common/payload.js b/packages/cheqd-blockchain-modules/src/common/payload.js new file mode 100644 index 000000000..c72300855 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/common/payload.js @@ -0,0 +1,42 @@ +import { + VerificationMethodSignature, + CheqdDid, +} from '@docknetwork/credential-sdk/types'; +import { + Any, + TypedArray, + TypedString, + TypedStruct, + TypedBytesArray, + TypedUUID, +} from '@docknetwork/credential-sdk/types/generic'; + +export class CheqdPayloadAndSignatures extends TypedStruct { + static Classes = { + payload: Any, + signatures: class Signatures extends TypedArray { + static Class = VerificationMethodSignature; + }, + }; +} + +export class CheqdPayloadWithTypeUrl extends TypedStruct { + static Classes = { + typeUrl: TypedString, + value: CheqdPayloadAndSignatures, + }; +} + +export class CheqdCreateResource extends TypedStruct { + static Classes = { + collectionId: TypedUUID, + id: class ResourceId extends TypedUUID {}, + version: class Version extends TypedString {}, + alsoKnownAs: class AlsoKnownAs extends TypedArray { + static Class = CheqdDid; + }, + name: class Name extends TypedString {}, + resourceType: class ResourceType extends TypedString {}, + data: class Data extends TypedBytesArray {}, + }; +} diff --git a/packages/cheqd-blockchain-modules/src/did/internal.js b/packages/cheqd-blockchain-modules/src/did/internal.js new file mode 100644 index 000000000..122a63410 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/did/internal.js @@ -0,0 +1,36 @@ +import { CheqdDid } from '@docknetwork/credential-sdk/types/did/onchain/typed-did'; +import { + TypedUUID, + TypedStruct, +} from '@docknetwork/credential-sdk/types/generic'; +import { DIDDocument } from '@docknetwork/credential-sdk/types/did/document'; +import { createInternalCheqdModule } from '../common'; + +const parseDocument = (document) => DIDDocument.from(document).toCheqd(); + +class DeactivateDidDocument extends TypedStruct { + static Classes = { + id: CheqdDid, + versionId: TypedUUID, + }; +} + +const methods = { + createDidDocument: parseDocument, + updateDidDocument: parseDocument, + deactivateDidDocument: (id) => new DeactivateDidDocument(id, TypedUUID.random()), +}; + +export class CheqdDIDModuleInternal extends createInternalCheqdModule(methods) { + static Prop = 'did'; + + static MsgNames = { + createDidDocument: 'MsgCreateDidDoc', + updateDidDocument: 'MsgUpdateDidDoc', + deactivateDidDocument: 'MsgDeactivateDidDoc', + }; + + async getDidDocumentWithMetadata(did) { + return await this.query.didDoc(String(CheqdDid.from(did))); + } +} diff --git a/packages/cheqd-blockchain-modules/src/did/module.js b/packages/cheqd-blockchain-modules/src/did/module.js new file mode 100644 index 000000000..ffd8f34d2 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/did/module.js @@ -0,0 +1,79 @@ +import { + AbstractDIDModule, + NoDIDError, +} from '@docknetwork/credential-sdk/modules/did'; +import { + CheqdDIDDocument, + CheqdDid, +} from '@docknetwork/credential-sdk/types/did'; +import { DIDDocument } from '@docknetwork/credential-sdk/types'; +import { CheqdDIDModuleInternal } from './internal'; +import injectCheqd from '../common/inject-cheqd'; +import CheqdAttestModule from '../attest/module'; + +export default class CheqdDIDModule extends injectCheqd(AbstractDIDModule) { + static CheqdOnly = CheqdDIDModuleInternal; + + constructor(...args) { + super(...args); + + this.attest = new CheqdAttestModule(...args); + } + + async createDocumentTx(document, didSigners) { + const didDocument = DIDDocument.from(document); + if (didDocument.attests != null) { + throw new Error( + `Non-null \`attest\` was provided for DID document \`${didDocument.id}\`. Use \`attest\` module to set attestations.`, + ); + } + + return await this.cheqdOnly.tx.createDidDocument(didDocument, didSigners); + } + + async updateDocumentTx(document, didSigners) { + const didDocument = DIDDocument.from(document); + if (didDocument.attests != null) { + throw new Error( + `Non-null \`attest\` was provided for DID document \`${didDocument.id}\`. Use \`attest\` module to set attestations.`, + ); + } + + return await this.cheqdOnly.tx.updateDidDocument(didDocument, didSigners); + } + + async removeDocumentTx(document, didSigners) { + return await this.cheqdOnly.tx.deactivateDidDocument(document, didSigners); + } + + /** + * Gets a DID from the Cheqd chain and create a DID document according to W3C spec. + * Throws NoDID if the DID does not exist on chain. + * @param {CheqdDid} did - The DID can be passed as fully qualified DID like `did:cheqd:UUID` + * @return {Promise} The DID document. + */ + async getDocument(did) { + const cheqdDid = CheqdDid.from(did); + + let doc = null; + try { + const { didDoc, metadata } = await this.cheqdOnly.getDidDocumentWithMetadata(cheqdDid); + + if (!metadata.deactivated) { + doc = didDoc; + } + } catch (err) { + if (!String(err).includes(String(cheqdDid))) { + throw err; + } + } + if (doc == null) { + throw new NoDIDError(cheqdDid); + } + + const document = CheqdDIDDocument.from(doc).toDIDDocument(); + const attests = await this.attest.getAttests(did); + + return document.setAttests(attests); + } +} diff --git a/packages/cheqd-blockchain-modules/src/index.js b/packages/cheqd-blockchain-modules/src/index.js new file mode 100644 index 000000000..1032f97b1 --- /dev/null +++ b/packages/cheqd-blockchain-modules/src/index.js @@ -0,0 +1,50 @@ +import { AbstractCoreModules } from '@docknetwork/credential-sdk/modules'; +import CheqdAttestModule from './attest/module'; +import CheqdDIDModule from './did/module'; +// import CheqdAccumulatorModule from './accumulator/module'; +// import CheqdAnchorModule from './anchor/module'; +// import CheqdBlobModule from './blob/module'; +// import CheqdOffchainSignaturesModule from './offchain-signatures/module'; +// import CheqdBBSModule from './offchain-signatures/bbs'; +// import CheqdBBSPlusModule from './offchain-signatures/bbs-plus'; +// import CheqdPSModule from './offchain-signatures/ps'; +// import CheqdStatusListCredentialModule from './status-list-credential/module'; +// import CheqdTrustRegistryModule from './trust-registry/module'; + +export class CheqdCoreModules extends AbstractCoreModules { + // static AccumulatorModule = CheqdAccumulatorModule; + + // static AnchorModule = CheqdAnchorModule; + + static AttestModule = CheqdAttestModule; + + // static BlobModule = CheqdBlobModule; + + static DIDModule = CheqdDIDModule; + + // static OffchainSignaturesModule = CheqdOffchainSignaturesModule; + + // static BBSModule = CheqdBBSModule; + + // static BBSPlusModule = CheqdBBSPlusModule; + + // static PSModule = CheqdPSModule; + + // static StatusListCredentialModule = CheqdStatusListCredentialModule; + + // static TrustRegistryModule = CheqdTrustRegistryModule; +} + +export { + CheqdAttestModule, + CheqdDIDModule, + // CheqdAccumulatorModule, + // CheqdAnchorModule, + // CheqdBlobModule, + // CheqdOffchainSignaturesModule, + // CheqdBBSModule, + // CheqdBBSPlusModule, + // CheqdPSModule, + // CheqdStatusListCredentialModule, + // CheqdTrustRegistryModule, +}; diff --git a/packages/cheqd-blockchain-modules/tests/attest.test.js b/packages/cheqd-blockchain-modules/tests/attest.test.js new file mode 100644 index 000000000..a2537edff --- /dev/null +++ b/packages/cheqd-blockchain-modules/tests/attest.test.js @@ -0,0 +1,63 @@ +import { + DidKeypair, + Ed25519Keypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { CheqdAPI } from "@docknetwork/cheqd-blockchain-api"; +import { timeout } from "@docknetwork/credential-sdk/utils"; +import { + DIDDocument, + CheqdTestnetDid, +} from "@docknetwork/credential-sdk/types"; +import CheqdDIDModule from "../src/did/module"; +import { faucet } from "./constants"; +import CheqdAttestModule from "../src/attest/module"; + +describe("DIDModule", () => { + const cheqd = new CheqdAPI(); + const didModule = new CheqdDIDModule(cheqd); + const attestModule = new CheqdAttestModule(cheqd); + + beforeAll(async () => { + await cheqd.init({ + url: process.env.ENDPOINT_URL || "http://localhost:26657", + mnemonic: faucet.mnemonic, + }); + }); + + afterAll(async () => { + await cheqd.disconnect(); + }); + + it("Generates a `DIDDocument` and appends an attestation to it", async () => { + const did = CheqdTestnetDid.random(); + + const keyPair = Ed25519Keypair.random(); + const didKeypair = new DidKeypair([did, 1], keyPair); + + const document = DIDDocument.create(did, [didKeypair.didKey()]); + + await didModule.createDocument(document, didKeypair); + + expect((await didModule.getDocument(did)).toJSON()).toEqual( + document.toJSON() + ); + + const iri = "some iri"; + await attestModule.setClaim(iri, did, didKeypair); + + expect((await attestModule.getAttests(did)).toString()).toBe(iri); + document.setAttests(iri); + expect((await didModule.getDocument(did)).toJSON()).toEqual( + document.toJSON() + ); + + const iri2 = "other iri"; + await attestModule.setClaim(iri2, did, didKeypair); + await timeout(500); + expect((await attestModule.getAttests(did)).toString()).toBe(iri2); + document.setAttests(iri2); + expect((await didModule.getDocument(did)).toJSON()).toEqual( + document.toJSON() + ); + }); +}); diff --git a/packages/cheqd-blockchain-modules/tests/constants.js b/packages/cheqd-blockchain-modules/tests/constants.js new file mode 100644 index 000000000..396b65b55 --- /dev/null +++ b/packages/cheqd-blockchain-modules/tests/constants.js @@ -0,0 +1,7 @@ +export const faucet = { + prefix: "cheqd", + minimalDenom: "ncheq", + mnemonic: + "steak come surprise obvious remain black trouble measure design volume retreat float coach amused match album moment radio stuff crack orphan ranch dose endorse", + address: "cheqd1fgl67nvjdkrnaemjzg5sqvck9fcst4vt99gmma", +}; diff --git a/packages/cheqd-blockchain-modules/tests/did-module.test.js b/packages/cheqd-blockchain-modules/tests/did-module.test.js new file mode 100644 index 000000000..14ba87f01 --- /dev/null +++ b/packages/cheqd-blockchain-modules/tests/did-module.test.js @@ -0,0 +1,168 @@ +import { + DidKeypair, + Ed25519Keypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { CheqdAPI } from "@docknetwork/cheqd-blockchain-api"; +import CheqdDIDModule from "../src/did/module"; +import { faucet } from "./constants"; +import { + DIDDocument, + BBSPublicKeyValue, + DidKey, + BBSPlusPublicKeyValue, + PSPublicKeyValue, + VerificationMethodRef, + CheqdTestnetDid, +} from "@docknetwork/credential-sdk/types"; +import { TypedBytes } from "@docknetwork/credential-sdk/types/generic"; +import { ServiceEndpoint } from "@docknetwork/credential-sdk/types/did/offchain"; +import { NoDIDError } from "@docknetwork/credential-sdk/modules/did"; + +describe("DIDModule", () => { + const cheqd = new CheqdAPI(); + const module = new CheqdDIDModule(cheqd); + + beforeAll(async () => { + await cheqd.init({ + url: process.env.ENDPOINT_URL || "http://localhost:26657", + mnemonic: faucet.mnemonic, + }); + }); + + afterAll(async () => { + await cheqd.disconnect(); + }); + + it("Creates basic `DIDDocument` with keys", async () => { + const did = CheqdTestnetDid.random(); + + const keyPair = Ed25519Keypair.random(); + const didKeypair = new DidKeypair([did, 1], keyPair); + + const document = DIDDocument.create(did, [didKeypair.didKey()]); + + await module.createDocument(document, didKeypair); + + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + }); + + it("Operates with `DIDDocument` containing BBS/BBSPlus/PS keys", async () => { + const did = CheqdTestnetDid.random(); + + const keyPair = Ed25519Keypair.random(); + const didKeypair = new DidKeypair([did, 1], keyPair); + + const bbsKey = new BBSPublicKeyValue(TypedBytes.random(100)); + const bbsPlusKey = new BBSPlusPublicKeyValue(TypedBytes.random(100)); + const psKey = new PSPublicKeyValue(TypedBytes.random(1000)); + + const document = DIDDocument.create(did, [ + didKeypair.didKey(), + new DidKey(bbsKey), + new DidKey(bbsPlusKey), + new DidKey(psKey), + ]); + + await module.createDocument(document, didKeypair); + + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + document.removeKey([did, 3]); + + await module.updateDocument(document, didKeypair); + + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + expect(document.didKeys().toJSON()).toEqual([ + [didKeypair.verificationMethodId.toJSON(), didKeypair.didKey().toJSON()], + [new VerificationMethodRef(did, 2).toJSON(), new DidKey(bbsKey).toJSON()], + [new VerificationMethodRef(did, 4).toJSON(), new DidKey(psKey).toJSON()], + ]); + }); + + it("Operates with `DIDDocument` containing services", async () => { + const did = CheqdTestnetDid.random(); + + const keyPair = Ed25519Keypair.random(); + const didKeypair = new DidKeypair([did, 1], keyPair); + + const service1 = new ServiceEndpoint("LinkedDomains", [ + "ServiceEndpoint#1", + ]); + const service2 = new ServiceEndpoint("LinkedDomains", [ + "ServiceEndpoint#2", + ]); + + const document = DIDDocument.create(did, [didKeypair.didKey()], [did], { + service1, + service2, + }); + + await module.createDocument(document, didKeypair); + + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + document.removeServiceEndpoint([did, "service2"]); + + await module.updateDocument(document, didKeypair); + + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + expect(document.service.length).toEqual(1); + }); + + it("Updates `DIDDocument`'s keys", async () => { + const did = CheqdTestnetDid.random(); + + const keyPair1 = Ed25519Keypair.random(); + const keyPair2 = Ed25519Keypair.random(); + const keyPair3 = Ed25519Keypair.random(); + + const didKeypair1 = new DidKeypair([did, 1], keyPair1); + const didKeypair2 = new DidKeypair([did, 2], keyPair2); + const didKeypair3 = new DidKeypair([did, 3], keyPair3); + + const document = DIDDocument.create(did, [ + didKeypair1.didKey(), + didKeypair2.didKey(), + ]); + + await module.createDocument(document, didKeypair2); + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + document.removeKey([did, 2]); + await module.updateDocument(document, didKeypair1); + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + await expect(() => + module.updateDocument(document, didKeypair2) + ).rejects.toThrow(); + + document.addKey([did, 3], didKeypair3.didKey()); + await module.updateDocument(document, didKeypair1); + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + }); + + it("Deactivates `DIDDocument`", async () => { + const did = CheqdTestnetDid.random(); + + const keyPair = Ed25519Keypair.random(); + const didKeypair = new DidKeypair([did, 1], keyPair); + + const document = DIDDocument.create(did, [didKeypair.didKey()]); + + await module.createDocument(document, didKeypair); + expect( + (await module.cheqdOnly.getDidDocumentWithMetadata(did)).metadata + .deactivated + ).toBe(false); + expect((await module.getDocument(did)).toJSON()).toEqual(document.toJSON()); + + await module.removeDocument(did, didKeypair); + expect( + (await module.cheqdOnly.getDidDocumentWithMetadata(did)).metadata + .deactivated + ).toBe(true); + expect(() => module.getDocument(did)).rejects.toThrow(new NoDIDError(did)); + }); +}); diff --git a/tests/test-environment.js b/packages/cheqd-blockchain-modules/tests/test-environment.js similarity index 72% rename from tests/test-environment.js rename to packages/cheqd-blockchain-modules/tests/test-environment.js index 7e991326f..21ed00ac3 100644 --- a/tests/test-environment.js +++ b/packages/cheqd-blockchain-modules/tests/test-environment.js @@ -1,4 +1,4 @@ -const NodeEnvironment = require('jest-environment-node').TestEnvironment; +import { TestEnvironment as NodeEnvironment } from "jest-environment-node"; class MyEnvironment extends NodeEnvironment { constructor(config, context) { @@ -12,10 +12,10 @@ class MyEnvironment extends NodeEnvironment { ArrayBuffer, TextDecoder, TextEncoder, - Buffer + Buffer, }, }, - context, + context ); } @@ -24,4 +24,4 @@ class MyEnvironment extends NodeEnvironment { async teardown() {} } -module.exports = MyEnvironment; +export default MyEnvironment; diff --git a/packages/credential-sdk/.npmignore b/packages/credential-sdk/.npmignore new file mode 100644 index 000000000..a35bd89d5 --- /dev/null +++ b/packages/credential-sdk/.npmignore @@ -0,0 +1,10 @@ +src/ +scripts/ +jest.config.js +rollup.config.mjs +out/ +node_modules/ +.vscode/ +.turbo/ +tests/ +*.log diff --git a/packages/credential-sdk/CHANGELOG.md b/packages/credential-sdk/CHANGELOG.md new file mode 100644 index 000000000..41cf41f80 --- /dev/null +++ b/packages/credential-sdk/CHANGELOG.md @@ -0,0 +1,7 @@ +# @docknetwork/credential-sdk + +## 0.1.1 + +### Minor Changes + +- Improved READMEs diff --git a/packages/credential-sdk/README.md b/packages/credential-sdk/README.md new file mode 100644 index 000000000..53ffd6f22 --- /dev/null +++ b/packages/credential-sdk/README.md @@ -0,0 +1,43 @@ +# @docknetwork/credential-sdk + +An API-agnostic Javascript library for working with Verifiable Credentials, DIDs, Claim Deduction and more. + +## Features + +- **Flexible Credential Issuance**: Issue verifiable credentials with customizable and embeddable JSON schema validators. + +- **DID Management**: Manage DIDs with support for various key types and update operations, including adding/removing keys, controllers, and service endpoints. + +- **Credential Verification**: Verify credentials using predefined or custom DID resolvers. + +- **Extensible DID Resolvers**: Support for universal, key, and network-specific DID resolvers, including Ethereum and Dock. + +- **Blockchain Interaction**: Seamlessly interact with the Dock blockchain for DID and credential management. + +## Installation + +You can install the `@docknetwork/credential-sdk` via npm: + +```bash +npm install @docknetwork/credential-sdk +``` + +Or via yarn: + +```bash +yarn add @docknetwork/credential-sdk +``` + +## Documentation + +Detailed documentation and API reference are provided at the [Dock Network Documentation](https://docs.dock.io) website. Please refer to this comprehensive resource for a deeper understanding of each module, its methods, and additional example codes. + +## Contribution + +Contributions to the @docknetwork/credential-sdk are welcome. Please feel free to open issues or submit pull requests to improve the SDK or add new features. + +## License + +This SDK is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. + +For any questions or issues, please refer to our [GitHub repository](https://github.com/docknetwork/credential-sdk) or [contact us](https://dock.io/contact). diff --git a/jest.config.js b/packages/credential-sdk/jest.config.js similarity index 53% rename from jest.config.js rename to packages/credential-sdk/jest.config.js index 813bd2a9a..40abd6c4d 100644 --- a/jest.config.js +++ b/packages/credential-sdk/jest.config.js @@ -1,9 +1,15 @@ -module.exports = { +export default { bail: true, + moduleNameMapper: {}, clearMocks: true, testTimeout: 30000, testEnvironment: "./tests/test-environment", - transformIgnorePatterns: ["/node_modules/(?!@polkadot|@babel|multiformats)"], + transform: { + "^.+\\.(ts|js)$": ["babel-jest", { rootMode: "upward" }], + }, + transformIgnorePatterns: [ + "/node_modules/(?!@polkadot|@babel|multiformats|@docknetwork|@stablelib)", + ], workerIdleMemoryLimit: "1G", verbose: true, globals: { diff --git a/packages/credential-sdk/package.json b/packages/credential-sdk/package.json new file mode 100644 index 000000000..09e717745 --- /dev/null +++ b/packages/credential-sdk/package.json @@ -0,0 +1,104 @@ +{ + "name": "@docknetwork/credential-sdk", + "version": "0.1.1", + "license": "MIT", + "type": "module", + "files": [ + "dist" + ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "default": "./dist/esm/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*", + "default": "./dist/esm/*" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/docknetwork/sdk" + }, + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@comunica/actor-init-sparql-rdfjs": "^1.22.3", + "@digitalcredentials/vc-status-list": "^8.0.0", + "@docknetwork/crypto-wasm-ts": "^0.63.0", + "@juanelas/base64": "^1.1.5", + "@stablelib/ed25519": "^2.0.0", + "@subsquid/ss58-codec": "latest", + "@transmute/json-web-signature": "^0.7.0-unstable.82", + "blakejs": "^1.2.1", + "bs58": "^5.0.0", + "deep-equal": "^2.2.3", + "elliptic": "^6.5.5", + "js-sha256": "^0.11.0", + "json-canonicalize": "1.0.4", + "json-stringify-deterministic": "^1.0.12", + "jsonld": "^5.0.0", + "jsonld-signatures": "^9.3.1", + "jsonschema": "1.4.1", + "key-did-resolver": "^1.4.0", + "mrklt": "^0.2.0", + "multiformats": "^9.5.4", + "n3": "^1.17.4", + "rify": "^0.7.1", + "semver": "^7.6.0", + "uuid": "^10.0.0", + "uuidv4": "^6.2.13", + "varint": "^6.0.0" + }, + "devDependencies": { + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.3", + "@babel/node": "^7.23.9", + "@babel/plugin-syntax-import-attributes": "^7.25.6", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.3", + "@helia/strings": "^3.0.5", + "@rollup/plugin-alias": "^4.0.2", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-wasm": "^5.1.0", + "@types/jest": "^29.5.12", + "aws-sdk": "^2.1057.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^29.7.0", + "eslint": "^8.0.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-sonarjs": "0.5.0", + "eslint-plugin-unused-imports": "^3.0.0", + "helia": "^4.2.5", + "jest": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jsdoc": "^3.6.3", + "jsdoc-typeof-plugin": "^1.0.0", + "rollup": "2.78.0", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-multi-input": "^1.3.2", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2" + }, + "scripts": { + "build": "rollup -c", + "test-ipfs": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=production jest --verbose --runInBand --forceExit ./tests/ipfs", + "test-ipfs-with-node": "../scripts/with_dock_docker_test_node yarn test-ipfs", + "test": "yarn jest --verbose ./tests", + "test-with-node": "../../scripts/with_dock_docker_test_node yarn test", + "test-with-all-nodes": "../../scripts/with_all_dock_docker_test_nodes yarn test-integration", + "lint": "eslint \"src/**/*.js\"", + "lint-scripts": "eslint \"scripts/**/*.js\"", + "lint-tests": "eslint \"{tests/unit,tests/integration}/**/*.js\"", + "docs": "rm -rf out && mkdir out && touch out/.nojekyll && jsdoc src -r -c ../../.jsdoc -d out/reference", + "prepublishOnly": "yarn build" + } +} diff --git a/packages/credential-sdk/rollup.config.mjs b/packages/credential-sdk/rollup.config.mjs new file mode 100644 index 000000000..cad8cbf4b --- /dev/null +++ b/packages/credential-sdk/rollup.config.mjs @@ -0,0 +1,37 @@ +import json from "@rollup/plugin-json"; +import multiInput from "rollup-plugin-multi-input"; +import commonjs from "@rollup/plugin-commonjs"; + +export default async function () { + return [ + { + plugins: [ + multiInput(), + json(), + // terser(), + commonjs(), + // Temporarily disabled, not sure if required + // since rify is a node module doesnt seem to work + // but would be nice to try embed it + // wasm({ + // sync: ['*.wasm'], + // }), + ], + input: ["src/**/*.js"], + output: [ + { + sourcemap: true, + dir: "dist/esm", + format: "esm", + entryFileNames: "[name].js", + }, + { + sourcemap: true, + dir: "dist/cjs", + format: "cjs", + entryFileNames: "[name].cjs", + }, + ], + }, + ]; +} diff --git a/packages/credential-sdk/src/crypto/index.js b/packages/credential-sdk/src/crypto/index.js new file mode 100644 index 000000000..9901d0768 --- /dev/null +++ b/packages/credential-sdk/src/crypto/index.js @@ -0,0 +1 @@ +export * from '@docknetwork/crypto-wasm-ts'; diff --git a/packages/credential-sdk/src/keypairs/did-keypair.js b/packages/credential-sdk/src/keypairs/did-keypair.js new file mode 100644 index 000000000..b45d6d967 --- /dev/null +++ b/packages/credential-sdk/src/keypairs/did-keypair.js @@ -0,0 +1,84 @@ +import DockKeypair from './keypair'; +import { DidKey } from '../types/did/onchain/did-key'; +import { VerificationMethodRefOrIdentRef } from '../types/did/document'; +import { ensureInstanceOf } from '../utils'; +import { DidMethodKey } from '../types/did/onchain/typed-did'; + +/** + * A class representation of DID Keypair which includes a signing keypair and its associated verification method reference identifier. + */ +export default class DidKeypair { + /** + * Constructs a `DidKeypair` instance from the supplied keypair. + * + * @param {VerificationMethodRef} keyRef - The reference of the verification method. + * @param {DockKeypair} keyPair - Key pair provided. + */ + constructor(keyRef, keyPair) { + const ref = VerificationMethodRefOrIdentRef.from(keyRef); + + ensureInstanceOf(keyPair, DockKeypair); + + this.verificationMethodId = ref; + this.keyPair = keyPair; + } + + /** + * Static function to create a `DidKeypair` instance from the provided keyPair. + * + * @param {DockKeypair} keyPair - Key pair provided. + * @return The new instance of `DidKeypair`. + */ + static didMethodKey(keyPair) { + const did = DidMethodKey.fromKeypair(keyPair); + + return new this([did, did.asDidMethodKey.toEncodedString()], keyPair); + } + + /** + * Get the public key from the current key pair. + * + * @return The public key. + */ + publicKey() { + return this.keyPair.publicKey(); + } + + /** + * Creates a new `DidKey` instance from the public key of the current key pair. + * + * @param {Array} verRels - Array of verification relationships. + * @return The new instance of `DidKey`. + */ + didKey(verRels) { + return new DidKey(this.keyPair.publicKey(), verRels); + } + + /** + * Get the DID from the current verification method ID. + * + * @return The DID. + */ + get did() { + return this.verificationMethodId[0]; + } + + /** + * Get the Key ID from the current verification method ID. + * + * @return The Key ID. + */ + get keyId() { + return this.verificationMethodId[1]; + } + + /** + * Sign the provided message with the key pair. + * + * @param {Uint8Array} message - The message to sign. + * @return The signature. + */ + sign(message) { + return this.keyPair.sign(message); + } +} diff --git a/packages/credential-sdk/src/keypairs/index.js b/packages/credential-sdk/src/keypairs/index.js new file mode 100644 index 000000000..9bd253c76 --- /dev/null +++ b/packages/credential-sdk/src/keypairs/index.js @@ -0,0 +1,4 @@ +export { default as DockKeypair } from './keypair'; +export { default as Ed25519Keypair } from './keypair-ed25519'; +export { default as Secp256k1Keypair } from './keypair-secp256k1'; +export { default as DidKeypair } from './did-keypair'; diff --git a/packages/credential-sdk/src/keypairs/keypair-ed25519.js b/packages/credential-sdk/src/keypairs/keypair-ed25519.js new file mode 100644 index 000000000..b0de2d22e --- /dev/null +++ b/packages/credential-sdk/src/keypairs/keypair-ed25519.js @@ -0,0 +1,33 @@ +import { generateKeyPairFromSeed, sign, verify } from '@stablelib/ed25519'; +import { SignatureEd25519 } from '../types/signatures'; +import { Ed25519VerKeyName } from '../vc/crypto/constants'; +import { normalizeToU8a, valueBytes } from '../utils'; +import DockKeypair from './keypair'; + +export default class Ed25519Keypair extends DockKeypair { + static Signature = SignatureEd25519; + + static VerKeyType = Ed25519VerKeyName; + + static SeedSize = 32; + + constructor(seed) { + super(generateKeyPairFromSeed(normalizeToU8a(seed))); + } + + _publicKey() { + return this.keyPair.publicKey; + } + + privateKey() { + return this.keyPair.secretKey; + } + + _sign(message) { + return sign(this.keyPair.secretKey, message); + } + + static verify(message, signature, publicKey) { + return verify(valueBytes(publicKey), message, valueBytes(signature)); + } +} diff --git a/packages/credential-sdk/src/keypairs/keypair-secp256k1.js b/packages/credential-sdk/src/keypairs/keypair-secp256k1.js new file mode 100644 index 000000000..1e6008523 --- /dev/null +++ b/packages/credential-sdk/src/keypairs/keypair-secp256k1.js @@ -0,0 +1,66 @@ +import elliptic from 'elliptic'; +import { sha256 } from 'js-sha256'; + +import { SignatureSecp256k1 } from '../types/signatures'; +import { EcdsaSecp256k1VerKeyName } from '../vc/crypto/constants'; +import DockKeypair from './keypair'; +import { hexToU8a, valueBytes } from '../utils'; + +const EC = elliptic.ec; +const secp256k1Curve = new EC('secp256k1'); + +export default class Secp256k1Keypair extends DockKeypair { + static Signature = SignatureSecp256k1; + + static VerKeyType = EcdsaSecp256k1VerKeyName; + + static SeedSize = 32; + + constructor(entropy) { + if (entropy == null) { + throw new Error('Entropy must be provided'); + } + + super( + secp256k1Curve.genKeyPair({ + entropy, + }), + ); + } + + _publicKey() { + // public key is in hex but doesn't contain a leading zero + return hexToU8a(`0x${this.keyPair.getPublic(true, 'hex')}`); + } + + privateKey() { + return hexToU8a(`0x${this.keyPair.getPrivate(true, 'hex')}`); + } + + _sign(message) { + const hash = this.constructor.hash(message); + const sig = this.keyPair.sign(hash, { + canonical: true, + }); + + // The signature is recoverable in 65-byte { R | S | index } format + const r = sig.r.toString('hex', 32); + const s = sig.s.toString('hex', 32); + const i = sig.recoveryParam.toString(16).padStart(2, '0'); + + // Make it proper hex + return hexToU8a(`0x${r}${s}${i}`); + } + + static hash(message) { + return sha256.digest(message); + } + + static verify(message, signature, publicKey) { + return secp256k1Curve.verify( + this.hash(message), + valueBytes(signature), + valueBytes(publicKey), + ); + } +} diff --git a/packages/credential-sdk/src/keypairs/keypair.js b/packages/credential-sdk/src/keypairs/keypair.js new file mode 100644 index 000000000..f9a83e35b --- /dev/null +++ b/packages/credential-sdk/src/keypairs/keypair.js @@ -0,0 +1,93 @@ +import { + withExtendedPrototypeProperties, + withExtendedStaticProperties, +} from '../utils'; +import { randomAsHex } from '../utils/bytes'; + +/** + * Wrapped keypair used to sign byte sequences of arbitrary size. + */ +class DockKeypair { + /** + * Wraps supplied keypair into a `DockKeypair`. + * + * @param {*} keyPair + */ + constructor(keyPair) { + this.keyPair = keyPair; + } + + /** + * Generates random `DockKeypair`. + * @returns {} + */ + static random() { + return new this(randomAsHex(this.SeedSize)); + } + + /** + * Returns underlying verification key type. + */ + get verKeyType() { + return this.constructor.VerKeyType; + } + + /** + * Returns underlying public key. + */ + publicKey() { + // eslint-disable-next-line no-underscore-dangle + return new this.constructor.Signature.PublicKey(this._publicKey()); + } + + /** + * Returns underlying private key. + */ + privateKey() { + throw new Error('Unimplemented'); + } + + /** + * Signs supplied message using underlying keypair. + * @param {*} message + */ + sign(message) { + // eslint-disable-next-line no-underscore-dangle + return new this.constructor.Signature(this._sign(message)); + } + + /** + * Returns raw bytes of the underlying public key. + * @returns {Uint8Array} + */ + _publicKey() { + throw new Error('Unimplemented'); + } + + /** + * Signs supplied message and returns raw signature bytes. + * @returns {Uint8Array} + */ + _sign(_message) { + throw new Error('Unimplemented'); + } + + /** + * Verifies signature produced over supplied message's using given public key. + * @param {Uint8Array} _message + * @param {Uint8Array | Signature} _signature + * @param {Uint8Array | PublicKey} _publicKey + * @returns {boolean} + */ + static verify(_message, _signature, _publicKey) { + throw new Error('Unimplemented'); + } +} + +export default withExtendedPrototypeProperties( + ['privateKey', '_publicKey', '_sign'], + withExtendedStaticProperties( + ['Signature', 'VerKeyType', 'SeedSize', 'verify'], + DockKeypair, + ), +); diff --git a/packages/credential-sdk/src/modules/accumulator/index.js b/packages/credential-sdk/src/modules/accumulator/index.js new file mode 100644 index 000000000..c8f01c474 --- /dev/null +++ b/packages/credential-sdk/src/modules/accumulator/index.js @@ -0,0 +1,2 @@ +export { default as AbstractAccumulatorModule } from './module'; +export * from './module'; diff --git a/packages/credential-sdk/src/modules/accumulator/module.js b/packages/credential-sdk/src/modules/accumulator/module.js new file mode 100644 index 000000000..043d76114 --- /dev/null +++ b/packages/credential-sdk/src/modules/accumulator/module.js @@ -0,0 +1,250 @@ +/* eslint-disable camelcase */ + +import { KBUniversalAccumulatorValue } from '@docknetwork/crypto-wasm-ts'; +import { normalizeToHex, normalizeToU8a } from '../../utils/bytes'; +import { AbstractWithParamsAndPublicKeys } from '../common'; +import { AccumulatorParams, AccumulatorPublicKey } from '../../types'; +import { withExtendedPrototypeProperties } from '../../utils'; + +export const AccumulatorType = { + VBPos: 0, + VBUni: 1, + KBUni: 2, +}; + +/** Class to manage accumulators on chain */ +class AbstractAccumulatorModule extends AbstractWithParamsAndPublicKeys { + static Params = AccumulatorParams; + + static PublicKey = AccumulatorPublicKey; + + /** + * Return the accumulated value as hex + * @param accumulated {Uint8Array|KBUniversalAccumulatorValue} + * @param typ {number} - Type of the accumulator + * @returns {string} + */ + static accumulatedAsHex(accumulated, typ = AccumulatorType.VBPos) { + if (typ === AccumulatorType.VBPos || typ === AccumulatorType.VBUni) { + return normalizeToHex(accumulated); + } else if (typ === AccumulatorType.KBUni) { + return normalizeToHex(accumulated.toBytes()); + } else { + throw new Error(`Unknown accumulator type ${typ}`); + } + } + + /** + * Parse the given accumulated value in hex form + * @param accumulated {string} + * @param typ {number} - Type of the accumulator + * @returns {Uint8Array|KBUniversalAccumulatorValue} + */ + static accumulatedFromHex(accumulated, typ = AccumulatorType.VBPos) { + if (typ === AccumulatorType.VBPos || typ === AccumulatorType.VBUni) { + return normalizeToU8a(accumulated); + } else if (typ === AccumulatorType.KBUni) { + return KBUniversalAccumulatorValue.fromBytes(normalizeToU8a(accumulated)); + } else { + throw new Error(`Unknown accumulator type ${typ}`); + } + } + + async addPublicKey(id, publicKey, targetDid, didKeypair, params) { + return await super.addPublicKey( + id, + publicKey, + targetDid, + didKeypair, + params, + ); + } + + /** + * Remove public key + * @param removeKeyId - The key index for key to remove. + * @param targetDid - The DID from which key is being removed + * @param signerDid - The DID that is removing the key by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's signing key reference + * @returns {Promise<*>} + */ + async removePublicKey(removeKeyId, targetDid, didKeypair, params) { + return await super.removePublicKey( + removeKeyId, + targetDid, + didKeypair, + params, + ); + } + + /** + * Add a positive (add-only) accumulator + * @param id - Unique accumulator id + * @param accumulated - Current accumulated value. + * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not + * have any public key on the chain. This is useful for KVAC. + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addPositiveAccumulator( + id, + accumulated, + publicKeyRef, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.addPositiveAccumulatorTx( + id, + accumulated, + publicKeyRef, + didKeypair, + ), + params, + ); + } + + /** + * Add universal (supports add/remove) accumulator + * @param id - Unique accumulator id + * @param accumulated - Current accumulated value. + * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not + * have any public key on the chain. This is useful for KVAC. + * @param maxSize - Maximum size of the accumulator + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addUniversalAccumulator( + id, + accumulated, + publicKeyRef, + maxSize, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.addUniversalAccumulatorTx( + id, + accumulated, + publicKeyRef, + maxSize, + didKeypair, + ), + params, + ); + } + + /** + * Add KB universal (supports add/remove) accumulator + * @param id - Unique accumulator id + * @param accumulated - Current accumulated value. + * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not + * have any public key on the chain. This is useful for KVAC. + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addKBUniversalAccumulator( + id, + accumulated, + publicKeyRef, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.addKBUniversalAccumulatorTx( + id, + accumulated, + publicKeyRef, + didKeypair, + ), + params, + ); + } + + /** + * Update existing accumulator + * @param id + * @param newAccumulated - Accumulated value after the update + * @param additions + * @param removals + * @param witnessUpdateInfo + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise< object>} + */ + async updateAccumulator( + id, + newAccumulated, + { additions, removals, witnessUpdateInfo }, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.updateAccumulatorTx( + id, + newAccumulated, + { + additions, + removals, + witnessUpdateInfo, + }, + didKeypair, + ), + params, + ); + } + + /** + * Remove the accumulator from chain. This frees up the id for reuse. + * @param id - id to remove + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async removeAccumulator(id, didKeypair, params) { + return await this.signAndSend( + await this.removeAccumulatorTx(id, didKeypair), + params, + ); + } + + /** + * Get the accumulator as an object. The field `type` in object specifies whether it is "positive" or "universal". + * Fields `created` and `lastModified` are block nos where the accumulator was created and last updated respectively. + * Field `nonce` is the last accepted nonce by the chain, the next write to the accumulator should increment the nonce by 1. + * Field `accumulated` contains the current accumulated value. + * @param id + * @param includeKey - Fetch public key for the given accumulator. + * @param includeKeyParams - Fetch public key params. + * @returns {Promise} + */ + async getAccumulator(id, _includeKey = false, _includeKeyParams = false) { + throw new Error('Unimplemented'); + } + + /** + * Update given witness by downloading necessary accumulators (blocks) and applying the updates if found. + * **Both `from` and `to` are inclusive.** + * + * @param accumulatorId + * @param member + * @param witness - this will be updated to the latest witness + * @param from - identifier to start from (block number or collection item id) + * @param to - identifier to end in (block number or collection item id) + * @returns {Promise} + */ + async updateWitness(_accumulatorId, _member, _witness, _from, _to) { + throw new Error('Unimplemented'); + } +} + +export default withExtendedPrototypeProperties( + [ + 'getAccumulator', + 'addPositiveAccumulatorTx', + 'addUniversalAccumulatorTx', + 'addKBUniversalAccumulatorTx', + 'updateAccumulatorTx', + 'removeAccumulatorTx', + 'updateWitness', + ], + AbstractAccumulatorModule, +); diff --git a/src/utils/errors/no-anchor-error.js b/packages/credential-sdk/src/modules/anchor/errors.js similarity index 77% rename from src/utils/errors/no-anchor-error.js rename to packages/credential-sdk/src/modules/anchor/errors.js index e38e0c5e2..9831cf73e 100644 --- a/src/utils/errors/no-anchor-error.js +++ b/packages/credential-sdk/src/modules/anchor/errors.js @@ -1,7 +1,7 @@ /** * Anchor wasn't found on chain */ -export default class NoAnchorError extends Error { +export class NoAnchorError extends Error { constructor(anchor) { super(`Anchor (${anchor}) does not exist`); this.name = 'NoAnchorError'; diff --git a/packages/credential-sdk/src/modules/anchor/index.js b/packages/credential-sdk/src/modules/anchor/index.js new file mode 100644 index 000000000..7a86bb2d1 --- /dev/null +++ b/packages/credential-sdk/src/modules/anchor/index.js @@ -0,0 +1,2 @@ +export { default as AbstractAnchorModule } from './module'; +export * from './errors'; diff --git a/packages/credential-sdk/src/modules/anchor/module.js b/packages/credential-sdk/src/modules/anchor/module.js new file mode 100644 index 000000000..888fd9bd2 --- /dev/null +++ b/packages/credential-sdk/src/modules/anchor/module.js @@ -0,0 +1,82 @@ +/* eslint-disable camelcase */ +import { construct, verify_proof } from 'mrklt'; +import { AbstractBaseModule } from '../common'; +import { Anchor } from '../../types/anchor'; +import { withExtendedPrototypeProperties } from '../../utils'; + +/** Class to create and query anchors from chain. */ +class AbstractAnchorModule extends AbstractBaseModule { + /** + * Write anchor on chain + * @param anchor + * @returns {Promise<*>} + */ + async deploy(anchor, params) { + return await this.signAndSend(await this.deployTx(anchor), params); + } + + /** + * Query anchor from chain + * @param {AnchorHash} anchor + * @param {boolean} preHashed - If the anchor has already been hashed. + * @returns {Promise} - The promise will either successfully resolve to the block number where anchor was created + * or reject with an error. + */ + async get(_anchorKey, _preHashed = false) { + throw new Error('Unimplemented'); + } + + /** + * Batch multiple documents in binary merkle tree and return the root and proofs for each document + * @param documents + * @returns {Array} - An 2 element array where 1st element is root and 2nd is an array with proofs for + * each document. + */ + static batchDocumentsInMerkleTree(documents) { + // Hash all documents + const leafHashes = documents.map((doc) => Anchor.hash(doc).bytes); + + // If only one document was hashed, just return that as the root with no proofs (single anchor) + if (leafHashes.length === 1) { + return [leafHashes[0], []]; + } + + // Concatenate all leaf hashes into one bytearray + const packed = new Uint8Array(leafHashes.map((a) => [...a]).flat()); + const [root, proofs] = construct(packed); + return [Uint8Array.from(root), proofs, leafHashes]; + } + + /** + * Verify inclusion proof of document in a merkle tree with given root. The document is hashed to form a leaf first + * @param document + * @param proof + * @param root + * @returns {boolean} + */ + static verifyMerkleProofOfDocument(document, proof, root) { + const hash = Anchor.hash(document).bytes; + return this.verifyMerkleProofOfLeaf(hash, proof, root); + } + + /** + * Verify inclusion proof of leaf in a merkle tree with given root. + * @param leaf + * @param proof + * @param root + * @returns {boolean} + */ + static verifyMerkleProofOfLeaf(leaf, proof, root) { + /* eslint-disable camelcase */ + const calculatedRoot = verify_proof(leaf, proof); + return ( + calculatedRoot.length === root.length + && calculatedRoot.every((v, i) => v === root[i]) + ); + } +} + +export default withExtendedPrototypeProperties( + ['deployTx', 'get'], + AbstractAnchorModule, +); diff --git a/packages/credential-sdk/src/modules/attest/index.js b/packages/credential-sdk/src/modules/attest/index.js new file mode 100644 index 000000000..5fc445f7b --- /dev/null +++ b/packages/credential-sdk/src/modules/attest/index.js @@ -0,0 +1 @@ +export { default as AbstractAttestModule } from './module'; diff --git a/packages/credential-sdk/src/modules/attest/module.js b/packages/credential-sdk/src/modules/attest/module.js new file mode 100644 index 000000000..58d872181 --- /dev/null +++ b/packages/credential-sdk/src/modules/attest/module.js @@ -0,0 +1,42 @@ +import { withExtendedPrototypeProperties } from '../../utils'; +import { AbstractBaseModule } from '../common'; + +class AbstractAttestModule extends AbstractBaseModule { + /** + * Fetches the DIDs attestations IRI from the chain + * @param {*} did - DID + * @return {Promise} The DID's attestation + */ + async getAttests(_did) { + throw new Error('Unimplemented'); + } + + /** + * Creates an attestation claim on chain for a specific DID + * @param iri + * @param signerDid + * @param didKeypair + * @param params + */ + async setClaim(iri, targetDid, didKeypair, params) { + return await this.signAndSend( + await this.setClaimTx(iri, targetDid, didKeypair), + params, + ); + } + + /** + * Creates an attestation claim on chain for a specific DID + * @param iri + * @param targetDid + * @param didKeypair + */ + async setClaimTx(_iri, _targetDid, _didKeypair) { + throw new Error('Unimplemented'); + } +} + +export default withExtendedPrototypeProperties( + ['getAttests', 'setClaimTx'], + AbstractAttestModule, +); diff --git a/src/utils/errors/no-blob-error.js b/packages/credential-sdk/src/modules/blob/errors.js similarity index 84% rename from src/utils/errors/no-blob-error.js rename to packages/credential-sdk/src/modules/blob/errors.js index 21eec4a49..ee2dacdbe 100644 --- a/src/utils/errors/no-blob-error.js +++ b/packages/credential-sdk/src/modules/blob/errors.js @@ -2,7 +2,7 @@ * Error thrown when a Blob lookup was successful, but the Blob in question does not exist. * This is different from a network error. */ -export default class NoBlobError extends Error { +export class NoBlobError extends Error { constructor(id) { super(`Blob ID (${id}) does not exist`); this.name = 'NoBlobError'; diff --git a/packages/credential-sdk/src/modules/blob/index.js b/packages/credential-sdk/src/modules/blob/index.js new file mode 100644 index 000000000..c65e80080 --- /dev/null +++ b/packages/credential-sdk/src/modules/blob/index.js @@ -0,0 +1 @@ +export { default as AbstractBlobModule } from './module'; diff --git a/packages/credential-sdk/src/modules/blob/module.js b/packages/credential-sdk/src/modules/blob/module.js new file mode 100644 index 000000000..0247a34ec --- /dev/null +++ b/packages/credential-sdk/src/modules/blob/module.js @@ -0,0 +1,33 @@ +import { AbstractBaseModule } from '../common'; +import { withExtendedPrototypeProperties } from '../../utils'; + +/** Class to create and update Blobs on chain. */ +class AbstractBlobModule extends AbstractBaseModule { + /** + * Write a new blob on chain. + * @param blobWithId + * @param targetDid - Signer of the blob + * @param signingKeyRef - The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification + * @returns {Promise<*>} + */ + async new(blobWithId, targetDid, didKeypair, params = {}) { + return await this.signAndSend( + await this.newTx(blobWithId, targetDid, didKeypair), + params, + ); + } + + /** + * Get blob with given id from the chain. Throws if the blob can't be found. + * @param {string} id - Can either be a full blob id like blob:dock:0x... or just the hex identifier + * @returns {Promise} - A 2-element array where the first is the author and the second is the blob contents. + */ + async get(_id) { + throw new Error('Unimplemented'); + } +} + +export default withExtendedPrototypeProperties( + ['newTx', 'get'], + AbstractBlobModule, +); diff --git a/packages/credential-sdk/src/modules/common.js b/packages/credential-sdk/src/modules/common.js new file mode 100644 index 000000000..b7e36c95f --- /dev/null +++ b/packages/credential-sdk/src/modules/common.js @@ -0,0 +1,207 @@ +import { + ensureInstanceOf, + ensurePrototypeOf, + withExtendedPrototypeProperties, + withExtendedStaticProperties, +} from '../utils'; + +/** + * Base class that must be extended by all API providers. + */ +export const ApiProvider = withExtendedPrototypeProperties( + ['stateChangeBytes', 'signAndSend'], + class ApiProvider { + async stateChangeBytes(name, payload) { + return await this.apiProvider.stateChangeBytes(name, payload); + } + + async signAndSend(extrinsic, params) { + return await this.apiProvider.signAndSend(extrinsic, params); + } + }, +); + +/** + * Base module class that must be extended by all modules. + */ +export const AbstractBaseModule = withExtendedStaticProperties( + ['ApiProvider'], + class AbstractBaseModule { + /** + * Class representing an API provider. Must be a successor of the `ApiProvider` class. + * @class + */ + static ApiProvider; + + /** + * Creates a new instance of the module and sets the api + * @constructor + * @param {object} apiProvider - API reference + * @param signAndSend + */ + constructor(apiProvider) { + this.apiProvider = ensureInstanceOf( + apiProvider, + ensurePrototypeOf(ApiProvider, this.constructor.ApiProvider), + ); + } + + /** + * Signs and sends provided extrinsic. + * + * @param {*} extrinsic + * @param {*} params + * @returns {Promise<*>} + */ + async signAndSend(extrinsic, params) { + return await this.apiProvider.signAndSend(extrinsic, params); + } + }, +); + +/** + * Abstract logic allowing to operate with public keys and parameters. + */ +class AbstractWithParamsAndPublicKey extends AbstractBaseModule { + /** + * Create object to add new parameters on chain + * @param prepareAddPublicKey + * @param curveType + * @param label + * @returns {{}} + */ + static prepareAddParameters(...args) { + const { Params } = this; + + return new Params(...args); + } + + /** + * Create object to add new public key on chain + * @param bytes + * @param curveType + * @param paramsRef - Provide if this public key was created using params present on chain. + * @returns {{}} + */ + static prepareAddPublicKey(...args) { + const { PublicKey } = this; + + return new PublicKey(...args); + } + + /** + * Add new signature params. + * @param id - Unique identifier of the new params to be added. + * @param param - The signature params to add. + * @param targetDid + * @param keyPair - Signer's keypair + * @param signingKeyRef - Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification + * @returns {Promise<*>} + */ + async addParams(id, param, targetDid, didKeypair, params) { + return await this.signAndSend( + await this.addParamsTx(id, param, targetDid, didKeypair), + params, + ); + } + + /** + * Remove existing BBS+ params. + * @param id - Identifier of the parameters to be removed. + * @param targetDid - Target DID associated with the params + * @param keyPair - Signer's keypair + * @param signingKeyRef - Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification + * @returns {Promise<*>} + */ + async removeParams(id, targetDid, didKeypair, params) { + return await this.signAndSend( + await this.removeParamsTx(id, targetDid, didKeypair), + params, + ); + } + + /** + * Add a public key + * @param publicKey - public key to add. + * @param targetDid - The DID to which key is being added + * @param signerDid - The DID that is adding the key by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's signingKeyRef + * @returns {Promise<*>} + */ + async addPublicKey(id, publicKey, targetDid, didKeypair, params) { + return await this.signAndSend( + await this.addPublicKeyTx(id, publicKey, targetDid, didKeypair), + params, + ); + } + + /** + * Remove public key + * @param removeKeyId - Identifier of the public key to be removed. + * @param targetDid - The DID from which key is being removed + * @param signerDid - The DID that is removing the key by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's signing key reference + * @returns {Promise<*>} + */ + async removePublicKey(id, targetDid, didKeypair, params) { + return await this.signAndSend( + await this.removePublicKeyTx(id, targetDid, didKeypair), + params, + ); + } + + /** + * Retrieves params by a DID and unique identifier. + * @param {*} did + * @param {*} id + * @returns {Promise} + */ + async getParams(_did, _id) { + throw new Error('Unimplemented'); + } + + /** + * Retrieves all params by a DID + * @param {*} did + * @returns {Promise>} + */ + async getAllParamsByDid(_did) { + throw new Error('Unimplemented'); + } + + /** + * Retrieves public key by a DID and unique identifier. + * @param {*} did + * @param {*} id + * @returns {Promise} + */ + async getPublicKey(_did, _id, _includeParams = false) { + throw new Error('Unimplemented'); + } + + /** + * Retrieves all public keys by a DID + * @param {*} did + * @returns {Promise>} + */ + async getAllPublicKeysByDid(_did, _includeParams = false) { + throw new Error('Unimplemented'); + } +} + +export const AbstractWithParamsAndPublicKeys = withExtendedPrototypeProperties( + [ + 'addParamsTx', + 'addPublicKeyTx', + 'removeParamsTx', + 'removePublicKeyTx', + 'getParams', + 'getPublicKey', + 'getAllParamsByDid', + 'getAllPublicKeysByDid', + ], + withExtendedStaticProperties( + ['PublicKey', 'Params'], + AbstractWithParamsAndPublicKey, + ), +); diff --git a/packages/credential-sdk/src/modules/did/errors.js b/packages/credential-sdk/src/modules/did/errors.js new file mode 100644 index 000000000..02c5732f1 --- /dev/null +++ b/packages/credential-sdk/src/modules/did/errors.js @@ -0,0 +1,36 @@ +/** + * Error thrown when a DID document lookup was successful, but the DID in question does not exist. + * This is different from a network error. + */ +export class NoDIDError extends Error { + constructor(did) { + super(`DID (${did}) does not exist`); + this.name = 'NoDIDError'; + this.did = did; + this.message = `A DID document lookup was successful, but the DID in question does not exist (${did}). This is different from a network error.`; + } +} + +/** + * Error thrown when a DID exists on chain but is an off-chain DID, meaning the DID document exists off-chain. + */ +export class NoOnchainDIDError extends Error { + constructor(did) { + super(`DID (${did}) is an off-chain DID`); + this.name = 'NoOnchainDIDError'; + this.did = did; + this.message = 'The DID exists on chain but is an off-chain DID, meaning the DID document exists off-chain.'; + } +} + +/** + * Error thrown when a DID exists on chain and is an on-chain DID but the lookup was performed for an off-chain DID. + */ +export class NoOffchainDIDError extends Error { + constructor(did) { + super(`DID (${did}) is an on-chain DID`); + this.name = 'NoOffchainDIDError'; + this.did = did; + this.message = 'The DID exists on chain and is an on-chain DID but the lookup was performed for an off-chain DID.'; + } +} diff --git a/packages/credential-sdk/src/modules/did/index.js b/packages/credential-sdk/src/modules/did/index.js new file mode 100644 index 000000000..3bda0e3b1 --- /dev/null +++ b/packages/credential-sdk/src/modules/did/index.js @@ -0,0 +1,2 @@ +export { default as AbstractDIDModule } from './module'; +export * from './errors'; diff --git a/packages/credential-sdk/src/modules/did/module.js b/packages/credential-sdk/src/modules/did/module.js new file mode 100644 index 000000000..73864e081 --- /dev/null +++ b/packages/credential-sdk/src/modules/did/module.js @@ -0,0 +1,92 @@ +import { AbstractBaseModule } from '../common'; +import { withExtendedPrototypeProperties } from '../../utils'; + +/** Class to create, update and destroy DIDs */ +class AbstractDIDModule extends AbstractBaseModule { + /** + * + * @param {DIDDocument} didDocument + * @param {*} didKeypair + * @param {DidKeypair} didKeypair + * @returns {Promise} + */ + async createDocument(didDocument, didKeypair, params) { + return await this.signAndSend( + await this.createDocumentTx(didDocument, didKeypair), + params, + ); + } + + /** + * + * @param {DIDDocument} didDocument + * @param {*} didKeypair + * @param {DidKeypair} didKeypair + * @returns {Promise} + */ + async updateDocument(didDocument, didKeypair, params) { + return await this.signAndSend( + await this.updateDocumentTx(didDocument, didKeypair), + params, + ); + } + + /** + * + * @param {*} did + * @param {*} didKeypair + * @param {DidKeypair} didKeypair + * @returns {Promise} + */ + async removeDocument(did, didKeypair, params) { + return await this.signAndSend( + await this.removeDocumentTx(did, didKeypair), + params, + ); + } + + /** + * + * @param {*} did + * @returns {Promise} + */ + async getDocument(_did) { + throw new Error('Unimplemented'); + } + + /** + * + * @param {DIDDocument} didDocument + * @returns {Promise} + */ + async createDocumentTx(_didDocument, _didKeypair) { + throw new Error('Unimplemented'); + } + + /** + * + * @param {DIDDocument} didDocument + * @param {*} didKeypair + * @param {DidKeypair} didKeypair + * @returns {Promise} + */ + async updateDocumentTx(_didDocument, _didKeypair) { + throw new Error('Unimplemented'); + } + + /** + * + * @param {*} did + * @param {*} didKeypair + * @param {DidKeypair} didKeypair + * @returns {Promise} + */ + async removeDocumentTx(_did, _didKeypair) { + throw new Error('Unimplemented'); + } +} + +export default withExtendedPrototypeProperties( + ['createDocumentTx', 'updateDocumentTx', 'removeDocumentTx', 'getDocument'], + AbstractDIDModule, +); diff --git a/packages/credential-sdk/src/modules/index.js b/packages/credential-sdk/src/modules/index.js new file mode 100644 index 000000000..d1b2d450c --- /dev/null +++ b/packages/credential-sdk/src/modules/index.js @@ -0,0 +1,96 @@ +import { ensurePrototypeOf } from '../utils'; +import AbstractAccumulatorModule from './accumulator/module'; +import AbstractAnchorModule from './anchor/module'; +import AbstractAttestModule from './attest/module'; +import AbstractBlobModule from './blob/module'; +import AbstractDIDModule from './did/module'; +import AbstractOffchainSignaturesModule from './offchain-signatures/module'; +import AbstractStatusListCredentialModule from './status-list-credential/module'; +import AbstractTrustRegistryModule from './trust-registry/module'; + +/** + * Class representing a set of core modules each of which is an instance of its respective abstract module. + */ +export class AbstractCoreModules { + static Accumulator; + + static Anchor; + + static Attest; + + static Blob; + + static Did; + + static OffchainSignatures; + + static BBS; + + static BBSPlus; + + static PS; + + static StatusListCredential; + + static TrustRegistry; + + constructor(apiProvider) { + const { + AccumulatorModule, + AnchorModule, + AttestModule, + BlobModule, + DIDModule, + OffchainSignaturesModule, + BBSModule, + BBSPlusModule, + PSModule, + StatusListCredentialModule, + TrustRegistryModule, + } = this.constructor; + + ensurePrototypeOf(AbstractAccumulatorModule, AccumulatorModule); + ensurePrototypeOf(AbstractAnchorModule, AnchorModule); + ensurePrototypeOf(AbstractAttestModule, AttestModule); + ensurePrototypeOf(AbstractBlobModule, BlobModule); + ensurePrototypeOf(AbstractDIDModule, DIDModule); + ensurePrototypeOf( + AbstractOffchainSignaturesModule, + OffchainSignaturesModule, + ); + ensurePrototypeOf(AbstractOffchainSignaturesModule, BBSModule); + ensurePrototypeOf(AbstractOffchainSignaturesModule, BBSPlusModule); + ensurePrototypeOf(AbstractOffchainSignaturesModule, PSModule); + ensurePrototypeOf( + AbstractStatusListCredentialModule, + StatusListCredentialModule, + ); + ensurePrototypeOf(AbstractTrustRegistryModule, TrustRegistryModule); + + this.accumulator = new AccumulatorModule(apiProvider); + this.anchor = new AnchorModule(apiProvider); + this.attest = new AttestModule(apiProvider); + this.blob = new BlobModule(apiProvider); + this.did = new DIDModule(apiProvider); + this.offchainSignatures = new OffchainSignaturesModule(apiProvider); + this.bbs = new BBSModule(apiProvider); + this.bbsPlus = new BBSPlusModule(apiProvider); + this.ps = new PSModule(apiProvider); + this.statusListCredential = new StatusListCredentialModule(apiProvider); + this.trustRegistry = new TrustRegistryModule(apiProvider); + } +} + +export { + AbstractAccumulatorModule, + AbstractAnchorModule, + AbstractAttestModule, + AbstractBlobModule, + AbstractDIDModule, + AbstractOffchainSignaturesModule, + AbstractStatusListCredentialModule, + AbstractTrustRegistryModule, +}; + +export { default as Schema } from './schema/module'; +export { AccumulatorType } from './accumulator'; diff --git a/packages/credential-sdk/src/modules/offchain-signatures/index.js b/packages/credential-sdk/src/modules/offchain-signatures/index.js new file mode 100644 index 000000000..701a777ad --- /dev/null +++ b/packages/credential-sdk/src/modules/offchain-signatures/index.js @@ -0,0 +1 @@ +export { default as AbstractOffchainSignaturesModule } from './module'; diff --git a/packages/credential-sdk/src/modules/offchain-signatures/module.js b/packages/credential-sdk/src/modules/offchain-signatures/module.js new file mode 100644 index 000000000..cbab532e2 --- /dev/null +++ b/packages/credential-sdk/src/modules/offchain-signatures/module.js @@ -0,0 +1,26 @@ +/* eslint-disable camelcase */ + +import { + OffchainSignatureParams, + OffchainSignaturePublicKey, +} from '../../types'; +import { AbstractWithParamsAndPublicKeys } from '../common'; + +/** Class to write offchain signature parameters and keys on chain */ +export default class AbstractOffchainSignaturesModule extends AbstractWithParamsAndPublicKeys { + static Params = OffchainSignatureParams; + + static PublicKey = OffchainSignaturePublicKey; + + static prepareAddParameters(bytes, label, curveType) { + return super.prepareAddParameters( + new this.Params.Class(bytes, label, curveType), + ); + } + + static prepareAddPublicKey(bytes, paramsRef, curveType) { + return super.prepareAddPublicKey( + new this.PublicKey.Class(bytes, paramsRef, curveType), + ); + } +} diff --git a/packages/credential-sdk/src/modules/schema/index.js b/packages/credential-sdk/src/modules/schema/index.js new file mode 100644 index 000000000..f38925732 --- /dev/null +++ b/packages/credential-sdk/src/modules/schema/index.js @@ -0,0 +1 @@ +export { default as Schema } from './module'; diff --git a/src/modules/schema.js b/packages/credential-sdk/src/modules/schema/module.js similarity index 71% rename from src/modules/schema.js rename to packages/credential-sdk/src/modules/schema/module.js index 05585bee8..5f30b1046 100644 --- a/src/modules/schema.js +++ b/packages/credential-sdk/src/modules/schema/module.js @@ -1,13 +1,10 @@ import { canonicalize } from 'json-canonicalize'; import { validate } from 'jsonschema'; -import { DockDidOrDidMethodKey } from '../did'; - -import { createNewDockBlobId, getHexIdentifierFromBlobID } from './blob'; - // Supported schemas -import JSONSchema07 from '../utils/vc/schemas/schema-draft-07'; -import jsonFetch from '../utils/json-fetch'; +import JSONSchema07 from '../../vc/schemas/schema-draft-07'; +import jsonFetch from '../../utils/json-fetch'; +import { BlobId, Blob, BlobWithId } from '../../types'; export default class Schema { /** @@ -15,8 +12,8 @@ export default class Schema { * @constructor * @param {string} [id] - optional schema ID, if not given, generate a random id */ - constructor(id) { - this.id = id || createNewDockBlobId(); + constructor(id = BlobId.random(32)) { + this.id = BlobId.from(id); } static fromJSON(json) { @@ -48,9 +45,8 @@ export default class Schema { * @param {object} pair - Key pair to sign with * @param blobModule */ - sign(pair, blobModule) { - const serializedBlob = blobModule.getSerializedBlob(this.toBlob()); - this.signature = pair.sign(serializedBlob); + sign(pair) { + this.signature = pair.sign(this.toBlob().blob.bytes); return this; } @@ -61,9 +57,7 @@ export default class Schema { toJSON() { const { signature: _signature, ...rest } = this; - return { - ...rest, - }; + return rest; } /** @@ -77,44 +71,19 @@ export default class Schema { ); } - return { - id: getHexIdentifierFromBlobID(this.id), - blob: canonicalize(this.schema), - }; + return new BlobWithId(this.id, new Blob(canonicalize(this.schema))); } /** * Prepares a transaction to write this schema object to the dock chain using the blob module - * @param {object} dock - The dock API - * @param signerDid + * @param {AbstractBlobModule} blobModule - The dock API + * @param targetDid * @param keyPair - * @param nonce - * @param waitForFinalization * @param params * @return {Promise} The extrinsic to sign and send. */ - async writeToChain( - dock, - signerDid, - keyPair, - nonce = undefined, - waitForFinalization, - params = {}, - ) { - let arg; - if (nonce === undefined) { - arg = { didModule: dock.did }; - } else { - arg = { nonce }; - } - return dock.blob.new( - this.toBlob(), - signerDid, - keyPair, - arg, - waitForFinalization, - params, - ); + async writeToChain(blobModule, targetDid, keyPair, params) { + return await blobModule.new(this.toBlob(), targetDid, keyPair, params); } /** @@ -136,24 +105,17 @@ export default class Schema { * The returned schema would be formatted as specified in the RFC (including author DID, schema id) or an error is * returned if schema is not found on the chain or in JSON format. * @param {string} id - The Schema ID - * @param {object} dockApi - The Dock API + * @param {AbstractBlobModule} blobModule * @returns {Promise} */ - static async get(id, dockApi) { - const hexId = getHexIdentifierFromBlobID(id); - const chainBlob = await dockApi.blob.get(hexId); - const chainValue = chainBlob[1]; - - if (typeof chainValue === 'object' && !(chainValue instanceof Uint8Array)) { - return { - ...chainValue, - id, - author: DockDidOrDidMethodKey.from( - chainBlob[0], - ).toQualifiedEncodedString(), - }; - } - throw new Error('Incorrect schema format'); + static async get(id, blobModule) { + const [author, chainBlob] = await blobModule.get(id); + + return { + ...chainBlob.toObject(), + id: String(id), + author: String(author), + }; } /** diff --git a/packages/credential-sdk/src/modules/status-list-credential/index.js b/packages/credential-sdk/src/modules/status-list-credential/index.js new file mode 100644 index 000000000..30e510cbd --- /dev/null +++ b/packages/credential-sdk/src/modules/status-list-credential/index.js @@ -0,0 +1 @@ +export { default as AbstractStatusListCredentialModule } from './module'; diff --git a/packages/credential-sdk/src/modules/status-list-credential/module.js b/packages/credential-sdk/src/modules/status-list-credential/module.js new file mode 100644 index 000000000..8a56cc83c --- /dev/null +++ b/packages/credential-sdk/src/modules/status-list-credential/module.js @@ -0,0 +1,118 @@ +import { AbstractBaseModule } from '../common'; +import { withExtendedPrototypeProperties } from '../../utils'; +// eslint-disable-next-line +import { StatusListCredentialId } from "../../types"; + +/** + * @typedef tx + * @prop {function(CreateStatusListCredential, Signatures, boolean, object): Promise<*>} create + * @prop {function(UpdateStatusListCredential, Signatures, boolean, object): Promise<*>} update + * @prop {function(RemoveStatusListCredential, Signatures, boolean, object): Promise<*>} remove + */ + +/** + * @typedef query + * @prop {function(StatusListCredentialId): Promise} statusListCredentials + */ + +/** + * Module supporting `StatusList2021Credential` and `RevocationList2020Credential`. + */ +class AbstractStatusListCredentialModule extends AbstractBaseModule { + /** + * Fetches `StatusList2021Credential` with the supplied identifier. + * @param {*} statusListCredentialId + * @returns {Promise} + */ + async getStatusListCredential(_statusListCredentialId) { + throw new Error('Unimplemented'); + } + + /** + * Create a transaction to create a new status list credential on-chain. + * @param id - is the unique id of the status list credential. The function will check whether `id` is already taken or not. + * @param statusListCredential - the credential to be associated with the given `id` + * @param targetDid + * @param didKeypair + * @param params + * @return {Promise} - the extrinsic to sign and send. + */ + async createStatusListCredential( + id, + statusListCredential, + targetDid, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.createStatusListCredentialTx( + id, + statusListCredential, + targetDid, + didKeypair, + ), + params, + ); + } + + /** + * Create a transaction to update an existing status list credential on-chain. + * @param id + * @param statusListCredentialUpdate - Update for the status list credential. + * @param targetDid + * @param didKeypair - `DID` signatures over an action with a nonce authorizing this action according to the existing policy. + * @param params + * @return {Promise} - the extrinsic to sign and send. + */ + async updateStatusListCredential( + id, + statusListCredential, + targetDid, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.updateStatusListCredentialTx( + id, + statusListCredential, + targetDid, + didKeypair, + ), + params, + ); + } + + /** + * Create a transaction to remove an existing status list credential from the chain. + * @param statusListCredentialId - is the unique id of the status list credential. The function will check whether `id` is already taken or not. + * @param targetDid + * @param didKeypair - `DID` signatures over an action with a nonce authorizing this action according to the existing policy. + * @param params + * @return {Promise} - the extrinsic to sign and send. + */ + async removeStatusListCredential( + statusListCredentialId, + targetDid, + didKeypair, + params, + ) { + return await this.signAndSend( + await this.removeStatusListCredentialTx( + statusListCredentialId, + targetDid, + didKeypair, + ), + params, + ); + } +} + +export default withExtendedPrototypeProperties( + [ + 'getStatusListCredential', + 'createStatusListCredentialTx', + 'updateStatusListCredentialTx', + 'removeStatusListCredentialTx', + ], + AbstractStatusListCredentialModule, +); diff --git a/packages/credential-sdk/src/modules/trust-registry/index.js b/packages/credential-sdk/src/modules/trust-registry/index.js new file mode 100644 index 000000000..e36bdee0b --- /dev/null +++ b/packages/credential-sdk/src/modules/trust-registry/index.js @@ -0,0 +1 @@ +export { default as AbstractTrustRegistryModule } from './module'; diff --git a/packages/credential-sdk/src/modules/trust-registry/module.js b/packages/credential-sdk/src/modules/trust-registry/module.js new file mode 100644 index 000000000..6abe78837 --- /dev/null +++ b/packages/credential-sdk/src/modules/trust-registry/module.js @@ -0,0 +1,69 @@ +import { withExtendedPrototypeProperties } from '../../utils'; +import { AbstractBaseModule } from '../common'; + +/** + * `Trust Registry` module. + */ +class AbstractTrustRegistryModule extends AbstractBaseModule { + /** + * Retrieves registry with provided identifier owned by supplied convener did. + * @param {*} did + * @param {*} id + */ + async getRegistry(_did, _id) { + throw new Error('Unimplemented'); + } + + /** + * Retrieves all registries owned by supplied convener did. + * @param {*} did + */ + async getAllRegistriesByDid(_did) { + throw new Error('Unimplemented'); + } + + /** + * Creates new registry. + * + * @param {*} id + * @param {*} info + * @param {*} schemas + * @param {*} didKeypair + * @param {*} params + * @returns Promise<*> + */ + async createRegistry(id, info, schemas, didKeypair, params) { + return await this.signAndSend( + await this.createRegistryTx(id, info, schemas, didKeypair), + params, + ); + } + + /** + * Updates existing registry. + * + * @param {*} id + * @param {*} info + * @param {*} schemas + * @param {*} signerDid + * @param {*} signingKeyRef + * @param {*} params + * @returns Promise<*> + */ + async updateRegistry(id, info, schemas, didKeypair, params) { + return await this.signAndSend( + await this.updateRegistryTx(id, info, schemas, didKeypair), + params, + ); + } +} + +export default withExtendedPrototypeProperties( + [ + 'getRegistry', + 'getAllRegistriesByDid', + 'createRegistryTx', + 'updateRegistryTx', + ], + AbstractTrustRegistryModule, +); diff --git a/src/utils/canonicalize.js b/packages/credential-sdk/src/rdf-and-cd/canonicalize.js similarity index 95% rename from src/utils/canonicalize.js rename to packages/credential-sdk/src/rdf-and-cd/canonicalize.js index 7d06b9d0a..84a4a3c87 100644 --- a/src/utils/canonicalize.js +++ b/packages/credential-sdk/src/rdf-and-cd/canonicalize.js @@ -3,7 +3,7 @@ // of RDF nodes ({ Iri: 'https://example.com' }) and the rify-js representation // AKA strings. -import { assert } from '@polkadot/util'; +import { assert } from '../utils/assert'; import { assertType, assertValidNode } from './common'; // Convert a Node into a cononicalized string representation. @@ -96,6 +96,8 @@ function orderKeys(a) { case 'boolean': return a; default: - throw new TypeError(`type error: orderKeys() does not accept type ${typeof a}`); + throw new TypeError( + `type error: orderKeys() does not accept type ${typeof a}`, + ); } } diff --git a/src/utils/cd.js b/packages/credential-sdk/src/rdf-and-cd/cd.js similarity index 92% rename from src/utils/cd.js rename to packages/credential-sdk/src/rdf-and-cd/cd.js index dabfb6d79..dc9087267 100644 --- a/src/utils/cd.js +++ b/packages/credential-sdk/src/rdf-and-cd/cd.js @@ -3,11 +3,15 @@ import deepEqual from 'deep-equal'; import jsonld from 'jsonld'; import { validate, prove, infer } from 'rify'; -import { assert } from '@polkadot/util'; -import { expandedCredentialProperty } from './vc/constants'; +import { assert } from '../utils/assert'; +import { expandedCredentialProperty } from '../vc/constants'; import { fromJsonldjsCg, merge } from './claimgraph'; import { - canonRules, canonProof, canonClaimGraph, decanonClaimGraph, decanonProof, + canonRules, + canonProof, + canonClaimGraph, + decanonClaimGraph, + decanonProof, } from './canonicalize'; import { assertValidNode, assertType } from './common'; @@ -70,7 +74,10 @@ async function credToEECG(expandedCredential) { // This line relies on the assumption that if the credential passed verification then the // issuer property was not forged. - assert(cred[expandedIssuerProperty] !== undefined, 'encountered credential without an issuer'); + assert( + cred[expandedIssuerProperty] !== undefined, + 'encountered credential without an issuer', + ); const issuer = cred[expandedIssuerProperty][0]['@id']; assertType(issuer, 'string'); assert(!issuer.startsWith('_:'), 'issuer is assumed not to be a blank node'); @@ -89,7 +96,10 @@ async function credToEECG(expandedCredential) { // Leaving a non-default graph as-is would be unsafe. // While it would be valid to simply delete quads with non-default graphs, it would be confusing // to users if the content of their credential was swallowed without warning. - assert(deepEqual(claim[3], { DefaultGraph: true }), 'subgraph found in credential'); + assert( + deepEqual(claim[3], { DefaultGraph: true }), + 'subgraph found in credential', + ); claim[3] = { Iri: issuer }; } @@ -129,7 +139,8 @@ export class UnverifiedAssumption extends Error { * @returns {Promise} */ export function extractProof(expandedPresentation) { - return jsonld.getValues(unwrapE(expandedPresentation), expandedLogicProperty) + return jsonld + .getValues(unwrapE(expandedPresentation), expandedLogicProperty) .map(fromJSONLiteral) .flat(1); } @@ -169,7 +180,11 @@ export function getImplications(claimgraph, proof, rules) { * @param rules - ordered list of axioms which will be accepted within proofs of composite claims * @returns {Promise} - proof is returned as a json literal */ -export async function proveCompositeClaims(expandedPresentation, compositeClaims, rules) { +export async function proveCompositeClaims( + expandedPresentation, + compositeClaims, + rules, +) { assert( rules !== undefined, 'An axiom list must be provided. Hint: rules may be "[]" to reject all.', @@ -184,11 +199,7 @@ export async function proveCompositeClaims(expandedPresentation, compositeClaims // A higher level wrapper around prove that first converts rules, composite claims, and premises to // the canonical representation as defined by `canon()` in `claimgraph.js`. This wrapper // deserializes the returned values before passing them back to the caller. -export function proveh( - premises, - toProve, - rules, -) { +export function proveh(premises, toProve, rules) { foreachQuadInRules(rules, assertQuad); premises.forEach(assertQuad); toProve.forEach(assertQuad); @@ -206,13 +217,7 @@ export function proveh( // returned values before passing them back to the caller. export function validateh(rules, proof) { foreachQuadInRules(rules, assertQuad); - const { - assumed, - implied, - } = validate( - canonRules(rules), - canonProof(proof), - ); + const { assumed, implied } = validate(canonRules(rules), canonProof(proof)); return { assumed: decanonClaimGraph(assumed), implied: decanonClaimGraph(implied), @@ -242,7 +247,10 @@ function foreachQuadInRules(rules, f) { } function assertQuad(quad) { - assert(quad.length === 4, () => `Quads must have length 4, got: ${JSON.stringify(quad)}`); + assert( + quad.length === 4, + () => `Quads must have length 4, got: ${JSON.stringify(quad)}`, + ); } /// check two claims for equality diff --git a/src/utils/claimgraph.js b/packages/credential-sdk/src/rdf-and-cd/claimgraph.js similarity index 92% rename from src/utils/claimgraph.js rename to packages/credential-sdk/src/rdf-and-cd/claimgraph.js index d307f5035..d93d10a78 100644 --- a/src/utils/claimgraph.js +++ b/packages/credential-sdk/src/rdf-and-cd/claimgraph.js @@ -26,7 +26,7 @@ // // This module implements utilities for operating on claimgraphs if the above format. -import { assert } from '@polkadot/util'; +import { assert } from '../utils/assert'; import { deepClone, assertValidClaimGraph } from './common'; export const claims = { Iri: 'https://www.dock.io/rdf2020#claimsV1' }; @@ -51,9 +51,15 @@ export function fromJsonldjsNode(jn) { case 'BlankNode': return { Blank: jn.value }; case 'Literal': - assert(jn.datatype.termType === 'NamedNode', 'The datatype of an RDF literal must be an IRI'); + assert( + jn.datatype.termType === 'NamedNode', + 'The datatype of an RDF literal must be an IRI', + ); ret = { Literal: { value: jn.value, datatype: jn.datatype.value } }; - if (jn.datatype.value === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString') { + if ( + jn.datatype.value + === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString' + ) { assert( jn.language !== undefined, 'Language tagged strings are expected to have a language tag.', diff --git a/src/utils/common.js b/packages/credential-sdk/src/rdf-and-cd/common.js similarity index 76% rename from src/utils/common.js rename to packages/credential-sdk/src/rdf-and-cd/common.js index 908ee763d..af5b5f7dd 100644 --- a/src/utils/common.js +++ b/packages/credential-sdk/src/rdf-and-cd/common.js @@ -1,7 +1,7 @@ // Helpers for internal use by sdk utilities. // The api of this module is not guaranteed to be stable. -import { assert } from '@polkadot/util'; +import { assert } from '../utils/assert'; // deep copy a json serializable object export function deepClone(obj) { @@ -20,7 +20,10 @@ export function assertValidClaimGraph(cg) { export function assertValidNode(node) { const ks = Object.keys(node); - assert(ks.length === 1, 'enum representaion invalid. enum must be exactly one variant'); + assert( + ks.length === 1, + 'enum representaion invalid. enum must be exactly one variant', + ); const tag = ks[0]; const value = node[tag]; switch (tag) { @@ -35,7 +38,10 @@ export function assertValidNode(node) { break; case 'Literal': assertType(value, 'object'); - assert(Object.keys(value).length === 2, 'Literals must have exactly two fields'); + assert( + Object.keys(value).length === 2, + 'Literals must have exactly two fields', + ); assertType(value.value, 'string'); assertType(value.datatype, 'string'); break; @@ -47,6 +53,8 @@ export function assertValidNode(node) { export function assertType(a, typ) { const t = typeof a; if (t !== typ) { - throw new TypeError(`Expected type ${typ}. Got ${a} which has type ${typeof a}.`); + throw new TypeError( + `Expected type ${typ}. Got ${a} which has type ${typeof a}.`, + ); } } diff --git a/src/crawl.js b/packages/credential-sdk/src/rdf-and-cd/crawl.js similarity index 84% rename from src/crawl.js rename to packages/credential-sdk/src/rdf-and-cd/crawl.js index e9ffe9714..c598e4f54 100644 --- a/src/crawl.js +++ b/packages/credential-sdk/src/rdf-and-cd/crawl.js @@ -7,11 +7,11 @@ import jsonld from 'jsonld'; import assert from 'assert'; import deepEqual from 'deep-equal'; import { CID } from 'multiformats/cid'; -import { deepClone, assertValidNode } from './utils/common'; -import { queryNextLookup, parseRDFDocument } from './utils/rdf'; -import { inferh } from './utils/cd'; -import { canon } from './utils/canonicalize'; -import { Namer, fromJsonldjsCg } from './utils/claimgraph'; +import { deepClone, assertValidNode } from './common'; +import { queryNextLookup, parseRDFDocument } from './rdf'; +import { inferh } from './cd'; +import { canon } from './canonicalize'; +import { Namer, fromJsonldjsCg } from './claimgraph'; // Crawl the rdf dataset composed of DIDs and turtle documents on ipfs. Return the graph // representing all knowledge obtained while crawling. @@ -46,7 +46,7 @@ export async function crawl( // lookup any interesting documents const interesting = await queryNextLookup(facts, curiosityQuery, engine); const novel = interesting.filter(marknew); - const newfacts = [...await Promise.all(novel.map(resolveGraph))]; + const newfacts = [...(await Promise.all(novel.map(resolveGraph)))]; for (const nf of newfacts) { namer.reallocateNames(nf); } @@ -64,7 +64,9 @@ export async function crawl( export function graphResolver( ipfsClient, documentLoader, - onFailedLookup = (_term, err) => { throw err; }, + onFailedLookup = (_term, err) => { + throw err; + }, ) { async function resolve(term) { assertValidNode(term); @@ -101,7 +103,10 @@ async function jsonldToCg(jld, documentLoader) { const exp = await jsonld.expand(jld, { documentLoader }); const cg = fromJsonldjsCg(await jsonld.toRDF(exp)); for (const claim of cg) { - assert(deepEqual(claim[3], { DefaultGraph: true }), 'illegal subgraph was specified'); + assert( + deepEqual(claim[3], { DefaultGraph: true }), + 'illegal subgraph was specified', + ); claim.pop(); assert(claim.length === 3); } diff --git a/packages/credential-sdk/src/rdf-and-cd/index.js b/packages/credential-sdk/src/rdf-and-cd/index.js new file mode 100644 index 000000000..d82fd2c80 --- /dev/null +++ b/packages/credential-sdk/src/rdf-and-cd/index.js @@ -0,0 +1,7 @@ +export * from './canonicalize'; +export * from './cd'; +export * from './claimgraph'; +export * from './common'; +export * from './rdf'; +export * from './crawl'; +export * from './rdf-defs'; diff --git a/src/rdf-defs.js b/packages/credential-sdk/src/rdf-and-cd/rdf-defs.js similarity index 93% rename from src/rdf-defs.js rename to packages/credential-sdk/src/rdf-and-cd/rdf-defs.js index 813c903a8..ff0bee7fa 100644 --- a/src/rdf-defs.js +++ b/packages/credential-sdk/src/rdf-and-cd/rdf-defs.js @@ -40,20 +40,10 @@ export const MAYCLAIM_DEF_1 = [ { Bound: { Iri: ANYCLAIM } }, { Unbound: 'a' }, ], - [ - { Unbound: 's' }, - { Unbound: 'p' }, - { Unbound: 'o' }, - { Unbound: 'b' }, - ], + [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'b' }], ], then: [ - [ - { Unbound: 's' }, - { Unbound: 'p' }, - { Unbound: 'o' }, - { Unbound: 'a' }, - ], + [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'a' }], ], }, ]; @@ -90,12 +80,7 @@ export const MAYCLAIM_DEF_2 = [ { Bound: { Iri: ANYCLAIM } }, { Bound: { DefaultGraph: true } }, ], - [ - { Unbound: 's' }, - { Unbound: 'p' }, - { Unbound: 'o' }, - { Unbound: 'b' }, - ], + [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'b' }], ], then: [ [ diff --git a/src/utils/rdf.js b/packages/credential-sdk/src/rdf-and-cd/rdf.js similarity index 87% rename from src/utils/rdf.js rename to packages/credential-sdk/src/rdf-and-cd/rdf.js index ba9280562..3e76d7dcf 100644 --- a/src/utils/rdf.js +++ b/packages/credential-sdk/src/rdf-and-cd/rdf.js @@ -1,6 +1,6 @@ // @ts-nocheck import { Parser, Store, DataFactory } from 'n3'; -import assert from 'assert'; +import { assert } from '../utils/assert'; import { fromJsonldjsNode } from './claimgraph'; /** @@ -37,12 +37,14 @@ export function claimgraphToStore(claimgraph) { const predicate = quad[1]; const object = quad[2]; const graph = quad.length > 3 ? toJsonldjsNode(quad[3]) : undefined; - store.addQuad(DataFactory.quad( - toJsonldjsNode(subject), - toJsonldjsNode(predicate), - toJsonldjsNode(object), - graph, - )); + store.addQuad( + DataFactory.quad( + toJsonldjsNode(subject), + toJsonldjsNode(predicate), + toJsonldjsNode(object), + graph, + ), + ); }); return store; } @@ -93,15 +95,16 @@ export function parseRDFDocument(document, parserOptions = {}) { // list of triples as quads are assumed to have DefaultGraph return parsedResult.map((quad) => { const { - subject, - predicate, - object, - graph, + subject, predicate, object, graph, } = quad; // Reject if graph isnt default as rify doesnt support it otherwise if (graph.termType !== 'DefaultGraph') { - throw new Error(`Unexpected graph, expecting DefaultGraph: ${JSON.stringify(graph.toJSON())}`); + throw new Error( + `Unexpected graph, expecting DefaultGraph: ${JSON.stringify( + graph.toJSON(), + )}`, + ); } // Format subject, predicate and object terms into rify standard @@ -110,10 +113,6 @@ export function parseRDFDocument(document, parserOptions = {}) { const formattedObject = fromJsonldjsNode(object); // Format result as RDF triple - return [ - formattedSubject, - formattedPredicate, - formattedObject, - ]; + return [formattedSubject, formattedPredicate, formattedObject]; }); } diff --git a/src/resolver/blob/blob-resolver.js b/packages/credential-sdk/src/resolver/blob/blob-resolver.js similarity index 100% rename from src/resolver/blob/blob-resolver.js rename to packages/credential-sdk/src/resolver/blob/blob-resolver.js diff --git a/src/resolver/blob/dock-blob-resolver.js b/packages/credential-sdk/src/resolver/blob/dock-blob-resolver.js similarity index 53% rename from src/resolver/blob/dock-blob-resolver.js rename to packages/credential-sdk/src/resolver/blob/dock-blob-resolver.js index 1a43c81ed..5876a44e1 100644 --- a/src/resolver/blob/dock-blob-resolver.js +++ b/packages/credential-sdk/src/resolver/blob/dock-blob-resolver.js @@ -1,5 +1,6 @@ +import { ensureInstanceOf } from '../../utils'; import BlobResolver from './blob-resolver'; -import { withInitializedDockAPI } from '../utils'; +import { AbstractBlobModule } from '../../modules/blob'; class DockBlobResolver extends BlobResolver { static METHOD = 'dock'; @@ -8,17 +9,19 @@ class DockBlobResolver extends BlobResolver { * @param {DockAPI} dock - An initialized connection to a dock full-node. * @constructor */ - constructor(dock) { + constructor(blobModule) { super(); /** * @type {DockAPI} */ - this.dock = dock; + this.blobModule = ensureInstanceOf(blobModule, AbstractBlobModule); } async resolve(blobUri) { - return await this.dock.blob.get(blobUri); + const [author, blob] = await this.blobModule.get(blobUri); + + return [String(author), blob.toObjectOrBytes()]; } } @@ -26,4 +29,4 @@ class DockBlobResolver extends BlobResolver { * Resolves `Blob`s with identifier `blob:dock:*`. * @type {DockBlobResolver} */ -export default withInitializedDockAPI(DockBlobResolver); +export default DockBlobResolver; diff --git a/src/resolver/blob/index.js b/packages/credential-sdk/src/resolver/blob/index.js similarity index 100% rename from src/resolver/blob/index.js rename to packages/credential-sdk/src/resolver/blob/index.js diff --git a/src/resolver/did/did-key-resolver.js b/packages/credential-sdk/src/resolver/did/did-key-resolver.js similarity index 100% rename from src/resolver/did/did-key-resolver.js rename to packages/credential-sdk/src/resolver/did/did-key-resolver.js diff --git a/src/resolver/did/did-resolver.js b/packages/credential-sdk/src/resolver/did/did-resolver.js similarity index 100% rename from src/resolver/did/did-resolver.js rename to packages/credential-sdk/src/resolver/did/did-resolver.js diff --git a/src/resolver/did/dock-did-resolver.js b/packages/credential-sdk/src/resolver/did/dock-did-resolver.js similarity index 52% rename from src/resolver/did/dock-did-resolver.js rename to packages/credential-sdk/src/resolver/did/dock-did-resolver.js index 703f121fa..56ba9fd83 100644 --- a/src/resolver/did/dock-did-resolver.js +++ b/packages/credential-sdk/src/resolver/did/dock-did-resolver.js @@ -1,6 +1,7 @@ -import { withInitializedDockAPI } from '../utils'; -import { validateDockDIDSS58Identifier } from '../../did'; +import { AbstractDIDModule } from '../../modules/did'; +import { validateDockDIDSS58Identifier } from '../../types/did'; import DIDResolver from './did-resolver'; +import { ensureInstanceOf } from '../../utils'; class DockDIDResolver extends DIDResolver { static METHOD = 'dock'; @@ -9,20 +10,22 @@ class DockDIDResolver extends DIDResolver { * @param {DockAPI} dock - An initialized connection to a dock full-node. * @constructor */ - constructor(dock) { + constructor(didModule) { super(); /** - * @type {DockAPI} + * @type {AbstractDIDModule} */ - this.dock = dock; + this.didModule = ensureInstanceOf(didModule, AbstractDIDModule); } async resolve(qualifiedDid) { const { id, did } = this.parseDid(qualifiedDid); validateDockDIDSS58Identifier(id); - return await this.dock.did.getDocument(did); + const document = await this.didModule.getDocument(did); + + return document.toJSON(); } } @@ -30,4 +33,4 @@ class DockDIDResolver extends DIDResolver { * Resolves `DID`s with identifier `did:dock:*`. * @type {DockDIDResolver} */ -export default withInitializedDockAPI(DockDIDResolver); +export default DockDIDResolver; diff --git a/src/resolver/did/index.js b/packages/credential-sdk/src/resolver/did/index.js similarity index 80% rename from src/resolver/did/index.js rename to packages/credential-sdk/src/resolver/did/index.js index 2efab98f3..d384719a2 100644 --- a/src/resolver/did/index.js +++ b/packages/credential-sdk/src/resolver/did/index.js @@ -1,5 +1,4 @@ export { default as DIDResolver } from './did-resolver'; export { default as DIDKeyResolver } from './did-key-resolver'; -export { default as DIDJWKResolver } from './did-jwk-resolver'; export { default as DockDIDResolver } from './dock-did-resolver'; export { default as UniversalResolver } from './universal-resolver'; diff --git a/src/resolver/did/universal-resolver.js b/packages/credential-sdk/src/resolver/did/universal-resolver.js similarity index 96% rename from src/resolver/did/universal-resolver.js rename to packages/credential-sdk/src/resolver/did/universal-resolver.js index f8a93c151..23e7ef2e2 100644 --- a/src/resolver/did/universal-resolver.js +++ b/packages/credential-sdk/src/resolver/did/universal-resolver.js @@ -1,4 +1,4 @@ -import { NoDIDError } from '../../did'; +import { NoDIDError } from '../../modules/did/errors'; import { Resolver, WILDCARD } from '../generic'; import jsonFetch from '../../utils/json-fetch'; @@ -7,6 +7,7 @@ import jsonFetch from '../../utils/json-fetch'; */ export default class UniversalResolver extends Resolver { static PREFIX = 'did'; + static METHOD = WILDCARD; /** diff --git a/src/resolver/dock-resolver.js b/packages/credential-sdk/src/resolver/dock-resolver.js similarity index 63% rename from src/resolver/dock-resolver.js rename to packages/credential-sdk/src/resolver/dock-resolver.js index 3928f929d..49d934d18 100644 --- a/src/resolver/dock-resolver.js +++ b/packages/credential-sdk/src/resolver/dock-resolver.js @@ -1,8 +1,9 @@ import { DockDIDResolver } from './did'; import { DockStatusList2021Resolver } from './status-list2021'; import { MultiResolver } from './generic'; -import { DockRevRegResolver } from './rev-reg'; import { DockBlobResolver } from './blob'; +import { ensureInstanceOf } from '../utils'; +import { AbstractCoreModules } from '../modules'; /** * Resolves dock-hosted entities such us `did:dock:*` and `status-list2021:dock:*`, `rev-reg:dock:*`, `blob:dock:*`. @@ -11,18 +12,18 @@ export default class DockResolver extends MultiResolver { static PREFIX = [ DockDIDResolver.PREFIX, DockStatusList2021Resolver.PREFIX, - DockRevRegResolver.PREFIX, DockBlobResolver.PREFIX, ]; static METHOD = 'dock'; - constructor(dock) { + constructor(modules) { + ensureInstanceOf(modules, AbstractCoreModules); + super([ - new DockDIDResolver(dock), - new DockStatusList2021Resolver(dock), - new DockRevRegResolver(dock), - new DockBlobResolver(dock), + new DockDIDResolver(modules.did), + new DockStatusList2021Resolver(modules.statusListCredential), + new DockBlobResolver(modules.blob), ]); } } diff --git a/src/resolver/generic/const.js b/packages/credential-sdk/src/resolver/generic/const.js similarity index 100% rename from src/resolver/generic/const.js rename to packages/credential-sdk/src/resolver/generic/const.js diff --git a/src/resolver/generic/helpers.js b/packages/credential-sdk/src/resolver/generic/helpers.js similarity index 99% rename from src/resolver/generic/helpers.js rename to packages/credential-sdk/src/resolver/generic/helpers.js index 02c8f6e1a..7b64c2c68 100644 --- a/src/resolver/generic/helpers.js +++ b/packages/credential-sdk/src/resolver/generic/helpers.js @@ -22,6 +22,7 @@ export const createResolver = ( return new (class ResolverCreatedUsingCreateResolver extends baseClass { static PREFIX = prefix; + static METHOD = method; constructor() { diff --git a/src/resolver/generic/index.js b/packages/credential-sdk/src/resolver/generic/index.js similarity index 100% rename from src/resolver/generic/index.js rename to packages/credential-sdk/src/resolver/generic/index.js diff --git a/src/resolver/generic/multi-resolver.js b/packages/credential-sdk/src/resolver/generic/multi-resolver.js similarity index 99% rename from src/resolver/generic/multi-resolver.js rename to packages/credential-sdk/src/resolver/generic/multi-resolver.js index fa107ec28..0d4e0e076 100644 --- a/src/resolver/generic/multi-resolver.js +++ b/packages/credential-sdk/src/resolver/generic/multi-resolver.js @@ -29,6 +29,7 @@ export default class MultiResolver extends Resolver { * @static */ static PREFIX; + /** * Matching string method, an array of string methods, or wildcard pattern. * @type {Array | string | symbol} diff --git a/src/resolver/generic/resolver.js b/packages/credential-sdk/src/resolver/generic/resolver.js similarity index 96% rename from src/resolver/generic/resolver.js rename to packages/credential-sdk/src/resolver/generic/resolver.js index a471a0337..61762e1ed 100644 --- a/src/resolver/generic/resolver.js +++ b/packages/credential-sdk/src/resolver/generic/resolver.js @@ -15,6 +15,7 @@ class Resolver { * @static */ static PREFIX; + /** * Matching method - either a string or wildcard pattern. * @type {string | symbol} @@ -61,6 +62,7 @@ class Resolver { ensureString(id); const end = id.indexOf(':'); + // eslint-disable-next-line no-bitwise return ~end ? id.slice(0, end) : ''; } @@ -75,6 +77,7 @@ class Resolver { const start = id.indexOf(':'); const end = id.indexOf(':', start + 1); + // eslint-disable-next-line no-bitwise return ~start && ~end ? id.slice(start + 1, end) : ''; } } diff --git a/src/resolver/generic/wildcard-multi-resolver.js b/packages/credential-sdk/src/resolver/generic/wildcard-multi-resolver.js similarity index 99% rename from src/resolver/generic/wildcard-multi-resolver.js rename to packages/credential-sdk/src/resolver/generic/wildcard-multi-resolver.js index f492e1c90..967939873 100644 --- a/src/resolver/generic/wildcard-multi-resolver.js +++ b/packages/credential-sdk/src/resolver/generic/wildcard-multi-resolver.js @@ -6,5 +6,6 @@ import { WILDCARD } from './const'; */ export default class WildcardMultiResolver extends MultiResolver { static PREFIX = WILDCARD; + static METHOD = WILDCARD; } diff --git a/src/resolver/index.js b/packages/credential-sdk/src/resolver/index.js similarity index 100% rename from src/resolver/index.js rename to packages/credential-sdk/src/resolver/index.js diff --git a/packages/credential-sdk/src/resolver/status-list2021/dock-status-list2021-resolver.js b/packages/credential-sdk/src/resolver/status-list2021/dock-status-list2021-resolver.js new file mode 100644 index 000000000..6a9e6378b --- /dev/null +++ b/packages/credential-sdk/src/resolver/status-list2021/dock-status-list2021-resolver.js @@ -0,0 +1,39 @@ +import { ensureInstanceOf } from '../../utils'; +import AbstractStatusListCredentialModule from '../../modules/status-list-credential/module'; +import StatusList2021Resolver from './status-list2021-resolver'; + +class DockStatusListResolver extends StatusList2021Resolver { + static METHOD = 'dock'; + + /** + * @param {AbstractStatusListCredentialModule} statusListCredentialModule + * @constructor + */ + constructor(statusListCredentialModule) { + super(); + + /** + * @type {AbstractStatusListCredentialModule} + */ + this.statusListCredentialModule = ensureInstanceOf( + statusListCredentialModule, + AbstractStatusListCredentialModule, + ); + } + + async resolve(fullyQualifiedStatusListId) { + const { id: dockStatusListId } = this.parse(fullyQualifiedStatusListId); + + const cred = await this.statusListCredentialModule.getStatusListCredential( + dockStatusListId, + ); + + return cred?.value.list.toJSON(); + } +} + +/** + * Resolves `StatusList2021Credential`s with identifier `status-list2021:dock:*`. + * @type {DockStatusListResolver} + */ +export default DockStatusListResolver; diff --git a/src/resolver/status-list2021/index.js b/packages/credential-sdk/src/resolver/status-list2021/index.js similarity index 100% rename from src/resolver/status-list2021/index.js rename to packages/credential-sdk/src/resolver/status-list2021/index.js diff --git a/src/resolver/status-list2021/status-list2021-resolver.js b/packages/credential-sdk/src/resolver/status-list2021/status-list2021-resolver.js similarity index 56% rename from src/resolver/status-list2021/status-list2021-resolver.js rename to packages/credential-sdk/src/resolver/status-list2021/status-list2021-resolver.js index 8ceccc3df..da949b1c1 100644 --- a/src/resolver/status-list2021/status-list2021-resolver.js +++ b/packages/credential-sdk/src/resolver/status-list2021/status-list2021-resolver.js @@ -1,4 +1,8 @@ -import { MultiResolver, METHOD_REG_EXP_PATTERN, HEX_ID_REG_EXP_PATTERN } from '../generic'; +import { + MultiResolver, + METHOD_REG_EXP_PATTERN, + HEX_ID_REG_EXP_PATTERN, +} from '../generic'; const STATUS_LIST_ID_MATCHER = new RegExp( `^status-list2021:${METHOD_REG_EXP_PATTERN}:${HEX_ID_REG_EXP_PATTERN}$`, @@ -14,15 +18,13 @@ export default class StatusList2021Resolver extends MultiResolver { static PREFIX = 'status-list2021'; parse(statusListId) { - if (statusListId === '' || !statusListId) throw new Error('Missing `statusListId`'); + if (!statusListId) throw new Error('Missing `statusListId`'); - if (statusListId) { - const sections = statusListId.match(STATUS_LIST_ID_MATCHER); - if (sections) { - const [, method, id] = sections; + const sections = statusListId.match(STATUS_LIST_ID_MATCHER); + if (sections) { + const [, method, id] = sections; - return { method, id }; - } + return { method, id }; } throw new Error( diff --git a/src/resolver/utils.js b/packages/credential-sdk/src/resolver/utils.js similarity index 71% rename from src/resolver/utils.js rename to packages/credential-sdk/src/resolver/utils.js index 63be2ad8e..f9cff4f72 100644 --- a/src/resolver/utils.js +++ b/packages/credential-sdk/src/resolver/utils.js @@ -1,25 +1,5 @@ import { fmtIter } from '../utils/generic'; -/** - * Before resolving an entity, ensures that `DockAPI` is initialized, throws an error otherwise. - * @template T - * @param {T} resolverClass - * @param {function(T): DockAPI} pickDockAPI - * @returns {T} - */ -export const withInitializedDockAPI = ( - resolverClass, - pickDockAPI = ({ dock }) => dock, -) => class extends resolverClass { - async resolve(url) { - if (pickDockAPI(this).isInitialized()) { - return super.resolve(url); - } else { - throw new Error('DockAPI is not connected'); - } - } -}; - /** * Caches last function result and returns it if function called with the same args again. * @param {Function} @@ -51,10 +31,11 @@ export const cacheLast = (fn) => { /** * Ensures that each item is present in the allowed set and that both sets are valid. * - * @template T - * @param {Iterable} items - * @param {Iterable} allowed - * @param {T} wildcard + * @template I + * @template W + * @param {Iterable} items + * @param {Iterable} allowed + * @param {W} wildcard */ export const ensureItemsAllowed = (items, allowed, wildcard) => { const itemsSet = new Set(items); diff --git a/packages/credential-sdk/src/types/accumulator/accumulator.js b/packages/credential-sdk/src/types/accumulator/accumulator.js new file mode 100644 index 000000000..10dfe83a8 --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/accumulator.js @@ -0,0 +1,39 @@ +import { TypedStruct, TypedNumber } from '../generic'; +import { DockAccumulatorPublicKeyRef } from './keys'; +import { createAccumulatorVariants } from './variants'; + +export const [ + DockAccumulatorCommon, + DockAccumulator, + DockUniversalAccumulator, + DockKBUniversalAccumulator, + DockPositiveAccumulator, +] = createAccumulatorVariants(DockAccumulatorPublicKeyRef); + +export class DockAccumulatorWithUpdateInfo extends TypedStruct { + static Classes = { + createdAt: TypedNumber, + lastUpdatedAt: TypedNumber, + accumulator: DockAccumulator, + }; + + get created() { + return this.createdAt; + } + + get lastModified() { + return this.lastUpdatedAt; + } + + get type() { + return this.accumulator.type; + } + + get accumulated() { + return this.accumulator.value.accumulated; + } + + get keyRef() { + return this.accumulator.value.keyRef; + } +} diff --git a/packages/credential-sdk/src/types/accumulator/counters.js b/packages/credential-sdk/src/types/accumulator/counters.js new file mode 100644 index 000000000..2e7015d9a --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/counters.js @@ -0,0 +1,8 @@ +import { TypedStruct, TypedNumber } from '../generic'; + +export class DockAccumulatorCounters extends TypedStruct { + static Classes = { + paramsCounter: class ParamsCounter extends TypedNumber {}, + keyCounter: class KeyCounter extends TypedNumber {}, + }; +} diff --git a/packages/credential-sdk/src/types/accumulator/index.js b/packages/credential-sdk/src/types/accumulator/index.js new file mode 100644 index 000000000..ae00852c2 --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/index.js @@ -0,0 +1,30 @@ +import { IdentRef } from '../did'; +import { + TypedBytes, TypedUUID, sized, withFrom, +} from '../generic'; + +export class AccumulatorId extends IdentRef {} + +export class CheqdAccumulatorIdIdent extends TypedUUID {} + +export class CheqdAccumulatorId extends AccumulatorId { + static Ident = CheqdAccumulatorIdIdent; +} + +export class DockAccumulatorIdIdent extends withFrom( + sized(TypedBytes), + // eslint-disable-next-line no-use-before-define + (value, from) => (value instanceof DockAccumulatorId ? value[1] : from(value)), +) { + static Size = 32; +} + +export class DockAccumulatorId extends AccumulatorId { + static Ident = DockAccumulatorIdIdent; +} + +export * from './keys'; +export * from './params'; +export * from './public-key'; +export * from './accumulator'; +export * from './counters'; diff --git a/packages/credential-sdk/src/types/accumulator/keys.js b/packages/credential-sdk/src/types/accumulator/keys.js new file mode 100644 index 000000000..6da778035 --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/keys.js @@ -0,0 +1,10 @@ +import { TypedTuple, TypedNumber } from '../generic'; +import { DockDidOrDidMethodKey } from '../did'; + +export class DockAccumulatorPublicKeyRef extends TypedTuple { + static Classes = [DockDidOrDidMethodKey, TypedNumber]; +} + +export class DockAccumulatorParamsRef extends TypedTuple { + static Classes = [DockDidOrDidMethodKey, TypedNumber]; +} diff --git a/packages/credential-sdk/src/types/accumulator/params.js b/packages/credential-sdk/src/types/accumulator/params.js new file mode 100644 index 000000000..0e8daf103 --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/params.js @@ -0,0 +1,17 @@ +import { option, TypedBytes, TypedStruct } from '../generic'; +import { + CurveType, + CurveTypeBls12381, +} from '../offchain-signatures/curve-type'; + +export class AccumulatorParams extends TypedStruct { + static Classes = { + bytes: class Bytes extends TypedBytes {}, + label: option(class Label extends TypedBytes {}), + curveType: CurveType, + }; + + constructor(bytes, label, curveType = new CurveTypeBls12381()) { + super(bytes, label, curveType); + } +} diff --git a/packages/credential-sdk/src/types/accumulator/public-key.js b/packages/credential-sdk/src/types/accumulator/public-key.js new file mode 100644 index 000000000..23a59be16 --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/public-key.js @@ -0,0 +1,29 @@ +import { + option, TypedBytes, TypedStruct, Any, withProp, +} from '../generic'; +import { + CurveType, + CurveTypeBls12381, +} from '../offchain-signatures/curve-type'; +import { DockAccumulatorParamsRef } from './keys'; +import { AccumulatorParams } from './params'; + +export class AccumulatorPublicKey extends TypedStruct { + static Params = AccumulatorParams; + + static Classes = { + bytes: class Bytes extends TypedBytes {}, + paramsRef: option(Any), + curveType: CurveType, + }; + + constructor(bytes, paramsRef, curveType = new CurveTypeBls12381(), ...rest) { + super(bytes, paramsRef, curveType, ...rest); + } +} + +export class DockAccumulatorPublicKey extends withProp( + AccumulatorPublicKey, + 'paramsRef', + option(DockAccumulatorParamsRef), +) {} diff --git a/packages/credential-sdk/src/types/accumulator/variants.js b/packages/credential-sdk/src/types/accumulator/variants.js new file mode 100644 index 000000000..cc772a0f3 --- /dev/null +++ b/packages/credential-sdk/src/types/accumulator/variants.js @@ -0,0 +1,61 @@ +import { + TypedBytes, TypedEnum, TypedNumber, TypedStruct, +} from '../generic'; + +export const createAccumulatorVariants = (keyRef) => { + class AccumulatorCommon extends TypedStruct { + static Classes = { + accumulated: class Accumulated extends TypedBytes {}, + keyRef, + }; + } + + class UniversalAccumulatorValue extends TypedStruct { + static Type = 'universal'; + + static Classes = { + common: AccumulatorCommon, + maxSize: TypedNumber, + }; + + get accumulated() { + return this.common.accumulated; + } + + get keyRef() { + return this.common.keyRef; + } + } + + class Accumulator extends TypedEnum {} + + class UniversalAccumulator extends Accumulator { + static Type = 'universal'; + + static Class = UniversalAccumulatorValue; + } + class KBUniversalAccumulator extends Accumulator { + static Type = 'kbUniversal'; + + static Class = AccumulatorCommon; + } + class PositiveAccumulator extends Accumulator { + static Type = 'positive'; + + static Class = AccumulatorCommon; + } + + Accumulator.bindVariants( + UniversalAccumulator, + KBUniversalAccumulator, + PositiveAccumulator, + ); + + return [ + AccumulatorCommon, + Accumulator, + UniversalAccumulator, + KBUniversalAccumulator, + PositiveAccumulator, + ]; +}; diff --git a/packages/credential-sdk/src/types/anchor/index.js b/packages/credential-sdk/src/types/anchor/index.js new file mode 100644 index 000000000..8a03f44d1 --- /dev/null +++ b/packages/credential-sdk/src/types/anchor/index.js @@ -0,0 +1,21 @@ +import BLAKE2b from 'blake2b'; +import { sized, TypedBytes } from '../generic'; +import { normalizeToU8a } from '../../utils'; + +export class AnchorHash extends sized(TypedBytes) { + static Size = 32; +} + +export class Anchor extends TypedBytes { + /** + * Returns new anchor produced by hashing given data using Blake2b. + * @param anchor + * @returns {AnchorHash} + */ + static hash(bytes) { + const hash = BLAKE2b(32); + hash.update(normalizeToU8a(bytes)); + + return new AnchorHash(hash.digest()); + } +} diff --git a/packages/credential-sdk/src/types/attest/index.js b/packages/credential-sdk/src/types/attest/index.js new file mode 100644 index 000000000..abab8f5a3 --- /dev/null +++ b/packages/credential-sdk/src/types/attest/index.js @@ -0,0 +1,12 @@ +import { + TypedStruct, option, TypedNumber, TypedString, +} from '../generic'; + +export class Iri extends TypedString {} + +export class Attest extends TypedStruct { + static Classes = { + priority: class Priority extends TypedNumber {}, + iri: option(Iri), + }; +} diff --git a/packages/credential-sdk/src/types/blob/blob-id.js b/packages/credential-sdk/src/types/blob/blob-id.js new file mode 100644 index 000000000..60e51714b --- /dev/null +++ b/packages/credential-sdk/src/types/blob/blob-id.js @@ -0,0 +1,64 @@ +import { encodeAsSS58, decodeFromSS58 } from '../../utils/ss58'; +import { isHex } from '../../utils/bytes'; +import { TypedBytes, sized, withQualifier } from '../generic'; +import { DockBlobQualifier } from './const'; + +export class BlobId extends withQualifier(TypedBytes) { + static Qualifier = DockBlobQualifier; + + static fromUnqualifiedString(bytes) { + return new this(isHex(bytes) ? bytes : decodeFromSS58(bytes)); + } + + toEncodedString() { + return encodeAsSS58(this.value); + } +} + +export class DockBlobId extends sized(BlobId) { + static Size = 32; +} + +/* +export class BlobIdIdent extends withQualifier(TypedBytes) { + static Qualifier = DockBlobQualifier; + + static fromUnqualifiedString(bytes) { + return new this(isHex(bytes) ? bytes : decodeFromSS58(bytes)); + } + + toEncodedString() { + return encodeAsSS58(this.value); + } +} + +export class BlobId extends IdentRef {} + +export class CheqdBlobIdIdent extends withFrom(sized(BlobIdIdent), (value, from) => value instanceof CheqdBlobId ? value[1]: from(value)) { + static Qualifier = DockBlobQualifier; + + static fromUnqualifiedString(bytes) { + return new this(bytes); + } + + toEncodedString() { + return this.value; + } +} + +export class CheqdBlobId extends BlobId { + static Ident = CheqdBlobIdIdent; +} + +export class DockBlobIdIdent extends withFrom(sized(BlobIdIdent), (value, from) => value instanceof DockBlobId ? value[1]: from(value)) { + static Size = 32; +} + +export class DockBlobId extends BlobId { + static Ident = DockBlobIdIdent; +} + +export class DockBlobId extends sized(BlobId) { + static Size = 32; +} +*/ diff --git a/packages/credential-sdk/src/types/blob/blob.js b/packages/credential-sdk/src/types/blob/blob.js new file mode 100644 index 000000000..d62e0cd3e --- /dev/null +++ b/packages/credential-sdk/src/types/blob/blob.js @@ -0,0 +1,57 @@ +import { TypedBytes } from '../generic'; +import { + hexToU8a, + isHex, + stringToU8a, + u8aToString, + u8aToU8a, +} from '../../utils'; + +export default class Blob extends TypedBytes { + constructor(value) { + let bytes; + if (value instanceof Uint8Array) { + bytes = value; + } else if (value && typeof value === 'object') { + if (typeof value[Symbol.iterator] !== 'function') { + bytes = stringToU8a(JSON.stringify(value)); + } else { + bytes = u8aToU8a(value); + } + } else if (typeof value === 'string') { + if (!isHex(value)) { + bytes = stringToU8a(value); + } else { + bytes = hexToU8a(value); + } + } + + super(bytes); + } + + static fromApi(value) { + return new this(value); + } + + static fromJSON(value) { + return new this(value); + } + + toObject() { + try { + return JSON.parse(u8aToString(this.bytes)); + } catch (err) { + throw new Error(`Underlying value is not a valid JSON: ${err}`); + } + } + + toObjectOrBytes() { + try { + return this.toObject(); + } catch (err) { + console.error('Failed to convert blob to JSON:', err); + + return this.bytes; + } + } +} diff --git a/packages/credential-sdk/src/types/blob/const.js b/packages/credential-sdk/src/types/blob/const.js new file mode 100644 index 000000000..1a559584e --- /dev/null +++ b/packages/credential-sdk/src/types/blob/const.js @@ -0,0 +1,2 @@ +export const DockBlobQualifier = 'blob:dock:'; +export const DockBlobIdByteSize = 32; diff --git a/packages/credential-sdk/src/types/blob/index.js b/packages/credential-sdk/src/types/blob/index.js new file mode 100644 index 000000000..1db3c6ceb --- /dev/null +++ b/packages/credential-sdk/src/types/blob/index.js @@ -0,0 +1,13 @@ +import { TypedStruct } from '../generic'; +import { BlobId } from './blob-id'; +import Blob from './blob'; + +export * from './blob-id'; +export { default as Blob } from './blob'; + +export class BlobWithId extends TypedStruct { + static Classes = { + id: BlobId, + blob: Blob, + }; +} diff --git a/packages/credential-sdk/src/types/did/document.js b/packages/credential-sdk/src/types/did/document.js new file mode 100644 index 000000000..5ee61f92b --- /dev/null +++ b/packages/credential-sdk/src/types/did/document.js @@ -0,0 +1,758 @@ +import { base58btc } from 'multiformats/bases/base58'; +import varint from 'varint'; +import bs58 from 'bs58'; +import { + Null, + TypedArray, + TypedBytes, + TypedEnum, + TypedNumber, + TypedString, + TypedStruct, + TypedTuple, + TypedUUID, + option, + withFrom, + withQualifier, +} from '../generic'; +import { LinkedDomains } from './offchain'; +import { NamespaceDid } from './onchain/typed-did'; +import { DidKey, DidKeyValue, DidKeys } from './onchain/did-key'; +import { VerificationRelationship } from './onchain/verification-relationship'; +import { + EcdsaSecp256k1VerKeyName, + Ed255192020VerKeyName, + Ed25519VerKeyName, + Sr25519VerKeyName, +} from '../../vc/custom_crypto'; +import { + PublicKeyEd25519, + PublicKeySecp256k1, + PublicKeySr25519, +} from '../public-keys'; +import { + fmtIter, + isBytes, + stringToU8a, + u8aToString, + withExtendedStaticProperties, +} from '../../utils'; + +export const ATTESTS_IRI = 'https://rdf.dock.io/alpha/2021#attestsDocumentContents'; + +export const CONTEXT_URI = 'https://www.w3.org/ns/did/v1'; + +class Context extends TypedArray { + static Class = TypedString; +} + +class ID extends NamespaceDid {} + +class AlsoKnownAs extends TypedArray { + static Class = NamespaceDid; +} + +class Controllers extends TypedArray { + static Class = NamespaceDid; +} + +class VerificationMethodType extends TypedEnum {} +class Ed25519Verification2018Method extends VerificationMethodType { + static Class = Null; + + static Type = 'Ed25519VerificationKey2018'; +} +class Ed25519Verification2020Method extends VerificationMethodType { + static Class = Null; + + static Type = 'Ed25519VerificationKey2020'; +} +class Sr25519Verification2020Method extends VerificationMethodType { + static Class = Null; + + static Type = 'Sr25519VerificationKey2020'; +} +class EcdsaSecp256k1VerificationKey2019 extends VerificationMethodType { + static Class = Null; + + static Type = 'EcdsaSecp256k1VerificationKey2019'; +} +class X25519KeyAgreementKey2019 extends VerificationMethodType { + static Class = Null; + + static Type = 'X25519KeyAgreementKey2019'; +} +class Bls12381G2VerificationKeyDock2022 extends VerificationMethodType { + static Class = Null; + + static Type = 'Bls12381G2VerificationKeyDock2022'; +} +class Bls12381BBSVerificationKeyDock2023 extends VerificationMethodType { + static Class = Null; + + static Type = 'Bls12381BBSVerificationKeyDock2023'; +} +class Bls12381BBDT16VerificationKeyDock2024 extends VerificationMethodType { + static Class = Null; + + static Type = 'Bls12381BBDT16VerificationKeyDock2024'; +} +class Bls12381PSVerificationKeyDock2023 extends VerificationMethodType { + static Class = Null; + + static Type = 'Bls12381PSVerificationKeyDock2023'; +} +VerificationMethodType.bindVariants( + Ed25519Verification2018Method, + Ed25519Verification2020Method, + Sr25519Verification2020Method, + EcdsaSecp256k1VerificationKey2019, + X25519KeyAgreementKey2019, + Bls12381G2VerificationKeyDock2022, + Bls12381BBSVerificationKeyDock2023, + Bls12381BBDT16VerificationKeyDock2024, + Bls12381PSVerificationKeyDock2023, +); + +export class TypedNumberOrTypedString extends withFrom( + TypedNumber, + (value, from) => (!Number.isNaN(Number(value)) || value instanceof TypedNumber + ? from(value) + : TypedString.from(value)), +) {} + +export class VerificationMethodRef extends withQualifier(TypedTuple) { + static Qualifier = ''; + + static Classes = [NamespaceDid, TypedNumber]; + + get did() { + return this[0]; + } + + get index() { + return this[1]; + } + + static fromUnqualifiedString(str) { + const regex = new RegExp(`^${this.Qualifier}([^#]+)#keys-(\\d+)$`); + const match = str.match(regex); + + if (!match) { + throw new Error(`Invalid format for VerificationMethodRef: \`${str}\``); + } + + const [, did, index] = match; + return new this(did, parseInt(index, 10)); + } + + toEncodedString() { + const { did, index } = this; + + return `${did}#keys-${index}`; + } + + toJSON() { + return this.toEncodedString(); + } +} + +export class IdentRef extends withQualifier(TypedTuple) { + static Qualifier = ''; + + static Ident = TypedString; + + static get Classes() { + return [NamespaceDid, this.Ident]; + } + + static random(did) { + return new this(did, this.Ident.random()); + } + + get did() { + return this[0]; + } + + get value() { + return this[1]; + } + + static fromUnqualifiedString(str) { + const regex = new RegExp(`^${this.Qualifier}([^#]+)#(.+)$`); + const match = str.match(regex); + + if (!match) { + throw new Error(`Invalid format for IdentRef: \`${str}\``); + } + + const [, did, value] = match; + return new this(did, value); + } + + toEncodedString() { + const { did, value } = this; + + return `${did}#${value}`; + } + + toJSON() { + return this.toString(); + } +} + +export class VerificationMethodRefOrIdentRef extends withFrom( + VerificationMethodRef, + (value, from) => { + try { + return from(value); + } catch { + return IdentRef.from(value); + } + }, +) {} + +export class DidKeyValueWithRef extends withFrom( + TypedStruct, + function (value, from) { + if (typeof value === 'string') { + const [ref, key] = value.split('='); + // eslint-disable-next-line no-use-before-define + const parsed = JSON.parse(u8aToString(new PublicKeyBase58(key).bytes)); + + return new this(ref, parsed); + } else { + return from(value); + } + }, +) { + static Classes = { + ref: VerificationMethodRef, + key: DidKeyValue, + }; + + toJSON() { + const { ref, key } = this; + + return `${ref.toString()}=${ + // eslint-disable-next-line no-use-before-define + new PublicKeyBase58(stringToU8a(JSON.stringify(key.toJSON()))).value + }`; + } +} + +export class VerificationMethodRefOrKey extends withFrom( + VerificationMethodRef, + (value, from) => { + try { + return DidKeyValueWithRef.from(value); + } catch (err) { + return from(value); + } + }, +) {} + +export class PublicKeyBase58 extends TypedString { + constructor(value) { + if (typeof value === 'string') { + // Decoding base58 if the input is a string + super(bs58.decode(value)); + } else { + // Handle case where value is already in byte format + super(value); + } + } + + get value() { + const { bytes } = this; + // Encode bytes back to base58 + return bs58.encode(bytes); + } +} + +export class PublicKeyMultibase extends withExtendedStaticProperties( + ['Prefix'], + TypedString, +) { + // Define the static prefix as a class variable + static Prefix; + + constructor(value) { + if (typeof value === 'string') { + if (value.startsWith('z')) { + // Decode base58btc multibase string + const decoded = base58btc.decode(value); + varint.decode(decoded); // Decode to get byte length + const bytes = decoded.slice(varint.decode.bytes); + + super(bytes); + } else { + throw new Error(`Invalid multibase string format: ${value}`); + } + } else { + // If it's already bytes + super(value); + } + } + + get value() { + const { + bytes, + constructor: { Prefix }, + } = this; + + // Use the static prefix (MULTICODEC_ED25519_HEADER) + const multibase = new Uint8Array(Prefix.length + bytes.length); + + // Add multibase prefix and concatenate with bytes + multibase.set(Prefix); + multibase.set(bytes, Prefix.length); + + // Return the encoded base58btc multibase string + return base58btc.encode(multibase); + } +} + +export class CheqdEd25519Key extends PublicKeyMultibase { + static Prefix = new Uint8Array([0xed, 0x01]); +} + +export class PublicKeyBase64 extends TypedString { + constructor(value) { + if (typeof value === 'string') { + super(atob(value)); + } else { + super(value); + } + } + + get value() { + return btoa(this.bytes); + } +} + +// eslint-disable-next-line no-use-before-define +export class VerificationMethod extends withFrom(TypedStruct, (value, from) => (value instanceof CheqdVerificationMethod + ? value.toVerificationMethod() + : from(value))) { + static Classes = { + id: VerificationMethodRef, + type: VerificationMethodType, + controller: NamespaceDid, + publicKeyBase58: option(PublicKeyBase58), + publicKeyBase64: option(PublicKeyBase64), + publicKeyJwk: option(TypedString), + publicKeyHex: option(TypedBytes), + }; + + publicKey() { + const bytes = ( + this.publicKeyBase58 + || this.publicKeyBase64 + || this.publicKeyJwk + || this.publicKeyHex + )?.bytes; + if (bytes == null) { + throw new Error( + `Expected either of ${fmtIter([ + 'publicKeyBase58', + 'publicKeyBase64', + 'publicKeyJwk', + 'publicKeyHex', + ])} to be specified`, + ); + } + + let PublicKey; + switch (this.type.type) { + case Ed25519VerKeyName: + PublicKey = PublicKeyEd25519; + break; + case Sr25519VerKeyName: + PublicKey = PublicKeySr25519; + break; + case Ed255192020VerKeyName: + PublicKey = PublicKeyEd25519; + break; + case EcdsaSecp256k1VerKeyName: + PublicKey = PublicKeySecp256k1; + break; + default: + throw new Error(`Unknown key type ${this.type.type}`); + } + + return new PublicKey(bytes); + } + + static fromDidKey(keyRef, didKey) { + const ref = VerificationMethodRef.from(keyRef); + + return new this( + ref, + didKey.publicKey.constructor.VerKeyType, + ref[0], + didKey.publicKey.value, + ); + } + + toCheqdVerificationMethod() { + // eslint-disable-next-line no-use-before-define + return new CheqdVerificationMethod( + this.id, + this.controller, + this.type, + this.publicKey().value.bytes, + ); + } +} + +export class CheqdVerificationMethod extends withFrom( + TypedStruct, + (value, from) => (value instanceof VerificationMethod + ? value.toCheqdVerificationMethod() + : from(value)), +) { + static Classes = { + id: VerificationMethodRef, + controller: NamespaceDid, + verificationMethodType: VerificationMethodType, + verificationMaterial: PublicKeyBase58, + }; + + toVerificationMethod() { + return new VerificationMethod( + this.id, + this.verificationMethodType, + this.controller, + this.verificationMaterial, + ); + } +} + +class VerificationMethods extends TypedArray { + static Class = VerificationMethod; +} + +export class ServiceEndpointId extends IdentRef {} + +export class SuffixServiceEndpointId extends withFrom( + TypedString, + (value, from) => from(isBytes(value) ? value : ServiceEndpointId.from(value)[1]), +) {} + +export class Service extends TypedStruct { + static Classes = { + id: ServiceEndpointId, + type: LinkedDomains, + serviceEndpoint: class ServiceEndpoints extends TypedArray { + static Class = class ServiceEndpoint extends TypedString {}; + }, + }; + + static fromServiceEndpoint(id, serviceEndpoint) { + return new this(id, serviceEndpoint.type, serviceEndpoint.origins); + } + + toCheqdService() { + // eslint-disable-next-line no-use-before-define + return new CheqdService(this.id, this.type, this.serviceEndpoint); + } +} + +export class CheqdService extends withFrom(TypedStruct, (value, from) => (value instanceof Service ? value.toCheqdService() : from(value))) { + static Classes = { + id: ServiceEndpointId, + serviceType: LinkedDomains, + serviceEndpoint: class ServiceEndpoints extends TypedArray { + static Class = class ServiceEndpoint extends TypedString {}; + }, + }; + + static fromServiceEndpoint(id, serviceEndpoint) { + return new this(id, serviceEndpoint.type, serviceEndpoint.origins); + } +} + +export class Services extends TypedArray { + static Class = Service; +} + +export class VerificationMethodReferences extends TypedArray { + static Class = VerificationMethodRef; +} + +export class VersionId extends TypedUUID {} + +class AssertionMethod extends TypedArray { + static Class = VerificationMethodRefOrKey; +} + +export class DIDDocument extends TypedStruct { + static Classes = { + '@context': Context, + id: ID, + alsoKnownAs: option(AlsoKnownAs), + controller: Controllers, + verificationMethod: VerificationMethods, + service: option(Services), + authentication: option(VerificationMethodReferences), + assertionMethod: option(AssertionMethod), + keyAgreement: option(VerificationMethodReferences), + capabilityInvocation: option(VerificationMethodReferences), + capabilityDelegation: option(VerificationMethodReferences), + [ATTESTS_IRI]: option(TypedString), + }; + + static create( + did, + keys, + controllers = [], + serviceEndpoints = {}, + { + context = [CONTEXT_URI], + alsoKnownAs = [], + capabilityDelegation = [], + [ATTESTS_IRI]: attests = null, + } = {}, + ) { + const obj = new this( + context, + did, + alsoKnownAs, + controllers, + [], + [], + [], + [], + [], + [], + capabilityDelegation, + attests, + ); + + let idx = 0; + for (const key of keys) { + obj.addKey([did, ++idx], key); + } + for (const [id, serviceEndpoint] of Object.entries(serviceEndpoints)) { + obj.addServiceEndpoint([did, id], serviceEndpoint); + } + + return obj; + } + + addKey(keyRef, didKey) { + const ref = VerificationMethodRef.from(keyRef); + const key = DidKey.from(didKey); + const isVerificationMethod = key.publicKey.constructor.VerificationMethod; + const refOrKey = isVerificationMethod + ? ref + : new DidKeyValueWithRef(keyRef, key.publicKey); + + if (key.verRels.isAuthentication()) { + this.authentication ||= []; + this.authentication.push(refOrKey); + } + if (key.verRels.isAssertion()) { + this.assertionMethod ||= []; + this.assertionMethod.push(refOrKey); + } + if (key.verRels.isKeyAgreement()) { + this.keyAgreement ||= []; + this.keyAgreement.push(refOrKey); + } + if (key.verRels.isCapabilityInvocation()) { + this.capabilityInvocation ||= []; + this.capabilityInvocation.push(refOrKey); + } + + if (isVerificationMethod) { + this.verificationMethod.push(VerificationMethod.fromDidKey(keyRef, key)); + } + + return this; + } + + addController(controller) { + this.controller.push(controller); + + return this; + } + + addServiceEndpoint(id, serviceEndpoint) { + this.service.push(Service.fromServiceEndpoint(id, serviceEndpoint)); + + return this; + } + + removeServiceEndpoint(id) { + this.service = this.service.filter((service) => !service.id.eq(id)); + + return this; + } + + removeKey(keyRef) { + const ref = VerificationMethodRef.from(keyRef); + const keyIndex = this.verificationMethod.findIndex((method) => method.id.eq(ref)); + + // eslint-disable-next-line no-bitwise + if (~keyIndex) { + this.verificationMethod.splice(keyIndex, 1); + } + + const isNotRef = (value) => !(value.ref ?? value).eq(ref); + + this.assertionMethod = this.assertionMethod?.filter(isNotRef); + this.authentication = this.authentication?.filter(isNotRef); + this.keyAgreement = this.keyAgreement?.filter(isNotRef); + this.capabilityInvocation = this.capabilityInvocation?.filter(isNotRef); + this.capabilityDelegation = this.capabilityDelegation?.filter(isNotRef); + + return this; + } + + get attests() { + return this[ATTESTS_IRI]; + } + + get publicKey() { + return this.verificationMethod; + } + + setAttests(iri) { + this[ATTESTS_IRI] = iri; + + return this; + } + + didKeys() { + const { + verificationMethod, + authentication, + assertionMethod, + keyAgreement, + capabilityInvocation, + capabilityDelegation, + } = this; + + if (capabilityDelegation && capabilityDelegation.length > 0) { + throw new Error('Capability delegation is not supported'); + } + + const auth = new Set([...authentication].map(String)); + const assertion = new Set([...assertionMethod].map(String)); + const keyAgr = new Set([...keyAgreement].map(String)); + const capInv = new Set([...capabilityInvocation].map(String)); + + const keys = [...verificationMethod] + .map((method) => { + const verRels = new VerificationRelationship(); + if (auth.has(String(method.id))) { + verRels.setAuthentication(); + } + if (assertion.has(String(method.id))) { + verRels.setAssertion(); + } + if (keyAgr.has(String(method.id))) { + verRels.setKeyAgreement(); + } + if (capInv.has(String(method.id))) { + verRels.setCapabilityInvocation(); + } + + return [method.id, new DidKey(method.publicKey(), verRels)]; + }) + .concat( + [...assertionMethod] + .filter((v) => v instanceof DidKeyValueWithRef) + .map((v) => [v.ref, new DidKey(v.key)]), + ) + .filter(Boolean); + + return new DidKeys(keys); + } + + toCheqd(versionId = TypedUUID.random()) { + const { + '@context': context, + id, + alsoKnownAs, + controller, + verificationMethod, + authentication, + assertionMethod, + capabilityInvocation, + capabilityDelegation, + keyAgreement, + service, + } = this; + + // eslint-disable-next-line no-use-before-define + return new CheqdDIDDocument( + context, + id, + alsoKnownAs, + controller, + verificationMethod, + service, + authentication, + assertionMethod, + keyAgreement, + capabilityInvocation, + capabilityDelegation, + versionId, + ); + } +} + +export class CheqdDIDDocument extends TypedStruct { + static Classes = { + context: Context, + id: ID, + alsoKnownAs: AlsoKnownAs, + controller: Controllers, + verificationMethod: class CheqdVerificationMethods extends TypedArray { + static Class = CheqdVerificationMethod; + }, + service: class CheqdServices extends TypedArray { + static Class = CheqdService; + }, + authentication: VerificationMethodReferences, + assertionMethod: AssertionMethod, + keyAgreement: VerificationMethodReferences, + capabilityInvocation: VerificationMethodReferences, + capabilityDelegation: VerificationMethodReferences, + versionId: option(VersionId), + }; + + toDIDDocument() { + const { + context, + id, + alsoKnownAs, + controller, + verificationMethod, + authentication, + assertionMethod, + capabilityInvocation, + capabilityDelegation, + keyAgreement, + service, + } = this; + + return new DIDDocument( + context, + id, + alsoKnownAs, + controller, + verificationMethod, + service, + authentication, + assertionMethod, + keyAgreement, + capabilityInvocation, + capabilityDelegation, + null, + ); + } +} diff --git a/packages/credential-sdk/src/types/did/index.js b/packages/credential-sdk/src/types/did/index.js new file mode 100644 index 000000000..ebfa6b435 --- /dev/null +++ b/packages/credential-sdk/src/types/did/index.js @@ -0,0 +1,25 @@ +import { TypedEnum } from '../generic'; +import { OffchainDidDetailsValue } from './offchain'; +import { StoredOnchainDidDetailsValue } from './onchain'; + +export * from './onchain'; +export * from './offchain'; +export * from './document'; + +export class StoredDidDetails extends TypedEnum {} + +export class StoredOnchainDidDetails extends StoredDidDetails { + static Type = 'onChain'; + + static Class = StoredOnchainDidDetailsValue; +} +export class StoredOffchainDidDetails extends StoredDidDetails { + static Type = 'offChain'; + + static Class = OffchainDidDetailsValue; +} + +StoredDidDetails.bindVariants( + StoredOnchainDidDetails, + StoredOffchainDidDetails, +); diff --git a/packages/credential-sdk/src/types/did/offchain/doc-ref.js b/packages/credential-sdk/src/types/did/offchain/doc-ref.js new file mode 100644 index 000000000..58321ada0 --- /dev/null +++ b/packages/credential-sdk/src/types/did/offchain/doc-ref.js @@ -0,0 +1,33 @@ +import { TypedEnum, TypedBytes } from '../../generic'; + +/** + * An off-chain DID Doc reference stored on-chain. The reference may be + * - a CID, https://docs.ipfs.io/concepts/content-addressing/#identifier-formats + * - a URL + * - any other format + */ +export class OffChainDidDocRef extends TypedEnum {} + +class DocValue extends TypedBytes {} + +export class CIDOffchainDocRef extends OffChainDidDocRef { + static Type = 'cid'; + + static Class = DocValue; +} +export class URLOffchainDocRef extends OffChainDidDocRef { + static Type = 'url'; + + static Class = DocValue; +} +export class CustomOffchainDocRef extends OffChainDidDocRef { + static Type = 'custom'; + + static Class = DocValue; +} + +OffChainDidDocRef.bindVariants( + CIDOffchainDocRef, + URLOffchainDocRef, + CustomOffchainDocRef, +); diff --git a/packages/credential-sdk/src/types/did/offchain/index.js b/packages/credential-sdk/src/types/did/offchain/index.js new file mode 100644 index 000000000..5705c20b2 --- /dev/null +++ b/packages/credential-sdk/src/types/did/offchain/index.js @@ -0,0 +1,14 @@ +import { sized, TypedBytes, TypedStruct } from '../../generic'; +import { OffChainDidDocRef } from './doc-ref'; + +export * from './doc-ref'; +export * from './service-endpoint'; + +export class OffchainDidDetailsValue extends TypedStruct { + static Classes = { + accountId: class AccountId extends sized(TypedBytes) { + static Size = 32; + }, + docRef: OffChainDidDocRef, + }; +} diff --git a/packages/credential-sdk/src/types/did/offchain/service-endpoint.js b/packages/credential-sdk/src/types/did/offchain/service-endpoint.js new file mode 100644 index 000000000..2add085be --- /dev/null +++ b/packages/credential-sdk/src/types/did/offchain/service-endpoint.js @@ -0,0 +1,66 @@ +import { maybeToNumber } from '../../../utils'; +import { + TypedStruct, + TypedString, + TypedArray, + TypedEnum, + createPlaceholder, + TypedMap, + Any, +} from '../../generic'; + +const LinkedDomainsPlaceholder = createPlaceholder((value) => { + if ( + +maybeToNumber(value) === 0b0001 + || String(value) === 'LinkedDomains' + || value == null + ) { + return 0b0001; + } else { + throw new Error(`Unknown value \`${value}\``); + } +}); + +export class ServiceEndpointType extends TypedEnum { + static fromApi(value) { + return new this(value); + } + + static fromJSON(value) { + return new this(value); + } + + static from(value) { + return new this(value); + } +} +export class LinkedDomains extends ServiceEndpointType { + static Type = 'LinkedDomains'; + + static Class = LinkedDomainsPlaceholder; + + toJSON() { + return this.constructor.Type; + } +} + +ServiceEndpointType.bindVariants(LinkedDomains); + +export class ServiceEndpointOrigin extends TypedString {} + +export class ServiceEndpointOrigins extends TypedArray { + static Class = ServiceEndpointOrigin; +} + +export class ServiceEndpoint extends TypedStruct { + static Classes = { + types: LinkedDomains, + origins: ServiceEndpointOrigins, + }; +} + +export class ServiceEndpoints extends TypedMap { + static KeyClass = Any; + + static ValueClass = ServiceEndpoint; +} diff --git a/src/did/constants.js b/packages/credential-sdk/src/types/did/onchain/constants.js similarity index 71% rename from src/did/constants.js rename to packages/credential-sdk/src/types/did/onchain/constants.js index b89b60d7d..2c9f3592f 100644 --- a/src/did/constants.js +++ b/packages/credential-sdk/src/types/did/onchain/constants.js @@ -1,10 +1,16 @@ export const DockDIDMethod = 'dock'; +export const CheqdDIDMethod = 'cheqd'; export const Secp256k1PublicKeyPrefix = 'zQ3s'; export const Ed25519PublicKeyPrefix = 'z6Mk'; export const DockDIDQualifier = `did:${DockDIDMethod}:`; export const DockDIDByteSize = 32; +export const CheqdDIDQualifier = `did:${CheqdDIDMethod}:`; +export const CheqdDIDTestnetQualifier = `${CheqdDIDQualifier}testnet:`; +export const CheqdDIDMainnetQualifier = `${CheqdDIDQualifier}mainnet:`; +export const CheqdDIDByteSize = 16; + export const DidMethodKeyQualifier = 'did:key:'; export const DidMethodKeySecp256k1ByteSize = 33; export const DidMethodKeyEd25519ByteSize = 32; diff --git a/packages/credential-sdk/src/types/did/onchain/controllers.js b/packages/credential-sdk/src/types/did/onchain/controllers.js new file mode 100644 index 000000000..57f2735be --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/controllers.js @@ -0,0 +1,6 @@ +import { TypedArray } from '../../generic'; +import { DockDidOrDidMethodKey } from './typed-did'; + +export class Controllers extends TypedArray { + static Class = DockDidOrDidMethodKey; +} diff --git a/packages/credential-sdk/src/types/did/onchain/did-key.js b/packages/credential-sdk/src/types/did/onchain/did-key.js new file mode 100644 index 000000000..6d99abbee --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/did-key.js @@ -0,0 +1,183 @@ +import { + Any, + TypedArray, + TypedEnum, + TypedMap, + TypedStruct, +} from '../../generic'; +import { + PublicKeyEd25519Value, + PublicKeySecp256k1Value, + PublicKeySr25519Value, + PublicKeyX25519Value, +} from '../../public-keys'; +import { + BBSPublicKeyValue, + BBSPlusPublicKeyValue, + PSPublicKeyValue, +} from '../../offchain-signatures'; +import { VerificationRelationship } from './verification-relationship'; +import { + Bls12381BBS23DockVerKeyName, + Bls12381BBSDockVerKeyName, + Bls12381PSDockVerKeyName, +} from '../../../vc/custom_crypto'; + +/** + * Class representing either of possible DidKeys. + * @class + * @extends {TypedEnum} + */ +export class DidKeyValue extends TypedEnum { + static get VerKeyType() { + return this.Class.VerKeyType; + } +} + +/** + * Class representing Ed25519 PublicKey + * @class + * @extends {PublicKey} + */ +export class DidKeyEd25519PublicKey extends DidKeyValue { + static Type = 'ed25519'; + + static Class = PublicKeyEd25519Value; + + static VerificationMethod = true; +} +/** + * Class representing Secp256k1 PublicKey + * @class + * @extends {PublicKey} + */ +export class DidKeySecp256k1PublicKey extends DidKeyValue { + static Type = 'secp256k1'; + + static Class = PublicKeySecp256k1Value; + + static VerificationMethod = true; +} +/** + * Class representing Sr25519 PublicKey + * @class + * @extends {PublicKey} + */ +export class DidKeySr25519PublicKey extends DidKeyValue { + static Type = 'sr25519'; + + static Class = PublicKeySr25519Value; + + static VerificationMethod = true; +} +/** + * Class representing X25519 PublicKey + * @class + * @extends {PublicKey} + */ +export class DidKeyX25519PublicKey extends DidKeyValue { + static Type = 'x25519'; + + static Class = PublicKeyX25519Value; + + static VerificationMethod = true; +} +export class DidKeyBBSPublicKey extends DidKeyValue { + static Class = BBSPublicKeyValue; + + static Type = 'bbs'; + + static VerKeyType = Bls12381BBS23DockVerKeyName; + + static VerificationMethod = false; +} +export class DidKeyBBSPlusPublicKey extends DidKeyValue { + static Class = BBSPlusPublicKeyValue; + + static Type = 'bbsPlus'; + + static VerKeyType = Bls12381BBSDockVerKeyName; + + static VerificationMethod = false; +} +export class DidKeyPSPublicKey extends DidKeyValue { + static Class = PSPublicKeyValue; + + static Type = 'ps'; + + static VerKeyType = Bls12381PSDockVerKeyName; + + static VerificationMethod = false; +} + +DidKeyValue.bindVariants( + DidKeyEd25519PublicKey, + DidKeySecp256k1PublicKey, + DidKeySr25519PublicKey, + DidKeyX25519PublicKey, + DidKeyBBSPublicKey, + DidKeyBBSPlusPublicKey, + DidKeyPSPublicKey, +); + +const Signing = [ + DidKeyEd25519PublicKey, + DidKeySr25519PublicKey, + DidKeySecp256k1PublicKey, +]; + +const Assertion = [ + DidKeyBBSPublicKey, + DidKeyBBSPlusPublicKey, + DidKeyPSPublicKey, +]; + +export class DidKey extends TypedStruct { + static Classes = { + publicKey: DidKeyValue, + verRels: VerificationRelationship, + }; + + /** + * + * @param {DidKeyValue} pk + * @param {VerificationRelationship} verRels + */ + constructor(pk, verRels = new VerificationRelationship()) { + const publicKey = DidKeyValue.from(pk); + + if (!+verRels) { + if ( + Signing.some( + (klass) => publicKey instanceof klass || publicKey instanceof klass.Class, + ) + ) { + verRels.setAllSigning(); + } else if ( + Assertion.some( + (klass) => publicKey instanceof klass || publicKey instanceof klass.Class, + ) + ) { + verRels.setAssertion(); + } else { + verRels.setKeyAgreement(); + } + } + + super(publicKey, verRels); + } + + static fromKeypair(keyPair, verRels) { + return new this(keyPair.publicKey(), verRels); + } +} + +export class DidKeysList extends TypedArray { + static Class = DidKey; +} + +export class DidKeys extends TypedMap { + static KeyClass = Any; + + static ValueClass = DidKey; +} diff --git a/packages/credential-sdk/src/types/did/onchain/index.js b/packages/credential-sdk/src/types/did/onchain/index.js new file mode 100644 index 000000000..411dbcafa --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/index.js @@ -0,0 +1,51 @@ +import { Null, TypedNumber, TypedStruct } from '../../generic'; + +export * from './utils'; +export * from './constants'; +export * from './typed-did'; +export * from './controllers'; +export * from './verification-relationship'; +export * from './did-key'; +export * from './verification-method-signature'; + +export class DidMethodKeyDetails extends TypedStruct { + static Classes = { + nonce: TypedNumber, + data: Null, + }; + + constructor(nonce) { + super(nonce, null); + } +} + +export class OnchainDidDetailsValue extends TypedStruct { + static Classes = { + lastKeyId: TypedNumber, + activeControllerKeys: TypedNumber, + activeControllers: TypedNumber, + }; +} + +export class StoredOnchainDidDetailsValue extends TypedStruct { + static Classes = { + nonce: TypedNumber, + data: OnchainDidDetailsValue, + }; + + constructor(nonce, data) { + super(nonce, data); + } + + get lastKeyId() { + return this.data.lastKeyId.value; + } + + get activeControllerKeys() { + return this.data.activeControllerKeys.value; + } + + get activeControllers() { + return this.data.activeControllers.value; + } +} diff --git a/packages/credential-sdk/src/types/did/onchain/typed-did/cheqd-did.js b/packages/credential-sdk/src/types/did/onchain/typed-did/cheqd-did.js new file mode 100644 index 000000000..4fcc76a78 --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/typed-did/cheqd-did.js @@ -0,0 +1,58 @@ +import { + CheqdDIDQualifier, + CheqdDIDTestnetQualifier, + CheqdDIDMainnetQualifier, +} from '../constants'; +import { TypedEnum, withQualifier } from '../../../generic'; +import TypedUUID from '../../../generic/typed-uuid'; + +/** + * `did:cheqd:*` + */ +export class CheqdDidValue extends withQualifier(TypedUUID) { + static Qualifier = CheqdDIDQualifier; + + toEncodedString() { + return this.value; + } + + static fromUnqualifiedString(str) { + return new this(str); + } +} + +export class CheqdTestnetDidValue extends CheqdDidValue { + static Qualifier = CheqdDIDTestnetQualifier; +} + +export class CheqdMainnetDidValue extends CheqdDidValue { + static Qualifier = CheqdDIDMainnetQualifier; +} + +export class CheqdDid extends withQualifier(TypedEnum, true) { + static random() { + return new this(this.Class.random()); + } + + toJSON() { + return String(this); + } +} + +export class CheqdTestnetDid extends CheqdDid { + static Class = CheqdTestnetDidValue; + + static Type = 'testnet'; +} +export class CheqdMainnetDid extends CheqdDid { + static Class = CheqdMainnetDidValue; + + static Type = 'mainnet'; +} +export class CheqdGenericDid extends CheqdDid { + static Class = CheqdDidValue; + + static Type = 'generic'; +} + +CheqdDid.bindVariants(CheqdTestnetDid, CheqdMainnetDid, CheqdGenericDid); diff --git a/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/did-method-key-public-key.js b/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/did-method-key-public-key.js new file mode 100644 index 000000000..d48356ee0 --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/did-method-key-public-key.js @@ -0,0 +1,104 @@ +import bs58 from 'bs58'; +import { base58btc } from 'multiformats/bases/base58'; +import varint from 'varint'; +import { TypedEnum, withQualifier } from '../../../../generic'; +import { + PublicKeyEd25519Value, + PublicKeySecp256k1Value, +} from '../../../../public-keys'; +import { + DidMethodKeyBytePrefixEd25519, + DidMethodKeyBytePrefixSecp256k1, + DidMethodKeyQualifier, + Ed25519PublicKeyPrefix, + Secp256k1PublicKeyPrefix, +} from '../../constants'; + +export class DidMethodKeyPublicKey extends withQualifier(TypedEnum) { + static Qualifier = DidMethodKeyQualifier; + + static Type = 'didMethodKey'; + + /** + * Instantiates `DidMethodKey` from a fully qualified did string. + * @param {string} did - fully qualified `did:key:*` string + * @returns {DidMethodKey} + */ + static fromUnqualifiedString(id) { + const multicodecPubKey = base58btc.decode(id); + varint.decode(multicodecPubKey); // NOTE: called to get byte length below + const bytes = multicodecPubKey.slice(varint.decode.bytes); + + let PublicKey; + if (id.startsWith(Secp256k1PublicKeyPrefix)) { + // eslint-disable-next-line no-use-before-define + PublicKey = DidMethodKeyPublicKeySecp256k1; + } else if (id.startsWith(Ed25519PublicKeyPrefix)) { + // eslint-disable-next-line no-use-before-define + PublicKey = DidMethodKeyPublicKeyEd25519; + } else { + throw new Error(`Unsupported \`did:key:*\`: \`${id}\``); + } + + return new PublicKey(bytes); + } + + /** + * Returns unqualified public key encoded in `BS58`. + */ + toEncodedString() { + const prefix = this.constructor.Prefix; + const publicKeyBytes = this.value.bytes; + + // Concatenate the prefix and the public key bytes + const didKeyBytes = new Uint8Array(prefix.length + publicKeyBytes.length); + didKeyBytes.set(prefix); + didKeyBytes.set(publicKeyBytes, prefix.length); + + // Encode the concatenated bytes to Base58 with z prefix + return `z${bs58.encode(didKeyBytes)}`; + } + + /** + * Creates a new `DidMethodKey` from the supplied keypair. + * + * @param {DockKeypair} keypair + * @returns {DidMethodKey} + */ + static fromKeypair(keypair) { + return this.from(keypair.publicKey().value); + } + + signWith(keyPair, bytes) { + if (!this.eq(this.constructor.fromKeypair(keyPair))) { + throw new Error('Expected keypair that has the same key as in `this`'); + } + + return { + didMethodKeySignature: { + didMethodKey: this, + sig: keyPair.sign(bytes), + }, + }; + } +} + +export class DidMethodKeyPublicKeyEd25519 extends DidMethodKeyPublicKey { + static Class = PublicKeyEd25519Value; + + static Type = PublicKeyEd25519Value.Type; + + static Prefix = DidMethodKeyBytePrefixEd25519; +} +export class DidMethodKeyPublicKeySecp256k1 extends DidMethodKeyPublicKey { + static Class = PublicKeySecp256k1Value; + + static Type = PublicKeySecp256k1Value.Type; + + static Prefix = DidMethodKeyBytePrefixSecp256k1; +} + +DidMethodKeyPublicKey.bindVariants( + DidMethodKeyPublicKeyEd25519, + DidMethodKeyPublicKeySecp256k1, +); diff --git a/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/did-method-key-signature.js b/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/did-method-key-signature.js new file mode 100644 index 000000000..22684ffc3 --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/did-method-key-signature.js @@ -0,0 +1,18 @@ +import { TypedEnum } from '../../../../generic'; +import { + SignatureEd25519Value, + SignatureSecp256k1Value, +} from '../../../../signatures'; + +export class DidMethodKeySignature extends TypedEnum {} +export class DidMethodKeySignatureEd25519 extends DidMethodKeySignature { + static Class = SignatureEd25519Value; +} +export class DidMethodKeySignatureSecp256k1 extends DidMethodKeySignature { + static Class = SignatureSecp256k1Value; +} + +DidMethodKeySignature.bindVariants( + DidMethodKeySignatureEd25519, + DidMethodKeySignatureSecp256k1, +); diff --git a/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/index.js b/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/index.js new file mode 100644 index 000000000..64b3330cd --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/typed-did/did-method-key/index.js @@ -0,0 +1,3 @@ +// export { default as DidMethodKeyValue } from "./did-method-key-value"; +export * from './did-method-key-public-key'; +export * from './did-method-key-signature'; diff --git a/packages/credential-sdk/src/types/did/onchain/typed-did/dock-did-value.js b/packages/credential-sdk/src/types/did/onchain/typed-did/dock-did-value.js new file mode 100644 index 000000000..5362dee57 --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/typed-did/dock-did-value.js @@ -0,0 +1,35 @@ +import { DockDIDQualifier } from '../constants'; +import { decodeFromSS58, encodeAsSS58, isHex } from '../../../../utils'; +import { withQualifier, TypedBytes, sized } from '../../../generic'; + +/** + * `did:dock:*` + */ +export default class DockDidValue extends sized(withQualifier(TypedBytes)) { + static Qualifier = DockDIDQualifier; + + static Type = 'did'; + + static Size = 32; + + static fromUnqualifiedString(did) { + return new this(isHex(did) ? did : decodeFromSS58(did)); + } + + /** + * Returns unqualified DID encoded as a `SS58` address. + */ + toEncodedString() { + return encodeAsSS58(this.value); + } + + signWith(keyPair, bytes) { + return { + didSignature: { + did: this, + keyId: keyPair.keyId, + sig: keyPair.sign(bytes), + }, + }; + } +} diff --git a/packages/credential-sdk/src/types/did/onchain/typed-did/index.js b/packages/credential-sdk/src/types/did/onchain/typed-did/index.js new file mode 100644 index 000000000..a76be7329 --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/typed-did/index.js @@ -0,0 +1,174 @@ +import { DidMethodKeyPublicKey } from './did-method-key'; +import DockDidValue from './dock-did-value'; +import { TypedEnum, withQualifier } from '../../../generic'; +import { CheqdDid } from './cheqd-did'; + +export const DockDidOrDidMethodKey = withQualifier( + class DockDidOrDidMethodKey extends TypedEnum { + /** + * Instantiates a random `dock:did:*`. + */ + static random() { + return new this(this.Class.random()); + } + + signWith(keyPair, bytes) { + return this.value.signWith(keyPair, bytes); + } + + /** + * Creates signature for the state change with supplied arguments. + * + * @param api + * @param name + * @param payload + * @param keyRef + * @returns {object} + */ + async signStateChange(apiProvider, name, payload, keyRef) { + // eslint-disable-next-line no-param-reassign + payload.nonce ??= 1 + (await apiProvider.nonce(this)); + if ( + Number(process.env.LOG_STATE_CHANGE) + || Boolean(process.env.LOG_STATE_CHANGE) + ) { + console.log('State change:', name, '=>', payload); + } + const bytes = await apiProvider.stateChangeBytes(name, payload); + + return this.signWith(keyRef, bytes); + } + + /** + * Creates a transaction that will modify the chain state. + * + * @param api + * @param method + * @param name + * @param payload + * @param keyRef + */ + async changeState(api, method, name, payload, keyRef) { + const signature = await this.signStateChange(api, name, payload, keyRef); + return await method(payload, signature); + } + + toString() { + return String(this.value); + } + + static fromApi(value) { + if (value.isDock) { + return super.from(value.asDock); + } else { + return super.fromApi(value); + } + } + + static fromJSON(json) { + if (json?.dock) { + return super.fromJSON({ did: json?.dock }); + } else { + return super.fromJSON(json); + } + } + + static from(value) { + // eslint-disable-next-line no-use-before-define + if (value instanceof NamespaceDid) { + return super.from(value.isDock ? { did: value.asDock } : value); + } else { + return super.from(value); + } + } + }, + true, +); + +export class DockDid extends DockDidOrDidMethodKey { + static Class = DockDidValue; + + toHex() { + return this.value.toHex(); + } + + toQualifiedString() { + return this.value.toQualifiedString(); + } +} + +export class DidMethodKey extends DockDidOrDidMethodKey { + static Class = DidMethodKeyPublicKey; + + static fromKeypair(keypair) { + return new this(DidMethodKeyPublicKey.fromKeypair(keypair)); + } +} + +DockDidOrDidMethodKey.bindVariants(DockDid, DidMethodKey); + +class DockDidValueToString extends DockDidValue { + toJSON() { + return String(this); + } +} + +class DidMethodKeyPublicKeyToString extends DidMethodKeyPublicKey { + toJSON() { + return String(this); + } +} + +export const NamespaceDid = withQualifier( + class extends TypedEnum { + toJSON() { + return String(this); + } + + static fromApi(value) { + if (value.isDid) { + return super.from({ dock: value.asDid }); + } else { + return super.fromApi(value); + } + } + + static fromJSON(json) { + if (json?.did && Object.keys(json).length === 1) { + return super.fromJSON({ dock: json.did }); + } else { + return super.fromJSON(json); + } + } + + static from(value) { + return super.from( + value instanceof DockDidOrDidMethodKey && value.isDid + ? { dock: value.asDid } + : value, + ); + } + }, + true, +); + +class DockNamespaceDid extends NamespaceDid { + static Type = 'dock'; + + static Class = DockDidValueToString; +} +class DidNamespaceKey extends NamespaceDid { + static Type = 'didMethodKey'; + + static Class = DidMethodKeyPublicKeyToString; +} +class CheqdNamespaceDid extends NamespaceDid { + static Type = 'cheqd'; + + static Class = CheqdDid; +} + +NamespaceDid.bindVariants(DockNamespaceDid, DidNamespaceKey, CheqdNamespaceDid); + +export { DockDidValue, DidMethodKeyPublicKey }; +export * from './cheqd-did'; diff --git a/src/did/utils.js b/packages/credential-sdk/src/types/did/onchain/utils.js similarity index 60% rename from src/did/utils.js rename to packages/credential-sdk/src/types/did/onchain/utils.js index 7a6c6c628..36448e5a8 100644 --- a/src/did/utils.js +++ b/packages/credential-sdk/src/types/did/onchain/utils.js @@ -1,52 +1,14 @@ /* eslint-disable max-classes-per-file */ -import { isHexWithGivenByteSize } from '../utils/codec'; +import { isHexWithGivenByteSize } from '../../../utils/bytes'; import { PublicKey, // eslint-disable-line - VerificationRelationship, // eslint-disable-line -} from '../public-keys'; +} from '../../public-keys'; -import { Signature } from "../signatures"; // eslint-disable-line +import { Signature } from "../../signatures"; // eslint-disable-line import { DockDIDByteSize } from './constants'; -/** - * Error thrown when a DID document lookup was successful, but the DID in question does not exist. - * This is different from a network error. - */ -export class NoDIDError extends Error { - constructor(did) { - super(`DID (${did}) does not exist`); - this.name = 'NoDIDError'; - this.did = did; - this.message = `A DID document lookup was successful, but the DID in question does not exist (${did}). This is different from a network error.`; - } -} - -/** - * Error thrown when a DID exists on chain but is an off-chain DID, meaning the DID document exists off-chain. - */ -export class NoOnchainDIDError extends Error { - constructor(did) { - super(`DID (${did}) is an off-chain DID`); - this.name = 'NoOnchainDIDError'; - this.did = did; - this.message = 'The DID exists on chain but is an off-chain DID, meaning the DID document exists off-chain.'; - } -} - -/** - * Error thrown when a DID exists on chain and is an on-chain DID but the lookup was performed for an off-chain DID. - */ -export class NoOffchainDIDError extends Error { - constructor(did) { - super(`DID (${did}) is an on-chain DID`); - this.name = 'NoOffchainDIDError'; - this.did = did; - this.message = 'The DID exists on chain and is an on-chain DID but the lookup was performed for an off-chain DID.'; - } -} - /** * Check if the given identifier is the hex representation of a Dock DID. * @param {string} identifier - The identifier to check. diff --git a/packages/credential-sdk/src/types/did/onchain/verification-method-signature.js b/packages/credential-sdk/src/types/did/onchain/verification-method-signature.js new file mode 100644 index 000000000..0c1d56f9d --- /dev/null +++ b/packages/credential-sdk/src/types/did/onchain/verification-method-signature.js @@ -0,0 +1,24 @@ +import { valueBytes } from '../../../utils/bytes'; +import { TypedStruct } from '../../generic'; +import { SignatureEd25519Value } from '../../signatures'; +import { VerificationMethodRef } from '../document'; + +class BytesSignatureEd25519Value extends SignatureEd25519Value { + toJSON() { + return Array.from(this); + } +} + +export class VerificationMethodSignature extends TypedStruct { + static Classes = { + verificationMethodId: VerificationMethodRef, + signature: BytesSignatureEd25519Value, + }; + + static fromDidKeypair(signer, bytes) { + return new this( + signer.verificationMethodId, + valueBytes(signer.sign(bytes)), + ); + } +} diff --git a/src/public-keys/verification-relationship.js b/packages/credential-sdk/src/types/did/onchain/verification-relationship.js similarity index 81% rename from src/public-keys/verification-relationship.js rename to packages/credential-sdk/src/types/did/onchain/verification-relationship.js index cdd0806b8..290cc5426 100644 --- a/src/public-keys/verification-relationship.js +++ b/packages/credential-sdk/src/types/did/onchain/verification-relationship.js @@ -1,31 +1,38 @@ -export default class VerificationRelationship { +import { TypedNumber } from '../../generic'; + +export class VerificationRelationship extends TypedNumber { constructor(value = 0) { - this.value = value; + super(value); } setAuthentication() { // eslint-disable-next-line no-bitwise this.value |= 0b0001; + return this; } setAssertion() { // eslint-disable-next-line no-bitwise this.value |= 0b0010; + return this; } setCapabilityInvocation() { // eslint-disable-next-line no-bitwise this.value |= 0b0100; + return this; } setKeyAgreement() { // eslint-disable-next-line no-bitwise this.value |= 0b1000; + return this; } setAllSigning() { // eslint-disable-next-line no-bitwise this.value |= 0b0111; + return this; } isAuthentication() { diff --git a/packages/credential-sdk/src/types/generic/create-placeholder.js b/packages/credential-sdk/src/types/generic/create-placeholder.js new file mode 100644 index 000000000..a2568d095 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/create-placeholder.js @@ -0,0 +1,23 @@ +import { NotAConstructor } from '../../utils/interfaces'; + +/** + * Creates a typed placeholder that implements `from`/`fromJSON`/`fromApi` and creates a value from the supplied + * argument using `makePlacholder` function. + * + * @template P + * @param {function(*): P} makePlaceholder + * @returns {function(*): P} + */ +export default function createPlaceholder(makePlaceholder) { + const name = `placeholder(${makePlaceholder.name})`; + const obj = { + [name]: (...args) => makePlaceholder(...args), + }; + + obj[name][NotAConstructor] = true; + obj[name].from = obj[name]; + obj[name].fromApi = obj[name]; + obj[name].fromJSON = obj[name]; + + return obj[name]; +} diff --git a/packages/credential-sdk/src/types/generic/index.js b/packages/credential-sdk/src/types/generic/index.js new file mode 100644 index 000000000..001f4cc4b --- /dev/null +++ b/packages/credential-sdk/src/types/generic/index.js @@ -0,0 +1,21 @@ +export { default as TypedEnum } from './typed-enum'; +export { default as TypedBytes } from './typed-bytes'; +export { default as TypedString } from './typed-string'; +export { default as createPlaceholder } from './create-placeholder'; +export { default as TypedArray } from './typed-array'; +export { default as TypedTuple } from './typed-tuple'; +export { default as Null } from './typed-null'; +export { default as option } from './option'; +export { default as sized } from './sized'; +export { default as TypedNumber } from './typed-number'; +export { default as TypedSet } from './typed-set'; +export { default as TypedMap } from './typed-map'; +export { default as TypedStruct } from './typed-struct'; +export { default as TypedBytesArray } from './typed-bytes-array'; +export { default as TypedUUID } from './typed-uuid'; +export { default as withQualifier } from './with-qualifier'; +export { default as withBase } from './with-base'; +export { default as withProp } from './with-prop'; +export { default as withFrom } from './with-from'; +export { default as withNullIfNotAVariant } from './with-null-if-not-a-variant'; +export { default as Any } from './typed-any'; diff --git a/packages/credential-sdk/src/types/generic/option.js b/packages/credential-sdk/src/types/generic/option.js new file mode 100644 index 000000000..e8cb42dce --- /dev/null +++ b/packages/credential-sdk/src/types/generic/option.js @@ -0,0 +1,86 @@ +import { NotAConstructor } from '../../utils'; + +/** + * Extends `fromApi`/`fromJSON`/`from` methods of the provided class to check for the `null`'ish (`None`) values. + * In case `class.from(null)` is called, returns `null` instead of throwing an error. + * + * @template C + * @param {C} klass + * @returns {C} + */ +/* eslint-disable sonarjs/cognitive-complexity */ +export default function option(klass) { + const name = `Option<${klass.name}>`; + + if (klass[NotAConstructor]) { + const obj = { + [name](...args) { + return klass.apply(this, args); + }, + }; + + obj[name].fromApi = function fromApi(valueOrValueOpt) { + if (valueOrValueOpt == null || valueOrValueOpt.isNone) { + return null; + } else if (valueOrValueOpt.isSome) { + return klass.fromApi(valueOrValueOpt.unwrap()); + } else { + return klass.fromApi(valueOrValueOpt); + } + }; + + obj[name].from = function from(valueOrValueOpt) { + if (valueOrValueOpt == null) { + return null; + } else if (valueOrValueOpt.isSome != null) { + return this.fromApi(valueOrValueOpt); + } else { + return klass.from(valueOrValueOpt); + } + }; + + obj[name].fromJSON = function fromJSON(valueOrNull) { + if (valueOrNull == null) { + return null; + } else { + return klass.fromJSON(valueOrNull); + } + }; + + return obj[name]; + } + + const obj = { + [name]: class extends klass { + static fromApi(valueOrValueOpt) { + if (valueOrValueOpt == null || valueOrValueOpt.isNone) { + return null; + } else if (valueOrValueOpt.isSome) { + return super.fromApi(valueOrValueOpt.unwrap()); + } else { + return super.fromApi(valueOrValueOpt); + } + } + + static from(valueOrValueOpt) { + if (valueOrValueOpt == null) { + return null; + } else if (valueOrValueOpt.isSome != null) { + return this.fromApi(valueOrValueOpt); + } else { + return super.from(valueOrValueOpt); + } + } + + static fromJSON(valueOrNull) { + if (valueOrNull == null) { + return null; + } else { + return super.fromJSON(valueOrNull); + } + } + }, + }; + + return obj[name]; +} diff --git a/packages/credential-sdk/src/types/generic/sized.js b/packages/credential-sdk/src/types/generic/sized.js new file mode 100644 index 000000000..624ef7e1f --- /dev/null +++ b/packages/credential-sdk/src/types/generic/sized.js @@ -0,0 +1,63 @@ +import { allProperties, withExtendedStaticProperties } from '../../utils'; + +/** + * Extends supplied class to check that its itstance lenght is always equal to the `static Size` property + * defined on the extended class. + * + * @template C + * @param {C} klass + * @param {function(*): number} getSize + * @returns {C} + */ +export default function sized(klass, getSize = ({ length }) => length) { + const name = `Sized<${klass.name}>`; + const methods = [...allProperties(klass.prototype)].filter( + (prop) => typeof klass.prototype[prop] === 'function' && prop !== 'constructor', + ); + + const obj = { + [name]: class extends klass { + static Size; + + constructor(...args) { + super(...args); + + this.ensureValidSize(); + } + + ensureValidSize() { + const { Size } = this.constructor; + + if (typeof Size !== 'number') { + throw new Error( + `Size must be a number, received \`${Size?.toString()}\``, + ); + } + + const size = getSize(this); + + if (size !== Size) { + throw new Error( + `Received \`${size}\` items while expected \`${Size}\` by \`${this.constructor.name}\``, + ); + } + } + + static random() { + return super.random(this.Size); + } + }, + }; + + for (const method of methods) { + // eslint-disable-next-line func-names + obj[name].prototype[method] = function (...args) { + const res = klass.prototype[method].apply(this, args); + this.ensureValidSize(); + + return res; + }; + } + + return withExtendedStaticProperties(['Size'], obj[name]); +} diff --git a/packages/credential-sdk/src/types/generic/typed-any.js b/packages/credential-sdk/src/types/generic/typed-any.js new file mode 100644 index 000000000..c0875305f --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-any.js @@ -0,0 +1,5 @@ +import createPlaceholder from './create-placeholder'; + +const Any = (any) => any; + +export default createPlaceholder(Any); diff --git a/packages/credential-sdk/src/types/generic/typed-array.js b/packages/credential-sdk/src/types/generic/typed-array.js new file mode 100644 index 000000000..0222ebf9b --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-array.js @@ -0,0 +1,98 @@ +import { ArrayWithoutPrototypeMethods, ensureArrayLike } from '../../utils'; +import { withExtendedStaticProperties } from '../../utils/inheritance'; +import { maybeEq, maybeFrom, maybeToJSON } from '../../utils/interfaces'; +import withBase from './with-base'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +/** + * An `Array` of items where each item is an instance of the associated `Class`. + */ +class TypedArray extends withBase(ArrayWithoutPrototypeMethods) { + /** + * Item class. + */ + static Class; + + constructor(...items) { + if (items.length === 1 && typeof items[0] === 'number') { + super(items[0]); + + return; + } + super(items.length); + + for (let idx = 0; idx < items.length; idx++) { + try { + this[idx] = maybeFrom(this.constructor.Class, items[idx]); + } catch (error) { + error.message = `\nFailed to set \`${idx}\` item of \`${this.constructor.name}\`:\n${error}`; + + throw error; + } + } + } + + push(item) { + return Array.prototype.push.call( + this, + maybeFrom(this.constructor.Class, item), + ); + } + + unshift(item) { + return Array.prototype.unshift.call( + this, + maybeFrom(this.constructor.Class, item), + ); + } + + toJSON() { + return [...Array.prototype.values.call(this)].map(maybeToJSON); + } + + static fromApi(arr) { + return new this(...ensureArrayLike(arr, this.name)); + } + + static fromJSON(arr) { + return new this(...ensureArrayLike(arr, this.name)); + } + + static from(value) { + if (value instanceof this) { + return value; + } else if (Array.isArray(value)) { + return this.fromJSON(value); + } else if (typeof value === 'object') { + return this.fromApi(value); + } else { + return new this(value); + } + } + + eq(other) { + if (this.length !== other.length) { + return false; + } + + for (let i = 0; i < this.length; i++) { + if (!maybeEq(this[i], other[i])) { + return false; + } + } + + return true; + } + + diff(other) { + return { + added: this.filter((item) => other.every((curItem) => !curItem.eq(item))), + removed: other.filter((item) => this.every((nextItem) => !nextItem.eq(item))), + }; + } +} + +export default withEq( + withCatchNull(withExtendedStaticProperties(['Class'], TypedArray)), +); diff --git a/packages/credential-sdk/src/types/generic/typed-bytes-array.js b/packages/credential-sdk/src/types/generic/typed-bytes-array.js new file mode 100644 index 000000000..65d63ccda --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-bytes-array.js @@ -0,0 +1,7 @@ +import TypedBytes from './typed-bytes'; + +export default class TypedBytesArray extends TypedBytes { + get value() { + return Array.from(this); + } +} diff --git a/packages/credential-sdk/src/types/generic/typed-bytes.js b/packages/credential-sdk/src/types/generic/typed-bytes.js new file mode 100644 index 000000000..c0dd507de --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-bytes.js @@ -0,0 +1,87 @@ +import { + normalizeToU8a, + randomAsU8a, + u8aToHex, + u8aToU8a, +} from '../../utils/bytes'; +import { ensureByte } from '../../utils/type-helpers'; +import { ArrayWithoutPrototypeMethods } from '../../utils/generic'; +import withBase from './with-base'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +class TypedBytes extends withBase(ArrayWithoutPrototypeMethods) { + constructor(value) { + super(); + + this.set(normalizeToU8a(value)); + } + + get value() { + return u8aToHex(this.bytes); + } + + get bytes() { + return u8aToU8a(Array.prototype.values.call(this)); + } + + set(bytes) { + this.length = 0; + this.length = bytes.length; + + for (let i = 0; i < bytes.length; i++) { + this[i] = ensureByte(bytes[i]); + } + } + + static fromApi(value) { + return new this(value); + } + + static random(size) { + // eslint-disable-next-line no-bitwise + if (!Number.isInteger(size) || (size & 65535) !== size || !size) { + throw new Error( + `Expected a natural number between 1 and 65535, received: \`${size}\``, + ); + } + + return new this(randomAsU8a(size)); + } + + toHex() { + return u8aToHex(this.bytes); + } + + toJSON() { + return this.value; + } + + static fromJSON(json) { + return new this(json); + } + + static from(obj) { + if (obj instanceof this) { + return obj; + } else if (!Array.isArray(obj) && typeof obj !== 'string') { + return this.fromApi(obj); + } else { + return new this(obj); + } + } + + eq(other) { + return String(this) === String(other); + } + + toString() { + return this.toHex(); + } + + toLocaleString() { + return this.toString(); + } +} + +export default withEq(withCatchNull(TypedBytes)); diff --git a/packages/credential-sdk/src/types/generic/typed-enum.js b/packages/credential-sdk/src/types/generic/typed-enum.js new file mode 100644 index 000000000..05bd0c508 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-enum.js @@ -0,0 +1,321 @@ +/* eslint-disable max-classes-per-file */ +import { fmtIter } from '../../utils/generic'; +import { + isEqualToOrPrototypeOf, + withExtendedStaticProperties, +} from '../../utils/inheritance'; +import { + maybeEq, + maybeFrom, + maybeNew, + maybeToJSON, +} from '../../utils/interfaces'; +import withBase from './with-base'; +import Null from './typed-null'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +/** + * @template V + */ +class TypedEnum extends withBase(class EnumBase {}) { + /** + * Possible subclasses. + * @type {Array} + * @static Variants + */ + static Variants; + + /** + * Class used to construct underlying value. + * @type {Function} + * @static Class + */ + static Class; + + /** + * The type of the enumeration. + * @type {string} + * @static + */ + static get Type() { + return this.Class.Type; + } + + /** + * Associates enum parameters with the base enum class and vice versa. + * @template Class + * @param {...this} classes + */ + /* eslint-disable */ + static bindVariants(...classes) { + class ClassIsBoundError extends Error { + constructor(klass) { + super(`Class \`${klass}\` is already bound`); + } + } + + if (Object.hasOwnProperty(this, "Variants")) { + throw new ClassIsBoundError(this); + } + + for (const klass of classes) { + if (klass === this) { + throw new Error(`\`${klass.name}\` can't be a variant of itself`); + } + if (!klass.Type) + throw new Error(`No \`Type\` specified in \`${klass.name}\``); + + const { Class, Type, isIdentifier, asIdentifier } = klass; + + Object.defineProperty(this.prototype, isIdentifier, { + get() { + return this instanceof klass; + }, + enumerable: false, + }); + + Object.defineProperty(this.prototype, asIdentifier, { + get() { + if (this[isIdentifier]) { + return this[Type]; + } else { + throw new Error(`Not a \`${Type}\``); + } + }, + enumerable: false, + }); + + const that = this; + const klassFrom = Class.from; + Class.from = function from(value) { + if (value instanceof that) { + return value[asIdentifier]; + } else { + return klassFrom.call(this, value); + } + }; + } + + this.Variants = classes; + } + /* eslint-enable */ + + static get isIdentifier() { + const { JsonType } = this; + + return `is${JsonType}`; + } + + static get asIdentifier() { + const { JsonType } = this; + + return `as${JsonType}`; + } + + static get JsonType() { + const { Type } = this; + + return `${Type[0].toUpperCase()}${Type.slice(1)}`; + } + + /** + * Create a new TypedEnum instance. + * @param {V} value - The value of the enumeration. + */ + constructor(value) { + super(); + + const { Class, name } = this.constructor; + + if (Class == null) { + throw new Error(`\`Class\` property is not specified for \`${name}\``); + } + + try { + this[this.type] = maybeFrom(Class, value); + } catch (error) { + error.message = `\nFailed to construct variant \`${Class.name}\` of \`${name}\`:\n${error}`; + + throw error; + } + } + + /** + * Get the type of the enumeration. + * @returns {string} The type of the enumeration. + */ + get type() { + return this.constructor.Type; + } + + get jsonType() { + return this.constructor.JsonType; + } + + /** + * Get the value of the enumeration. + * @returns {V} The value of the enumeration. + */ + get value() { + return this[this.type]; + } + + /** + * Convert the instance to a JSON representation. + * @returns {Object} The JSON representation of the instance. + */ + toJSON() { + if (this.constructor.isNullish) { + return this.constructor.JsonType; + } else { + const { type, value } = this; + + return { + [type]: maybeToJSON(value), + }; + } + } + + // eslint-disable-next-line + static fromJSON(json) { + if (json == null) { + throw new Error( + `Received \`null\` while object was expected by \`${this.name}\``, + ); + } + if (typeof json === 'string' && this.isNullish) { + if (this.Class != null) { + if (this.JsonType === json || this.Type === json) { + return maybeNew(this, []); + } + + throw new Error( + `Unexpected json in \`${this}\`: \`${json}\`, expected \`${this.JsonType}\``, + ); + } else { + for (const Variant of this.Variants) { + if (Variant.JsonType === json || Variant.Type === json) { + return Variant.fromJSON(json); + } + } + + throw new Error( + `Unexpected json in \`${this}\`: \`${json}\`, expected one of ${fmtIter( + new Set([...this.Variants].flatMap((v) => [v.JsonType, v.Type])), + )}`, + ); + } + } + + const keys = Object.keys(json); + if (keys.length !== 1) { + throw new Error( + `Expected object with 1 key, received \`${json}\` with keys: ${fmtIter( + keys, + )} by ${this.name}`, + ); + } + const [key] = keys; + + if (this.Class != null) { + if (this.JsonType === key || this.Type === key) { + return maybeNew(this, [json[key]]); + } + + throw new Error( + `Unexpected key \`${key}\`, expected \`${this.JsonType}\` by \`${this.name}\``, + ); + } else { + for (const Variant of this.Variants) { + if (Variant.JsonType === key || Variant.Type === key) { + return Variant.fromJSON(json); + } + } + + throw new Error( + `Invalid key \`${key}\`, expected one of ${fmtIter( + new Set([...this.Variants].flatMap((v) => [v.JsonType, v.Type])), + )} by \`${this.name}\``, + ); + } + } + + static fromApi(obj) { + if (this.Class != null) { + if (obj[this.isIdentifier]) { + return maybeNew(this, [obj[this.asIdentifier]]); + } else { + throw new Error( + `Incompatible value provided: \`${obj}\` to \`${this}\``, + ); + } + } else { + for (const Variant of this.Variants) { + if (obj[Variant.isIdentifier]) { + return Variant.fromApi(obj); + } + } + } + + throw new Error( + `Invalid object received: \`${maybeToJSON( + obj, + )}\`, expected to build an instance of ${fmtIter( + this.Variants.map((v) => v.Type), + )} by \`${this.name}\``, + ); + } + + static variant(obj) { + return this.Variants.find((variant) => isEqualToOrPrototypeOf(variant.Class, obj?.constructor ?? Null)); + } + + static directVariant(obj) { + return this.Variants.find((variant) => isEqualToOrPrototypeOf(variant, obj?.constructor ?? Null)); + } + + static get isNullish() { + return this.Class + ? this.Class === Null + : this.Variants.every((variant) => variant.Class === Null); + } + + static from(obj) { + if (obj instanceof this) { + return obj; + } else if (typeof obj === 'string' && this.isNullish) { + return this.fromJSON(obj); + } else if (Object.getPrototypeOf(obj) === Object.getPrototypeOf({})) { + return this.fromJSON(obj); + } else if (this.Class == null) { + const Variant = this.variant(obj); + + if (Variant) { + return new Variant(obj); + } else { + const DirectVariant = this.directVariant(obj); + + if (DirectVariant != null) { + return DirectVariant.from(obj); + } + } + } else if (obj instanceof this.Class) { + return new this(this.Class.from(obj)); + } + + return this.fromApi(obj); + } + + eq(other) { + return this.type === other.type && maybeEq(this.value, other.value); + } + + toString() { + return JSON.stringify(this.toJSON()); + } +} + +export default withEq( + withCatchNull(withExtendedStaticProperties(['Variants'], TypedEnum)), +); diff --git a/packages/credential-sdk/src/types/generic/typed-map.js b/packages/credential-sdk/src/types/generic/typed-map.js new file mode 100644 index 000000000..56e6df4bf --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-map.js @@ -0,0 +1,130 @@ +import { maybeEq, maybeFrom, maybeToJSON } from '../../utils/interfaces'; +import { withExtendedStaticProperties } from '../../utils/inheritance'; +import withBase from './with-base'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +class TypedMap extends withBase(Map) { + static KeyClass; + + static ValueClass; + + constructor(values = []) { + super(); + + this.keysAsKeyClass = new Map(); + + for (const [key, value] of values) { + this.set(key, value); + } + } + + keyAsKeyClass(key) { + const asKeyClass = maybeFrom(this.constructor.KeyClass, key); + const strKey = JSON.stringify(maybeToJSON(asKeyClass)); + + if (this.keysAsKeyClass.has(strKey)) { + return this.keysAsKeyClass.get(strKey); + } else { + this.keysAsKeyClass.set(strKey, asKeyClass); + + return asKeyClass; + } + } + + set(key, value) { + return super.set( + this.keyAsKeyClass(key), + maybeFrom(this.constructor.ValueClass, value), + ); + } + + get(key) { + return super.get(this.keyAsKeyClass(key)); + } + + has(key) { + return super.has(this.keyAsKeyClass(key)); + } + + delete(key) { + const removed = super.delete(this.keyAsKeyClass(key)); + if (removed) this.keysAsKeyClass.delete(key); + + return removed; + } + + clear() { + this.clear(); + this.keysAsKeyClass.clear(); + } + + toJSON() { + return [...this.entries()] + .map(([key, value]) => [maybeToJSON(key), maybeToJSON(value)]) + .sort(([k1], [k2]) => String(k1).localeCompare(String(k2))); + } + + static fromJSON(entries) { + return new this( + [...entries].map(([key, value]) => [ + this.KeyClass.fromJSON(key), + this.ValueClass.fromJSON(value), + ]), + ); + } + + static fromApi(obj) { + return new this( + [...obj.entries()].map(([key, value]) => [ + this.KeyClass.fromApi(key), + this.ValueClass.fromApi(value), + ]), + ); + } + + static from(obj) { + if (obj instanceof this) { + return obj; + } else if (Array.isArray(obj)) { + return this.fromJSON(obj); + } else if (obj && typeof obj === 'object') { + return this.fromApi(obj); + } else { + return new this(obj); + } + } + + eq(other) { + return ( + this.size === other.size + && this.entries().all(([key, value]) => maybeEq(other.get(key), value)) + ); + } + + diff(other) { + return { + added: new this.constructor( + [...this.keys()] + .filter((key) => !other.has(key)) + .map((key) => [key, this.get(key)]), + ), + removed: new this.constructor( + [...other.keys()] + .filter((key) => !this.has(key)) + .map((key) => [key, other.get(key)]), + ), + modified: new this.constructor( + [...this.keys()] + .filter((key) => other.has(key) && !this.get(key).eq(other.get(key))) + .map((key) => [key, this.get(key)]), + ), + }; + } +} + +export default withEq( + withCatchNull( + withExtendedStaticProperties(['KeyClass', 'ValueClass'], TypedMap), + ), +); diff --git a/packages/credential-sdk/src/types/generic/typed-null.js b/packages/credential-sdk/src/types/generic/typed-null.js new file mode 100644 index 000000000..b18ced280 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-null.js @@ -0,0 +1,11 @@ +import createPlaceholder from './create-placeholder'; + +const Null = (value) => { + if (value == null || !String(value).length) { + return null; + } else { + throw new Error(`Unexpected value received: \`${value}\``); + } +}; + +export default createPlaceholder(Null); diff --git a/packages/credential-sdk/src/types/generic/typed-number.js b/packages/credential-sdk/src/types/generic/typed-number.js new file mode 100644 index 000000000..dd58358e2 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-number.js @@ -0,0 +1,51 @@ +import { maybeToNumber } from '../../utils/interfaces'; +import withBase from './with-base'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +class TypedNumber extends withBase(class NumberBase {}) { + constructor(value) { + super(); + + const num = Number(value); + if (!Number.isFinite(num)) { + throw new Error( + `Invalid number provided: \`${value}\`, parsed as \`${num}\` by \`${this.constructor.name}\``, + ); + } + + this.value = num; + } + + static from(value) { + if (value instanceof this) { + return value; + } else if (typeof value === 'object') { + return this.fromApi(value); + } else { + return new this(value); + } + } + + toJSON() { + return this.value; + } + + static fromJSON(value) { + return new this(value); + } + + static fromApi(value) { + return new this(maybeToNumber(value.value ?? value)); + } + + valueOf() { + return this.value; + } + + eq(other) { + return this.value === other.value; + } +} + +export default withEq(withCatchNull(TypedNumber)); diff --git a/packages/credential-sdk/src/types/generic/typed-set.js b/packages/credential-sdk/src/types/generic/typed-set.js new file mode 100644 index 000000000..d67c1af58 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-set.js @@ -0,0 +1,85 @@ +import { maybeFrom, maybeToJSON } from '../../utils/interfaces'; +import { withExtendedStaticProperties } from '../../utils/inheritance'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +class TypedSet extends Set { + static Class; + + constructor(values = []) { + super(); + + this.valuesAsClass = new Map(); + + for (const value of values) { + this.add(value); + } + } + + valueAsClass(value) { + const valuesAsClass = maybeFrom(this.constructor.Class, value); + const valueStr = JSON.stringify(maybeToJSON(valuesAsClass)); + + if (this.valuesAsClass.has(valueStr)) { + return this.valuesAsClass.get(valueStr); + } else { + this.valuesAsClass.set(valueStr, valuesAsClass); + + return valuesAsClass; + } + } + + delete(key) { + const removed = super.delete(this.valueAsClass(key)); + if (removed) this.valuesAsClass.delete(key); + + return removed; + } + + add(value) { + return super.add(this.valueAsClass(value)); + } + + has(value) { + return super.has(this.valueAsClass(value)); + } + + toJSON() { + return [...this.values()].map(maybeToJSON).sort(); + } + + clear() { + this.clear(); + this.valuesAsClass.clear(); + } + + static fromJSON(values) { + return new this(values); + } + + static fromApi(value) { + return new this(value.values()); + } + + static from(obj) { + if (obj instanceof this) { + return obj; + } else if (Array.isArray(obj)) { + return this.fromJSON(obj); + } else if (obj && typeof obj === 'object') { + return this.fromApi(obj); + } else { + return new this(obj); + } + } + + eq(other) { + return ( + this.size === other.size && this.values().all((value) => other.has(value)) + ); + } +} + +export default withEq( + withCatchNull(withExtendedStaticProperties(['Class'], TypedSet)), +); diff --git a/packages/credential-sdk/src/types/generic/typed-string.js b/packages/credential-sdk/src/types/generic/typed-string.js new file mode 100644 index 000000000..19875ce8d --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-string.js @@ -0,0 +1,35 @@ +import { normalizeOrConvertStringToU8a, u8aToString } from '../../utils/bytes'; +import TypedBytes from './typed-bytes'; +import withCatchNull from './with-catch-null'; + +class TypedString extends TypedBytes { + constructor(value) { + super(normalizeOrConvertStringToU8a(value)); + } + + get value() { + return u8aToString(this.bytes); + } + + toString() { + return this.value; + } + + static fromApi(value) { + if ( + !Array.isArray(value) + && !(value instanceof Uint8Array) + && typeof value !== 'string' + ) { + return new this(String(value)); + } else { + return super.fromApi(value); + } + } + + eq(other) { + return String(this) === String(other); + } +} + +export default withCatchNull(TypedString); diff --git a/packages/credential-sdk/src/types/generic/typed-struct.js b/packages/credential-sdk/src/types/generic/typed-struct.js new file mode 100644 index 000000000..01c3dc41a --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-struct.js @@ -0,0 +1,81 @@ +import { + validateProperties, + withExtendedStaticProperties, +} from '../../utils/inheritance'; +import { maybeToJSON, maybeEq, maybeFrom } from '../../utils/interfaces'; +import withBase from './with-base'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +class TypedStruct extends withBase(class StructBase {}) { + static Classes; + + constructor(...values) { + super(); + + let idx = 0; + for (const key of Object.keys(this.constructor.Classes)) { + const prop = Symbol(key); + + Object.defineProperty(this, key, { + enumerable: true, + get() { + return this[prop]; + }, + set(newValue) { + try { + this[prop] = maybeFrom(this.constructor.Classes[key], newValue); + } catch (error) { + error.message = `\nFailed to set property \`${key}\` of \`${this.constructor.name}\`: ${error.message}`; + + throw error; + } + }, + }); + + this[key] = values[idx++]; + } + + validateProperties(this); + Object.seal(this); + } + + toJSON() { + return Object.fromEntries( + Object.entries(this).map(([key, value]) => [key, maybeToJSON(value)]), + ); + } + + static fromJSON(obj) { + return new this(...Object.keys(this.Classes).map((key) => obj[key])); + } + + static fromApi(obj) { + return this.fromJSON(obj); + } + + eq(other) { + const thisEntries = Object.entries(this); + const otherEntries = Object.entries(other); + + if (thisEntries.length !== otherEntries.length) { + return false; + } + + for (const key of Object.keys(this)) { + if (!maybeEq(this[key], other[key])) { + return false; + } + } + + return true; + } + + toString() { + return JSON.stringify(this.toJSON()); + } +} + +export default withEq( + withCatchNull(withExtendedStaticProperties(['Classes'], TypedStruct)), +); diff --git a/packages/credential-sdk/src/types/generic/typed-tuple.js b/packages/credential-sdk/src/types/generic/typed-tuple.js new file mode 100644 index 000000000..099f9a0f4 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-tuple.js @@ -0,0 +1,97 @@ +import { withExtendedStaticProperties } from '../../utils/inheritance'; +import { maybeEq, maybeFrom, maybeToJSON } from '../../utils/interfaces'; +import { ArrayWithoutPrototypeMethods } from '../../utils/generic'; +import withBase from './with-base'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; +import { ensureArrayLike } from '../../utils'; + +class TypedTuple extends withBase(ArrayWithoutPrototypeMethods) { + /** + * Item's classes. + * @type {Array} + */ + static Classes; + + static get Size() { + return this.Classes.length; + } + + constructor(...items) { + super(items.length); + + const { Size } = this.constructor; + + if (this.constructor.Size !== items.length) { + throw new Error( + `Received \`${items.length}\` items while expected \`${Size}\` by \`${this.constructor.name}\``, + ); + } + + for (let idx = 0; idx < items.length; idx++) { + const prop = Symbol(idx); + + Object.defineProperty(this, idx, { + enumerable: true, + get() { + return this[prop]; + }, + set(newValue) { + try { + this[prop] = maybeFrom(this.constructor.Classes[idx], newValue); + } catch (error) { + error.message = `\nFailed to set property \`${idx}\` of \`${this.constructor.name}\`: ${error.message}`; + + throw error; + } + }, + }); + + this[idx] = items[idx]; + } + + Object.seal(this); + } + + toJSON() { + return [...Array.prototype.values.call(this)].map(maybeToJSON); + } + + static from(value) { + if (value instanceof this) { + return value; + } else if (Array.isArray(value)) { + return this.fromJSON(value); + } else if (typeof value === 'object') { + return this.fromApi(value); + } else { + return new this(value); + } + } + + static fromJSON(arr) { + return new this(...ensureArrayLike(arr, this.name)); + } + + static fromApi(arr) { + return this.fromJSON(arr); + } + + eq(other) { + if (this.length !== other.length) { + return false; + } + + for (let i = 0; i < this.length; i++) { + if (!maybeEq(this[i], other[i])) { + return false; + } + } + + return true; + } +} + +export default withEq( + withCatchNull(withExtendedStaticProperties(['Classes'], TypedTuple)), +); diff --git a/packages/credential-sdk/src/types/generic/typed-uuid.js b/packages/credential-sdk/src/types/generic/typed-uuid.js new file mode 100644 index 000000000..18530d786 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/typed-uuid.js @@ -0,0 +1,26 @@ +import { + parse, validate, stringify, v4, +} from 'uuid'; +import TypedString from './typed-string'; + +export default class TypedUUID extends TypedString { + constructor(id) { + super(validate(id) ? parse(id) : id); + + if (!validate(this.value)) { + throw new Error(`Invalid UUID: ${this.value}`); + } + } + + get value() { + return stringify(this.bytes); + } + + toString() { + return this.value; + } + + static random() { + return new this(v4()); + } +} diff --git a/packages/credential-sdk/src/types/generic/with-base.js b/packages/credential-sdk/src/types/generic/with-base.js new file mode 100644 index 000000000..7e76f7f89 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-base.js @@ -0,0 +1,105 @@ +import { + withExtendedStaticProperties, + withExtendedPrototypeProperties, +} from '../../utils/inheritance'; +import { applyToValue, maybeEq } from '../../utils/interfaces'; +import withCatchNull from './with-catch-null'; +import withEq from './with-eq'; + +/** + * Enhances provided class by adding prototype methods `toString`/`eq`, static `from` and requiring + * successor to implement static `fromJSON`/`fromApi` and prototype `toJSON`. + * + * @templace C + * @param {C} klass + * @returns {C} + */ +export default function withBase(klass) { + const name = `withBase(${klass.name})`; + + const classes = { + [name]: class extends klass { + /** + * Attempts to instantiate `this` from the provided JSON object. + * @param {object} json + */ + static fromJSON(_json) { + throw new Error('Unimplemented'); + } + + /** + * Attempts to instantiate `this` from the provided object received from the API side. + * @param {object} json + */ + static fromApi(_obj) { + throw new Error('Unimplemented'); + } + + /** + * Instantiates `this` from the supplied object. + * @param obj + */ + static from(obj) { + if (obj instanceof this) { + return obj; + } else if (Object.getPrototypeOf(obj) === Object.getPrototypeOf({})) { + return this.fromJSON(obj); + } else { + return this.fromApi(obj); + } + } + + /** + * Converts the instance to a JSON representation. + * @returns {object} The JSON representation of the instance. + */ + toJSON() { + throw new Error('Unimplemented'); + } + + /** + * Converts the instance to a string representation. + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * Applies supplied function to the underlying value if `check` returns `true`. + * Otherwise, attempts to do the same on the inner value. + * + * @template T + * @param {function(this): T} fn + * @returns {T} + */ + applyToValue(check, fn) { + if (check(this)) { + return fn(this); + } + const { value } = this; + const hasValue = typeof value !== 'undefined'; + + return applyToValue(check, fn, value ?? this, hasValue); + } + + /** + * Performs an equality check against other value. + * + * @param {*} other + * @returns {boolean} + */ + eq(other) { + return maybeEq(this.value, other.value); + } + }, + }; + + return withExtendedStaticProperties( + ['fromJSON', 'fromApi'], + withExtendedPrototypeProperties( + ['toJSON'], + withEq(withCatchNull(classes[name])), + ), + ); +} diff --git a/packages/credential-sdk/src/types/generic/with-catch-null.js b/packages/credential-sdk/src/types/generic/with-catch-null.js new file mode 100644 index 000000000..6da82da4e --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-catch-null.js @@ -0,0 +1,45 @@ +/** + * Wraps supplied klass into a class that catches `null`ish values in `from`/`fromJSON`/`fromApi` methods. + * @template C + * @param {C} klass + * @returns {C} + */ +export default function withCatchNull(klass) { + const name = `withCatchNull(${klass.name})`; + + const obj = { + [name]: class extends klass { + static from(value) { + if (value == null) { + throw new Error( + `Unexpected \`null\`ish value received by \`${this.name}\``, + ); + } else { + return super.from(value); + } + } + + static fromJSON(value) { + if (value == null) { + throw new Error( + `Unexpected \`null\`ish value received by \`${this.name}\``, + ); + } else { + return super.fromJSON(value); + } + } + + static fromApi(value) { + if (value == null) { + throw new Error( + `Unexpected \`null\`ish value received by \`${this.name}\``, + ); + } else { + return super.fromApi(value); + } + } + }, + }; + + return obj[name]; +} diff --git a/packages/credential-sdk/src/types/generic/with-eq.js b/packages/credential-sdk/src/types/generic/with-eq.js new file mode 100644 index 000000000..a9e1414e6 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-eq.js @@ -0,0 +1,37 @@ +import { isEqualToOrPrototypeOf } from '../../utils'; + +/** + * Enhances `prototype.eq` of the provided class to make it catch `null`ish values and + * attempt to instantiate a new value of the supplied class in case if constructor is different. + * @template C + * @param {C} klass + * @returns {C} + */ +export default function withEq(klass) { + const name = `withEq(${klass.name})`; + + const obj = { + [name]: class extends klass { + eq(other) { + if (other == null) { + return false; + } else if (Object.is(this, other)) { + return true; + } else if (!isEqualToOrPrototypeOf(klass, other.constructor)) { + let compareWith; + try { + compareWith = this.constructor.from(other); + } catch { + return false; + } + + return super.eq(compareWith); + } else { + return super.eq(other); + } + } + }, + }; + + return obj[name]; +} diff --git a/packages/credential-sdk/src/types/generic/with-from.js b/packages/credential-sdk/src/types/generic/with-from.js new file mode 100644 index 000000000..764cd9ed5 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-from.js @@ -0,0 +1,21 @@ +export default function withFrom(klass, from, fromJSON = from, fromApi = from) { + const name = `withFrom(${klass.name})`; + + const obj = { + [name]: class extends klass { + static from(value) { + return from.call(this, value, (v) => super.from(v)); + } + + static fromJSON(value) { + return fromJSON.call(this, value, (v) => super.fromJSON(v)); + } + + static fromApi(value) { + return fromApi.call(this, value, (v) => super.fromApi(v)); + } + }, + }; + + return obj[name]; +} diff --git a/packages/credential-sdk/src/types/generic/with-null-if-not-a-variant.js b/packages/credential-sdk/src/types/generic/with-null-if-not-a-variant.js new file mode 100644 index 000000000..df50697ab --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-null-if-not-a-variant.js @@ -0,0 +1,68 @@ +import TypedEnum from './typed-enum'; +import { fmtIter, isEqualToOrPrototypeOf, maybeNew } from '../../utils'; + +/** + * Extends supplied class which must be a successor of `TypedEnum` in a way that every of the methods + * `from`/`fromJSON`/`fromApi` will return `null` if variant of the provided value is not the same as the underlying type. + * + * @template C + * @param {C} klass + * @returns {C} + */ +/* eslint-disable sonarjs/cognitive-complexity */ +export default function withNullIfNotAVariant(klass) { + if (!isEqualToOrPrototypeOf(TypedEnum, klass)) { + throw new Error('Expected `{klass.name}` to extend `TypedEnum`'); + } else if (klass.Class == null) { + throw new Error( + `Expected static \`Class\` property to be present in \`${klass.name}\``, + ); + } + const name = `withNullIfNotAVariant(${klass.name})`; + + const classObj = { + [name]: class extends klass { + static fromJSON(value) { + const keys = Object.keys(value); + if (keys.length !== 1) { + throw new Error( + `Expected object with 1 key, received \`${value}\` with keys: ${fmtIter( + keys, + )} by ${this.name}`, + ); + } + const [key] = keys; + + if (this.JsonType === key || this.Type === key) { + return super.from(value); + } + + return null; + } + + static fromApi(obj) { + if (obj[this.isIdentifier]) { + return maybeNew(this, [obj[this.asIdentifier]]); + } else { + return null; + } + } + + static from(obj) { + if (obj instanceof this) { + return obj; + } else if (typeof obj === 'string' && this.isNullish) { + return this.fromJSON(obj); + } else if (Object.getPrototypeOf(obj) === Object.getPrototypeOf({})) { + return this.fromJSON(obj); + } else if (obj instanceof this.Class) { + return new this(this.Class.from(obj)); + } + + return this.fromApi(obj); + } + }, + }; + + return classObj[name]; +} diff --git a/packages/credential-sdk/src/types/generic/with-prop.js b/packages/credential-sdk/src/types/generic/with-prop.js new file mode 100644 index 000000000..6c766e008 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-prop.js @@ -0,0 +1,55 @@ +import { isEqualToOrPrototypeOf } from '../../utils'; +import TypedEnum from './typed-enum'; +import TypedStruct from './typed-struct'; + +/** + * Extends supplied class which must be a successor of `TypedStruct`/`TypedEnum` by adding/overriding + * its property class. + * + * @template C + * @template K + * @param {C} klass + * @param {string} prop + * @param {K} PropClass + * @param {function(*, string, K): *} handleNested + * @returns {C} + */ +export default function withProp( + klass, + prop, + PropClass, + handleNested = withProp, +) { + const name = `withProp(${klass.name}, ${prop})`; + const isStruct = isEqualToOrPrototypeOf(TypedStruct, klass); + const isEnum = isEqualToOrPrototypeOf(TypedEnum, klass); + if (!isStruct && !isEnum) { + throw new Error(`Unexpected class provided: \`${klass}\``); + } + + if (isStruct) { + const obj = { + [name]: class extends klass { + static Classes = { + ...klass.Classes, + [prop]: PropClass, + }; + }, + }; + + return obj[name]; + } else { + const obj = { + [name]: + klass.Class != null + ? class extends klass { + static Class = handleNested(klass.Class, prop, PropClass); + } + : class extends klass { + static Variants = klass.Variants.map((variant) => handleNested(variant, prop, PropClass)); + }, + }; + + return obj[name]; + } +} diff --git a/packages/credential-sdk/src/types/generic/with-qualifier.js b/packages/credential-sdk/src/types/generic/with-qualifier.js new file mode 100644 index 000000000..4c81b37fd --- /dev/null +++ b/packages/credential-sdk/src/types/generic/with-qualifier.js @@ -0,0 +1,192 @@ +import { ID_STR } from '@docknetwork/crypto-wasm-ts'; +import TypedBytes from './typed-bytes'; +import { + withExtendedStaticProperties, + withExtendedPrototypeProperties, +} from '../../utils/inheritance'; +import { maybeFrom } from '../../utils/interfaces'; +import withFrom from './with-from'; +import { fmtIter } from '../../utils'; +import TypedString from './typed-string'; + +/** + * Extends supplied class. + * @template C + * @param {C} klass + * @param {boolean} wrapper + * @returns {C} + */ +/* eslint-disable */ +export default function withQualifier(klass, wrapper = false) { + const name = `withQualifier(${klass.name})`; + + if (wrapper) { + const classes = { + [name]: class extends klass { + static get Qualifier() { + return this.Class?.Qualifier; + } + + static get Qualifiers() { + return [].concat( + this.Qualifier ?? + this.Variants.flatMap((variant) => + [].concat( + variant.Qualifier ?? variant !== this + ? variant.Qualifiers + : [] + ) + ) + ); + } + + /** + * Returns underlying value encoded according to the specification. + */ + toEncodedString() { + return this.value.toEncodedString(); + } + + static fromQualifiedString(value) { + if (!this.Class) { + for (const Variant of this.Variants) { + if (Variant.Class.isQualifiedString(value)) { + return maybeFrom(Variant, value); + } + } + } else { + return new this(maybeFrom(this.Class, value)); + } + + throw new Error( + `Unsupported qualified string: \`${value}\`, expected with either prefix: ${fmtIter( + this.Qualifiers + )}` + ); + } + + static isQualifiedString(str) { + for (const variant of this.Variants) { + if (variant.Class.isQualifiedString(str)) { + return true; + } + } + + return false; + } + + static fromUnqualifiedString(str) { + throw new Error( + `Can't build an instance of \`${this.name}\` from unqualified string: ${ID_STR}` + ); + } + + /** + * Returns fully qualified `did:dock:*` encoded in SS58 or `did:key:*` encoded in BS58. + */ + toQualifiedEncodedString() { + return this.value.toQualifiedEncodedString(); + } + + toQualifiedString() { + return this.value.toQualifiedString(); + } + + toString() { + return this.value.toString(); + } + }, + }; + + return withFrom(classes[name], function (value, from) { + if (typeof value === "string" || value instanceof TypedString) { + if (this.Class != null) { + return new this(maybeFrom(this.Class, String(value))); + } else { + return this.fromQualifiedString(String(value)); + } + } else { + return from(value); + } + }); + } else { + const classes = { + [name]: class extends klass { + static Qualifier; + + static isQualifiedString(str) { + return typeof str === "string" && str.startsWith(this.Qualifier); + } + + /** + * Instantiates `DockDid` from a fully qualified did string. + * @param {string} did - fully qualified `did:dock:*` string + * @returns {DockDid} + */ + static fromQualifiedString(str) { + if (this.isQualifiedString(str)) { + return this.fromUnqualifiedString(str.slice(this.Qualifier.length)); + } else { + throw new Error(`Invalid identifier provided: \`${str}\``); + } + } + + /** + * Instantiates `DockDid` from an unqualified did string. + * @param {string} did - SS58-encoded or hex did. + * @returns {DockDid} + */ + static fromUnqualifiedString(str) { + throw new Error("Unimplemented"); + } + + /** + * Returns unqualified DID encoded as a `SS58` address. + */ + toEncodedString() { + throw new Error("Unimplemented"); + } + + /** + * Returns fully-qualified encoded string. + */ + toQualifiedEncodedString() { + return `${this.constructor.Qualifier}${this.toEncodedString()}`; + } + + toQualifiedString() { + if (this instanceof TypedBytes) { + return `${this.constructor.Qualifier}${this.value}`; + } else { + return this.toQualifiedEncodedString(); + } + } + + toString() { + return this.toQualifiedEncodedString(); + } + }, + }; + + return withFrom( + withExtendedPrototypeProperties( + ["toEncodedString"], + withExtendedStaticProperties( + ["Qualifier", "fromUnqualifiedString"], + classes[name] + ) + ), + function (value, from) { + if (typeof value === "string" || value instanceof TypedString) { + if (this.isQualifiedString(String(value))) { + return this.fromQualifiedString(String(value)); + } else { + return this.fromUnqualifiedString(String(value)); + } + } else { + return from(value); + } + } + ); + } +} diff --git a/packages/credential-sdk/src/types/generic/without-prop.js b/packages/credential-sdk/src/types/generic/without-prop.js new file mode 100644 index 000000000..7a25aa3c1 --- /dev/null +++ b/packages/credential-sdk/src/types/generic/without-prop.js @@ -0,0 +1,54 @@ +import { isEqualToOrPrototypeOf } from '../../utils'; +import TypedEnum from './typed-enum'; +import TypedStruct from './typed-struct'; + +/** + * Extends supplied class which must be a successor of `TypedStruct`/`TypedEnum` by removing + * its property. + * + * @template C + * @template K + * @param {C} klass + * @param {string} prop + * @param {K} PropClass + * @param {function(*, string, K): *} handleNested + * @returns {C} + */ +export default function withoutProp(klass, prop, handleNested = withoutProp) { + const name = `withoutProp(${klass.name}, ${prop})`; + const isStruct = isEqualToOrPrototypeOf(TypedStruct, klass); + const isEnum = isEqualToOrPrototypeOf(TypedEnum, klass); + if (!isStruct && !isEnum) { + throw new Error(`Unexpected class provided: \`${klass}\``); + } + + if (isStruct) { + const { [prop]: _, ...classes } = klass.Classes; + + const obj = { + [name]: class extends klass { + static Classes = classes; + }, + }; + + return obj[name]; + } else { + let classWithProp = klass.Class; + let variants = klass.Variants; + if (classWithProp != null) { + classWithProp = handleNested(klass.Class, prop); + } else { + variants = variants.map((variant) => handleNested(variant, prop)); + } + + const obj = { + [name]: class extends klass { + static Class = classWithProp; + + static Variants = variants; + }, + }; + + return obj[name]; + } +} diff --git a/packages/credential-sdk/src/types/index.js b/packages/credential-sdk/src/types/index.js new file mode 100644 index 000000000..0e53a2e9e --- /dev/null +++ b/packages/credential-sdk/src/types/index.js @@ -0,0 +1,11 @@ +export * from './blob'; +export * from './attest'; +export * from './did'; +export * from './offchain-signatures'; +export * from './policy'; +export * from './public-keys'; +export * from './signatures'; +export * from './status-list-credential'; +export * from './anchor'; +export * from './accumulator'; +export * from './trust-registry'; diff --git a/packages/credential-sdk/src/types/offchain-signatures/curve-type.js b/packages/credential-sdk/src/types/offchain-signatures/curve-type.js new file mode 100644 index 000000000..c025a6e35 --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/curve-type.js @@ -0,0 +1,11 @@ +import { Null, TypedEnum } from '../generic'; + +export class CurveType extends TypedEnum {} + +export class CurveTypeBls12381 extends CurveType { + static Class = Null; + + static Type = 'bls12381'; +} + +CurveType.bindVariants(CurveTypeBls12381); diff --git a/packages/credential-sdk/src/types/offchain-signatures/index.js b/packages/credential-sdk/src/types/offchain-signatures/index.js new file mode 100644 index 000000000..2ff879cef --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/index.js @@ -0,0 +1,23 @@ +import { TypedTuple } from '../generic'; +import { + OffchainSignatureParams, + OffchainSignatureParamsValue, +} from './params'; +import { + OffchainSignaturePublicKey, + OffchainSignaturePublicKeyValue, +} from './public-keys'; + +export * from './params'; +export * from './public-keys'; + +export class OffchainSignaturePublicKeyWithParams extends TypedTuple { + static Classes = [OffchainSignaturePublicKey, OffchainSignatureParams]; +} + +export class OffchainSignaturePublicKeyValueWithParamsValue extends TypedTuple { + static Classes = [ + OffchainSignaturePublicKeyValue, + OffchainSignatureParamsValue, + ]; +} diff --git a/packages/credential-sdk/src/types/offchain-signatures/params/index.js b/packages/credential-sdk/src/types/offchain-signatures/params/index.js new file mode 100644 index 000000000..858657de8 --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/params/index.js @@ -0,0 +1,35 @@ +import { TypedEnum } from '../../generic'; +import { BBSParamsValue, BBSPlusParamsValue, PSParamsValue } from './value'; + +export class OffchainSignatureParams extends TypedEnum { + get bytes() { + return this.value.bytes; + } + + get label() { + return this.value.label; + } + + get curveType() { + return this.value.curveType; + } +} +export class BBSParams extends OffchainSignatureParams { + static Type = 'bbs'; + + static Class = BBSParamsValue; +} +export class BBSPlusParams extends OffchainSignatureParams { + static Type = 'bbsPlus'; + + static Class = BBSPlusParamsValue; +} +export class PSParams extends OffchainSignatureParams { + static Type = 'ps'; + + static Class = PSParamsValue; +} + +OffchainSignatureParams.bindVariants(BBSParams, BBSPlusParams, PSParams); + +export * from './value'; diff --git a/packages/credential-sdk/src/types/offchain-signatures/params/value.js b/packages/credential-sdk/src/types/offchain-signatures/params/value.js new file mode 100644 index 000000000..6e2d24f53 --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/params/value.js @@ -0,0 +1,23 @@ +import { TypedBytes, TypedStruct, option } from '../../generic'; +import { CurveType, CurveTypeBls12381 } from '../curve-type'; + +export class OffchainSignatureParamsValue extends TypedStruct { + static Classes = { + bytes: class Bytes extends TypedBytes {}, + label: option(class Label extends TypedBytes {}), + curveType: CurveType, + }; + + constructor(bytes, label, curveType = new CurveTypeBls12381()) { + super(bytes, label, curveType); + } +} +export class BBSParamsValue extends OffchainSignatureParamsValue { + static Type = 'bbs'; +} +export class BBSPlusParamsValue extends OffchainSignatureParamsValue { + static Type = 'bbsPlus'; +} +export class PSParamsValue extends OffchainSignatureParamsValue { + static Type = 'ps'; +} diff --git a/packages/credential-sdk/src/types/offchain-signatures/public-keys/index.js b/packages/credential-sdk/src/types/offchain-signatures/public-keys/index.js new file mode 100644 index 000000000..668ea7079 --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/public-keys/index.js @@ -0,0 +1,75 @@ +import { TypedEnum, withProp } from '../../generic'; +import { + Bls12381BBS23DockVerKeyName, + Bls12381BBSDockVerKeyName, + Bls12381PSDockVerKeyName, +} from '../../../vc/custom_crypto'; +import { + BBSPublicKeyValue, + BBSPlusPublicKeyValue, + PSPublicKeyValue, +} from './value'; +import { + CheqdOffchainSignatureParamsRef, + DockOffchainSignatureParamsRef, +} from './ref'; + +export class OffchainSignaturePublicKey extends TypedEnum { + get bytes() { + return this.value.bytes; + } + + get paramsRef() { + return this.value.paramsRef; + } + + get curveType() { + return this.value.curveType; + } + + get participantId() { + return this.value.participantId; + } +} +export class BBSPublicKey extends OffchainSignaturePublicKey { + static Class = BBSPublicKeyValue; + + static Type = 'bbs'; + + static VerKeyType = Bls12381BBS23DockVerKeyName; +} +export class BBSPlusPublicKey extends OffchainSignaturePublicKey { + static Class = BBSPlusPublicKeyValue; + + static Type = 'bbsPlus'; + + static VerKeyType = Bls12381BBSDockVerKeyName; +} +export class PSPublicKey extends OffchainSignaturePublicKey { + static Class = PSPublicKeyValue; + + static Type = 'ps'; + + static VerKeyType = Bls12381PSDockVerKeyName; +} + +OffchainSignaturePublicKey.bindVariants( + BBSPublicKey, + BBSPlusPublicKey, + PSPublicKey, +); + +export class DockOffchainSignaturePublicKey extends withProp( + OffchainSignaturePublicKey, + 'paramsRef', + DockOffchainSignatureParamsRef, +) {} + +export class CheqdOffchainSignaturePublicKey extends withProp( + OffchainSignaturePublicKey, + 'paramsRef', + CheqdOffchainSignatureParamsRef, +) {} + +export * from './value'; +export * from './ref'; diff --git a/packages/credential-sdk/src/types/offchain-signatures/public-keys/ref.js b/packages/credential-sdk/src/types/offchain-signatures/public-keys/ref.js new file mode 100644 index 000000000..079aefe22 --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/public-keys/ref.js @@ -0,0 +1,22 @@ +import { TypedTuple, TypedNumber, TypedUUID } from '../../generic'; +import { + DockDidValue, + DockDidOrDidMethodKey, + CheqdDid, +} from '../../did/onchain/typed-did'; + +export class DockOffchainSignatureKeyRef extends TypedTuple { + static Classes = [DockDidValue, TypedNumber]; +} + +export class DockOffchainSignatureParamsRef extends TypedTuple { + static Classes = [DockDidOrDidMethodKey, TypedNumber]; +} + +export class CheqdOffchainSignatureKeyRef extends TypedTuple { + static Classes = [CheqdDid, TypedUUID]; +} + +export class CheqdOffchainSignatureParamsRef extends TypedTuple { + static Classes = [CheqdDid, TypedUUID]; +} diff --git a/packages/credential-sdk/src/types/offchain-signatures/public-keys/value.js b/packages/credential-sdk/src/types/offchain-signatures/public-keys/value.js new file mode 100644 index 000000000..4e0010d33 --- /dev/null +++ b/packages/credential-sdk/src/types/offchain-signatures/public-keys/value.js @@ -0,0 +1,38 @@ +import { + TypedBytes, + TypedStruct, + TypedNumber, + option, + Any, +} from '../../generic'; +import { CurveType, CurveTypeBls12381 } from '../curve-type'; +import { BBSParams, BBSPlusParams, PSParams } from '../params'; + +export class OffchainSignaturePublicKeyValue extends TypedStruct { + static Classes = { + bytes: class Bytes extends TypedBytes {}, + paramsRef: option(Any), + curveType: CurveType, + participantId: option(TypedNumber), + }; + + constructor( + bytes, + paramsRef, + curveType = new CurveTypeBls12381(), + participantId = null, + ...rest + ) { + super(bytes, paramsRef, curveType, participantId, ...rest); + } +} + +export class BBSPublicKeyValue extends OffchainSignaturePublicKeyValue { + static Params = BBSParams; +} +export class BBSPlusPublicKeyValue extends OffchainSignaturePublicKeyValue { + static Params = BBSPlusParams; +} +export class PSPublicKeyValue extends OffchainSignaturePublicKeyValue { + static Params = PSParams; +} diff --git a/packages/credential-sdk/src/types/policy/index.js b/packages/credential-sdk/src/types/policy/index.js new file mode 100644 index 000000000..9c42871be --- /dev/null +++ b/packages/credential-sdk/src/types/policy/index.js @@ -0,0 +1,13 @@ +import { TypedEnum } from '../generic'; +import OneOfPolicyValue from './one-of-policy-value'; + +export class Policy extends TypedEnum {} +export class OneOfPolicy extends Policy { + static Class = OneOfPolicyValue; + + addOwner(ownerDID) { + return this.value.addOwner(ownerDID); + } +} + +Policy.bindVariants(OneOfPolicy); diff --git a/packages/credential-sdk/src/types/policy/one-of-policy-value.js b/packages/credential-sdk/src/types/policy/one-of-policy-value.js new file mode 100644 index 000000000..19246f886 --- /dev/null +++ b/packages/credential-sdk/src/types/policy/one-of-policy-value.js @@ -0,0 +1,22 @@ +import { TypedSet } from '../generic'; +import { DockDidOrDidMethodKey } from '../did/onchain/typed-did'; + +/** + * Constructs a OneOfPolicy with given controllers + * @param {any} [controllers] - Controller set + * @constructor + */ + +export default class OneOfPolicyValue extends TypedSet { + static Type = 'oneOf'; + + static Class = DockDidOrDidMethodKey; + + /** + * Add a owner to the policy + * @param {string} ownerDID - Owner's DID + */ + addOwner(ownerDID) { + this.add(this.constructor.Class.from(ownerDID)); + } +} diff --git a/packages/credential-sdk/src/types/public-keys/index.js b/packages/credential-sdk/src/types/public-keys/index.js new file mode 100644 index 000000000..21ab418ea --- /dev/null +++ b/packages/credential-sdk/src/types/public-keys/index.js @@ -0,0 +1,6 @@ +export * from './public-key'; + +export { default as PublicKeySr25519Value } from './public-key-sr25519-value'; +export { default as PublicKeyEd25519Value } from './public-key-ed25519-value'; +export { default as PublicKeySecp256k1Value } from './public-key-secp256k1-value'; +export { default as PublicKeyX25519Value } from './public-key-x25519-value'; diff --git a/packages/credential-sdk/src/types/public-keys/public-key-ed25519-value.js b/packages/credential-sdk/src/types/public-keys/public-key-ed25519-value.js new file mode 100644 index 000000000..02b2de8ff --- /dev/null +++ b/packages/credential-sdk/src/types/public-keys/public-key-ed25519-value.js @@ -0,0 +1,11 @@ +import { sized, TypedBytes } from '../generic'; +import { Ed25519VerKeyName } from '../../vc/crypto/constants'; + +/** Class representing value of a Ed25519 PublicKey */ +export default class PublicKeyEd25519Value extends sized(TypedBytes) { + static Type = 'ed25519'; + + static Size = 32; + + static VerKeyType = Ed25519VerKeyName; +} diff --git a/packages/credential-sdk/src/types/public-keys/public-key-secp256k1-value.js b/packages/credential-sdk/src/types/public-keys/public-key-secp256k1-value.js new file mode 100644 index 000000000..2f952fb18 --- /dev/null +++ b/packages/credential-sdk/src/types/public-keys/public-key-secp256k1-value.js @@ -0,0 +1,11 @@ +import { sized, TypedBytes } from '../generic'; +import { EcdsaSecp256k1VerKeyName } from '../../vc/crypto/constants'; + +/** Class representing value of a compressed Secp256k1 PublicKey */ +export default class PublicKeySecp256k1Value extends sized(TypedBytes) { + static Type = 'secp256k1'; + + static Size = 33; + + static VerKeyType = EcdsaSecp256k1VerKeyName; +} diff --git a/packages/credential-sdk/src/types/public-keys/public-key-sr25519-value.js b/packages/credential-sdk/src/types/public-keys/public-key-sr25519-value.js new file mode 100644 index 000000000..c726d3286 --- /dev/null +++ b/packages/credential-sdk/src/types/public-keys/public-key-sr25519-value.js @@ -0,0 +1,11 @@ +import { sized, TypedBytes } from '../generic'; +import { Sr25519VerKeyName } from '../../vc/crypto/constants'; + +/** Class representing value of a Sr25519 PublicKey */ +export default class PublicKeySr25519Value extends sized(TypedBytes) { + static Type = 'sr25519'; + + static Size = 32; + + static VerKeyType = Sr25519VerKeyName; +} diff --git a/packages/credential-sdk/src/types/public-keys/public-key-x25519-value.js b/packages/credential-sdk/src/types/public-keys/public-key-x25519-value.js new file mode 100644 index 000000000..3768f1416 --- /dev/null +++ b/packages/credential-sdk/src/types/public-keys/public-key-x25519-value.js @@ -0,0 +1,10 @@ +import { sized, TypedBytes } from '../generic'; + +/** Class representing value of a X25519 PublicKey */ +export default class PublicKeyX25519Value extends sized(TypedBytes) { + static Type = 'x25519'; + + static Size = 32; + + static VerKeyType = 'X25519KeyAgreementKey2019'; +} diff --git a/packages/credential-sdk/src/types/public-keys/public-key.js b/packages/credential-sdk/src/types/public-keys/public-key.js new file mode 100644 index 000000000..7ab0c74d7 --- /dev/null +++ b/packages/credential-sdk/src/types/public-keys/public-key.js @@ -0,0 +1,55 @@ +import { TypedEnum } from '../generic'; +import PublicKeyX25519Value from './public-key-x25519-value'; +import PublicKeyEd25519Value from './public-key-ed25519-value'; +import PublicKeySecp256k1Value from './public-key-secp256k1-value'; +import PublicKeySr25519Value from './public-key-sr25519-value'; + +/** + * Class representing either Ed25519 or Secp256k1 or Sr25519 or X25519 PublicKey + * @class + * @extends {TypedEnum} + */ +export class PublicKey extends TypedEnum { + static get VerKeyType() { + return this.Class.VerKeyType; + } +} +/** + * Class representing Ed25519 PublicKey + * @class + * @extends {PublicKey} + */ +export class PublicKeyEd25519 extends PublicKey { + static Class = PublicKeyEd25519Value; +} +/** + * Class representing Secp256k1 PublicKey + * @class + * @extends {PublicKey} + */ +export class PublicKeySecp256k1 extends PublicKey { + static Class = PublicKeySecp256k1Value; +} +/** + * Class representing Sr25519 PublicKey + * @class + * @extends {PublicKey} + */ +export class PublicKeySr25519 extends PublicKey { + static Class = PublicKeySr25519Value; +} +/** + * Class representing X25519 PublicKey + * @class + * @extends {PublicKey} + */ +export class PublicKeyX25519 extends PublicKey { + static Class = PublicKeyX25519Value; +} + +PublicKey.bindVariants( + PublicKeyEd25519, + PublicKeySecp256k1, + PublicKeySr25519, + PublicKeyX25519, +); diff --git a/packages/credential-sdk/src/types/signatures/index.js b/packages/credential-sdk/src/types/signatures/index.js new file mode 100644 index 000000000..c4bc4952a --- /dev/null +++ b/packages/credential-sdk/src/types/signatures/index.js @@ -0,0 +1,10 @@ +import SignatureSr25519Value from './signature-sr25519-value'; +import SignatureEd25519Value from './signature-ed25519-value'; +import SignatureSecp256k1Value from './signature-secp256k1-value'; + +export { + SignatureSr25519Value, + SignatureEd25519Value, + SignatureSecp256k1Value, +}; +export * from './signature'; diff --git a/src/signatures/signature-ed25519.js b/packages/credential-sdk/src/types/signatures/signature-ed25519-value.js similarity index 57% rename from src/signatures/signature-ed25519.js rename to packages/credential-sdk/src/types/signatures/signature-ed25519-value.js index 17e39dcd3..0e3631924 100644 --- a/src/signatures/signature-ed25519.js +++ b/packages/credential-sdk/src/types/signatures/signature-ed25519-value.js @@ -1,8 +1,9 @@ import { PublicKeyEd25519 } from '../public-keys'; -import Signature from './signature'; +import SignatureValue from './signature-value'; /** Class representing a Ed25519 Signature */ -export default class SignatureEd25519 extends Signature { +export default class SignatureEd25519Value extends SignatureValue { static PublicKey = PublicKeyEd25519; + static Size = 64; } diff --git a/packages/credential-sdk/src/types/signatures/signature-secp256k1-value.js b/packages/credential-sdk/src/types/signatures/signature-secp256k1-value.js new file mode 100644 index 000000000..87f852d06 --- /dev/null +++ b/packages/credential-sdk/src/types/signatures/signature-secp256k1-value.js @@ -0,0 +1,9 @@ +import SignatureValue from './signature-value'; +import { PublicKeySecp256k1 } from '../public-keys'; + +/** Class representing a Secp256k1 Signature */ +export default class SignatureSecp256k1Value extends SignatureValue { + static PublicKey = PublicKeySecp256k1; + + static Size = 65; +} diff --git a/src/signatures/signature-sr25519.js b/packages/credential-sdk/src/types/signatures/signature-sr25519-value.js similarity index 57% rename from src/signatures/signature-sr25519.js rename to packages/credential-sdk/src/types/signatures/signature-sr25519-value.js index bbed29dd9..bc033f14b 100644 --- a/src/signatures/signature-sr25519.js +++ b/packages/credential-sdk/src/types/signatures/signature-sr25519-value.js @@ -1,8 +1,9 @@ import { PublicKeySr25519 } from '../public-keys'; -import Signature from './signature'; +import SignatureValue from './signature-value'; /** Class representing a Sr25519 Signature */ -export default class SignatureSr25519 extends Signature { +export default class SignatureSr25519Value extends SignatureValue { static PublicKey = PublicKeySr25519; + static Size = 64; } diff --git a/packages/credential-sdk/src/types/signatures/signature-value.js b/packages/credential-sdk/src/types/signatures/signature-value.js new file mode 100644 index 000000000..a3f074db4 --- /dev/null +++ b/packages/credential-sdk/src/types/signatures/signature-value.js @@ -0,0 +1,25 @@ +import { withExtendedStaticProperties } from '../../utils/inheritance'; +import { sized, TypedBytes } from '../generic'; + +/** Class representing a Signature. This export class should always be extended (abstract export class in some languages) */ +export default withExtendedStaticProperties( + ['PublicKey'], + class SignatureValue extends sized(TypedBytes) { + /** + * Public key associated with the signature. + * @type {typeof PublicKey} + */ + static PublicKey; + + static get Type() { + return this.PublicKey.Type; + } + + /** + * Returns the size of the underlying signature. + */ + get size() { + return this.constructor.Size; + } + }, +); diff --git a/packages/credential-sdk/src/types/signatures/signature.js b/packages/credential-sdk/src/types/signatures/signature.js new file mode 100644 index 000000000..37ce2da80 --- /dev/null +++ b/packages/credential-sdk/src/types/signatures/signature.js @@ -0,0 +1,45 @@ +import { TypedEnum } from '../generic'; +import SignatureEd25519Value from './signature-ed25519-value'; +import SignatureSecp256k1Value from './signature-secp256k1-value'; +import SignatureSr25519Value from './signature-sr25519-value'; + +/** + * Class representing either Ed25519 or Secp256k1 or Sr25519 Signature + * @class + * @extends {TypedEnum} + */ +export class Signature extends TypedEnum { + static get PublicKey() { + return this.Class.PublicKey; + } + + get bytes() { + return this.value.bytes; + } +} +/** + * Class representing Ed25519 Signature + * @class + * @extends {Signature} + */ +export class SignatureEd25519 extends Signature { + static Class = SignatureEd25519Value; +} +/** + * Class representing Secp256k1 Signature + * @class + * @extends {Signature} + */ +export class SignatureSecp256k1 extends Signature { + static Class = SignatureSecp256k1Value; +} +/** + * Class representing Sr25519 Signature + * @class + * @extends {SignatureEd25519OrSignatureSecp256k1OrSignatureSr25519} + */ +export class SignatureSr25519 extends Signature { + static Class = SignatureSr25519Value; +} + +Signature.bindVariants(SignatureEd25519, SignatureSecp256k1, SignatureSr25519); diff --git a/packages/credential-sdk/src/types/status-list-credential/id.js b/packages/credential-sdk/src/types/status-list-credential/id.js new file mode 100644 index 000000000..5984742b9 --- /dev/null +++ b/packages/credential-sdk/src/types/status-list-credential/id.js @@ -0,0 +1,18 @@ +import { DockStatusList2021Qualifier } from '../../vc/constants'; +import { sized, TypedBytes, withQualifier } from '../generic'; + +export class StatusListCredentialId extends withQualifier(TypedBytes) { + static Qualifier = DockStatusList2021Qualifier; + + static fromUnqualifiedString(bytes) { + return new this(bytes); + } + + toEncodedString() { + return this.value; + } +} + +export class DockStatusListCredentialId extends sized(StatusListCredentialId) { + static Size = 32; +} diff --git a/packages/credential-sdk/src/types/status-list-credential/index.js b/packages/credential-sdk/src/types/status-list-credential/index.js new file mode 100644 index 000000000..968206451 --- /dev/null +++ b/packages/credential-sdk/src/types/status-list-credential/index.js @@ -0,0 +1,114 @@ +import { maybeFrom } from '../../utils'; +import StatusListCredentialValue from './status-list-credential-value'; +import { TypedEnum } from '../generic'; + +export class StatusListOrRevocationListCredential extends TypedEnum {} + +export class StatusList2021Credential extends StatusListOrRevocationListCredential { + static Class = StatusListCredentialValue; + + static Type = 'statusList2021Credential'; + + constructor(value) { + super(maybeFrom(StatusListCredentialValue, value)); + } + + /** + * Fail if the given verifiable credential id isn't a valid `StatusList2021Credential` id. + * @param {*} id + */ + static verifyID(id) { + return this.Class.verifyID(id); + } + + /** + * Creates new `StatusList2021Credential` with supplied `id` and option `statusPurpose` = `revocation` by default, + * `length` and `revokeIndices`. Note that credential with `statusPurpose` = `revocation` can't unsuspend its indices. + * To allow unrevoking indices in the future, use `statusPurpose` = `suspension`. + * The proof will be generated immediately using supplied `keyDoc`. + * + * @param {KeyDoc} keyDoc + * @param {string} id - on-chain hex identifier for the `StatusList2021Credential`. + * @param {object} [params={}] + * @param {'revocation'|'suspension'} [params.statusPurpose=revocation] - `statusPurpose` of the `StatusList2021Credential`. + * Can be either `revocation` or `suspension`. + * @param {number} [params.length=1e4] - length of the underlying `StatusList`. + * @param {Iterable} [params.revokeIndices=[]] - iterable producing indices to be revoked or suspended initially + * @returns {Promise} + */ + static async create( + keyDoc, + id, + { statusPurpose = 'revocation', length = 1e4, revokeIndices = [] } = {}, + ) { + return new this( + await this.Class.create(keyDoc, id, { + statusPurpose, + length, + revokeIndices, + }), + ); + } + + /** + * Revokes indices and unsuspends other indices in the underlying status list, regenerating the proof. + * If `statusPurpose` = `revocation`, indices can't be unsuspended. + * The status list revoked (suspended)/unsuspended indices will be set atomically and in case of an error, + * the underlying value won't be modified. + * Throws an error if the underlying status list can't be decoded or any of the supplied indices is out of range. + * + * @param {KeyDoc} keyDoc + * @param {object} [update={}] + * @param {Iterable} update.revokeIndices - indices to be revoked or suspended + * @param {Iterable} update.unsuspendIndices - indices to be unsuspended + * @returns {Promise} + */ + async update(keyDoc, { revokeIndices = [], unsuspendIndices = [] }) { + await this.value.update(keyDoc, { revokeIndices, unsuspendIndices }); + + return this; + } + + /** + * Returns a `Promise` resolving to the decoded `StatusList`. + * + * @returns {Promise} + */ + async decodedStatusList() { + return await this.value.decodedStatusList(); + } + + /** + * Returns `true` if given index is revoked or suspended, `false` otherwise. + * Throws an error if the underlying status list can't be decoded or supplied index is out of range. + * + * @param {number} index + * @returns {Promise} + */ + async revoked(index) { + return await this.value.revoked(index); + } + + /** + * Accepts an iterable of indices to be checked and returns an array containing `true` in the positions + * of revoked (suspended) indices and `false` for non-revoked (non-suspended) indices. + * Throws an error if the underlying status list can't be decoded or any of supplied indices is out of range. + * + * @param {Iterable} indices + * @returns {Promise>} + */ + async revokedBatch(indices) { + return await this.value.revokedBatch(indices); + } + + /** + * Validates underlying `StatusList2021Credential`. + */ + validate() { + this.value.validate(); + } +} + +StatusListOrRevocationListCredential.bindVariants(StatusList2021Credential); + +export * from './id'; diff --git a/packages/credential-sdk/src/types/status-list-credential/status-list-credential-value.js b/packages/credential-sdk/src/types/status-list-credential/status-list-credential-value.js new file mode 100644 index 000000000..482f000f3 --- /dev/null +++ b/packages/credential-sdk/src/types/status-list-credential/status-list-credential-value.js @@ -0,0 +1,105 @@ +import { normalizeToU8a } from '../../utils'; +import { TypedBytes } from '../generic'; +import StatusList2021Credential from '../../vc/status-list2021-credential'; + +export default class StatusListCredentialValue extends TypedBytes { + constructor(value) { + const [bytes, list] = value instanceof StatusList2021Credential + ? [value.toBytes(), value] + : [ + normalizeToU8a(value), + StatusList2021Credential.fromBytes(normalizeToU8a(value)), + ]; + super(bytes); + this.list = list; + } + + /** + * Fail if the given verifiable credential id isn't a valid `StatusList2021Credential` id. + * @param {*} id + */ + static verifyID(id) { + return StatusList2021Credential.verifyID(id); + } + + /** + * Creates new `StatusList2021Credential` with supplied `id` and option `statusPurpose` = `revocation` by default, + * `length` and `revokeIndices`. Note that credential with `statusPurpose` = `revocation` can't unsuspend its indices. + * To allow unrevoking indices in the future, use `statusPurpose` = `suspension`. + * The proof will be generated immediately using supplied `keyDoc`. + * + * @param {KeyDoc} keyDoc + * @param {string} id - on-chain hex identifier for the `StatusList2021Credential`. + * @param {object} [params={}] + * @param {'revocation'|'suspension'} [params.statusPurpose=revocation] - `statusPurpose` of the `StatusList2021Credential`. + * Can be either `revocation` or `suspension`. + * @param {number} [params.length=1e4] - length of the underlying `StatusList`. + * @param {Iterable} [params.revokeIndices=[]] - iterable producing indices to be revoked or suspended initially + * @returns {Promise} + */ + static async create( + keyDoc, + id, + { statusPurpose = 'revocation', length = 1e4, revokeIndices = [] } = {}, + ) { + return new this( + await StatusList2021Credential.create(keyDoc, id, { + statusPurpose, + length, + revokeIndices, + }), + ); + } + + /** + * Revokes indices and unsuspends other indices in the underlying status list, regenerating the proof. + * If `statusPurpose` = `revocation`, indices can't be unsuspended. + * The status list revoked (suspended)/unsuspended indices will be set atomically and in case of an error, + * the underlying value won't be modified. + * Throws an error if the underlying status list can't be decoded or any of the supplied indices is out of range. + * + * @param {KeyDoc} keyDoc + * @param {object} [update={}] + * @param {Iterable} update.revokeIndices - indices to be revoked or suspended + * @param {Iterable} update.unsuspendIndices - indices to be unsuspended + * @returns {Promise} + */ + async update(keyDoc, { revokeIndices = [], unsuspendIndices = [] }) { + await this.list.update(keyDoc, { revokeIndices, unsuspendIndices }); + this.set(this.list.toBytes()); + + return this; + } + + /** + * Returns a `Promise` resolving to the decoded `StatusList`. + * + * @returns {Promise} + */ + async decodedStatusList() { + return await this.list.decodedStatusList(); + } + + /** + * Returns `true` if given index is revoked or suspended, `false` otherwise. + * Throws an error if the underlying status list can't be decoded or supplied index is out of range. + * + * @param {number} index + * @returns {Promise} + */ + async revoked(index) { + return await this.list.revoked(index); + } + + /** + * Accepts an iterable of indices to be checked and returns an array containing `true` in the positions + * of revoked (suspended) indices and `false` for non-revoked (non-suspended) indices. + * Throws an error if the underlying status list can't be decoded or any of supplied indices is out of range. + * + * @param {Iterable} indices + * @returns {Promise>} + */ + async revokedBatch(indices) { + return await this.list.revokedBatch(indices); + } +} diff --git a/packages/credential-sdk/src/types/trust-registry/id.js b/packages/credential-sdk/src/types/trust-registry/id.js new file mode 100644 index 000000000..3751b7b22 --- /dev/null +++ b/packages/credential-sdk/src/types/trust-registry/id.js @@ -0,0 +1,13 @@ +import { TypedBytes, sized } from '../generic'; + +export class TrustRegistryId extends TypedBytes {} + +export class DockTrustRegistryId extends sized(TrustRegistryId) { + static Size = 32; +} + +export class TrustRegistrySchemaId extends TypedBytes {} + +export class DockTrustRegistrySchemaId extends sized(TypedBytes) { + static Size = 32; +} diff --git a/packages/credential-sdk/src/types/trust-registry/index.js b/packages/credential-sdk/src/types/trust-registry/index.js new file mode 100644 index 000000000..0d06873f5 --- /dev/null +++ b/packages/credential-sdk/src/types/trust-registry/index.js @@ -0,0 +1,38 @@ +import { TypedMap, TypedString, TypedStruct } from '../generic'; +import { DockDidOrDidMethodKey } from '../did'; +import { TrustRegistrySchemas } from './schema'; +import { TrustRegistryId } from './id'; + +export class TrustRegistryInfo extends TypedStruct { + static Classes = { + name: class Name extends TypedString {}, + govFramework: class GovFramework extends TypedString {}, + convener: class Convener extends DockDidOrDidMethodKey {}, + }; +} + +export class TrustRegistryParticipantInformation extends TypedStruct { + static Classes = { + orgName: class OrgName extends TypedString {}, + logo: class Logo extends TypedString {}, + description: class Description extends TypedString {}, + }; +} + +export class TrustRegistry extends TypedStruct { + static Classes = { + info: TrustRegistryInfo, + schemas: TrustRegistrySchemas, + }; +} + +export class TrustRegistries extends TypedMap { + static KeyClass = TrustRegistryId; + + static ValueClass = TrustRegistry; +} + +export * from './id'; +export * from './issuer'; +export * from './schema'; +export * from './verifier'; diff --git a/packages/credential-sdk/src/types/trust-registry/issuer.js b/packages/credential-sdk/src/types/trust-registry/issuer.js new file mode 100644 index 000000000..6c26556fe --- /dev/null +++ b/packages/credential-sdk/src/types/trust-registry/issuer.js @@ -0,0 +1,22 @@ +import { DockDidOrDidMethodKey } from '../did'; +import { + TypedMap, TypedNumber, TypedSet, TypedString, +} from '../generic'; + +export class VerificationPrices extends TypedMap { + static KeyClass = TypedString; + + static ValueClass = TypedNumber; +} + +export class Issuer extends DockDidOrDidMethodKey {} + +export class IssuersSet extends TypedSet { + static Class = Issuer; +} + +export class Issuers extends TypedMap { + static KeyClass = Issuer; + + static ValueClass = VerificationPrices; +} diff --git a/packages/credential-sdk/src/types/trust-registry/schema.js b/packages/credential-sdk/src/types/trust-registry/schema.js new file mode 100644 index 000000000..3af5ab73e --- /dev/null +++ b/packages/credential-sdk/src/types/trust-registry/schema.js @@ -0,0 +1,17 @@ +import { TrustRegistryId } from './id'; +import { TypedMap, TypedStruct } from '../generic'; +import { Issuers } from './issuer'; +import { Verifiers } from './verifier'; + +export class TrustRegistrySchema extends TypedStruct { + static Classes = { + verifiers: Verifiers, + issuers: Issuers, + }; +} + +export class TrustRegistrySchemas extends TypedMap { + static KeyClass = TrustRegistryId; + + static ValueClass = TrustRegistrySchema; +} diff --git a/packages/credential-sdk/src/types/trust-registry/verifier.js b/packages/credential-sdk/src/types/trust-registry/verifier.js new file mode 100644 index 000000000..711300182 --- /dev/null +++ b/packages/credential-sdk/src/types/trust-registry/verifier.js @@ -0,0 +1,8 @@ +import { DockDidOrDidMethodKey } from '../did'; +import { TypedSet } from '../generic'; + +export class Verifier extends DockDidOrDidMethodKey {} + +export class Verifiers extends TypedSet { + static Class = Verifier; +} diff --git a/packages/credential-sdk/src/utils/assert.js b/packages/credential-sdk/src/utils/assert.js new file mode 100644 index 000000000..74a724c76 --- /dev/null +++ b/packages/credential-sdk/src/utils/assert.js @@ -0,0 +1,5 @@ +export const assert = (cond, error) => { + if (!cond) { + throw new Error(error); + } +}; diff --git a/src/utils/async.js b/packages/credential-sdk/src/utils/async.js similarity index 97% rename from src/utils/async.js rename to packages/credential-sdk/src/utils/async.js index a06c354f2..6d2447e85 100644 --- a/src/utils/async.js +++ b/packages/credential-sdk/src/utils/async.js @@ -173,7 +173,7 @@ export class ReusablePromiseMap { * @param {function(): Promise} f * @returns {Promise} */ -export const timeout = async (time, f = () => { }) => await new Promise((resolve, reject) => setTimeout(async () => { +export const timeout = async (time, f = () => {}) => await new Promise((resolve, reject) => setTimeout(async () => { try { resolve(await f()); } catch (err) { @@ -263,7 +263,8 @@ export const retry = async ( } throw new Error( - `Promise created by \`${fn}\` didn't resolve within the specified timeout of ${timeLimit} ms ${maxAttempts + 1 + `Promise created by \`${fn}\` didn't resolve within the specified timeout of ${timeLimit} ms ${ + maxAttempts + 1 } times`, ); }; diff --git a/packages/credential-sdk/src/utils/bytes.js b/packages/credential-sdk/src/utils/bytes.js new file mode 100644 index 000000000..2198fc5dc --- /dev/null +++ b/packages/credential-sdk/src/utils/bytes.js @@ -0,0 +1,179 @@ +import { applyToValue } from './interfaces'; +import { ensureBytes, ensureString, ensureUint8Array } from './type-helpers'; + +/** + * Check if the given input is hexadecimal or not. Optionally checks for the byte size of the hex. Case-insensitive on hex chars + * @param {string} value - Hexadecimal value + * @param {number} [byteSize] - Expected byte size of the input. + * @return {boolean} True if hex (with given size) else false + */ +export const isHexWithGivenByteSize = (value, byteSize) => { + if (typeof value !== 'string') { + return false; + } + const match = value.match(/^0x([0-9a-f]+$)/i); + + if (match && match.length > 1) { + if (byteSize !== undefined) { + // If `byteSize` is not a positive integer type, then check will fail + // 2 hex digits make a byte + return match[1].length === 2 * byteSize; + } + // Don't care about byte size of the match but it must be full byte + return match[1].length % 2 === 0; + } + + return false; +}; + +/** + * Returns `true` if provided value is a valid hex string. + * @param value + * @returns {boolean} + */ +export const isHex = (value) => isHexWithGivenByteSize(value); + +/** + * Converts supplied bytes to its hex representation. + * @param {Iterable} bytes + * @returns {string} + */ +export const u8aToHex = (bytes) => `0x${Buffer.from(ensureBytes(bytes)).toString('hex')}`; + +/** + * Creates random `Uint8Array` array of supplied byte length. + * @param {number} length + * @returns {Uint8Array} + */ +export const randomAsU8a = (length) => Uint8Array.from({ length }, () => (Math.random() * 255) | 0); // eslint-disable-line no-bitwise + +/** + * Creates random hex string of supplied byte length. + * @param {number} length + * @returns {string} + */ +export const randomAsHex = (length) => u8aToHex(randomAsU8a(length)); + +/** + * Creates `Uint8Array` from the supplied hex string. + * @param {string} str + * @returns {Uint8Array} + */ +export const hexToU8a = (str) => { + if (!isHex(str)) { + throw new Error( + `Expected valid hex string, received: \`${str}\` with type \`${typeof str}\``, + ); + } + + return Uint8Array.from(Buffer.from(str.slice(2), 'hex')); +}; + +/** + * Creates `Buffer` from the supplied string. + * @param {string} str + * @returns {Buffer} + */ +export const stringToBuffer = (str) => Buffer.from(ensureString(str)); + +/** + * Creates `Uint8Array` from the supplied string. + * @param {string} str + * @returns {Uint8Array} + */ +export const stringToU8a = (str) => Uint8Array.from(stringToBuffer(str)); + +/** + * Creates `Uint8Array` from the supplied buffer. + * @param {Buffer} buffer + * @returns {Uint8Array} + */ +export const bufferToU8a = (buffer) => { + if (!(buffer instanceof Buffer)) { + throw new Error(`Expected instance of \`Buffer\`, received: \`${buffer}\``); + } + + return Uint8Array.from(buffer); +}; + +/** + * Converts supplied bytes to `Uint8Array` representation. + * @param {Iterable} bytes + * @returns {Uint8Array} + */ +export const u8aToU8a = (bytes) => bufferToU8a(Buffer.from(ensureBytes(bytes))); + +/** + * Converts supplied bytes buffer to its hex string representation. + * @param {Iterable} bytes + * @returns {string} + */ +export const u8aToString = (bytes) => Buffer.from(ensureBytes(bytes)).toString(); + +/** + * Converts supplied string containing any characters to its hex string representation. + * @param {string} str + * @returns {string} + */ +export const stringToHex = (str) => u8aToHex(stringToBuffer(str)); + +/** + * Attempts to convert supplied bytes to `Uint8Array`. + * @param {string | Uint8Array | Array} bytes + * @returns {Uint8Array} + */ +export const normalizeToU8a = (bytes) => { + if (bytes instanceof Uint8Array) { + return bytes; + } else if (bytes instanceof Buffer || Array.isArray(bytes)) { + return u8aToU8a(bytes); + } else if (isHex(bytes)) { + return hexToU8a(bytes); + } + + throw new Error( + `Can't convert supplied value to \`Uint8Array\`: \`${bytes}\``, + ); +}; + +/** + * Attempts to convert supplied bytes or a raw string to `Uint8Array`. + * @param {Uint8Array | string} bytesOrString + * @returns {Uint8Array} + */ +export const normalizeOrConvertStringToU8a = (bytesOrString) => (typeof bytesOrString === 'string' && !isHex(bytesOrString) + ? stringToU8a(bytesOrString) + : normalizeToU8a(bytesOrString)); + +/** + * Attempts to get byte representation of the supplied object. + * Throws an error in case if it's not possible. + * @param {*} obj + * @returns {Uint8Array} + */ +export const valueBytes = (value) => applyToValue( + (inner) => Array.isArray(inner) || inner instanceof Uint8Array || 'bytes' in inner, + (inner) => ensureUint8Array(inner.bytes ?? u8aToU8a(inner)), + value, +); + +/** + * Normalizes the given input to hex. Expects a Uint8Array or a hex string + * @param {Uint8Array|string} data + * @returns {string} + */ +export function normalizeToHex(data) { + if ( + data instanceof Uint8Array + || data instanceof Buffer + || Array.isArray(data) + ) { + return u8aToHex(data); + } else if (isHex(data)) { + return data; + } + + throw new Error( + `Expected a hex string or a byte array, received \`${data}\` with type \`${typeof data}\``, + ); +} diff --git a/src/utils/generic.js b/packages/credential-sdk/src/utils/generic.js similarity index 91% rename from src/utils/generic.js rename to packages/credential-sdk/src/utils/generic.js index a693034ae..9ddeed27c 100644 --- a/src/utils/generic.js +++ b/packages/credential-sdk/src/utils/generic.js @@ -1,4 +1,7 @@ /* eslint-disable max-classes-per-file */ + +import { maybeToJSONString } from './interfaces'; + /** * A `Map` that has a capacity. */ @@ -41,7 +44,9 @@ export class MapWithCapacity extends Map { * Adjusts the size of the underlying map, so it will fit the capacity. */ adjustSize() { - while (this.size > this.capacity) { this.removeFirstAdded(); } + while (this.size > this.capacity) { + this.removeFirstAdded(); + } } /** @@ -61,7 +66,7 @@ export class MapWithCapacity extends Map { * @param {Iterable} iter * @returns {string} */ -export const fmtIter = (iter) => `\`[${[...iter].map(String).join(', ')}]\``; +export const fmtIter = (iter) => `[${[...iter].map(String).join(', ')}]`; /** * Pattern matching error. @@ -239,7 +244,7 @@ export class PatternMatcher { if (!Array.isArray(pattern.$mapOf) || pattern.$mapOf.length !== 2) { throw new Error( - `\`$mapOf\` pattern should be an array with two items, received \`${JSON.stringify( + `\`$mapOf\` pattern should be an array with two items, received \`${maybeToJSONString( pattern, )}\``, ); @@ -319,3 +324,24 @@ export class PatternMatcher { pattern.$ensure(value); } } + +/** + * Class extending `Array` with all prototype methods set to `undefined`. + */ +export class ArrayWithoutPrototypeMethods extends Array {} + +const Ignore = new Set([ + 'forEach', + 'filter', + 'every', + 'find', + 'findIndex', + 'splice', +]); +for (const member of Object.getOwnPropertyNames(Array.prototype)) { + if (!Ignore.has(member) && typeof Array.prototype[member] === 'function') { + Object.defineProperty(ArrayWithoutPrototypeMethods.prototype, member, { + enumerable: false, + }); + } +} diff --git a/packages/credential-sdk/src/utils/index.js b/packages/credential-sdk/src/utils/index.js new file mode 100644 index 000000000..79dacfc6a --- /dev/null +++ b/packages/credential-sdk/src/utils/index.js @@ -0,0 +1,10 @@ +export * from './assert'; +export * from './generic'; +export * from './interfaces'; +export * from './ss58'; +export * from './async'; +export * from './json-fetch'; +export * from './type-helpers'; +export * from './bytes'; +export * from './inheritance'; +export * from './misc'; diff --git a/packages/credential-sdk/src/utils/inheritance.js b/packages/credential-sdk/src/utils/inheritance.js new file mode 100644 index 000000000..558422bab --- /dev/null +++ b/packages/credential-sdk/src/utils/inheritance.js @@ -0,0 +1,136 @@ +import { fmtIter } from './generic'; + +/** + * Enhances the provided class with the given list of static properties to require + * in the inherited class. + * All properties will be checked for presence during the object constructor call. + * Each property on its own will be checked every time it is accessed. + * In case some property is missing, an error will be thrown. + * + * @template T + * @param {Array} properties + * @param {T} parentClass + * @returns {T} + */ +export function withExtendedStaticProperties(properties, parentClass) { + const name = `withExtStatics(${parentClass.name}, ${fmtIter(properties)})`; + + const extendedClass = { + [name]: class extends parentClass { + constructor(...args) { + super(...args); + + /* + * Ensures that properties are extended properly. + */ + for (const property of properties) { + if (this.constructor[property] === parentClass[property]) { + throw new Error( + `Static property \`${property}\` of \`${this.constructor.name}\` isn't extended properly`, + ); + } + } + } + }, + }; + + for (const property of properties) { + const propertySymbol = Symbol(property); + + Object.defineProperty(extendedClass[name], property, { + get() { + if ( + this !== extendedClass[name] + && this[propertySymbol] === parentClass[property] + ) { + throw new Error( + `Property \`${property}\` of \`${this.name}\` isn't extended properly`, + ); + } + return this[propertySymbol]; + }, + set(newValue) { + if (Object.hasOwnProperty.call(this, propertySymbol)) { + throw new Error( + `Can't override the property \`${property}\` of \`${this.name}\``, + ); + } + + this[propertySymbol] = newValue; + }, + }); + } + + return extendedClass[name]; +} + +/** + * Enhances the provided class with the given list of prototype properties to require + * in the inherited class. + * All properties will be checked for presence during the object constructor call. + * In case some property is missing, an error will be thrown. + * + * @template T + * @param {Array} properties + * @param {T} parentClass + * @returns {T} + */ +export function withExtendedPrototypeProperties(properties, parentClass) { + const name = `withExtProto(${parentClass.name}, ${fmtIter(properties)})`; + + const extendedClass = { + [name]: class extends parentClass { + constructor(...args) { + super(...args); + const proto = Object.getPrototypeOf(this); + + /* + * Ensures that properties are extended properly. + */ + for (const property of properties) { + if (proto[property] === parentClass.prototype[property]) { + throw new Error( + `Property \`${property}\` of the object prototype of \`${this.constructor.name}\` isn't extended properly`, + ); + } + } + } + }, + }; + + return extendedClass[name]; +} + +export const ensurePropertiesAreUnique = (reservedFields, fields) => { + for (const field of fields) { + if (reservedFields.has(field)) { + throw new Error(`Property \`${field}\` is reserved`); + } + } +}; + +const AllProperties = new WeakMap(); + +export const allProperties = (obj) => { + if (obj == null) return new Set(); + + let props = AllProperties.get(obj); + if (!props) { + props = new Set( + ...Object.getOwnPropertyNames(obj), + ...allProperties(Object.getPrototypeOf(obj)), + ); + AllProperties.set(obj, props); + } + + return props; +}; + +export const validateProperties = (obj) => ensurePropertiesAreUnique( + new Set(Object.getOwnPropertyNames(obj)), + allProperties(Object.getPrototypeOf(obj)), +); + +export const isPrototypeOf = (proto, obj) => Object.isPrototypeOf.call(proto, obj); + +export const isEqualToOrPrototypeOf = (proto, obj) => Object.is(proto, obj) || isPrototypeOf(proto, obj); diff --git a/packages/credential-sdk/src/utils/interfaces.js b/packages/credential-sdk/src/utils/interfaces.js new file mode 100644 index 000000000..ff1718317 --- /dev/null +++ b/packages/credential-sdk/src/utils/interfaces.js @@ -0,0 +1,87 @@ +/** + * Attempts to call `value.toJSON()`, returns `value` if method doesn't exist. + * @template T + * @param {T} value + * @returns {T | Object} + */ +export const maybeToJSON = (value) => (value && typeof value.toJSON === 'function' ? value.toJSON() : value); + +export const maybeToJSONString = (value) => { + const json = maybeToJSON(value); + + try { + return JSON.stringify(json); + } catch { + return String(json); + } +}; + +/** + * Attempts to compare two values using `value.eq(other)`, returns `boolean`. + * @template T + * @param {T} value + * @param {T} other + * @returns {boolean} + */ +export const maybeEq = (value, other) => (value && typeof value.eq === 'function' ? value.eq(other) : value === other); + +/** + * Attempts to call `value.toHuman()` or `value.toJSON`, returns `value` if methods don't exist. + * @template T + * @param {T} value + * @returns {T | Object} + */ +export const maybeToHuman = (obj) => (obj && typeof obj.toHuman === 'function' ? obj.toHuman() : maybeToJSON(obj)); + +/** + * Attempts to call `value.toNumber()`, returns `value` if method doesn't exist. + * @template T + * @param {T} value + * @returns {T | number} + */ +export const maybeToNumber = (value) => (value && typeof value.toNumber === 'function' ? value.toNumber() : +value); + +/** + * Marks function that it can't be used as a constructor. + */ +export const NotAConstructor = Symbol.for( + '@docknetwork/credential-sdk/NotAConstructor', +); + +/** + * Attempts to intantiate new object of the supplied class using provided arguments. + * @param Class + * @param args + * @returns {T | number} + */ +export const maybeNew = (Class, args) => (!Class[NotAConstructor] ? new Class(...args) : Class.apply(Class, args)); + +/** + * Attempts to create new instance of the supplied class using `Class.from(obj)`, instantiates class if `from` doesn't exist. + * @param Class + * @param args + * @returns {T | number} + */ +export const maybeFrom = (klass, obj) => (typeof klass.from === 'function' ? klass.from(obj) : maybeNew(klass, [obj])); + +/** + * Applies function to the inner value of the provided object. + * @template T + * @template I + * @template O + * @param {function(I): boolean} check + * @param {function(I): O} fn + * @param {T} value + * @returns {O} + */ +export const applyToValue = (check, fn, value, rec = true) => { + if (check(value)) { + return fn(value); + } else if (rec && typeof value?.applyToValue === 'function') { + return value.applyToValue(check, fn); + } + + throw new Error( + `\`fn\` can't be applied because value \`${value}\` didn't pass the check \`${check}\``, + ); +}; diff --git a/src/utils/json-fetch.js b/packages/credential-sdk/src/utils/json-fetch.js similarity index 100% rename from src/utils/json-fetch.js rename to packages/credential-sdk/src/utils/json-fetch.js diff --git a/src/utils/misc.js b/packages/credential-sdk/src/utils/misc.js similarity index 76% rename from src/utils/misc.js rename to packages/credential-sdk/src/utils/misc.js index a85a23ffe..6f719b7e1 100644 --- a/src/utils/misc.js +++ b/packages/credential-sdk/src/utils/misc.js @@ -1,6 +1,5 @@ /* eslint-disable max-classes-per-file */ import elliptic from 'elliptic'; -import { blake2AsHex } from '@polkadot/util-crypto'; import { sha256 } from 'js-sha256'; import { PatternMatcher } from './generic'; @@ -19,6 +18,10 @@ export function getBytesForStateChange(api, stateChange) { return api.createType('StateChange', stateChange).toU8a(); } +export async function getDidNonce() { + throw new Error('Unimplemented'); +} + export function getStateChange(api, name, value) { const stateChange = {}; stateChange[name] = value; @@ -62,6 +65,12 @@ export function verifyEcdsaSecp256k1SigPrehashed( return secp256k1Curve.verify(messageHash, sig, pk); } +// deep copy a json serializable object +export function deepClone(obj) { + // https://jsben.ch/E55IQ + return JSON.parse(JSON.stringify(obj)); +} + /** * Get unique elements from an array as seen by the filterCallback function. * @param {array} a - Array to check for duplicates. @@ -76,40 +85,6 @@ export function getUniqueElementsFromArray(a, filterCallback) { }); } -/** - * Encodes an extrinsic as a blake2 hash - * @param {*} api - API for creating Call type - * @param {*} tx - Extrinsic to encode - * @returns {string} - */ -export function encodeExtrinsicAsHash(api, tx) { - return blake2AsHex(api.createType('Call', tx).toU8a()); -} - -/** - * Get the nonce to be used for sending the next transaction if not provided already. - * @param {DockDidOrDidMethodKey} didOrDidMethodKey - DID whose nonce is needed - * @param nonce - If provided, returned as it is. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise} - */ -export async function getDidNonce( - didOrDidMethodKey, - nonce = undefined, - didModule = undefined, -) { - if (nonce === undefined && didModule === undefined) { - throw new Error( - 'Provide either nonce or didModule to fetch nonce but none provided', - ); - } - if (nonce === undefined) { - return didModule.getNextNonceForDid(didOrDidMethodKey); - } - return nonce; -} - /** * Ensures that provided value matches supplied pattern(s), throws an error otherwise. * @@ -126,5 +101,3 @@ export const ensureMatchesPattern = (pattern, value) => new PatternMatcher().che * @returns {number[]} */ export const inclusiveRange = (start, stop, step) => Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step); - -export * from './keypair'; diff --git a/packages/credential-sdk/src/utils/ss58.js b/packages/credential-sdk/src/utils/ss58.js new file mode 100644 index 000000000..f7c9d431e --- /dev/null +++ b/packages/credential-sdk/src/utils/ss58.js @@ -0,0 +1,26 @@ +import { encode, decode } from '@subsquid/ss58-codec'; +import { normalizeToU8a, u8aToHex } from './bytes'; + +export const encodeAsSS58 = (address, prefix = 42) => encode({ bytes: normalizeToU8a(address), prefix }); + +export const decodeFromSS58 = (value) => u8aToHex(decode(value).bytes); + +/** + * Convert address to Dock appropriate network address. + * @param addr - address to convert + * @param network - the network to use, allowed values are `main`, `test` and `dev` corresponding to mainnet, testnet and dev node + */ +export const asDockAddress = (addr, network = 'test') => { + switch (network) { + case 'dev': + return encodeAsSS58(addr, 42); + case 'test': + return encodeAsSS58(addr, 21); + case 'main': + return encodeAsSS58(addr, 22); + default: + throw new Error( + `Network can be either test or main or dev but was passed as ${network}`, + ); + } +}; diff --git a/src/utils/type-helpers.js b/packages/credential-sdk/src/utils/type-helpers.js similarity index 61% rename from src/utils/type-helpers.js rename to packages/credential-sdk/src/utils/type-helpers.js index defa21b54..e9574db4f 100644 --- a/src/utils/type-helpers.js +++ b/packages/credential-sdk/src/utils/type-helpers.js @@ -1,4 +1,8 @@ -import { METHOD_REG_EXP_PATTERN, HEX_ID_REG_EXP_PATTERN } from '../resolver/generic/const'; +import { + METHOD_REG_EXP_PATTERN, + HEX_ID_REG_EXP_PATTERN, +} from '../resolver/generic/const'; +import { isPrototypeOf } from './inheritance'; /** * Return true if the given value is a string. * @param value @@ -20,11 +24,13 @@ export function isObject(value) { /** * Fail if the given value isn't a string * @param value + * @returns {string} */ -export function ensureString(value) { +export function ensureString(value, ctx = '') { if (!isString(value)) { - throw new Error(`${value} needs to be a string.`); + throw new Error(`${value} needs to be a string. ${ctx}`); } + return String(value); } /** @@ -37,6 +43,28 @@ export function ensureObject(value) { } } +export function ensureArrayLike(value, errCtx = '') { + if ( + Array.isArray(value) + || value instanceof Uint8Array + || value instanceof Uint16Array + || value instanceof Uint32Array + || value instanceof Buffer + ) { + return value; + } else { + throw new Error(`\`${value}\` needs to be an Array-like. ${errCtx}`); + } +} + +export function ensureIterable(value, errCtx = '') { + if (typeof value?.[Symbol.iterator] !== 'function') { + throw new Error(`${value} needs to be an iterable. ${errCtx}`); + } + + return value; +} + /** * Fail if the given string isn't a URI * @param uri @@ -49,6 +77,64 @@ export function ensureURI(uri) { } } +export function ensureByte(byte) { + if (typeof byte !== 'number') { + throw new TypeError( + `Expected number in range 0-255, received \`${byte}\` with type \`${typeof byte}\``, + ); + } + // eslint-disable-next-line no-bitwise + if (!Number.isInteger(byte) || (byte & 0xff) !== byte) { + throw new Error(`Value is out of range 0-255: \`${byte}\``); + } + + return byte; +} + +export const ensureBytes = (bytes) => (bytes instanceof Uint8Array + ? bytes + : [...ensureIterable(bytes)].map(ensureByte)); + +export const ensureUint8Array = (bytes) => { + if (!(bytes instanceof Uint8Array)) { + throw new Error( + `Expected instance of \`Uint8Array\`, received: \`${bytes}\``, + ); + } + + return bytes; +}; + +export const isBytes = (bytes) => { + try { + ensureBytes(bytes); + + return true; + } catch { + return false; + } +}; + +export const ensureInstanceOf = (value, klass) => { + if (!(value instanceof klass)) { + throw new Error( + `Expected \`${value}\` to be an instance of \`${klass.name}\``, + ); + } + + return value; +}; + +export const ensurePrototypeOf = (proto, value) => { + if (!isPrototypeOf(proto, value)) { + throw new Error( + `Expected \`${proto.name}\` to be a prototype of \`${value}\``, + ); + } + + return value; +}; + const STATUS_LIST_ID_MATCHER = new RegExp( `^status-list2021:${METHOD_REG_EXP_PATTERN}:${HEX_ID_REG_EXP_PATTERN}$`, ); diff --git a/src/utils/vc/CredentialIssuancePurpose.js b/packages/credential-sdk/src/vc/CredentialIssuancePurpose.js similarity index 89% rename from src/utils/vc/CredentialIssuancePurpose.js rename to packages/credential-sdk/src/vc/CredentialIssuancePurpose.js index ea02f5aa9..d1f6666c3 100644 --- a/src/utils/vc/CredentialIssuancePurpose.js +++ b/packages/credential-sdk/src/vc/CredentialIssuancePurpose.js @@ -50,15 +50,22 @@ export default class CredentialIssuancePurpose extends AssertionProofPurpose { * * @returns {Promise<{valid: boolean, error: Error}>} Resolves on completion. */ - async validate(proof, { - document, suite, verificationMethod, documentLoader, expansionMap, - }) { + async validate( + proof, + { + document, suite, verificationMethod, documentLoader, expansionMap, + }, + ) { try { if (proof.type === Bls12381BBDT16MacProofDockName) { return { valid: true, error: null }; } const result = await super.validate(proof, { - document, suite, verificationMethod, documentLoader, expansionMap, + document, + suite, + verificationMethod, + documentLoader, + expansionMap, }); if (!result.valid) { @@ -69,8 +76,10 @@ export default class CredentialIssuancePurpose extends AssertionProofPurpose { documentLoader, }); - const issuer = jsonld.getValues(expandedDoc, - 'https://www.w3.org/2018/credentials#issuer'); + const issuer = jsonld.getValues( + expandedDoc, + 'https://www.w3.org/2018/credentials#issuer', + ); if (!issuer || issuer.length === 0) { throw new Error('Credential issuer is required.'); diff --git a/src/utils/vc/constants.js b/packages/credential-sdk/src/vc/constants.js similarity index 100% rename from src/utils/vc/constants.js rename to packages/credential-sdk/src/vc/constants.js diff --git a/packages/credential-sdk/src/vc/contexts.js b/packages/credential-sdk/src/vc/contexts.js new file mode 100644 index 000000000..8112b3173 --- /dev/null +++ b/packages/credential-sdk/src/vc/contexts.js @@ -0,0 +1,45 @@ +import vcExamplesV1 from './contexts/vc-examples-v1'; +import ed25519V1Context from './contexts/ed25519-2020-v1-context.json'; +import sr25519Context from './contexts/sr25519-context.json'; +import secContext from './contexts/security_context'; +import secContextV1 from './contexts/security-v1.json'; +import didV1Context from './contexts/did-v1-updated.json'; +import credV1Context from './contexts/credential-v1-updated.json'; +import schema from './contexts/schema.json'; +import odrl from './contexts/odrl.json'; +import bbsV1Context from './contexts/bbs-v1.json'; +import dockBBSV1Context from './contexts/dock-bbs-v1.json'; +import dockBBS23V1Context from './contexts/dock-bbs23-v1.json'; +import dockPSV1Context from './contexts/dock-ps-v1.json'; +import dockBBDT16V1Context from './contexts/dock-bbdt16-v1.json'; +import dockPrettyVCContext from './contexts/prettyvc.json'; +import jws2020V1Context from './contexts/jws-2020-v1.json'; +import statusList21Context from './contexts/status-list-21'; +import privateStatusList21Context from './contexts/private-status-list-21'; + +// Lookup of following URLs will lead to loading data from the context directory, this is done as the Sr25519 keys are not +// supported in any W3C standard and vc-js has them stored locally. This is a temporary solution. +export default new Map([ + ['https://ld.dock.io/credentials/prettyvc', dockPrettyVCContext], + ['https://ld.dock.io/security/bbs/v1', dockBBSV1Context], + ['https://ld.dock.io/security/bbs23/v1', dockBBS23V1Context], + ['https://ld.dock.io/security/ps/v1', dockPSV1Context], + ['https://ld.dock.io/security/bbdt16/v1', dockBBDT16V1Context], + ['https://w3id.org/security/bbs/v1', bbsV1Context], + ['https://w3c-ccg.github.io/ldp-bbs2020/contexts/v1/', bbsV1Context], + ['https://www.w3.org/2018/credentials/v1', credV1Context], + ['https://www.w3.org/2018/credentials/examples/v1', vcExamplesV1], + ['https://www.w3.org/ns/odrl.jsonld', odrl], + ['https://schema.org', schema], + ['http://schema.org', schema], + ['https://www.dock.io/2020/credentials/context/sr25519', sr25519Context], + ['https://w3id.org/security/v1', secContextV1], + ['https://w3id.org/security/v2', secContext], + ['https://w3id.org/did/v0.11', didV1Context], + ['https://www.w3.org/ns/did/v1', didV1Context], + ['https://w3id.org/security/suites/ed25519-2020/v1', ed25519V1Context], + ['https://w3id.org/security/suites/jws-2020/v1', jws2020V1Context], + // This is overridden because the URL is 404 now, likely because domain name change. But the status-list library still uses the old domain name + ['https://w3id.org/vc/status-list/2021/v1', statusList21Context], + ['https://ld.dock.io/private-status-list-21', privateStatusList21Context], +]); diff --git a/src/utils/vc/contexts/bbs-v1.json b/packages/credential-sdk/src/vc/contexts/bbs-v1.json similarity index 100% rename from src/utils/vc/contexts/bbs-v1.json rename to packages/credential-sdk/src/vc/contexts/bbs-v1.json diff --git a/src/utils/vc/contexts/credential-v1-updated.json b/packages/credential-sdk/src/vc/contexts/credential-v1-updated.json similarity index 100% rename from src/utils/vc/contexts/credential-v1-updated.json rename to packages/credential-sdk/src/vc/contexts/credential-v1-updated.json diff --git a/src/utils/vc/contexts/did-v1-updated.json b/packages/credential-sdk/src/vc/contexts/did-v1-updated.json similarity index 100% rename from src/utils/vc/contexts/did-v1-updated.json rename to packages/credential-sdk/src/vc/contexts/did-v1-updated.json diff --git a/src/utils/vc/contexts/dock-bbdt16-v1.json b/packages/credential-sdk/src/vc/contexts/dock-bbdt16-v1.json similarity index 96% rename from src/utils/vc/contexts/dock-bbdt16-v1.json rename to packages/credential-sdk/src/vc/contexts/dock-bbdt16-v1.json index 85e40aed5..76f1543b4 100644 --- a/src/utils/vc/contexts/dock-bbdt16-v1.json +++ b/packages/credential-sdk/src/vc/contexts/dock-bbdt16-v1.json @@ -61,7 +61,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -77,7 +77,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -97,7 +97,7 @@ "context": "https://ld.dock.io/security#context", "bounds": { "@id": "https://ld.dock.io/security#bounds", - "@context": {"@vocab": "https://ld.dock.io/security/bounds"} + "@context": { "@vocab": "https://ld.dock.io/security/bounds" } }, "sigType": "https://ld.dock.io/security#sigType", "boundedPseudonyms": "https://ld.dock.io/security#boundedPseudonyms", diff --git a/src/utils/vc/contexts/dock-bbs-v1.json b/packages/credential-sdk/src/vc/contexts/dock-bbs-v1.json similarity index 97% rename from src/utils/vc/contexts/dock-bbs-v1.json rename to packages/credential-sdk/src/vc/contexts/dock-bbs-v1.json index bc58e2c5b..04135e450 100644 --- a/src/utils/vc/contexts/dock-bbs-v1.json +++ b/packages/credential-sdk/src/vc/contexts/dock-bbs-v1.json @@ -61,7 +61,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -77,7 +77,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -97,7 +97,7 @@ "context": "https://ld.dock.io/security#context", "bounds": { "@id": "https://ld.dock.io/security#bounds", - "@context": {"@vocab": "https://ld.dock.io/security/bounds"} + "@context": { "@vocab": "https://ld.dock.io/security/bounds" } }, "sigType": "https://ld.dock.io/security#sigType", "boundedPseudonyms": "https://ld.dock.io/security#boundedPseudonyms", diff --git a/src/utils/vc/contexts/dock-bbs23-v1.json b/packages/credential-sdk/src/vc/contexts/dock-bbs23-v1.json similarity index 96% rename from src/utils/vc/contexts/dock-bbs23-v1.json rename to packages/credential-sdk/src/vc/contexts/dock-bbs23-v1.json index ce858ed2a..2340c4599 100644 --- a/src/utils/vc/contexts/dock-bbs23-v1.json +++ b/packages/credential-sdk/src/vc/contexts/dock-bbs23-v1.json @@ -61,7 +61,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -77,7 +77,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -97,7 +97,7 @@ "context": "https://ld.dock.io/security#context", "bounds": { "@id": "https://ld.dock.io/security#bounds", - "@context": {"@vocab": "https://ld.dock.io/security/bounds"} + "@context": { "@vocab": "https://ld.dock.io/security/bounds" } }, "sigType": "https://ld.dock.io/security#sigType", "boundedPseudonyms": "https://ld.dock.io/security#boundedPseudonyms", diff --git a/src/utils/vc/contexts/dock-ps-v1.json b/packages/credential-sdk/src/vc/contexts/dock-ps-v1.json similarity index 96% rename from src/utils/vc/contexts/dock-ps-v1.json rename to packages/credential-sdk/src/vc/contexts/dock-ps-v1.json index 15eb73999..ce48e1a86 100644 --- a/src/utils/vc/contexts/dock-ps-v1.json +++ b/packages/credential-sdk/src/vc/contexts/dock-ps-v1.json @@ -61,7 +61,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -77,7 +77,7 @@ "revocationId": "https://ld.dock.io/security#revocationId", "extra": { "@id": "https://ld.dock.io/security#extra", - "@context": {"@vocab": "https://ld.dock.io/security/extra"} + "@context": { "@vocab": "https://ld.dock.io/security/extra" } } } }, @@ -97,7 +97,7 @@ "context": "https://ld.dock.io/security#context", "bounds": { "@id": "https://ld.dock.io/security#bounds", - "@context": {"@vocab": "https://ld.dock.io/security/bounds"} + "@context": { "@vocab": "https://ld.dock.io/security/bounds" } }, "sigType": "https://ld.dock.io/security#sigType", "boundedPseudonyms": "https://ld.dock.io/security#boundedPseudonyms", diff --git a/src/utils/vc/contexts/ed25519-2020-v1-context.json b/packages/credential-sdk/src/vc/contexts/ed25519-2020-v1-context.json similarity index 100% rename from src/utils/vc/contexts/ed25519-2020-v1-context.json rename to packages/credential-sdk/src/vc/contexts/ed25519-2020-v1-context.json diff --git a/src/utils/vc/contexts/jws-2020-v1.json b/packages/credential-sdk/src/vc/contexts/jws-2020-v1.json similarity index 100% rename from src/utils/vc/contexts/jws-2020-v1.json rename to packages/credential-sdk/src/vc/contexts/jws-2020-v1.json diff --git a/src/utils/vc/contexts/odrl.json b/packages/credential-sdk/src/vc/contexts/odrl.json similarity index 100% rename from src/utils/vc/contexts/odrl.json rename to packages/credential-sdk/src/vc/contexts/odrl.json diff --git a/src/utils/vc/contexts/prettyvc.json b/packages/credential-sdk/src/vc/contexts/prettyvc.json similarity index 100% rename from src/utils/vc/contexts/prettyvc.json rename to packages/credential-sdk/src/vc/contexts/prettyvc.json diff --git a/src/utils/vc/contexts/private-status-list-21.js b/packages/credential-sdk/src/vc/contexts/private-status-list-21.js similarity index 100% rename from src/utils/vc/contexts/private-status-list-21.js rename to packages/credential-sdk/src/vc/contexts/private-status-list-21.js diff --git a/packages/credential-sdk/src/vc/contexts/schema.json b/packages/credential-sdk/src/vc/contexts/schema.json new file mode 100644 index 000000000..dc66a3179 --- /dev/null +++ b/packages/credential-sdk/src/vc/contexts/schema.json @@ -0,0 +1,2538 @@ +{ + "@context": { + "type": "@type", + "id": "@id", + "HTML": { "@id": "rdf:HTML" }, + + "@vocab": "http://schema.org/", + "xml": "http://www.w3.org/XML/1998/namespace", + "foaf": "http://xmlns.com/foaf/0.1/", + "eli": "http://data.europa.eu/eli/ontology#", + "snomed": "http://purl.bioontology.org/ontology/SNOMEDCT/", + "bibo": "http://purl.org/ontology/bibo/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "void": "http://rdfs.org/ns/void#", + "dc": "http://purl.org/dc/elements/1.1/", + "dctype": "http://purl.org/dc/dcmitype/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "dcat": "http://www.w3.org/ns/dcat#", + "rdfa": "http://www.w3.org/ns/rdfa#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "schema": "http://schema.org/", + "dct": "http://purl.org/dc/terms/", + "dcterms": "http://purl.org/dc/terms/", + "owl": "http://www.w3.org/2002/07/owl#", + "xsd1": "hhttp://www.w3.org/2001/XMLSchema#", + "3DModel": { "@id": "schema:3DModel" }, + "AMRadioChannel": { "@id": "schema:AMRadioChannel" }, + "APIReference": { "@id": "schema:APIReference" }, + "Abdomen": { "@id": "schema:Abdomen" }, + "AboutPage": { "@id": "schema:AboutPage" }, + "AcceptAction": { "@id": "schema:AcceptAction" }, + "Accommodation": { "@id": "schema:Accommodation" }, + "AccountingService": { "@id": "schema:AccountingService" }, + "AchieveAction": { "@id": "schema:AchieveAction" }, + "Action": { "@id": "schema:Action" }, + "ActionAccessSpecification": { "@id": "schema:ActionAccessSpecification" }, + "ActionStatusType": { "@id": "schema:ActionStatusType" }, + "ActivateAction": { "@id": "schema:ActivateAction" }, + "ActiveActionStatus": { "@id": "schema:ActiveActionStatus" }, + "ActiveNotRecruiting": { "@id": "schema:ActiveNotRecruiting" }, + "AddAction": { "@id": "schema:AddAction" }, + "AdministrativeArea": { "@id": "schema:AdministrativeArea" }, + "AdultEntertainment": { "@id": "schema:AdultEntertainment" }, + "AdvertiserContentArticle": { "@id": "schema:AdvertiserContentArticle" }, + "AerobicActivity": { "@id": "schema:AerobicActivity" }, + "AggregateOffer": { "@id": "schema:AggregateOffer" }, + "AggregateRating": { "@id": "schema:AggregateRating" }, + "AgreeAction": { "@id": "schema:AgreeAction" }, + "Airline": { "@id": "schema:Airline" }, + "Airport": { "@id": "schema:Airport" }, + "AlbumRelease": { "@id": "schema:AlbumRelease" }, + "AlignmentObject": { "@id": "schema:AlignmentObject" }, + "AllWheelDriveConfiguration": { + "@id": "schema:AllWheelDriveConfiguration" + }, + "AllocateAction": { "@id": "schema:AllocateAction" }, + "AmusementPark": { "@id": "schema:AmusementPark" }, + "AnaerobicActivity": { "@id": "schema:AnaerobicActivity" }, + "AnalysisNewsArticle": { "@id": "schema:AnalysisNewsArticle" }, + "AnatomicalStructure": { "@id": "schema:AnatomicalStructure" }, + "AnatomicalSystem": { "@id": "schema:AnatomicalSystem" }, + "Anesthesia": { "@id": "schema:Anesthesia" }, + "AnimalShelter": { "@id": "schema:AnimalShelter" }, + "Answer": { "@id": "schema:Answer" }, + "Apartment": { "@id": "schema:Apartment" }, + "ApartmentComplex": { "@id": "schema:ApartmentComplex" }, + "Appearance": { "@id": "schema:Appearance" }, + "AppendAction": { "@id": "schema:AppendAction" }, + "ApplyAction": { "@id": "schema:ApplyAction" }, + "ApprovedIndication": { "@id": "schema:ApprovedIndication" }, + "Aquarium": { "@id": "schema:Aquarium" }, + "ArchiveComponent": { "@id": "schema:ArchiveComponent" }, + "ArchiveOrganization": { "@id": "schema:ArchiveOrganization" }, + "ArriveAction": { "@id": "schema:ArriveAction" }, + "ArtGallery": { "@id": "schema:ArtGallery" }, + "Artery": { "@id": "schema:Artery" }, + "Article": { "@id": "schema:Article" }, + "AskAction": { "@id": "schema:AskAction" }, + "AskPublicNewsArticle": { "@id": "schema:AskPublicNewsArticle" }, + "AssessAction": { "@id": "schema:AssessAction" }, + "AssignAction": { "@id": "schema:AssignAction" }, + "Atlas": { "@id": "schema:Atlas" }, + "Attorney": { "@id": "schema:Attorney" }, + "Audience": { "@id": "schema:Audience" }, + "AudioObject": { "@id": "schema:AudioObject" }, + "Audiobook": { "@id": "schema:Audiobook" }, + "AudiobookFormat": { "@id": "schema:AudiobookFormat" }, + "AuthoritativeLegalValue": { "@id": "schema:AuthoritativeLegalValue" }, + "AuthorizeAction": { "@id": "schema:AuthorizeAction" }, + "AutoBodyShop": { "@id": "schema:AutoBodyShop" }, + "AutoDealer": { "@id": "schema:AutoDealer" }, + "AutoPartsStore": { "@id": "schema:AutoPartsStore" }, + "AutoRental": { "@id": "schema:AutoRental" }, + "AutoRepair": { "@id": "schema:AutoRepair" }, + "AutoWash": { "@id": "schema:AutoWash" }, + "AutomatedTeller": { "@id": "schema:AutomatedTeller" }, + "AutomotiveBusiness": { "@id": "schema:AutomotiveBusiness" }, + "Ayurvedic": { "@id": "schema:Ayurvedic" }, + "BackgroundNewsArticle": { "@id": "schema:BackgroundNewsArticle" }, + "Bacteria": { "@id": "schema:Bacteria" }, + "Bakery": { "@id": "schema:Bakery" }, + "Balance": { "@id": "schema:Balance" }, + "BankAccount": { "@id": "schema:BankAccount" }, + "BankOrCreditUnion": { "@id": "schema:BankOrCreditUnion" }, + "BarOrPub": { "@id": "schema:BarOrPub" }, + "Barcode": { "@id": "schema:Barcode" }, + "Beach": { "@id": "schema:Beach" }, + "BeautySalon": { "@id": "schema:BeautySalon" }, + "BedAndBreakfast": { "@id": "schema:BedAndBreakfast" }, + "BedDetails": { "@id": "schema:BedDetails" }, + "BedType": { "@id": "schema:BedType" }, + "BefriendAction": { "@id": "schema:BefriendAction" }, + "BikeStore": { "@id": "schema:BikeStore" }, + "Blog": { "@id": "schema:Blog" }, + "BlogPosting": { "@id": "schema:BlogPosting" }, + "BloodTest": { "@id": "schema:BloodTest" }, + "BoardingPolicyType": { "@id": "schema:BoardingPolicyType" }, + "BodyOfWater": { "@id": "schema:BodyOfWater" }, + "Bone": { "@id": "schema:Bone" }, + "Book": { "@id": "schema:Book" }, + "BookFormatType": { "@id": "schema:BookFormatType" }, + "BookSeries": { "@id": "schema:BookSeries" }, + "BookStore": { "@id": "schema:BookStore" }, + "BookmarkAction": { "@id": "schema:BookmarkAction" }, + "Boolean": { "@id": "schema:Boolean" }, + "BorrowAction": { "@id": "schema:BorrowAction" }, + "BowlingAlley": { "@id": "schema:BowlingAlley" }, + "BrainStructure": { "@id": "schema:BrainStructure" }, + "Brand": { "@id": "schema:Brand" }, + "BreadcrumbList": { "@id": "schema:BreadcrumbList" }, + "Brewery": { "@id": "schema:Brewery" }, + "Bridge": { "@id": "schema:Bridge" }, + "BroadcastChannel": { "@id": "schema:BroadcastChannel" }, + "BroadcastEvent": { "@id": "schema:BroadcastEvent" }, + "BroadcastFrequencySpecification": { + "@id": "schema:BroadcastFrequencySpecification" + }, + "BroadcastRelease": { "@id": "schema:BroadcastRelease" }, + "BroadcastService": { "@id": "schema:BroadcastService" }, + "BrokerageAccount": { "@id": "schema:BrokerageAccount" }, + "BuddhistTemple": { "@id": "schema:BuddhistTemple" }, + "BusOrCoach": { "@id": "schema:BusOrCoach" }, + "BusReservation": { "@id": "schema:BusReservation" }, + "BusStation": { "@id": "schema:BusStation" }, + "BusStop": { "@id": "schema:BusStop" }, + "BusTrip": { "@id": "schema:BusTrip" }, + "BusinessAudience": { "@id": "schema:BusinessAudience" }, + "BusinessEntityType": { "@id": "schema:BusinessEntityType" }, + "BusinessEvent": { "@id": "schema:BusinessEvent" }, + "BusinessFunction": { "@id": "schema:BusinessFunction" }, + "BuyAction": { "@id": "schema:BuyAction" }, + "CDFormat": { "@id": "schema:CDFormat" }, + "CT": { "@id": "schema:CT" }, + "CableOrSatelliteService": { "@id": "schema:CableOrSatelliteService" }, + "CafeOrCoffeeShop": { "@id": "schema:CafeOrCoffeeShop" }, + "Campground": { "@id": "schema:Campground" }, + "CampingPitch": { "@id": "schema:CampingPitch" }, + "Canal": { "@id": "schema:Canal" }, + "CancelAction": { "@id": "schema:CancelAction" }, + "Car": { "@id": "schema:Car" }, + "CarUsageType": { "@id": "schema:CarUsageType" }, + "Cardiovascular": { "@id": "schema:Cardiovascular" }, + "CardiovascularExam": { "@id": "schema:CardiovascularExam" }, + "CaseSeries": { "@id": "schema:CaseSeries" }, + "Casino": { "@id": "schema:Casino" }, + "CassetteFormat": { "@id": "schema:CassetteFormat" }, + "CategoryCode": { "@id": "schema:CategoryCode" }, + "CategoryCodeSet": { "@id": "schema:CategoryCodeSet" }, + "CatholicChurch": { "@id": "schema:CatholicChurch" }, + "Cemetery": { "@id": "schema:Cemetery" }, + "Chapter": { "@id": "schema:Chapter" }, + "CheckAction": { "@id": "schema:CheckAction" }, + "CheckInAction": { "@id": "schema:CheckInAction" }, + "CheckOutAction": { "@id": "schema:CheckOutAction" }, + "CheckoutPage": { "@id": "schema:CheckoutPage" }, + "ChildCare": { "@id": "schema:ChildCare" }, + "ChildrensEvent": { "@id": "schema:ChildrensEvent" }, + "Chiropractic": { "@id": "schema:Chiropractic" }, + "ChooseAction": { "@id": "schema:ChooseAction" }, + "Church": { "@id": "schema:Church" }, + "City": { "@id": "schema:City" }, + "CityHall": { "@id": "schema:CityHall" }, + "CivicStructure": { "@id": "schema:CivicStructure" }, + "Claim": { "@id": "schema:Claim" }, + "ClaimReview": { "@id": "schema:ClaimReview" }, + "Class": { "@id": "schema:Class" }, + "Clinician": { "@id": "schema:Clinician" }, + "Clip": { "@id": "schema:Clip" }, + "ClothingStore": { "@id": "schema:ClothingStore" }, + "CoOp": { "@id": "schema:CoOp" }, + "Code": { "@id": "schema:Code" }, + "CohortStudy": { "@id": "schema:CohortStudy" }, + "Collection": { "@id": "schema:Collection" }, + "CollectionPage": { "@id": "schema:CollectionPage" }, + "CollegeOrUniversity": { "@id": "schema:CollegeOrUniversity" }, + "ComedyClub": { "@id": "schema:ComedyClub" }, + "ComedyEvent": { "@id": "schema:ComedyEvent" }, + "ComicCoverArt": { "@id": "schema:ComicCoverArt" }, + "ComicIssue": { "@id": "schema:ComicIssue" }, + "ComicSeries": { "@id": "schema:ComicSeries" }, + "ComicStory": { "@id": "schema:ComicStory" }, + "Comment": { "@id": "schema:Comment" }, + "CommentAction": { "@id": "schema:CommentAction" }, + "CommentPermission": { "@id": "schema:CommentPermission" }, + "CommunicateAction": { "@id": "schema:CommunicateAction" }, + "CommunityHealth": { "@id": "schema:CommunityHealth" }, + "CompilationAlbum": { "@id": "schema:CompilationAlbum" }, + "CompleteDataFeed": { "@id": "schema:CompleteDataFeed" }, + "Completed": { "@id": "schema:Completed" }, + "CompletedActionStatus": { "@id": "schema:CompletedActionStatus" }, + "CompoundPriceSpecification": { + "@id": "schema:CompoundPriceSpecification" + }, + "ComputerLanguage": { "@id": "schema:ComputerLanguage" }, + "ComputerStore": { "@id": "schema:ComputerStore" }, + "ConfirmAction": { "@id": "schema:ConfirmAction" }, + "Consortium": { "@id": "schema:Consortium" }, + "ConsumeAction": { "@id": "schema:ConsumeAction" }, + "ContactPage": { "@id": "schema:ContactPage" }, + "ContactPoint": { "@id": "schema:ContactPoint" }, + "ContactPointOption": { "@id": "schema:ContactPointOption" }, + "Continent": { "@id": "schema:Continent" }, + "ControlAction": { "@id": "schema:ControlAction" }, + "ConvenienceStore": { "@id": "schema:ConvenienceStore" }, + "Conversation": { "@id": "schema:Conversation" }, + "CookAction": { "@id": "schema:CookAction" }, + "Corporation": { "@id": "schema:Corporation" }, + "CorrectionComment": { "@id": "schema:CorrectionComment" }, + "Country": { "@id": "schema:Country" }, + "Course": { "@id": "schema:Course" }, + "CourseInstance": { "@id": "schema:CourseInstance" }, + "Courthouse": { "@id": "schema:Courthouse" }, + "CoverArt": { "@id": "schema:CoverArt" }, + "CreateAction": { "@id": "schema:CreateAction" }, + "CreativeWork": { "@id": "schema:CreativeWork" }, + "CreativeWorkSeason": { "@id": "schema:CreativeWorkSeason" }, + "CreativeWorkSeries": { "@id": "schema:CreativeWorkSeries" }, + "CreditCard": { "@id": "schema:CreditCard" }, + "Crematorium": { "@id": "schema:Crematorium" }, + "CriticReview": { "@id": "schema:CriticReview" }, + "CrossSectional": { "@id": "schema:CrossSectional" }, + "CssSelectorType": { "@id": "schema:CssSelectorType" }, + "CurrencyConversionService": { "@id": "schema:CurrencyConversionService" }, + "DDxElement": { "@id": "schema:DDxElement" }, + "DJMixAlbum": { "@id": "schema:DJMixAlbum" }, + "DVDFormat": { "@id": "schema:DVDFormat" }, + "DamagedCondition": { "@id": "schema:DamagedCondition" }, + "DanceEvent": { "@id": "schema:DanceEvent" }, + "DanceGroup": { "@id": "schema:DanceGroup" }, + "DataCatalog": { "@id": "schema:DataCatalog" }, + "DataDownload": { "@id": "schema:DataDownload" }, + "DataFeed": { "@id": "schema:DataFeed" }, + "DataFeedItem": { "@id": "schema:DataFeedItem" }, + "DataType": { "@id": "schema:DataType" }, + "Dataset": { "@id": "schema:Dataset" }, + "Date": { "@id": "schema:Date" }, + "DateTime": { "@id": "schema:DateTime" }, + "DatedMoneySpecification": { "@id": "schema:DatedMoneySpecification" }, + "DayOfWeek": { "@id": "schema:DayOfWeek" }, + "DaySpa": { "@id": "schema:DaySpa" }, + "DeactivateAction": { "@id": "schema:DeactivateAction" }, + "DefenceEstablishment": { "@id": "schema:DefenceEstablishment" }, + "DefinedTerm": { "@id": "schema:DefinedTerm" }, + "DefinedTermSet": { "@id": "schema:DefinedTermSet" }, + "DefinitiveLegalValue": { "@id": "schema:DefinitiveLegalValue" }, + "DeleteAction": { "@id": "schema:DeleteAction" }, + "DeliveryChargeSpecification": { + "@id": "schema:DeliveryChargeSpecification" + }, + "DeliveryEvent": { "@id": "schema:DeliveryEvent" }, + "DeliveryMethod": { "@id": "schema:DeliveryMethod" }, + "Demand": { "@id": "schema:Demand" }, + "DemoAlbum": { "@id": "schema:DemoAlbum" }, + "Dentist": { "@id": "schema:Dentist" }, + "Dentistry": { "@id": "schema:Dentistry" }, + "DepartAction": { "@id": "schema:DepartAction" }, + "DepartmentStore": { "@id": "schema:DepartmentStore" }, + "DepositAccount": { "@id": "schema:DepositAccount" }, + "Dermatologic": { "@id": "schema:Dermatologic" }, + "Dermatology": { "@id": "schema:Dermatology" }, + "DiabeticDiet": { "@id": "schema:DiabeticDiet" }, + "Diagnostic": { "@id": "schema:Diagnostic" }, + "DiagnosticLab": { "@id": "schema:DiagnosticLab" }, + "DiagnosticProcedure": { "@id": "schema:DiagnosticProcedure" }, + "Diet": { "@id": "schema:Diet" }, + "DietNutrition": { "@id": "schema:DietNutrition" }, + "DietarySupplement": { "@id": "schema:DietarySupplement" }, + "DigitalAudioTapeFormat": { "@id": "schema:DigitalAudioTapeFormat" }, + "DigitalDocument": { "@id": "schema:DigitalDocument" }, + "DigitalDocumentPermission": { "@id": "schema:DigitalDocumentPermission" }, + "DigitalDocumentPermissionType": { + "@id": "schema:DigitalDocumentPermissionType" + }, + "DigitalFormat": { "@id": "schema:DigitalFormat" }, + "DisagreeAction": { "@id": "schema:DisagreeAction" }, + "Discontinued": { "@id": "schema:Discontinued" }, + "DiscoverAction": { "@id": "schema:DiscoverAction" }, + "DiscussionForumPosting": { "@id": "schema:DiscussionForumPosting" }, + "DislikeAction": { "@id": "schema:DislikeAction" }, + "Distance": { "@id": "schema:Distance" }, + "Distillery": { "@id": "schema:Distillery" }, + "DonateAction": { "@id": "schema:DonateAction" }, + "DoseSchedule": { "@id": "schema:DoseSchedule" }, + "DoubleBlindedTrial": { "@id": "schema:DoubleBlindedTrial" }, + "DownloadAction": { "@id": "schema:DownloadAction" }, + "DrawAction": { "@id": "schema:DrawAction" }, + "Drawing": { "@id": "schema:Drawing" }, + "DrinkAction": { "@id": "schema:DrinkAction" }, + "DriveWheelConfigurationValue": { + "@id": "schema:DriveWheelConfigurationValue" + }, + "DrivingSchoolVehicleUsage": { "@id": "schema:DrivingSchoolVehicleUsage" }, + "Drug": { "@id": "schema:Drug" }, + "DrugClass": { "@id": "schema:DrugClass" }, + "DrugCost": { "@id": "schema:DrugCost" }, + "DrugCostCategory": { "@id": "schema:DrugCostCategory" }, + "DrugLegalStatus": { "@id": "schema:DrugLegalStatus" }, + "DrugPregnancyCategory": { "@id": "schema:DrugPregnancyCategory" }, + "DrugPrescriptionStatus": { "@id": "schema:DrugPrescriptionStatus" }, + "DrugStrength": { "@id": "schema:DrugStrength" }, + "DryCleaningOrLaundry": { "@id": "schema:DryCleaningOrLaundry" }, + "Duration": { "@id": "schema:Duration" }, + "EBook": { "@id": "schema:EBook" }, + "EPRelease": { "@id": "schema:EPRelease" }, + "Ear": { "@id": "schema:Ear" }, + "EatAction": { "@id": "schema:EatAction" }, + "EducationEvent": { "@id": "schema:EducationEvent" }, + "EducationalAudience": { "@id": "schema:EducationalAudience" }, + "EducationalOccupationalCredential": { + "@id": "schema:EducationalOccupationalCredential" + }, + "EducationalOrganization": { "@id": "schema:EducationalOrganization" }, + "Electrician": { "@id": "schema:Electrician" }, + "ElectronicsStore": { "@id": "schema:ElectronicsStore" }, + "ElementarySchool": { "@id": "schema:ElementarySchool" }, + "EmailMessage": { "@id": "schema:EmailMessage" }, + "Embassy": { "@id": "schema:Embassy" }, + "Emergency": { "@id": "schema:Emergency" }, + "EmergencyService": { "@id": "schema:EmergencyService" }, + "EmployeeRole": { "@id": "schema:EmployeeRole" }, + "EmployerAggregateRating": { "@id": "schema:EmployerAggregateRating" }, + "EmployerReview": { "@id": "schema:EmployerReview" }, + "EmploymentAgency": { "@id": "schema:EmploymentAgency" }, + "Endocrine": { "@id": "schema:Endocrine" }, + "EndorseAction": { "@id": "schema:EndorseAction" }, + "EndorsementRating": { "@id": "schema:EndorsementRating" }, + "Energy": { "@id": "schema:Energy" }, + "EngineSpecification": { "@id": "schema:EngineSpecification" }, + "EnrollingByInvitation": { "@id": "schema:EnrollingByInvitation" }, + "EntertainmentBusiness": { "@id": "schema:EntertainmentBusiness" }, + "EntryPoint": { "@id": "schema:EntryPoint" }, + "Enumeration": { "@id": "schema:Enumeration" }, + "Episode": { "@id": "schema:Episode" }, + "Event": { "@id": "schema:Event" }, + "EventCancelled": { "@id": "schema:EventCancelled" }, + "EventPostponed": { "@id": "schema:EventPostponed" }, + "EventRescheduled": { "@id": "schema:EventRescheduled" }, + "EventReservation": { "@id": "schema:EventReservation" }, + "EventScheduled": { "@id": "schema:EventScheduled" }, + "EventSeries": { "@id": "schema:EventSeries" }, + "EventStatusType": { "@id": "schema:EventStatusType" }, + "EventVenue": { "@id": "schema:EventVenue" }, + "EvidenceLevelA": { "@id": "schema:EvidenceLevelA" }, + "EvidenceLevelB": { "@id": "schema:EvidenceLevelB" }, + "EvidenceLevelC": { "@id": "schema:EvidenceLevelC" }, + "ExchangeRateSpecification": { "@id": "schema:ExchangeRateSpecification" }, + "ExchangeRefund": { "@id": "schema:ExchangeRefund" }, + "ExerciseAction": { "@id": "schema:ExerciseAction" }, + "ExerciseGym": { "@id": "schema:ExerciseGym" }, + "ExercisePlan": { "@id": "schema:ExercisePlan" }, + "ExhibitionEvent": { "@id": "schema:ExhibitionEvent" }, + "Eye": { "@id": "schema:Eye" }, + "FAQPage": { "@id": "schema:FAQPage" }, + "FDAcategoryA": { "@id": "schema:FDAcategoryA" }, + "FDAcategoryB": { "@id": "schema:FDAcategoryB" }, + "FDAcategoryC": { "@id": "schema:FDAcategoryC" }, + "FDAcategoryD": { "@id": "schema:FDAcategoryD" }, + "FDAcategoryX": { "@id": "schema:FDAcategoryX" }, + "FDAnotEvaluated": { "@id": "schema:FDAnotEvaluated" }, + "FMRadioChannel": { "@id": "schema:FMRadioChannel" }, + "FailedActionStatus": { "@id": "schema:FailedActionStatus" }, + "False": { "@id": "schema:False" }, + "FastFoodRestaurant": { "@id": "schema:FastFoodRestaurant" }, + "Female": { "@id": "schema:Female" }, + "Festival": { "@id": "schema:Festival" }, + "FilmAction": { "@id": "schema:FilmAction" }, + "FinancialProduct": { "@id": "schema:FinancialProduct" }, + "FinancialService": { "@id": "schema:FinancialService" }, + "FindAction": { "@id": "schema:FindAction" }, + "FireStation": { "@id": "schema:FireStation" }, + "Flexibility": { "@id": "schema:Flexibility" }, + "Flight": { "@id": "schema:Flight" }, + "FlightReservation": { "@id": "schema:FlightReservation" }, + "Float": { "@id": "schema:Float" }, + "Florist": { "@id": "schema:Florist" }, + "FollowAction": { "@id": "schema:FollowAction" }, + "FoodEstablishment": { "@id": "schema:FoodEstablishment" }, + "FoodEstablishmentReservation": { + "@id": "schema:FoodEstablishmentReservation" + }, + "FoodEvent": { "@id": "schema:FoodEvent" }, + "FoodService": { "@id": "schema:FoodService" }, + "FourWheelDriveConfiguration": { + "@id": "schema:FourWheelDriveConfiguration" + }, + "Friday": { "@id": "schema:Friday" }, + "FrontWheelDriveConfiguration": { + "@id": "schema:FrontWheelDriveConfiguration" + }, + "FullRefund": { "@id": "schema:FullRefund" }, + "FundingAgency": { "@id": "schema:FundingAgency" }, + "FundingScheme": { "@id": "schema:FundingScheme" }, + "Fungus": { "@id": "schema:Fungus" }, + "FurnitureStore": { "@id": "schema:FurnitureStore" }, + "Game": { "@id": "schema:Game" }, + "GamePlayMode": { "@id": "schema:GamePlayMode" }, + "GameServer": { "@id": "schema:GameServer" }, + "GameServerStatus": { "@id": "schema:GameServerStatus" }, + "GardenStore": { "@id": "schema:GardenStore" }, + "GasStation": { "@id": "schema:GasStation" }, + "Gastroenterologic": { "@id": "schema:Gastroenterologic" }, + "GatedResidenceCommunity": { "@id": "schema:GatedResidenceCommunity" }, + "GenderType": { "@id": "schema:GenderType" }, + "GeneralContractor": { "@id": "schema:GeneralContractor" }, + "Genetic": { "@id": "schema:Genetic" }, + "Genitourinary": { "@id": "schema:Genitourinary" }, + "GeoCircle": { "@id": "schema:GeoCircle" }, + "GeoCoordinates": { "@id": "schema:GeoCoordinates" }, + "GeoShape": { "@id": "schema:GeoShape" }, + "GeospatialGeometry": { "@id": "schema:GeospatialGeometry" }, + "Geriatric": { "@id": "schema:Geriatric" }, + "GiveAction": { "@id": "schema:GiveAction" }, + "GlutenFreeDiet": { "@id": "schema:GlutenFreeDiet" }, + "GolfCourse": { "@id": "schema:GolfCourse" }, + "GovernmentBuilding": { "@id": "schema:GovernmentBuilding" }, + "GovernmentOffice": { "@id": "schema:GovernmentOffice" }, + "GovernmentOrganization": { "@id": "schema:GovernmentOrganization" }, + "GovernmentPermit": { "@id": "schema:GovernmentPermit" }, + "GovernmentService": { "@id": "schema:GovernmentService" }, + "Grant": { "@id": "schema:Grant" }, + "GraphicNovel": { "@id": "schema:GraphicNovel" }, + "GroceryStore": { "@id": "schema:GroceryStore" }, + "GroupBoardingPolicy": { "@id": "schema:GroupBoardingPolicy" }, + "Gynecologic": { "@id": "schema:Gynecologic" }, + "HVACBusiness": { "@id": "schema:HVACBusiness" }, + "HairSalon": { "@id": "schema:HairSalon" }, + "HalalDiet": { "@id": "schema:HalalDiet" }, + "Hardcover": { "@id": "schema:Hardcover" }, + "HardwareStore": { "@id": "schema:HardwareStore" }, + "Head": { "@id": "schema:Head" }, + "HealthAndBeautyBusiness": { "@id": "schema:HealthAndBeautyBusiness" }, + "HealthClub": { "@id": "schema:HealthClub" }, + "HealthInsurancePlan": { "@id": "schema:HealthInsurancePlan" }, + "HealthPlanCostSharingSpecification": { + "@id": "schema:HealthPlanCostSharingSpecification" + }, + "HealthPlanFormulary": { "@id": "schema:HealthPlanFormulary" }, + "HealthPlanNetwork": { "@id": "schema:HealthPlanNetwork" }, + "HearingImpairedSupported": { "@id": "schema:HearingImpairedSupported" }, + "Hematologic": { "@id": "schema:Hematologic" }, + "HighSchool": { "@id": "schema:HighSchool" }, + "HinduDiet": { "@id": "schema:HinduDiet" }, + "HinduTemple": { "@id": "schema:HinduTemple" }, + "HobbyShop": { "@id": "schema:HobbyShop" }, + "HomeAndConstructionBusiness": { + "@id": "schema:HomeAndConstructionBusiness" + }, + "HomeGoodsStore": { "@id": "schema:HomeGoodsStore" }, + "Homeopathic": { "@id": "schema:Homeopathic" }, + "Hospital": { "@id": "schema:Hospital" }, + "Hostel": { "@id": "schema:Hostel" }, + "Hotel": { "@id": "schema:Hotel" }, + "HotelRoom": { "@id": "schema:HotelRoom" }, + "House": { "@id": "schema:House" }, + "HousePainter": { "@id": "schema:HousePainter" }, + "HowTo": { "@id": "schema:HowTo" }, + "HowToDirection": { "@id": "schema:HowToDirection" }, + "HowToItem": { "@id": "schema:HowToItem" }, + "HowToSection": { "@id": "schema:HowToSection" }, + "HowToStep": { "@id": "schema:HowToStep" }, + "HowToSupply": { "@id": "schema:HowToSupply" }, + "HowToTip": { "@id": "schema:HowToTip" }, + "HowToTool": { "@id": "schema:HowToTool" }, + "IceCreamShop": { "@id": "schema:IceCreamShop" }, + "IgnoreAction": { "@id": "schema:IgnoreAction" }, + "ImageGallery": { "@id": "schema:ImageGallery" }, + "ImageObject": { "@id": "schema:ImageObject" }, + "ImagingTest": { "@id": "schema:ImagingTest" }, + "InForce": { "@id": "schema:InForce" }, + "InStock": { "@id": "schema:InStock" }, + "InStoreOnly": { "@id": "schema:InStoreOnly" }, + "IndividualProduct": { "@id": "schema:IndividualProduct" }, + "Infectious": { "@id": "schema:Infectious" }, + "InfectiousAgentClass": { "@id": "schema:InfectiousAgentClass" }, + "InfectiousDisease": { "@id": "schema:InfectiousDisease" }, + "InformAction": { "@id": "schema:InformAction" }, + "InsertAction": { "@id": "schema:InsertAction" }, + "InstallAction": { "@id": "schema:InstallAction" }, + "InsuranceAgency": { "@id": "schema:InsuranceAgency" }, + "Intangible": { "@id": "schema:Intangible" }, + "Integer": { "@id": "schema:Integer" }, + "InteractAction": { "@id": "schema:InteractAction" }, + "InteractionCounter": { "@id": "schema:InteractionCounter" }, + "InternationalTrial": { "@id": "schema:InternationalTrial" }, + "InternetCafe": { "@id": "schema:InternetCafe" }, + "InvestmentFund": { "@id": "schema:InvestmentFund" }, + "InvestmentOrDeposit": { "@id": "schema:InvestmentOrDeposit" }, + "InviteAction": { "@id": "schema:InviteAction" }, + "Invoice": { "@id": "schema:Invoice" }, + "ItemAvailability": { "@id": "schema:ItemAvailability" }, + "ItemList": { "@id": "schema:ItemList" }, + "ItemListOrderAscending": { "@id": "schema:ItemListOrderAscending" }, + "ItemListOrderDescending": { "@id": "schema:ItemListOrderDescending" }, + "ItemListOrderType": { "@id": "schema:ItemListOrderType" }, + "ItemListUnordered": { "@id": "schema:ItemListUnordered" }, + "ItemPage": { "@id": "schema:ItemPage" }, + "JewelryStore": { "@id": "schema:JewelryStore" }, + "JobPosting": { "@id": "schema:JobPosting" }, + "JoinAction": { "@id": "schema:JoinAction" }, + "Joint": { "@id": "schema:Joint" }, + "KosherDiet": { "@id": "schema:KosherDiet" }, + "LaboratoryScience": { "@id": "schema:LaboratoryScience" }, + "LakeBodyOfWater": { "@id": "schema:LakeBodyOfWater" }, + "Landform": { "@id": "schema:Landform" }, + "LandmarksOrHistoricalBuildings": { + "@id": "schema:LandmarksOrHistoricalBuildings" + }, + "Language": { "@id": "schema:Language" }, + "LaserDiscFormat": { "@id": "schema:LaserDiscFormat" }, + "LeaveAction": { "@id": "schema:LeaveAction" }, + "LeftHandDriving": { "@id": "schema:LeftHandDriving" }, + "LegalForceStatus": { "@id": "schema:LegalForceStatus" }, + "LegalService": { "@id": "schema:LegalService" }, + "LegalValueLevel": { "@id": "schema:LegalValueLevel" }, + "Legislation": { "@id": "schema:Legislation" }, + "LegislationObject": { "@id": "schema:LegislationObject" }, + "LegislativeBuilding": { "@id": "schema:LegislativeBuilding" }, + "LeisureTimeActivity": { "@id": "schema:LeisureTimeActivity" }, + "LendAction": { "@id": "schema:LendAction" }, + "Library": { "@id": "schema:Library" }, + "LibrarySystem": { "@id": "schema:LibrarySystem" }, + "LifestyleModification": { "@id": "schema:LifestyleModification" }, + "Ligament": { "@id": "schema:Ligament" }, + "LikeAction": { "@id": "schema:LikeAction" }, + "LimitedAvailability": { "@id": "schema:LimitedAvailability" }, + "LinkRole": { "@id": "schema:LinkRole" }, + "LiquorStore": { "@id": "schema:LiquorStore" }, + "ListItem": { "@id": "schema:ListItem" }, + "ListenAction": { "@id": "schema:ListenAction" }, + "LiteraryEvent": { "@id": "schema:LiteraryEvent" }, + "LiveAlbum": { "@id": "schema:LiveAlbum" }, + "LiveBlogPosting": { "@id": "schema:LiveBlogPosting" }, + "LoanOrCredit": { "@id": "schema:LoanOrCredit" }, + "LocalBusiness": { "@id": "schema:LocalBusiness" }, + "LocationFeatureSpecification": { + "@id": "schema:LocationFeatureSpecification" + }, + "LockerDelivery": { "@id": "schema:LockerDelivery" }, + "Locksmith": { "@id": "schema:Locksmith" }, + "LodgingBusiness": { "@id": "schema:LodgingBusiness" }, + "LodgingReservation": { "@id": "schema:LodgingReservation" }, + "Longitudinal": { "@id": "schema:Longitudinal" }, + "LoseAction": { "@id": "schema:LoseAction" }, + "LowCalorieDiet": { "@id": "schema:LowCalorieDiet" }, + "LowFatDiet": { "@id": "schema:LowFatDiet" }, + "LowLactoseDiet": { "@id": "schema:LowLactoseDiet" }, + "LowSaltDiet": { "@id": "schema:LowSaltDiet" }, + "Lung": { "@id": "schema:Lung" }, + "LymphaticVessel": { "@id": "schema:LymphaticVessel" }, + "MRI": { "@id": "schema:MRI" }, + "Male": { "@id": "schema:Male" }, + "Manuscript": { "@id": "schema:Manuscript" }, + "Map": { "@id": "schema:Map" }, + "MapCategoryType": { "@id": "schema:MapCategoryType" }, + "MarryAction": { "@id": "schema:MarryAction" }, + "Mass": { "@id": "schema:Mass" }, + "MaximumDoseSchedule": { "@id": "schema:MaximumDoseSchedule" }, + "MediaObject": { "@id": "schema:MediaObject" }, + "MediaSubscription": { "@id": "schema:MediaSubscription" }, + "MedicalAudience": { "@id": "schema:MedicalAudience" }, + "MedicalBusiness": { "@id": "schema:MedicalBusiness" }, + "MedicalCause": { "@id": "schema:MedicalCause" }, + "MedicalClinic": { "@id": "schema:MedicalClinic" }, + "MedicalCode": { "@id": "schema:MedicalCode" }, + "MedicalCondition": { "@id": "schema:MedicalCondition" }, + "MedicalConditionStage": { "@id": "schema:MedicalConditionStage" }, + "MedicalContraindication": { "@id": "schema:MedicalContraindication" }, + "MedicalDevice": { "@id": "schema:MedicalDevice" }, + "MedicalDevicePurpose": { "@id": "schema:MedicalDevicePurpose" }, + "MedicalEntity": { "@id": "schema:MedicalEntity" }, + "MedicalEnumeration": { "@id": "schema:MedicalEnumeration" }, + "MedicalEvidenceLevel": { "@id": "schema:MedicalEvidenceLevel" }, + "MedicalGuideline": { "@id": "schema:MedicalGuideline" }, + "MedicalGuidelineContraindication": { + "@id": "schema:MedicalGuidelineContraindication" + }, + "MedicalGuidelineRecommendation": { + "@id": "schema:MedicalGuidelineRecommendation" + }, + "MedicalImagingTechnique": { "@id": "schema:MedicalImagingTechnique" }, + "MedicalIndication": { "@id": "schema:MedicalIndication" }, + "MedicalIntangible": { "@id": "schema:MedicalIntangible" }, + "MedicalObservationalStudy": { "@id": "schema:MedicalObservationalStudy" }, + "MedicalObservationalStudyDesign": { + "@id": "schema:MedicalObservationalStudyDesign" + }, + "MedicalOrganization": { "@id": "schema:MedicalOrganization" }, + "MedicalProcedure": { "@id": "schema:MedicalProcedure" }, + "MedicalProcedureType": { "@id": "schema:MedicalProcedureType" }, + "MedicalResearcher": { "@id": "schema:MedicalResearcher" }, + "MedicalRiskCalculator": { "@id": "schema:MedicalRiskCalculator" }, + "MedicalRiskEstimator": { "@id": "schema:MedicalRiskEstimator" }, + "MedicalRiskFactor": { "@id": "schema:MedicalRiskFactor" }, + "MedicalRiskScore": { "@id": "schema:MedicalRiskScore" }, + "MedicalScholarlyArticle": { "@id": "schema:MedicalScholarlyArticle" }, + "MedicalSign": { "@id": "schema:MedicalSign" }, + "MedicalSignOrSymptom": { "@id": "schema:MedicalSignOrSymptom" }, + "MedicalSpecialty": { "@id": "schema:MedicalSpecialty" }, + "MedicalStudy": { "@id": "schema:MedicalStudy" }, + "MedicalStudyStatus": { "@id": "schema:MedicalStudyStatus" }, + "MedicalSymptom": { "@id": "schema:MedicalSymptom" }, + "MedicalTest": { "@id": "schema:MedicalTest" }, + "MedicalTestPanel": { "@id": "schema:MedicalTestPanel" }, + "MedicalTherapy": { "@id": "schema:MedicalTherapy" }, + "MedicalTrial": { "@id": "schema:MedicalTrial" }, + "MedicalTrialDesign": { "@id": "schema:MedicalTrialDesign" }, + "MedicalWebPage": { "@id": "schema:MedicalWebPage" }, + "MedicineSystem": { "@id": "schema:MedicineSystem" }, + "MeetingRoom": { "@id": "schema:MeetingRoom" }, + "MensClothingStore": { "@id": "schema:MensClothingStore" }, + "Menu": { "@id": "schema:Menu" }, + "MenuItem": { "@id": "schema:MenuItem" }, + "MenuSection": { "@id": "schema:MenuSection" }, + "Message": { "@id": "schema:Message" }, + "MiddleSchool": { "@id": "schema:MiddleSchool" }, + "Midwifery": { "@id": "schema:Midwifery" }, + "MixtapeAlbum": { "@id": "schema:MixtapeAlbum" }, + "MobileApplication": { "@id": "schema:MobileApplication" }, + "MobilePhoneStore": { "@id": "schema:MobilePhoneStore" }, + "Monday": { "@id": "schema:Monday" }, + "MonetaryAmount": { "@id": "schema:MonetaryAmount" }, + "MonetaryAmountDistribution": { + "@id": "schema:MonetaryAmountDistribution" + }, + "MonetaryGrant": { "@id": "schema:MonetaryGrant" }, + "MoneyTransfer": { "@id": "schema:MoneyTransfer" }, + "MortgageLoan": { "@id": "schema:MortgageLoan" }, + "Mosque": { "@id": "schema:Mosque" }, + "Motel": { "@id": "schema:Motel" }, + "Motorcycle": { "@id": "schema:Motorcycle" }, + "MotorcycleDealer": { "@id": "schema:MotorcycleDealer" }, + "MotorcycleRepair": { "@id": "schema:MotorcycleRepair" }, + "MotorizedBicycle": { "@id": "schema:MotorizedBicycle" }, + "Mountain": { "@id": "schema:Mountain" }, + "MoveAction": { "@id": "schema:MoveAction" }, + "Movie": { "@id": "schema:Movie" }, + "MovieClip": { "@id": "schema:MovieClip" }, + "MovieRentalStore": { "@id": "schema:MovieRentalStore" }, + "MovieSeries": { "@id": "schema:MovieSeries" }, + "MovieTheater": { "@id": "schema:MovieTheater" }, + "MovingCompany": { "@id": "schema:MovingCompany" }, + "MultiCenterTrial": { "@id": "schema:MultiCenterTrial" }, + "MultiPlayer": { "@id": "schema:MultiPlayer" }, + "MulticellularParasite": { "@id": "schema:MulticellularParasite" }, + "Muscle": { "@id": "schema:Muscle" }, + "Musculoskeletal": { "@id": "schema:Musculoskeletal" }, + "MusculoskeletalExam": { "@id": "schema:MusculoskeletalExam" }, + "Museum": { "@id": "schema:Museum" }, + "MusicAlbum": { "@id": "schema:MusicAlbum" }, + "MusicAlbumProductionType": { "@id": "schema:MusicAlbumProductionType" }, + "MusicAlbumReleaseType": { "@id": "schema:MusicAlbumReleaseType" }, + "MusicComposition": { "@id": "schema:MusicComposition" }, + "MusicEvent": { "@id": "schema:MusicEvent" }, + "MusicGroup": { "@id": "schema:MusicGroup" }, + "MusicPlaylist": { "@id": "schema:MusicPlaylist" }, + "MusicRecording": { "@id": "schema:MusicRecording" }, + "MusicRelease": { "@id": "schema:MusicRelease" }, + "MusicReleaseFormatType": { "@id": "schema:MusicReleaseFormatType" }, + "MusicStore": { "@id": "schema:MusicStore" }, + "MusicVenue": { "@id": "schema:MusicVenue" }, + "MusicVideoObject": { "@id": "schema:MusicVideoObject" }, + "NGO": { "@id": "schema:NGO" }, + "NailSalon": { "@id": "schema:NailSalon" }, + "Neck": { "@id": "schema:Neck" }, + "Nerve": { "@id": "schema:Nerve" }, + "Neuro": { "@id": "schema:Neuro" }, + "Neurologic": { "@id": "schema:Neurologic" }, + "NewCondition": { "@id": "schema:NewCondition" }, + "NewsArticle": { "@id": "schema:NewsArticle" }, + "NewsMediaOrganization": { "@id": "schema:NewsMediaOrganization" }, + "Newspaper": { "@id": "schema:Newspaper" }, + "NightClub": { "@id": "schema:NightClub" }, + "NoninvasiveProcedure": { "@id": "schema:NoninvasiveProcedure" }, + "Nose": { "@id": "schema:Nose" }, + "NotInForce": { "@id": "schema:NotInForce" }, + "NotYetRecruiting": { "@id": "schema:NotYetRecruiting" }, + "Notary": { "@id": "schema:Notary" }, + "NoteDigitalDocument": { "@id": "schema:NoteDigitalDocument" }, + "Number": { "@id": "schema:Number" }, + "Nursing": { "@id": "schema:Nursing" }, + "NutritionInformation": { "@id": "schema:NutritionInformation" }, + "OTC": { "@id": "schema:OTC" }, + "Observational": { "@id": "schema:Observational" }, + "Obstetric": { "@id": "schema:Obstetric" }, + "Occupation": { "@id": "schema:Occupation" }, + "OccupationalActivity": { "@id": "schema:OccupationalActivity" }, + "OccupationalTherapy": { "@id": "schema:OccupationalTherapy" }, + "OceanBodyOfWater": { "@id": "schema:OceanBodyOfWater" }, + "Offer": { "@id": "schema:Offer" }, + "OfferCatalog": { "@id": "schema:OfferCatalog" }, + "OfferItemCondition": { "@id": "schema:OfferItemCondition" }, + "OfficeEquipmentStore": { "@id": "schema:OfficeEquipmentStore" }, + "OfficialLegalValue": { "@id": "schema:OfficialLegalValue" }, + "OfflinePermanently": { "@id": "schema:OfflinePermanently" }, + "OfflineTemporarily": { "@id": "schema:OfflineTemporarily" }, + "OnDemandEvent": { "@id": "schema:OnDemandEvent" }, + "OnSitePickup": { "@id": "schema:OnSitePickup" }, + "Oncologic": { "@id": "schema:Oncologic" }, + "Online": { "@id": "schema:Online" }, + "OnlineFull": { "@id": "schema:OnlineFull" }, + "OnlineOnly": { "@id": "schema:OnlineOnly" }, + "OpenTrial": { "@id": "schema:OpenTrial" }, + "OpeningHoursSpecification": { "@id": "schema:OpeningHoursSpecification" }, + "OpinionNewsArticle": { "@id": "schema:OpinionNewsArticle" }, + "Optician": { "@id": "schema:Optician" }, + "Optometric": { "@id": "schema:Optometric" }, + "Order": { "@id": "schema:Order" }, + "OrderAction": { "@id": "schema:OrderAction" }, + "OrderCancelled": { "@id": "schema:OrderCancelled" }, + "OrderDelivered": { "@id": "schema:OrderDelivered" }, + "OrderInTransit": { "@id": "schema:OrderInTransit" }, + "OrderItem": { "@id": "schema:OrderItem" }, + "OrderPaymentDue": { "@id": "schema:OrderPaymentDue" }, + "OrderPickupAvailable": { "@id": "schema:OrderPickupAvailable" }, + "OrderProblem": { "@id": "schema:OrderProblem" }, + "OrderProcessing": { "@id": "schema:OrderProcessing" }, + "OrderReturned": { "@id": "schema:OrderReturned" }, + "OrderStatus": { "@id": "schema:OrderStatus" }, + "Organization": { "@id": "schema:Organization" }, + "OrganizationRole": { "@id": "schema:OrganizationRole" }, + "OrganizeAction": { "@id": "schema:OrganizeAction" }, + "OriginalShippingFees": { "@id": "schema:OriginalShippingFees" }, + "Osteopathic": { "@id": "schema:Osteopathic" }, + "Otolaryngologic": { "@id": "schema:Otolaryngologic" }, + "OutOfStock": { "@id": "schema:OutOfStock" }, + "OutletStore": { "@id": "schema:OutletStore" }, + "OwnershipInfo": { "@id": "schema:OwnershipInfo" }, + "PET": { "@id": "schema:PET" }, + "PaintAction": { "@id": "schema:PaintAction" }, + "Painting": { "@id": "schema:Painting" }, + "PalliativeProcedure": { "@id": "schema:PalliativeProcedure" }, + "Paperback": { "@id": "schema:Paperback" }, + "ParcelDelivery": { "@id": "schema:ParcelDelivery" }, + "ParcelService": { "@id": "schema:ParcelService" }, + "ParentAudience": { "@id": "schema:ParentAudience" }, + "Park": { "@id": "schema:Park" }, + "ParkingFacility": { "@id": "schema:ParkingFacility" }, + "ParkingMap": { "@id": "schema:ParkingMap" }, + "PartiallyInForce": { "@id": "schema:PartiallyInForce" }, + "Pathology": { "@id": "schema:Pathology" }, + "PathologyTest": { "@id": "schema:PathologyTest" }, + "Patient": { "@id": "schema:Patient" }, + "PawnShop": { "@id": "schema:PawnShop" }, + "PayAction": { "@id": "schema:PayAction" }, + "PaymentAutomaticallyApplied": { + "@id": "schema:PaymentAutomaticallyApplied" + }, + "PaymentCard": { "@id": "schema:PaymentCard" }, + "PaymentChargeSpecification": { + "@id": "schema:PaymentChargeSpecification" + }, + "PaymentComplete": { "@id": "schema:PaymentComplete" }, + "PaymentDeclined": { "@id": "schema:PaymentDeclined" }, + "PaymentDue": { "@id": "schema:PaymentDue" }, + "PaymentMethod": { "@id": "schema:PaymentMethod" }, + "PaymentPastDue": { "@id": "schema:PaymentPastDue" }, + "PaymentService": { "@id": "schema:PaymentService" }, + "PaymentStatusType": { "@id": "schema:PaymentStatusType" }, + "Pediatric": { "@id": "schema:Pediatric" }, + "PeopleAudience": { "@id": "schema:PeopleAudience" }, + "PercutaneousProcedure": { "@id": "schema:PercutaneousProcedure" }, + "PerformAction": { "@id": "schema:PerformAction" }, + "PerformanceRole": { "@id": "schema:PerformanceRole" }, + "PerformingArtsTheater": { "@id": "schema:PerformingArtsTheater" }, + "PerformingGroup": { "@id": "schema:PerformingGroup" }, + "Periodical": { "@id": "schema:Periodical" }, + "Permit": { "@id": "schema:Permit" }, + "Person": { "@id": "schema:Person" }, + "PetStore": { "@id": "schema:PetStore" }, + "Pharmacy": { "@id": "schema:Pharmacy" }, + "PharmacySpecialty": { "@id": "schema:PharmacySpecialty" }, + "Photograph": { "@id": "schema:Photograph" }, + "PhotographAction": { "@id": "schema:PhotographAction" }, + "PhysicalActivity": { "@id": "schema:PhysicalActivity" }, + "PhysicalActivityCategory": { "@id": "schema:PhysicalActivityCategory" }, + "PhysicalExam": { "@id": "schema:PhysicalExam" }, + "PhysicalTherapy": { "@id": "schema:PhysicalTherapy" }, + "Physician": { "@id": "schema:Physician" }, + "Physiotherapy": { "@id": "schema:Physiotherapy" }, + "Place": { "@id": "schema:Place" }, + "PlaceOfWorship": { "@id": "schema:PlaceOfWorship" }, + "PlaceboControlledTrial": { "@id": "schema:PlaceboControlledTrial" }, + "PlanAction": { "@id": "schema:PlanAction" }, + "PlasticSurgery": { "@id": "schema:PlasticSurgery" }, + "Play": { "@id": "schema:Play" }, + "PlayAction": { "@id": "schema:PlayAction" }, + "Playground": { "@id": "schema:Playground" }, + "Plumber": { "@id": "schema:Plumber" }, + "Podiatric": { "@id": "schema:Podiatric" }, + "PoliceStation": { "@id": "schema:PoliceStation" }, + "Pond": { "@id": "schema:Pond" }, + "PostOffice": { "@id": "schema:PostOffice" }, + "PostalAddress": { "@id": "schema:PostalAddress" }, + "Poster": { "@id": "schema:Poster" }, + "PotentialActionStatus": { "@id": "schema:PotentialActionStatus" }, + "PreOrder": { "@id": "schema:PreOrder" }, + "PreOrderAction": { "@id": "schema:PreOrderAction" }, + "PreSale": { "@id": "schema:PreSale" }, + "PrependAction": { "@id": "schema:PrependAction" }, + "Preschool": { "@id": "schema:Preschool" }, + "PrescriptionOnly": { "@id": "schema:PrescriptionOnly" }, + "PresentationDigitalDocument": { + "@id": "schema:PresentationDigitalDocument" + }, + "PreventionIndication": { "@id": "schema:PreventionIndication" }, + "PriceSpecification": { "@id": "schema:PriceSpecification" }, + "PrimaryCare": { "@id": "schema:PrimaryCare" }, + "Prion": { "@id": "schema:Prion" }, + "Product": { "@id": "schema:Product" }, + "ProductModel": { "@id": "schema:ProductModel" }, + "ProductReturnEnumeration": { "@id": "schema:ProductReturnEnumeration" }, + "ProductReturnFiniteReturnWindow": { + "@id": "schema:ProductReturnFiniteReturnWindow" + }, + "ProductReturnNotPermitted": { "@id": "schema:ProductReturnNotPermitted" }, + "ProductReturnPolicy": { "@id": "schema:ProductReturnPolicy" }, + "ProductReturnUnlimitedWindow": { + "@id": "schema:ProductReturnUnlimitedWindow" + }, + "ProductReturnUnspecified": { "@id": "schema:ProductReturnUnspecified" }, + "ProfessionalService": { "@id": "schema:ProfessionalService" }, + "ProfilePage": { "@id": "schema:ProfilePage" }, + "ProgramMembership": { "@id": "schema:ProgramMembership" }, + "Project": { "@id": "schema:Project" }, + "Property": { "@id": "schema:Property" }, + "PropertyValue": { "@id": "schema:PropertyValue" }, + "PropertyValueSpecification": { + "@id": "schema:PropertyValueSpecification" + }, + "Protozoa": { "@id": "schema:Protozoa" }, + "Psychiatric": { "@id": "schema:Psychiatric" }, + "PsychologicalTreatment": { "@id": "schema:PsychologicalTreatment" }, + "PublicHealth": { "@id": "schema:PublicHealth" }, + "PublicHolidays": { "@id": "schema:PublicHolidays" }, + "PublicSwimmingPool": { "@id": "schema:PublicSwimmingPool" }, + "PublicToilet": { "@id": "schema:PublicToilet" }, + "PublicationEvent": { "@id": "schema:PublicationEvent" }, + "PublicationIssue": { "@id": "schema:PublicationIssue" }, + "PublicationVolume": { "@id": "schema:PublicationVolume" }, + "Pulmonary": { "@id": "schema:Pulmonary" }, + "QAPage": { "@id": "schema:QAPage" }, + "QualitativeValue": { "@id": "schema:QualitativeValue" }, + "QuantitativeValue": { "@id": "schema:QuantitativeValue" }, + "QuantitativeValueDistribution": { + "@id": "schema:QuantitativeValueDistribution" + }, + "Quantity": { "@id": "schema:Quantity" }, + "Question": { "@id": "schema:Question" }, + "Quotation": { "@id": "schema:Quotation" }, + "QuoteAction": { "@id": "schema:QuoteAction" }, + "RVPark": { "@id": "schema:RVPark" }, + "RadiationTherapy": { "@id": "schema:RadiationTherapy" }, + "RadioBroadcastService": { "@id": "schema:RadioBroadcastService" }, + "RadioChannel": { "@id": "schema:RadioChannel" }, + "RadioClip": { "@id": "schema:RadioClip" }, + "RadioEpisode": { "@id": "schema:RadioEpisode" }, + "RadioSeason": { "@id": "schema:RadioSeason" }, + "RadioSeries": { "@id": "schema:RadioSeries" }, + "RadioStation": { "@id": "schema:RadioStation" }, + "Radiography": { "@id": "schema:Radiography" }, + "RandomizedTrial": { "@id": "schema:RandomizedTrial" }, + "Rating": { "@id": "schema:Rating" }, + "ReactAction": { "@id": "schema:ReactAction" }, + "ReadAction": { "@id": "schema:ReadAction" }, + "ReadPermission": { "@id": "schema:ReadPermission" }, + "RealEstateAgent": { "@id": "schema:RealEstateAgent" }, + "RearWheelDriveConfiguration": { + "@id": "schema:RearWheelDriveConfiguration" + }, + "ReceiveAction": { "@id": "schema:ReceiveAction" }, + "Recipe": { "@id": "schema:Recipe" }, + "RecommendedDoseSchedule": { "@id": "schema:RecommendedDoseSchedule" }, + "Recruiting": { "@id": "schema:Recruiting" }, + "RecyclingCenter": { "@id": "schema:RecyclingCenter" }, + "RefundTypeEnumeration": { "@id": "schema:RefundTypeEnumeration" }, + "RefurbishedCondition": { "@id": "schema:RefurbishedCondition" }, + "RegisterAction": { "@id": "schema:RegisterAction" }, + "Registry": { "@id": "schema:Registry" }, + "ReimbursementCap": { "@id": "schema:ReimbursementCap" }, + "RejectAction": { "@id": "schema:RejectAction" }, + "RemixAlbum": { "@id": "schema:RemixAlbum" }, + "Renal": { "@id": "schema:Renal" }, + "RentAction": { "@id": "schema:RentAction" }, + "RentalCarReservation": { "@id": "schema:RentalCarReservation" }, + "RentalVehicleUsage": { "@id": "schema:RentalVehicleUsage" }, + "RepaymentSpecification": { "@id": "schema:RepaymentSpecification" }, + "ReplaceAction": { "@id": "schema:ReplaceAction" }, + "ReplyAction": { "@id": "schema:ReplyAction" }, + "Report": { "@id": "schema:Report" }, + "ReportageNewsArticle": { "@id": "schema:ReportageNewsArticle" }, + "ReportedDoseSchedule": { "@id": "schema:ReportedDoseSchedule" }, + "ResearchProject": { "@id": "schema:ResearchProject" }, + "Researcher": { "@id": "schema:Researcher" }, + "Reservation": { "@id": "schema:Reservation" }, + "ReservationCancelled": { "@id": "schema:ReservationCancelled" }, + "ReservationConfirmed": { "@id": "schema:ReservationConfirmed" }, + "ReservationHold": { "@id": "schema:ReservationHold" }, + "ReservationPackage": { "@id": "schema:ReservationPackage" }, + "ReservationPending": { "@id": "schema:ReservationPending" }, + "ReservationStatusType": { "@id": "schema:ReservationStatusType" }, + "ReserveAction": { "@id": "schema:ReserveAction" }, + "Reservoir": { "@id": "schema:Reservoir" }, + "Residence": { "@id": "schema:Residence" }, + "Resort": { "@id": "schema:Resort" }, + "RespiratoryTherapy": { "@id": "schema:RespiratoryTherapy" }, + "Restaurant": { "@id": "schema:Restaurant" }, + "RestockingFees": { "@id": "schema:RestockingFees" }, + "RestrictedDiet": { "@id": "schema:RestrictedDiet" }, + "ResultsAvailable": { "@id": "schema:ResultsAvailable" }, + "ResultsNotAvailable": { "@id": "schema:ResultsNotAvailable" }, + "ResumeAction": { "@id": "schema:ResumeAction" }, + "Retail": { "@id": "schema:Retail" }, + "ReturnAction": { "@id": "schema:ReturnAction" }, + "ReturnFeesEnumeration": { "@id": "schema:ReturnFeesEnumeration" }, + "ReturnShippingFees": { "@id": "schema:ReturnShippingFees" }, + "Review": { "@id": "schema:Review" }, + "ReviewAction": { "@id": "schema:ReviewAction" }, + "ReviewNewsArticle": { "@id": "schema:ReviewNewsArticle" }, + "Rheumatologic": { "@id": "schema:Rheumatologic" }, + "RightHandDriving": { "@id": "schema:RightHandDriving" }, + "RiverBodyOfWater": { "@id": "schema:RiverBodyOfWater" }, + "Role": { "@id": "schema:Role" }, + "RoofingContractor": { "@id": "schema:RoofingContractor" }, + "Room": { "@id": "schema:Room" }, + "RsvpAction": { "@id": "schema:RsvpAction" }, + "RsvpResponseMaybe": { "@id": "schema:RsvpResponseMaybe" }, + "RsvpResponseNo": { "@id": "schema:RsvpResponseNo" }, + "RsvpResponseType": { "@id": "schema:RsvpResponseType" }, + "RsvpResponseYes": { "@id": "schema:RsvpResponseYes" }, + "SaleEvent": { "@id": "schema:SaleEvent" }, + "SatiricalArticle": { "@id": "schema:SatiricalArticle" }, + "Saturday": { "@id": "schema:Saturday" }, + "Schedule": { "@id": "schema:Schedule" }, + "ScheduleAction": { "@id": "schema:ScheduleAction" }, + "ScholarlyArticle": { "@id": "schema:ScholarlyArticle" }, + "School": { "@id": "schema:School" }, + "ScreeningEvent": { "@id": "schema:ScreeningEvent" }, + "Sculpture": { "@id": "schema:Sculpture" }, + "SeaBodyOfWater": { "@id": "schema:SeaBodyOfWater" }, + "SearchAction": { "@id": "schema:SearchAction" }, + "SearchResultsPage": { "@id": "schema:SearchResultsPage" }, + "Season": { "@id": "schema:Season" }, + "Seat": { "@id": "schema:Seat" }, + "SeatingMap": { "@id": "schema:SeatingMap" }, + "SelfStorage": { "@id": "schema:SelfStorage" }, + "SellAction": { "@id": "schema:SellAction" }, + "SendAction": { "@id": "schema:SendAction" }, + "Series": { "@id": "schema:Series" }, + "Service": { "@id": "schema:Service" }, + "ServiceChannel": { "@id": "schema:ServiceChannel" }, + "ShareAction": { "@id": "schema:ShareAction" }, + "SheetMusic": { "@id": "schema:SheetMusic" }, + "ShoeStore": { "@id": "schema:ShoeStore" }, + "ShoppingCenter": { "@id": "schema:ShoppingCenter" }, + "ShortStory": { "@id": "schema:ShortStory" }, + "SingleBlindedTrial": { "@id": "schema:SingleBlindedTrial" }, + "SingleCenterTrial": { "@id": "schema:SingleCenterTrial" }, + "SingleFamilyResidence": { "@id": "schema:SingleFamilyResidence" }, + "SinglePlayer": { "@id": "schema:SinglePlayer" }, + "SingleRelease": { "@id": "schema:SingleRelease" }, + "SiteNavigationElement": { "@id": "schema:SiteNavigationElement" }, + "SkiResort": { "@id": "schema:SkiResort" }, + "Skin": { "@id": "schema:Skin" }, + "SocialEvent": { "@id": "schema:SocialEvent" }, + "SocialMediaPosting": { "@id": "schema:SocialMediaPosting" }, + "SoftwareApplication": { "@id": "schema:SoftwareApplication" }, + "SoftwareSourceCode": { "@id": "schema:SoftwareSourceCode" }, + "SoldOut": { "@id": "schema:SoldOut" }, + "SomeProducts": { "@id": "schema:SomeProducts" }, + "SoundtrackAlbum": { "@id": "schema:SoundtrackAlbum" }, + "SpeakableSpecification": { "@id": "schema:SpeakableSpecification" }, + "Specialty": { "@id": "schema:Specialty" }, + "SpeechPathology": { "@id": "schema:SpeechPathology" }, + "SpokenWordAlbum": { "@id": "schema:SpokenWordAlbum" }, + "SportingGoodsStore": { "@id": "schema:SportingGoodsStore" }, + "SportsActivityLocation": { "@id": "schema:SportsActivityLocation" }, + "SportsClub": { "@id": "schema:SportsClub" }, + "SportsEvent": { "@id": "schema:SportsEvent" }, + "SportsOrganization": { "@id": "schema:SportsOrganization" }, + "SportsTeam": { "@id": "schema:SportsTeam" }, + "SpreadsheetDigitalDocument": { + "@id": "schema:SpreadsheetDigitalDocument" + }, + "StadiumOrArena": { "@id": "schema:StadiumOrArena" }, + "State": { "@id": "schema:State" }, + "SteeringPositionValue": { "@id": "schema:SteeringPositionValue" }, + "Store": { "@id": "schema:Store" }, + "StoreCreditRefund": { "@id": "schema:StoreCreditRefund" }, + "StrengthTraining": { "@id": "schema:StrengthTraining" }, + "StructuredValue": { "@id": "schema:StructuredValue" }, + "StudioAlbum": { "@id": "schema:StudioAlbum" }, + "StupidType": { "@id": "schema:StupidType" }, + "SubscribeAction": { "@id": "schema:SubscribeAction" }, + "Substance": { "@id": "schema:Substance" }, + "SubwayStation": { "@id": "schema:SubwayStation" }, + "Suite": { "@id": "schema:Suite" }, + "Sunday": { "@id": "schema:Sunday" }, + "SuperficialAnatomy": { "@id": "schema:SuperficialAnatomy" }, + "Surgical": { "@id": "schema:Surgical" }, + "SurgicalProcedure": { "@id": "schema:SurgicalProcedure" }, + "SuspendAction": { "@id": "schema:SuspendAction" }, + "Suspended": { "@id": "schema:Suspended" }, + "Synagogue": { "@id": "schema:Synagogue" }, + "TVClip": { "@id": "schema:TVClip" }, + "TVEpisode": { "@id": "schema:TVEpisode" }, + "TVSeason": { "@id": "schema:TVSeason" }, + "TVSeries": { "@id": "schema:TVSeries" }, + "Table": { "@id": "schema:Table" }, + "TakeAction": { "@id": "schema:TakeAction" }, + "TattooParlor": { "@id": "schema:TattooParlor" }, + "Taxi": { "@id": "schema:Taxi" }, + "TaxiReservation": { "@id": "schema:TaxiReservation" }, + "TaxiService": { "@id": "schema:TaxiService" }, + "TaxiStand": { "@id": "schema:TaxiStand" }, + "TaxiVehicleUsage": { "@id": "schema:TaxiVehicleUsage" }, + "TechArticle": { "@id": "schema:TechArticle" }, + "TelevisionChannel": { "@id": "schema:TelevisionChannel" }, + "TelevisionStation": { "@id": "schema:TelevisionStation" }, + "TennisComplex": { "@id": "schema:TennisComplex" }, + "Terminated": { "@id": "schema:Terminated" }, + "Text": { "@id": "schema:Text" }, + "TextDigitalDocument": { "@id": "schema:TextDigitalDocument" }, + "TheaterEvent": { "@id": "schema:TheaterEvent" }, + "TheaterGroup": { "@id": "schema:TheaterGroup" }, + "Therapeutic": { "@id": "schema:Therapeutic" }, + "TherapeuticProcedure": { "@id": "schema:TherapeuticProcedure" }, + "Thesis": { "@id": "schema:Thesis" }, + "Thing": { "@id": "schema:Thing" }, + "Throat": { "@id": "schema:Throat" }, + "Thursday": { "@id": "schema:Thursday" }, + "Ticket": { "@id": "schema:Ticket" }, + "TieAction": { "@id": "schema:TieAction" }, + "Time": { "@id": "schema:Time" }, + "TipAction": { "@id": "schema:TipAction" }, + "TireShop": { "@id": "schema:TireShop" }, + "TollFree": { "@id": "schema:TollFree" }, + "TouristAttraction": { "@id": "schema:TouristAttraction" }, + "TouristDestination": { "@id": "schema:TouristDestination" }, + "TouristInformationCenter": { "@id": "schema:TouristInformationCenter" }, + "TouristTrip": { "@id": "schema:TouristTrip" }, + "Toxicologic": { "@id": "schema:Toxicologic" }, + "ToyStore": { "@id": "schema:ToyStore" }, + "TrackAction": { "@id": "schema:TrackAction" }, + "TradeAction": { "@id": "schema:TradeAction" }, + "TraditionalChinese": { "@id": "schema:TraditionalChinese" }, + "TrainReservation": { "@id": "schema:TrainReservation" }, + "TrainStation": { "@id": "schema:TrainStation" }, + "TrainTrip": { "@id": "schema:TrainTrip" }, + "TransferAction": { "@id": "schema:TransferAction" }, + "TransitMap": { "@id": "schema:TransitMap" }, + "TravelAction": { "@id": "schema:TravelAction" }, + "TravelAgency": { "@id": "schema:TravelAgency" }, + "TreatmentIndication": { "@id": "schema:TreatmentIndication" }, + "Trip": { "@id": "schema:Trip" }, + "TripleBlindedTrial": { "@id": "schema:TripleBlindedTrial" }, + "True": { "@id": "schema:True" }, + "Tuesday": { "@id": "schema:Tuesday" }, + "TypeAndQuantityNode": { "@id": "schema:TypeAndQuantityNode" }, + "URL": { "@id": "schema:URL" }, + "Ultrasound": { "@id": "schema:Ultrasound" }, + "UnRegisterAction": { "@id": "schema:UnRegisterAction" }, + "UnitPriceSpecification": { "@id": "schema:UnitPriceSpecification" }, + "UnofficialLegalValue": { "@id": "schema:UnofficialLegalValue" }, + "UpdateAction": { "@id": "schema:UpdateAction" }, + "Urologic": { "@id": "schema:Urologic" }, + "UseAction": { "@id": "schema:UseAction" }, + "UsedCondition": { "@id": "schema:UsedCondition" }, + "UserBlocks": { "@id": "schema:UserBlocks" }, + "UserCheckins": { "@id": "schema:UserCheckins" }, + "UserComments": { "@id": "schema:UserComments" }, + "UserDownloads": { "@id": "schema:UserDownloads" }, + "UserInteraction": { "@id": "schema:UserInteraction" }, + "UserLikes": { "@id": "schema:UserLikes" }, + "UserPageVisits": { "@id": "schema:UserPageVisits" }, + "UserPlays": { "@id": "schema:UserPlays" }, + "UserPlusOnes": { "@id": "schema:UserPlusOnes" }, + "UserReview": { "@id": "schema:UserReview" }, + "UserTweets": { "@id": "schema:UserTweets" }, + "VeganDiet": { "@id": "schema:VeganDiet" }, + "VegetarianDiet": { "@id": "schema:VegetarianDiet" }, + "Vehicle": { "@id": "schema:Vehicle" }, + "Vein": { "@id": "schema:Vein" }, + "VenueMap": { "@id": "schema:VenueMap" }, + "Vessel": { "@id": "schema:Vessel" }, + "VeterinaryCare": { "@id": "schema:VeterinaryCare" }, + "VideoGallery": { "@id": "schema:VideoGallery" }, + "VideoGame": { "@id": "schema:VideoGame" }, + "VideoGameClip": { "@id": "schema:VideoGameClip" }, + "VideoGameSeries": { "@id": "schema:VideoGameSeries" }, + "VideoObject": { "@id": "schema:VideoObject" }, + "ViewAction": { "@id": "schema:ViewAction" }, + "VinylFormat": { "@id": "schema:VinylFormat" }, + "Virus": { "@id": "schema:Virus" }, + "VisualArtsEvent": { "@id": "schema:VisualArtsEvent" }, + "VisualArtwork": { "@id": "schema:VisualArtwork" }, + "VitalSign": { "@id": "schema:VitalSign" }, + "Volcano": { "@id": "schema:Volcano" }, + "VoteAction": { "@id": "schema:VoteAction" }, + "WPAdBlock": { "@id": "schema:WPAdBlock" }, + "WPFooter": { "@id": "schema:WPFooter" }, + "WPHeader": { "@id": "schema:WPHeader" }, + "WPSideBar": { "@id": "schema:WPSideBar" }, + "WantAction": { "@id": "schema:WantAction" }, + "WarrantyPromise": { "@id": "schema:WarrantyPromise" }, + "WarrantyScope": { "@id": "schema:WarrantyScope" }, + "WatchAction": { "@id": "schema:WatchAction" }, + "Waterfall": { "@id": "schema:Waterfall" }, + "WearAction": { "@id": "schema:WearAction" }, + "WebAPI": { "@id": "schema:WebAPI" }, + "WebApplication": { "@id": "schema:WebApplication" }, + "WebPage": { "@id": "schema:WebPage" }, + "WebPageElement": { "@id": "schema:WebPageElement" }, + "WebSite": { "@id": "schema:WebSite" }, + "Wednesday": { "@id": "schema:Wednesday" }, + "WesternConventional": { "@id": "schema:WesternConventional" }, + "Wholesale": { "@id": "schema:Wholesale" }, + "WholesaleStore": { "@id": "schema:WholesaleStore" }, + "WinAction": { "@id": "schema:WinAction" }, + "Winery": { "@id": "schema:Winery" }, + "Withdrawn": { "@id": "schema:Withdrawn" }, + "WorkersUnion": { "@id": "schema:WorkersUnion" }, + "WriteAction": { "@id": "schema:WriteAction" }, + "WritePermission": { "@id": "schema:WritePermission" }, + "XPathType": { "@id": "schema:XPathType" }, + "XRay": { "@id": "schema:XRay" }, + "ZoneBoardingPolicy": { "@id": "schema:ZoneBoardingPolicy" }, + "Zoo": { "@id": "schema:Zoo" }, + "about": { "@id": "schema:about" }, + "abridged": { "@id": "schema:abridged" }, + "accelerationTime": { "@id": "schema:accelerationTime" }, + "acceptedAnswer": { "@id": "schema:acceptedAnswer" }, + "acceptedOffer": { "@id": "schema:acceptedOffer" }, + "acceptedPaymentMethod": { "@id": "schema:acceptedPaymentMethod" }, + "acceptsReservations": { "@id": "schema:acceptsReservations" }, + "accessCode": { "@id": "schema:accessCode" }, + "accessMode": { "@id": "schema:accessMode" }, + "accessModeSufficient": { "@id": "schema:accessModeSufficient" }, + "accessibilityAPI": { "@id": "schema:accessibilityAPI" }, + "accessibilityControl": { "@id": "schema:accessibilityControl" }, + "accessibilityFeature": { "@id": "schema:accessibilityFeature" }, + "accessibilityHazard": { "@id": "schema:accessibilityHazard" }, + "accessibilitySummary": { "@id": "schema:accessibilitySummary" }, + "accountId": { "@id": "schema:accountId" }, + "accountMinimumInflow": { "@id": "schema:accountMinimumInflow" }, + "accountOverdraftLimit": { "@id": "schema:accountOverdraftLimit" }, + "accountablePerson": { "@id": "schema:accountablePerson" }, + "acquiredFrom": { "@id": "schema:acquiredFrom" }, + "acrissCode": { "@id": "schema:acrissCode" }, + "action": { "@id": "schema:action" }, + "actionAccessibilityRequirement": { + "@id": "schema:actionAccessibilityRequirement" + }, + "actionApplication": { "@id": "schema:actionApplication" }, + "actionOption": { "@id": "schema:actionOption" }, + "actionPlatform": { "@id": "schema:actionPlatform" }, + "actionStatus": { "@id": "schema:actionStatus" }, + "actionableFeedbackPolicy": { + "@id": "schema:actionableFeedbackPolicy", + "@type": "@id" + }, + "activeIngredient": { "@id": "schema:activeIngredient" }, + "activityDuration": { "@id": "schema:activityDuration" }, + "activityFrequency": { "@id": "schema:activityFrequency" }, + "actor": { "@id": "schema:actor" }, + "actors": { "@id": "schema:actors" }, + "addOn": { "@id": "schema:addOn" }, + "additionalName": { "@id": "schema:additionalName" }, + "additionalNumberOfGuests": { "@id": "schema:additionalNumberOfGuests" }, + "additionalProperty": { "@id": "schema:additionalProperty" }, + "additionalType": { "@id": "schema:additionalType", "@type": "@id" }, + "additionalVariable": { "@id": "schema:additionalVariable" }, + "address": { "@id": "schema:address" }, + "addressCountry": { "@id": "schema:addressCountry" }, + "addressLocality": { "@id": "schema:addressLocality" }, + "addressRegion": { "@id": "schema:addressRegion" }, + "administrationRoute": { "@id": "schema:administrationRoute" }, + "advanceBookingRequirement": { "@id": "schema:advanceBookingRequirement" }, + "adverseOutcome": { "@id": "schema:adverseOutcome" }, + "affectedBy": { "@id": "schema:affectedBy" }, + "affiliation": { "@id": "schema:affiliation" }, + "afterMedia": { "@id": "schema:afterMedia", "@type": "@id" }, + "agent": { "@id": "schema:agent" }, + "aggregateRating": { "@id": "schema:aggregateRating" }, + "aircraft": { "@id": "schema:aircraft" }, + "album": { "@id": "schema:album" }, + "albumProductionType": { "@id": "schema:albumProductionType" }, + "albumRelease": { "@id": "schema:albumRelease" }, + "albumReleaseType": { "@id": "schema:albumReleaseType" }, + "albums": { "@id": "schema:albums" }, + "alcoholWarning": { "@id": "schema:alcoholWarning" }, + "algorithm": { "@id": "schema:algorithm" }, + "alignmentType": { "@id": "schema:alignmentType" }, + "alternateName": { "@id": "schema:alternateName" }, + "alternativeHeadline": { "@id": "schema:alternativeHeadline" }, + "alumni": { "@id": "schema:alumni" }, + "alumniOf": { "@id": "schema:alumniOf" }, + "amenityFeature": { "@id": "schema:amenityFeature" }, + "amount": { "@id": "schema:amount" }, + "amountOfThisGood": { "@id": "schema:amountOfThisGood" }, + "annualPercentageRate": { "@id": "schema:annualPercentageRate" }, + "answerCount": { "@id": "schema:answerCount" }, + "antagonist": { "@id": "schema:antagonist" }, + "appearance": { "@id": "schema:appearance" }, + "applicableLocation": { "@id": "schema:applicableLocation" }, + "applicantLocationRequirements": { + "@id": "schema:applicantLocationRequirements" + }, + "application": { "@id": "schema:application" }, + "applicationCategory": { "@id": "schema:applicationCategory" }, + "applicationSubCategory": { "@id": "schema:applicationSubCategory" }, + "applicationSuite": { "@id": "schema:applicationSuite" }, + "appliesToDeliveryMethod": { "@id": "schema:appliesToDeliveryMethod" }, + "appliesToPaymentMethod": { "@id": "schema:appliesToPaymentMethod" }, + "archiveHeld": { "@id": "schema:archiveHeld" }, + "area": { "@id": "schema:area" }, + "areaServed": { "@id": "schema:areaServed" }, + "arrivalAirport": { "@id": "schema:arrivalAirport" }, + "arrivalBusStop": { "@id": "schema:arrivalBusStop" }, + "arrivalGate": { "@id": "schema:arrivalGate" }, + "arrivalPlatform": { "@id": "schema:arrivalPlatform" }, + "arrivalStation": { "@id": "schema:arrivalStation" }, + "arrivalTerminal": { "@id": "schema:arrivalTerminal" }, + "arrivalTime": { "@id": "schema:arrivalTime", "@type": "DateTime" }, + "artEdition": { "@id": "schema:artEdition" }, + "artMedium": { "@id": "schema:artMedium" }, + "arterialBranch": { "@id": "schema:arterialBranch" }, + "artform": { "@id": "schema:artform" }, + "articleBody": { "@id": "schema:articleBody" }, + "articleSection": { "@id": "schema:articleSection" }, + "artist": { "@id": "schema:artist" }, + "artworkSurface": { "@id": "schema:artworkSurface" }, + "aspect": { "@id": "schema:aspect" }, + "assembly": { "@id": "schema:assembly" }, + "assemblyVersion": { "@id": "schema:assemblyVersion" }, + "associatedAnatomy": { "@id": "schema:associatedAnatomy" }, + "associatedArticle": { "@id": "schema:associatedArticle" }, + "associatedMedia": { "@id": "schema:associatedMedia" }, + "associatedPathophysiology": { "@id": "schema:associatedPathophysiology" }, + "athlete": { "@id": "schema:athlete" }, + "attendee": { "@id": "schema:attendee" }, + "attendees": { "@id": "schema:attendees" }, + "audience": { "@id": "schema:audience" }, + "audienceType": { "@id": "schema:audienceType" }, + "audio": { "@id": "schema:audio" }, + "authenticator": { "@id": "schema:authenticator" }, + "author": { "@id": "schema:author" }, + "availability": { "@id": "schema:availability" }, + "availabilityEnds": { "@id": "schema:availabilityEnds", "@type": "Date" }, + "availabilityStarts": { + "@id": "schema:availabilityStarts", + "@type": "Date" + }, + "availableAtOrFrom": { "@id": "schema:availableAtOrFrom" }, + "availableChannel": { "@id": "schema:availableChannel" }, + "availableDeliveryMethod": { "@id": "schema:availableDeliveryMethod" }, + "availableFrom": { "@id": "schema:availableFrom", "@type": "DateTime" }, + "availableIn": { "@id": "schema:availableIn" }, + "availableLanguage": { "@id": "schema:availableLanguage" }, + "availableOnDevice": { "@id": "schema:availableOnDevice" }, + "availableService": { "@id": "schema:availableService" }, + "availableStrength": { "@id": "schema:availableStrength" }, + "availableTest": { "@id": "schema:availableTest" }, + "availableThrough": { + "@id": "schema:availableThrough", + "@type": "DateTime" + }, + "award": { "@id": "schema:award" }, + "awards": { "@id": "schema:awards" }, + "awayTeam": { "@id": "schema:awayTeam" }, + "background": { "@id": "schema:background" }, + "backstory": { "@id": "schema:backstory" }, + "bankAccountType": { "@id": "schema:bankAccountType" }, + "baseSalary": { "@id": "schema:baseSalary" }, + "bccRecipient": { "@id": "schema:bccRecipient" }, + "bed": { "@id": "schema:bed" }, + "beforeMedia": { "@id": "schema:beforeMedia", "@type": "@id" }, + "beneficiaryBank": { "@id": "schema:beneficiaryBank" }, + "benefits": { "@id": "schema:benefits" }, + "benefitsSummaryUrl": { + "@id": "schema:benefitsSummaryUrl", + "@type": "@id" + }, + "bestRating": { "@id": "schema:bestRating" }, + "billingAddress": { "@id": "schema:billingAddress" }, + "billingIncrement": { "@id": "schema:billingIncrement" }, + "billingPeriod": { "@id": "schema:billingPeriod" }, + "biomechnicalClass": { "@id": "schema:biomechnicalClass" }, + "birthDate": { "@id": "schema:birthDate", "@type": "Date" }, + "birthPlace": { "@id": "schema:birthPlace" }, + "bitrate": { "@id": "schema:bitrate" }, + "blogPost": { "@id": "schema:blogPost" }, + "blogPosts": { "@id": "schema:blogPosts" }, + "bloodSupply": { "@id": "schema:bloodSupply" }, + "boardingGroup": { "@id": "schema:boardingGroup" }, + "boardingPolicy": { "@id": "schema:boardingPolicy" }, + "bodyLocation": { "@id": "schema:bodyLocation" }, + "bodyType": { "@id": "schema:bodyType" }, + "bookEdition": { "@id": "schema:bookEdition" }, + "bookFormat": { "@id": "schema:bookFormat" }, + "bookingAgent": { "@id": "schema:bookingAgent" }, + "bookingTime": { "@id": "schema:bookingTime", "@type": "DateTime" }, + "borrower": { "@id": "schema:borrower" }, + "box": { "@id": "schema:box" }, + "branch": { "@id": "schema:branch" }, + "branchCode": { "@id": "schema:branchCode" }, + "branchOf": { "@id": "schema:branchOf" }, + "brand": { "@id": "schema:brand" }, + "breadcrumb": { "@id": "schema:breadcrumb" }, + "breastfeedingWarning": { "@id": "schema:breastfeedingWarning" }, + "broadcastAffiliateOf": { "@id": "schema:broadcastAffiliateOf" }, + "broadcastChannelId": { "@id": "schema:broadcastChannelId" }, + "broadcastDisplayName": { "@id": "schema:broadcastDisplayName" }, + "broadcastFrequency": { "@id": "schema:broadcastFrequency" }, + "broadcastFrequencyValue": { "@id": "schema:broadcastFrequencyValue" }, + "broadcastOfEvent": { "@id": "schema:broadcastOfEvent" }, + "broadcastServiceTier": { "@id": "schema:broadcastServiceTier" }, + "broadcastSignalModulation": { "@id": "schema:broadcastSignalModulation" }, + "broadcastSubChannel": { "@id": "schema:broadcastSubChannel" }, + "broadcastTimezone": { "@id": "schema:broadcastTimezone" }, + "broadcaster": { "@id": "schema:broadcaster" }, + "broker": { "@id": "schema:broker" }, + "browserRequirements": { "@id": "schema:browserRequirements" }, + "busName": { "@id": "schema:busName" }, + "busNumber": { "@id": "schema:busNumber" }, + "businessFunction": { "@id": "schema:businessFunction" }, + "buyer": { "@id": "schema:buyer" }, + "byArtist": { "@id": "schema:byArtist" }, + "byDay": { "@id": "schema:byDay" }, + "byMonth": { "@id": "schema:byMonth" }, + "byMonthDay": { "@id": "schema:byMonthDay" }, + "callSign": { "@id": "schema:callSign" }, + "calories": { "@id": "schema:calories" }, + "candidate": { "@id": "schema:candidate" }, + "caption": { "@id": "schema:caption" }, + "carbohydrateContent": { "@id": "schema:carbohydrateContent" }, + "cargoVolume": { "@id": "schema:cargoVolume" }, + "carrier": { "@id": "schema:carrier" }, + "carrierRequirements": { "@id": "schema:carrierRequirements" }, + "cashBack": { "@id": "schema:cashBack" }, + "catalog": { "@id": "schema:catalog" }, + "catalogNumber": { "@id": "schema:catalogNumber" }, + "category": { "@id": "schema:category" }, + "cause": { "@id": "schema:cause" }, + "causeOf": { "@id": "schema:causeOf" }, + "ccRecipient": { "@id": "schema:ccRecipient" }, + "character": { "@id": "schema:character" }, + "characterAttribute": { "@id": "schema:characterAttribute" }, + "characterName": { "@id": "schema:characterName" }, + "cheatCode": { "@id": "schema:cheatCode" }, + "checkinTime": { "@id": "schema:checkinTime", "@type": "DateTime" }, + "checkoutTime": { "@id": "schema:checkoutTime", "@type": "DateTime" }, + "childMaxAge": { "@id": "schema:childMaxAge" }, + "childMinAge": { "@id": "schema:childMinAge" }, + "children": { "@id": "schema:children" }, + "cholesterolContent": { "@id": "schema:cholesterolContent" }, + "circle": { "@id": "schema:circle" }, + "citation": { "@id": "schema:citation" }, + "claimReviewed": { "@id": "schema:claimReviewed" }, + "clincalPharmacology": { "@id": "schema:clincalPharmacology" }, + "clinicalPharmacology": { "@id": "schema:clinicalPharmacology" }, + "clipNumber": { "@id": "schema:clipNumber" }, + "closes": { "@id": "schema:closes" }, + "coach": { "@id": "schema:coach" }, + "code": { "@id": "schema:code" }, + "codeRepository": { "@id": "schema:codeRepository", "@type": "@id" }, + "codeSampleType": { "@id": "schema:codeSampleType" }, + "codeValue": { "@id": "schema:codeValue" }, + "codingSystem": { "@id": "schema:codingSystem" }, + "colleague": { "@id": "schema:colleague", "@type": "@id" }, + "colleagues": { "@id": "schema:colleagues" }, + "collection": { "@id": "schema:collection" }, + "collectionSize": { "@id": "schema:collectionSize" }, + "color": { "@id": "schema:color" }, + "colorist": { "@id": "schema:colorist" }, + "comment": { "@id": "schema:comment" }, + "commentCount": { "@id": "schema:commentCount" }, + "commentText": { "@id": "schema:commentText" }, + "commentTime": { "@id": "schema:commentTime", "@type": "Date" }, + "competencyRequired": { "@id": "schema:competencyRequired" }, + "competitor": { "@id": "schema:competitor" }, + "composer": { "@id": "schema:composer" }, + "comprisedOf": { "@id": "schema:comprisedOf" }, + "conditionsOfAccess": { "@id": "schema:conditionsOfAccess" }, + "confirmationNumber": { "@id": "schema:confirmationNumber" }, + "connectedTo": { "@id": "schema:connectedTo" }, + "contactOption": { "@id": "schema:contactOption" }, + "contactPoint": { "@id": "schema:contactPoint" }, + "contactPoints": { "@id": "schema:contactPoints" }, + "contactType": { "@id": "schema:contactType" }, + "contactlessPayment": { "@id": "schema:contactlessPayment" }, + "containedIn": { "@id": "schema:containedIn" }, + "containedInPlace": { "@id": "schema:containedInPlace" }, + "containsPlace": { "@id": "schema:containsPlace" }, + "containsSeason": { "@id": "schema:containsSeason" }, + "contentLocation": { "@id": "schema:contentLocation" }, + "contentRating": { "@id": "schema:contentRating" }, + "contentReferenceTime": { + "@id": "schema:contentReferenceTime", + "@type": "DateTime" + }, + "contentSize": { "@id": "schema:contentSize" }, + "contentType": { "@id": "schema:contentType" }, + "contentUrl": { "@id": "schema:contentUrl", "@type": "@id" }, + "contraindication": { "@id": "schema:contraindication" }, + "contributor": { "@id": "schema:contributor" }, + "cookTime": { "@id": "schema:cookTime" }, + "cookingMethod": { "@id": "schema:cookingMethod" }, + "copyrightHolder": { "@id": "schema:copyrightHolder" }, + "copyrightYear": { "@id": "schema:copyrightYear" }, + "correction": { "@id": "schema:correction" }, + "correctionsPolicy": { "@id": "schema:correctionsPolicy", "@type": "@id" }, + "cost": { "@id": "schema:cost" }, + "costCategory": { "@id": "schema:costCategory" }, + "costCurrency": { "@id": "schema:costCurrency" }, + "costOrigin": { "@id": "schema:costOrigin" }, + "costPerUnit": { "@id": "schema:costPerUnit" }, + "countriesNotSupported": { "@id": "schema:countriesNotSupported" }, + "countriesSupported": { "@id": "schema:countriesSupported" }, + "countryOfOrigin": { "@id": "schema:countryOfOrigin" }, + "course": { "@id": "schema:course" }, + "courseCode": { "@id": "schema:courseCode" }, + "courseMode": { "@id": "schema:courseMode" }, + "coursePrerequisites": { "@id": "schema:coursePrerequisites" }, + "courseWorkload": { "@id": "schema:courseWorkload" }, + "coverageEndTime": { "@id": "schema:coverageEndTime", "@type": "DateTime" }, + "coverageStartTime": { + "@id": "schema:coverageStartTime", + "@type": "DateTime" + }, + "creativeWorkStatus": { "@id": "schema:creativeWorkStatus" }, + "creator": { "@id": "schema:creator" }, + "credentialCategory": { "@id": "schema:credentialCategory" }, + "creditedTo": { "@id": "schema:creditedTo" }, + "cssSelector": { "@id": "schema:cssSelector" }, + "currenciesAccepted": { "@id": "schema:currenciesAccepted" }, + "currency": { "@id": "schema:currency" }, + "currentExchangeRate": { "@id": "schema:currentExchangeRate" }, + "customer": { "@id": "schema:customer" }, + "dataFeedElement": { "@id": "schema:dataFeedElement" }, + "dataset": { "@id": "schema:dataset" }, + "datasetTimeInterval": { + "@id": "schema:datasetTimeInterval", + "@type": "DateTime" + }, + "dateCreated": { "@id": "schema:dateCreated", "@type": "Date" }, + "dateDeleted": { "@id": "schema:dateDeleted", "@type": "Date" }, + "dateIssued": { "@id": "schema:dateIssued", "@type": "Date" }, + "dateModified": { "@id": "schema:dateModified", "@type": "Date" }, + "datePosted": { "@id": "schema:datePosted", "@type": "Date" }, + "datePublished": { "@id": "schema:datePublished", "@type": "Date" }, + "dateRead": { "@id": "schema:dateRead", "@type": "Date" }, + "dateReceived": { "@id": "schema:dateReceived", "@type": "DateTime" }, + "dateSent": { "@id": "schema:dateSent", "@type": "DateTime" }, + "dateVehicleFirstRegistered": { + "@id": "schema:dateVehicleFirstRegistered", + "@type": "Date" + }, + "dateline": { "@id": "schema:dateline" }, + "dayOfWeek": { "@id": "schema:dayOfWeek" }, + "deathDate": { "@id": "schema:deathDate", "@type": "Date" }, + "deathPlace": { "@id": "schema:deathPlace" }, + "defaultValue": { "@id": "schema:defaultValue" }, + "deliveryAddress": { "@id": "schema:deliveryAddress" }, + "deliveryLeadTime": { "@id": "schema:deliveryLeadTime" }, + "deliveryMethod": { "@id": "schema:deliveryMethod" }, + "deliveryStatus": { "@id": "schema:deliveryStatus" }, + "department": { "@id": "schema:department" }, + "departureAirport": { "@id": "schema:departureAirport" }, + "departureBusStop": { "@id": "schema:departureBusStop" }, + "departureGate": { "@id": "schema:departureGate" }, + "departurePlatform": { "@id": "schema:departurePlatform" }, + "departureStation": { "@id": "schema:departureStation" }, + "departureTerminal": { "@id": "schema:departureTerminal" }, + "departureTime": { "@id": "schema:departureTime", "@type": "DateTime" }, + "dependencies": { "@id": "schema:dependencies" }, + "depth": { "@id": "schema:depth" }, + "description": { "@id": "schema:description" }, + "device": { "@id": "schema:device" }, + "diagnosis": { "@id": "schema:diagnosis" }, + "diagram": { "@id": "schema:diagram" }, + "diet": { "@id": "schema:diet" }, + "dietFeatures": { "@id": "schema:dietFeatures" }, + "differentialDiagnosis": { "@id": "schema:differentialDiagnosis" }, + "director": { "@id": "schema:director" }, + "directors": { "@id": "schema:directors" }, + "disambiguatingDescription": { "@id": "schema:disambiguatingDescription" }, + "discount": { "@id": "schema:discount" }, + "discountCode": { "@id": "schema:discountCode" }, + "discountCurrency": { "@id": "schema:discountCurrency" }, + "discusses": { "@id": "schema:discusses" }, + "discussionUrl": { "@id": "schema:discussionUrl", "@type": "@id" }, + "dissolutionDate": { "@id": "schema:dissolutionDate", "@type": "Date" }, + "distance": { "@id": "schema:distance" }, + "distinguishingSign": { "@id": "schema:distinguishingSign" }, + "distribution": { "@id": "schema:distribution" }, + "diversityPolicy": { "@id": "schema:diversityPolicy", "@type": "@id" }, + "diversityStaffingReport": { + "@id": "schema:diversityStaffingReport", + "@type": "@id" + }, + "documentation": { "@id": "schema:documentation", "@type": "@id" }, + "domainIncludes": { "@id": "schema:domainIncludes" }, + "domiciledMortgage": { "@id": "schema:domiciledMortgage" }, + "doorTime": { "@id": "schema:doorTime", "@type": "DateTime" }, + "dosageForm": { "@id": "schema:dosageForm" }, + "doseSchedule": { "@id": "schema:doseSchedule" }, + "doseUnit": { "@id": "schema:doseUnit" }, + "doseValue": { "@id": "schema:doseValue" }, + "downPayment": { "@id": "schema:downPayment" }, + "downloadUrl": { "@id": "schema:downloadUrl", "@type": "@id" }, + "downvoteCount": { "@id": "schema:downvoteCount" }, + "drainsTo": { "@id": "schema:drainsTo" }, + "driveWheelConfiguration": { "@id": "schema:driveWheelConfiguration" }, + "dropoffLocation": { "@id": "schema:dropoffLocation" }, + "dropoffTime": { "@id": "schema:dropoffTime", "@type": "DateTime" }, + "drug": { "@id": "schema:drug" }, + "drugClass": { "@id": "schema:drugClass" }, + "drugUnit": { "@id": "schema:drugUnit" }, + "duns": { "@id": "schema:duns" }, + "duplicateTherapy": { "@id": "schema:duplicateTherapy" }, + "duration": { "@id": "schema:duration" }, + "durationOfWarranty": { "@id": "schema:durationOfWarranty" }, + "duringMedia": { "@id": "schema:duringMedia", "@type": "@id" }, + "earlyPrepaymentPenalty": { "@id": "schema:earlyPrepaymentPenalty" }, + "editor": { "@id": "schema:editor" }, + "educationRequirements": { "@id": "schema:educationRequirements" }, + "educationalAlignment": { "@id": "schema:educationalAlignment" }, + "educationalCredentialAwarded": { + "@id": "schema:educationalCredentialAwarded" + }, + "educationalFramework": { "@id": "schema:educationalFramework" }, + "educationalLevel": { "@id": "schema:educationalLevel" }, + "educationalRole": { "@id": "schema:educationalRole" }, + "educationalUse": { "@id": "schema:educationalUse" }, + "elevation": { "@id": "schema:elevation" }, + "eligibleCustomerType": { "@id": "schema:eligibleCustomerType" }, + "eligibleDuration": { "@id": "schema:eligibleDuration" }, + "eligibleQuantity": { "@id": "schema:eligibleQuantity" }, + "eligibleRegion": { "@id": "schema:eligibleRegion" }, + "eligibleTransactionVolume": { "@id": "schema:eligibleTransactionVolume" }, + "email": { "@id": "schema:email" }, + "embedUrl": { "@id": "schema:embedUrl", "@type": "@id" }, + "emissionsCO2": { "@id": "schema:emissionsCO2" }, + "employee": { "@id": "schema:employee" }, + "employees": { "@id": "schema:employees" }, + "employmentType": { "@id": "schema:employmentType" }, + "encodesCreativeWork": { "@id": "schema:encodesCreativeWork" }, + "encoding": { "@id": "schema:encoding" }, + "encodingFormat": { "@id": "schema:encodingFormat" }, + "encodingType": { "@id": "schema:encodingType" }, + "encodings": { "@id": "schema:encodings" }, + "endDate": { "@id": "schema:endDate", "@type": "Date" }, + "endOffset": { "@id": "schema:endOffset" }, + "endTime": { "@id": "schema:endTime", "@type": "DateTime" }, + "endorsee": { "@id": "schema:endorsee" }, + "endorsers": { "@id": "schema:endorsers" }, + "engineDisplacement": { "@id": "schema:engineDisplacement" }, + "enginePower": { "@id": "schema:enginePower" }, + "engineType": { "@id": "schema:engineType" }, + "entertainmentBusiness": { "@id": "schema:entertainmentBusiness" }, + "epidemiology": { "@id": "schema:epidemiology" }, + "episode": { "@id": "schema:episode" }, + "episodeNumber": { "@id": "schema:episodeNumber" }, + "episodes": { "@id": "schema:episodes" }, + "equal": { "@id": "schema:equal" }, + "error": { "@id": "schema:error" }, + "estimatedCost": { "@id": "schema:estimatedCost" }, + "estimatedFlightDuration": { "@id": "schema:estimatedFlightDuration" }, + "estimatedSalary": { "@id": "schema:estimatedSalary" }, + "estimatesRiskOf": { "@id": "schema:estimatesRiskOf" }, + "ethicsPolicy": { "@id": "schema:ethicsPolicy", "@type": "@id" }, + "event": { "@id": "schema:event" }, + "eventSchedule": { "@id": "schema:eventSchedule" }, + "eventStatus": { "@id": "schema:eventStatus" }, + "events": { "@id": "schema:events" }, + "evidenceLevel": { "@id": "schema:evidenceLevel" }, + "evidenceOrigin": { "@id": "schema:evidenceOrigin" }, + "exampleOfWork": { "@id": "schema:exampleOfWork" }, + "exceptDate": { "@id": "schema:exceptDate", "@type": "Date" }, + "exchangeRateSpread": { "@id": "schema:exchangeRateSpread" }, + "executableLibraryName": { "@id": "schema:executableLibraryName" }, + "exerciseCourse": { "@id": "schema:exerciseCourse" }, + "exercisePlan": { "@id": "schema:exercisePlan" }, + "exerciseRelatedDiet": { "@id": "schema:exerciseRelatedDiet" }, + "exerciseType": { "@id": "schema:exerciseType" }, + "exifData": { "@id": "schema:exifData" }, + "expectedArrivalFrom": { + "@id": "schema:expectedArrivalFrom", + "@type": "Date" + }, + "expectedArrivalUntil": { + "@id": "schema:expectedArrivalUntil", + "@type": "Date" + }, + "expectedPrognosis": { "@id": "schema:expectedPrognosis" }, + "expectsAcceptanceOf": { "@id": "schema:expectsAcceptanceOf" }, + "experienceRequirements": { "@id": "schema:experienceRequirements" }, + "expertConsiderations": { "@id": "schema:expertConsiderations" }, + "expires": { "@id": "schema:expires", "@type": "Date" }, + "familyName": { "@id": "schema:familyName" }, + "fatContent": { "@id": "schema:fatContent" }, + "faxNumber": { "@id": "schema:faxNumber" }, + "featureList": { "@id": "schema:featureList" }, + "feesAndCommissionsSpecification": { + "@id": "schema:feesAndCommissionsSpecification" + }, + "fiberContent": { "@id": "schema:fiberContent" }, + "fileFormat": { "@id": "schema:fileFormat" }, + "fileSize": { "@id": "schema:fileSize" }, + "firstAppearance": { "@id": "schema:firstAppearance" }, + "firstPerformance": { "@id": "schema:firstPerformance" }, + "flightDistance": { "@id": "schema:flightDistance" }, + "flightNumber": { "@id": "schema:flightNumber" }, + "floorLimit": { "@id": "schema:floorLimit" }, + "floorSize": { "@id": "schema:floorSize" }, + "followee": { "@id": "schema:followee" }, + "follows": { "@id": "schema:follows" }, + "followup": { "@id": "schema:followup" }, + "foodEstablishment": { "@id": "schema:foodEstablishment" }, + "foodEvent": { "@id": "schema:foodEvent" }, + "foodWarning": { "@id": "schema:foodWarning" }, + "founder": { "@id": "schema:founder" }, + "founders": { "@id": "schema:founders" }, + "foundingDate": { "@id": "schema:foundingDate", "@type": "Date" }, + "foundingLocation": { "@id": "schema:foundingLocation" }, + "free": { "@id": "schema:free" }, + "frequency": { "@id": "schema:frequency" }, + "fromLocation": { "@id": "schema:fromLocation" }, + "fuelCapacity": { "@id": "schema:fuelCapacity" }, + "fuelConsumption": { "@id": "schema:fuelConsumption" }, + "fuelEfficiency": { "@id": "schema:fuelEfficiency" }, + "fuelType": { "@id": "schema:fuelType" }, + "function": { "@id": "schema:function" }, + "functionalClass": { "@id": "schema:functionalClass" }, + "fundedItem": { "@id": "schema:fundedItem" }, + "funder": { "@id": "schema:funder" }, + "game": { "@id": "schema:game" }, + "gameItem": { "@id": "schema:gameItem" }, + "gameLocation": { "@id": "schema:gameLocation", "@type": "@id" }, + "gamePlatform": { "@id": "schema:gamePlatform" }, + "gameServer": { "@id": "schema:gameServer" }, + "gameTip": { "@id": "schema:gameTip" }, + "gender": { "@id": "schema:gender" }, + "genre": { "@id": "schema:genre" }, + "geo": { "@id": "schema:geo" }, + "geoContains": { "@id": "schema:geoContains" }, + "geoCoveredBy": { "@id": "schema:geoCoveredBy" }, + "geoCovers": { "@id": "schema:geoCovers" }, + "geoCrosses": { "@id": "schema:geoCrosses" }, + "geoDisjoint": { "@id": "schema:geoDisjoint" }, + "geoEquals": { "@id": "schema:geoEquals" }, + "geoIntersects": { "@id": "schema:geoIntersects" }, + "geoMidpoint": { "@id": "schema:geoMidpoint" }, + "geoOverlaps": { "@id": "schema:geoOverlaps" }, + "geoRadius": { "@id": "schema:geoRadius" }, + "geoTouches": { "@id": "schema:geoTouches" }, + "geoWithin": { "@id": "schema:geoWithin" }, + "geographicArea": { "@id": "schema:geographicArea" }, + "givenName": { "@id": "schema:givenName" }, + "globalLocationNumber": { "@id": "schema:globalLocationNumber" }, + "gracePeriod": { "@id": "schema:gracePeriod" }, + "grantee": { "@id": "schema:grantee" }, + "greater": { "@id": "schema:greater" }, + "greaterOrEqual": { "@id": "schema:greaterOrEqual" }, + "gtin": { "@id": "schema:gtin" }, + "gtin12": { "@id": "schema:gtin12" }, + "gtin13": { "@id": "schema:gtin13" }, + "gtin14": { "@id": "schema:gtin14" }, + "gtin8": { "@id": "schema:gtin8" }, + "guideline": { "@id": "schema:guideline" }, + "guidelineDate": { "@id": "schema:guidelineDate", "@type": "Date" }, + "guidelineSubject": { "@id": "schema:guidelineSubject" }, + "hasBroadcastChannel": { "@id": "schema:hasBroadcastChannel" }, + "hasCategoryCode": { "@id": "schema:hasCategoryCode" }, + "hasCourseInstance": { "@id": "schema:hasCourseInstance" }, + "hasDefinedTerm": { "@id": "schema:hasDefinedTerm" }, + "hasDeliveryMethod": { "@id": "schema:hasDeliveryMethod" }, + "hasDigitalDocumentPermission": { + "@id": "schema:hasDigitalDocumentPermission" + }, + "hasMap": { "@id": "schema:hasMap", "@type": "@id" }, + "hasMenu": { "@id": "schema:hasMenu" }, + "hasMenuItem": { "@id": "schema:hasMenuItem" }, + "hasMenuSection": { "@id": "schema:hasMenuSection" }, + "hasOccupation": { "@id": "schema:hasOccupation" }, + "hasOfferCatalog": { "@id": "schema:hasOfferCatalog" }, + "hasPOS": { "@id": "schema:hasPOS" }, + "hasPart": { "@id": "schema:hasPart" }, + "hasProductReturnPolicy": { "@id": "schema:hasProductReturnPolicy" }, + "headline": { "@id": "schema:headline" }, + "healthCondition": { "@id": "schema:healthCondition" }, + "healthPlanCoinsuranceOption": { + "@id": "schema:healthPlanCoinsuranceOption" + }, + "healthPlanCoinsuranceRate": { "@id": "schema:healthPlanCoinsuranceRate" }, + "healthPlanCopay": { "@id": "schema:healthPlanCopay" }, + "healthPlanCopayOption": { "@id": "schema:healthPlanCopayOption" }, + "healthPlanCostSharing": { "@id": "schema:healthPlanCostSharing" }, + "healthPlanDrugOption": { "@id": "schema:healthPlanDrugOption" }, + "healthPlanDrugTier": { "@id": "schema:healthPlanDrugTier" }, + "healthPlanId": { "@id": "schema:healthPlanId" }, + "healthPlanMarketingUrl": { + "@id": "schema:healthPlanMarketingUrl", + "@type": "@id" + }, + "healthPlanNetworkId": { "@id": "schema:healthPlanNetworkId" }, + "healthPlanNetworkTier": { "@id": "schema:healthPlanNetworkTier" }, + "healthPlanPharmacyCategory": { + "@id": "schema:healthPlanPharmacyCategory" + }, + "height": { "@id": "schema:height" }, + "highPrice": { "@id": "schema:highPrice" }, + "hiringOrganization": { "@id": "schema:hiringOrganization" }, + "holdingArchive": { "@id": "schema:holdingArchive" }, + "homeLocation": { "@id": "schema:homeLocation" }, + "homeTeam": { "@id": "schema:homeTeam" }, + "honorificPrefix": { "@id": "schema:honorificPrefix" }, + "honorificSuffix": { "@id": "schema:honorificSuffix" }, + "hospitalAffiliation": { "@id": "schema:hospitalAffiliation" }, + "hostingOrganization": { "@id": "schema:hostingOrganization" }, + "hoursAvailable": { "@id": "schema:hoursAvailable" }, + "howPerformed": { "@id": "schema:howPerformed" }, + "iataCode": { "@id": "schema:iataCode" }, + "icaoCode": { "@id": "schema:icaoCode" }, + "identifier": { "@id": "schema:identifier" }, + "identifyingExam": { "@id": "schema:identifyingExam" }, + "identifyingTest": { "@id": "schema:identifyingTest" }, + "illustrator": { "@id": "schema:illustrator" }, + "image": { "@id": "schema:image", "@type": "@id" }, + "imagingTechnique": { "@id": "schema:imagingTechnique" }, + "inAlbum": { "@id": "schema:inAlbum" }, + "inBroadcastLineup": { "@id": "schema:inBroadcastLineup" }, + "inCodeSet": { "@id": "schema:inCodeSet", "@type": "@id" }, + "inDefinedTermSet": { "@id": "schema:inDefinedTermSet", "@type": "@id" }, + "inLanguage": { "@id": "schema:inLanguage" }, + "inPlaylist": { "@id": "schema:inPlaylist" }, + "inStoreReturnsOffered": { "@id": "schema:inStoreReturnsOffered" }, + "inSupportOf": { "@id": "schema:inSupportOf" }, + "incentiveCompensation": { "@id": "schema:incentiveCompensation" }, + "incentives": { "@id": "schema:incentives" }, + "includedComposition": { "@id": "schema:includedComposition" }, + "includedDataCatalog": { "@id": "schema:includedDataCatalog" }, + "includedInDataCatalog": { "@id": "schema:includedInDataCatalog" }, + "includedInHealthInsurancePlan": { + "@id": "schema:includedInHealthInsurancePlan" + }, + "includedRiskFactor": { "@id": "schema:includedRiskFactor" }, + "includesAttraction": { "@id": "schema:includesAttraction" }, + "includesHealthPlanFormulary": { + "@id": "schema:includesHealthPlanFormulary" + }, + "includesHealthPlanNetwork": { "@id": "schema:includesHealthPlanNetwork" }, + "includesObject": { "@id": "schema:includesObject" }, + "increasesRiskOf": { "@id": "schema:increasesRiskOf" }, + "indication": { "@id": "schema:indication" }, + "industry": { "@id": "schema:industry" }, + "ineligibleRegion": { "@id": "schema:ineligibleRegion" }, + "infectiousAgent": { "@id": "schema:infectiousAgent" }, + "infectiousAgentClass": { "@id": "schema:infectiousAgentClass" }, + "ingredients": { "@id": "schema:ingredients" }, + "inker": { "@id": "schema:inker" }, + "insertion": { "@id": "schema:insertion" }, + "installUrl": { "@id": "schema:installUrl", "@type": "@id" }, + "instructor": { "@id": "schema:instructor" }, + "instrument": { "@id": "schema:instrument" }, + "intensity": { "@id": "schema:intensity" }, + "interactingDrug": { "@id": "schema:interactingDrug" }, + "interactionCount": { "@id": "schema:interactionCount" }, + "interactionService": { "@id": "schema:interactionService" }, + "interactionStatistic": { "@id": "schema:interactionStatistic" }, + "interactionType": { "@id": "schema:interactionType" }, + "interactivityType": { "@id": "schema:interactivityType" }, + "interestRate": { "@id": "schema:interestRate" }, + "inventoryLevel": { "@id": "schema:inventoryLevel" }, + "inverseOf": { "@id": "schema:inverseOf" }, + "isAcceptingNewPatients": { "@id": "schema:isAcceptingNewPatients" }, + "isAccessibleForFree": { "@id": "schema:isAccessibleForFree" }, + "isAccessoryOrSparePartFor": { "@id": "schema:isAccessoryOrSparePartFor" }, + "isAvailableGenerically": { "@id": "schema:isAvailableGenerically" }, + "isBasedOn": { "@id": "schema:isBasedOn", "@type": "@id" }, + "isBasedOnUrl": { "@id": "schema:isBasedOnUrl", "@type": "@id" }, + "isConsumableFor": { "@id": "schema:isConsumableFor" }, + "isFamilyFriendly": { "@id": "schema:isFamilyFriendly" }, + "isGift": { "@id": "schema:isGift" }, + "isLiveBroadcast": { "@id": "schema:isLiveBroadcast" }, + "isPartOf": { "@id": "schema:isPartOf" }, + "isProprietary": { "@id": "schema:isProprietary" }, + "isRelatedTo": { "@id": "schema:isRelatedTo" }, + "isSimilarTo": { "@id": "schema:isSimilarTo" }, + "isVariantOf": { "@id": "schema:isVariantOf" }, + "isbn": { "@id": "schema:isbn" }, + "isicV4": { "@id": "schema:isicV4" }, + "isrcCode": { "@id": "schema:isrcCode" }, + "issn": { "@id": "schema:issn" }, + "issueNumber": { "@id": "schema:issueNumber" }, + "issuedBy": { "@id": "schema:issuedBy" }, + "issuedThrough": { "@id": "schema:issuedThrough" }, + "iswcCode": { "@id": "schema:iswcCode" }, + "item": { "@id": "schema:item" }, + "itemCondition": { "@id": "schema:itemCondition" }, + "itemListElement": { "@id": "schema:itemListElement" }, + "itemListOrder": { "@id": "schema:itemListOrder" }, + "itemLocation": { "@id": "schema:itemLocation" }, + "itemOffered": { "@id": "schema:itemOffered" }, + "itemReviewed": { "@id": "schema:itemReviewed" }, + "itemShipped": { "@id": "schema:itemShipped" }, + "itinerary": { "@id": "schema:itinerary" }, + "jobBenefits": { "@id": "schema:jobBenefits" }, + "jobImmediateStart": { "@id": "schema:jobImmediateStart" }, + "jobLocation": { "@id": "schema:jobLocation" }, + "jobLocationType": { "@id": "schema:jobLocationType" }, + "jobStartDate": { "@id": "schema:jobStartDate" }, + "jobTitle": { "@id": "schema:jobTitle" }, + "keywords": { "@id": "schema:keywords" }, + "knownVehicleDamages": { "@id": "schema:knownVehicleDamages" }, + "knows": { "@id": "schema:knows" }, + "knowsAbout": { "@id": "schema:knowsAbout" }, + "knowsLanguage": { "@id": "schema:knowsLanguage" }, + "labelDetails": { "@id": "schema:labelDetails", "@type": "@id" }, + "landlord": { "@id": "schema:landlord" }, + "language": { "@id": "schema:language" }, + "lastReviewed": { "@id": "schema:lastReviewed", "@type": "Date" }, + "latitude": { "@id": "schema:latitude" }, + "learningResourceType": { "@id": "schema:learningResourceType" }, + "legalName": { "@id": "schema:legalName" }, + "legalStatus": { "@id": "schema:legalStatus" }, + "legislationApplies": { "@id": "schema:legislationApplies" }, + "legislationChanges": { "@id": "schema:legislationChanges" }, + "legislationConsolidates": { "@id": "schema:legislationConsolidates" }, + "legislationDate": { "@id": "schema:legislationDate", "@type": "Date" }, + "legislationDateVersion": { + "@id": "schema:legislationDateVersion", + "@type": "Date" + }, + "legislationIdentifier": { "@id": "schema:legislationIdentifier" }, + "legislationJurisdiction": { "@id": "schema:legislationJurisdiction" }, + "legislationLegalForce": { "@id": "schema:legislationLegalForce" }, + "legislationLegalValue": { "@id": "schema:legislationLegalValue" }, + "legislationPassedBy": { "@id": "schema:legislationPassedBy" }, + "legislationResponsible": { "@id": "schema:legislationResponsible" }, + "legislationTransposes": { "@id": "schema:legislationTransposes" }, + "legislationType": { "@id": "schema:legislationType" }, + "leiCode": { "@id": "schema:leiCode" }, + "lender": { "@id": "schema:lender" }, + "lesser": { "@id": "schema:lesser" }, + "lesserOrEqual": { "@id": "schema:lesserOrEqual" }, + "letterer": { "@id": "schema:letterer" }, + "license": { "@id": "schema:license", "@type": "@id" }, + "line": { "@id": "schema:line" }, + "linkRelationship": { "@id": "schema:linkRelationship" }, + "liveBlogUpdate": { "@id": "schema:liveBlogUpdate" }, + "loanMortgageMandateAmount": { "@id": "schema:loanMortgageMandateAmount" }, + "loanPaymentAmount": { "@id": "schema:loanPaymentAmount" }, + "loanPaymentFrequency": { "@id": "schema:loanPaymentFrequency" }, + "loanRepaymentForm": { "@id": "schema:loanRepaymentForm" }, + "loanTerm": { "@id": "schema:loanTerm" }, + "loanType": { "@id": "schema:loanType" }, + "location": { "@id": "schema:location" }, + "locationCreated": { "@id": "schema:locationCreated" }, + "lodgingUnitDescription": { "@id": "schema:lodgingUnitDescription" }, + "lodgingUnitType": { "@id": "schema:lodgingUnitType" }, + "logo": { "@id": "schema:logo", "@type": "@id" }, + "longitude": { "@id": "schema:longitude" }, + "loser": { "@id": "schema:loser" }, + "lowPrice": { "@id": "schema:lowPrice" }, + "lyricist": { "@id": "schema:lyricist" }, + "lyrics": { "@id": "schema:lyrics" }, + "mainContentOfPage": { "@id": "schema:mainContentOfPage" }, + "mainEntity": { "@id": "schema:mainEntity" }, + "mainEntityOfPage": { "@id": "schema:mainEntityOfPage", "@type": "@id" }, + "makesOffer": { "@id": "schema:makesOffer" }, + "manufacturer": { "@id": "schema:manufacturer" }, + "map": { "@id": "schema:map", "@type": "@id" }, + "mapType": { "@id": "schema:mapType" }, + "maps": { "@id": "schema:maps", "@type": "@id" }, + "masthead": { "@id": "schema:masthead", "@type": "@id" }, + "material": { "@id": "schema:material" }, + "materialExtent": { "@id": "schema:materialExtent" }, + "maxPrice": { "@id": "schema:maxPrice" }, + "maxValue": { "@id": "schema:maxValue" }, + "maximumAttendeeCapacity": { "@id": "schema:maximumAttendeeCapacity" }, + "maximumIntake": { "@id": "schema:maximumIntake" }, + "mealService": { "@id": "schema:mealService" }, + "measurementTechnique": { "@id": "schema:measurementTechnique" }, + "mechanismOfAction": { "@id": "schema:mechanismOfAction" }, + "median": { "@id": "schema:median" }, + "medicalSpecialty": { "@id": "schema:medicalSpecialty" }, + "medicineSystem": { "@id": "schema:medicineSystem" }, + "meetsEmissionStandard": { "@id": "schema:meetsEmissionStandard" }, + "member": { "@id": "schema:member" }, + "memberOf": { "@id": "schema:memberOf" }, + "members": { "@id": "schema:members" }, + "membershipNumber": { "@id": "schema:membershipNumber" }, + "membershipPointsEarned": { "@id": "schema:membershipPointsEarned" }, + "memoryRequirements": { "@id": "schema:memoryRequirements" }, + "mentions": { "@id": "schema:mentions" }, + "menu": { "@id": "schema:menu" }, + "menuAddOn": { "@id": "schema:menuAddOn" }, + "merchant": { "@id": "schema:merchant" }, + "messageAttachment": { "@id": "schema:messageAttachment" }, + "mileageFromOdometer": { "@id": "schema:mileageFromOdometer" }, + "minPrice": { "@id": "schema:minPrice" }, + "minValue": { "@id": "schema:minValue" }, + "minimumPaymentDue": { "@id": "schema:minimumPaymentDue" }, + "missionCoveragePrioritiesPolicy": { + "@id": "schema:missionCoveragePrioritiesPolicy", + "@type": "@id" + }, + "model": { "@id": "schema:model" }, + "modelDate": { "@id": "schema:modelDate", "@type": "Date" }, + "modifiedTime": { "@id": "schema:modifiedTime", "@type": "DateTime" }, + "monthlyMinimumRepaymentAmount": { + "@id": "schema:monthlyMinimumRepaymentAmount" + }, + "mpn": { "@id": "schema:mpn" }, + "multipleValues": { "@id": "schema:multipleValues" }, + "muscleAction": { "@id": "schema:muscleAction" }, + "musicArrangement": { "@id": "schema:musicArrangement" }, + "musicBy": { "@id": "schema:musicBy" }, + "musicCompositionForm": { "@id": "schema:musicCompositionForm" }, + "musicGroupMember": { "@id": "schema:musicGroupMember" }, + "musicReleaseFormat": { "@id": "schema:musicReleaseFormat" }, + "musicalKey": { "@id": "schema:musicalKey" }, + "naics": { "@id": "schema:naics" }, + "name": { "@id": "schema:name" }, + "namedPosition": { "@id": "schema:namedPosition" }, + "nationality": { "@id": "schema:nationality" }, + "naturalProgression": { "@id": "schema:naturalProgression" }, + "nerve": { "@id": "schema:nerve" }, + "nerveMotor": { "@id": "schema:nerveMotor" }, + "netWorth": { "@id": "schema:netWorth" }, + "nextItem": { "@id": "schema:nextItem" }, + "noBylinesPolicy": { "@id": "schema:noBylinesPolicy", "@type": "@id" }, + "nonEqual": { "@id": "schema:nonEqual" }, + "nonProprietaryName": { "@id": "schema:nonProprietaryName" }, + "normalRange": { "@id": "schema:normalRange" }, + "nsn": { "@id": "schema:nsn" }, + "numAdults": { "@id": "schema:numAdults" }, + "numChildren": { "@id": "schema:numChildren" }, + "numTracks": { "@id": "schema:numTracks" }, + "numberOfAirbags": { "@id": "schema:numberOfAirbags" }, + "numberOfAxles": { "@id": "schema:numberOfAxles" }, + "numberOfBeds": { "@id": "schema:numberOfBeds" }, + "numberOfDoors": { "@id": "schema:numberOfDoors" }, + "numberOfEmployees": { "@id": "schema:numberOfEmployees" }, + "numberOfEpisodes": { "@id": "schema:numberOfEpisodes" }, + "numberOfForwardGears": { "@id": "schema:numberOfForwardGears" }, + "numberOfItems": { "@id": "schema:numberOfItems" }, + "numberOfLoanPayments": { "@id": "schema:numberOfLoanPayments" }, + "numberOfPages": { "@id": "schema:numberOfPages" }, + "numberOfPlayers": { "@id": "schema:numberOfPlayers" }, + "numberOfPreviousOwners": { "@id": "schema:numberOfPreviousOwners" }, + "numberOfRooms": { "@id": "schema:numberOfRooms" }, + "numberOfSeasons": { "@id": "schema:numberOfSeasons" }, + "numberedPosition": { "@id": "schema:numberedPosition" }, + "nutrition": { "@id": "schema:nutrition" }, + "object": { "@id": "schema:object" }, + "occupancy": { "@id": "schema:occupancy" }, + "occupationLocation": { "@id": "schema:occupationLocation" }, + "occupationalCategory": { "@id": "schema:occupationalCategory" }, + "offerCount": { "@id": "schema:offerCount" }, + "offeredBy": { "@id": "schema:offeredBy" }, + "offers": { "@id": "schema:offers" }, + "offersPrescriptionByMail": { "@id": "schema:offersPrescriptionByMail" }, + "openingHours": { "@id": "schema:openingHours" }, + "openingHoursSpecification": { "@id": "schema:openingHoursSpecification" }, + "opens": { "@id": "schema:opens" }, + "operatingSystem": { "@id": "schema:operatingSystem" }, + "opponent": { "@id": "schema:opponent" }, + "option": { "@id": "schema:option" }, + "orderDate": { "@id": "schema:orderDate", "@type": "Date" }, + "orderDelivery": { "@id": "schema:orderDelivery" }, + "orderItemNumber": { "@id": "schema:orderItemNumber" }, + "orderItemStatus": { "@id": "schema:orderItemStatus" }, + "orderNumber": { "@id": "schema:orderNumber" }, + "orderQuantity": { "@id": "schema:orderQuantity" }, + "orderStatus": { "@id": "schema:orderStatus" }, + "orderedItem": { "@id": "schema:orderedItem" }, + "organizer": { "@id": "schema:organizer" }, + "origin": { "@id": "schema:origin" }, + "originAddress": { "@id": "schema:originAddress" }, + "originatesFrom": { "@id": "schema:originatesFrom" }, + "outcome": { "@id": "schema:outcome" }, + "overdosage": { "@id": "schema:overdosage" }, + "overview": { "@id": "schema:overview" }, + "ownedFrom": { "@id": "schema:ownedFrom", "@type": "DateTime" }, + "ownedThrough": { "@id": "schema:ownedThrough", "@type": "DateTime" }, + "ownershipFundingInfo": { "@id": "schema:ownershipFundingInfo" }, + "owns": { "@id": "schema:owns" }, + "pageEnd": { "@id": "schema:pageEnd" }, + "pageStart": { "@id": "schema:pageStart" }, + "pagination": { "@id": "schema:pagination" }, + "parent": { "@id": "schema:parent" }, + "parentItem": { "@id": "schema:parentItem" }, + "parentOrganization": { "@id": "schema:parentOrganization" }, + "parentService": { "@id": "schema:parentService" }, + "parents": { "@id": "schema:parents" }, + "partOfEpisode": { "@id": "schema:partOfEpisode" }, + "partOfInvoice": { "@id": "schema:partOfInvoice" }, + "partOfOrder": { "@id": "schema:partOfOrder" }, + "partOfSeason": { "@id": "schema:partOfSeason" }, + "partOfSeries": { "@id": "schema:partOfSeries" }, + "partOfSystem": { "@id": "schema:partOfSystem" }, + "partOfTVSeries": { "@id": "schema:partOfTVSeries" }, + "partOfTrip": { "@id": "schema:partOfTrip" }, + "participant": { "@id": "schema:participant" }, + "partySize": { "@id": "schema:partySize" }, + "passengerPriorityStatus": { "@id": "schema:passengerPriorityStatus" }, + "passengerSequenceNumber": { "@id": "schema:passengerSequenceNumber" }, + "pathophysiology": { "@id": "schema:pathophysiology" }, + "payload": { "@id": "schema:payload" }, + "paymentAccepted": { "@id": "schema:paymentAccepted" }, + "paymentDue": { "@id": "schema:paymentDue", "@type": "DateTime" }, + "paymentDueDate": { "@id": "schema:paymentDueDate", "@type": "Date" }, + "paymentMethod": { "@id": "schema:paymentMethod" }, + "paymentMethodId": { "@id": "schema:paymentMethodId" }, + "paymentStatus": { "@id": "schema:paymentStatus" }, + "paymentUrl": { "@id": "schema:paymentUrl", "@type": "@id" }, + "penciler": { "@id": "schema:penciler" }, + "percentile10": { "@id": "schema:percentile10" }, + "percentile25": { "@id": "schema:percentile25" }, + "percentile75": { "@id": "schema:percentile75" }, + "percentile90": { "@id": "schema:percentile90" }, + "performTime": { "@id": "schema:performTime" }, + "performer": { "@id": "schema:performer" }, + "performerIn": { "@id": "schema:performerIn" }, + "performers": { "@id": "schema:performers" }, + "permissionType": { "@id": "schema:permissionType" }, + "permissions": { "@id": "schema:permissions" }, + "permitAudience": { "@id": "schema:permitAudience" }, + "permittedUsage": { "@id": "schema:permittedUsage" }, + "petsAllowed": { "@id": "schema:petsAllowed" }, + "phase": { "@id": "schema:phase" }, + "photo": { "@id": "schema:photo" }, + "photos": { "@id": "schema:photos" }, + "physiologicalBenefits": { "@id": "schema:physiologicalBenefits" }, + "pickupLocation": { "@id": "schema:pickupLocation" }, + "pickupTime": { "@id": "schema:pickupTime", "@type": "DateTime" }, + "playMode": { "@id": "schema:playMode" }, + "playerType": { "@id": "schema:playerType" }, + "playersOnline": { "@id": "schema:playersOnline" }, + "polygon": { "@id": "schema:polygon" }, + "population": { "@id": "schema:population" }, + "position": { "@id": "schema:position" }, + "possibleComplication": { "@id": "schema:possibleComplication" }, + "possibleTreatment": { "@id": "schema:possibleTreatment" }, + "postOfficeBoxNumber": { "@id": "schema:postOfficeBoxNumber" }, + "postOp": { "@id": "schema:postOp" }, + "postalCode": { "@id": "schema:postalCode" }, + "potentialAction": { "@id": "schema:potentialAction" }, + "preOp": { "@id": "schema:preOp" }, + "predecessorOf": { "@id": "schema:predecessorOf" }, + "pregnancyCategory": { "@id": "schema:pregnancyCategory" }, + "pregnancyWarning": { "@id": "schema:pregnancyWarning" }, + "prepTime": { "@id": "schema:prepTime" }, + "preparation": { "@id": "schema:preparation" }, + "prescribingInfo": { "@id": "schema:prescribingInfo", "@type": "@id" }, + "prescriptionStatus": { "@id": "schema:prescriptionStatus" }, + "previousItem": { "@id": "schema:previousItem" }, + "previousStartDate": { "@id": "schema:previousStartDate", "@type": "Date" }, + "price": { "@id": "schema:price" }, + "priceComponent": { "@id": "schema:priceComponent" }, + "priceCurrency": { "@id": "schema:priceCurrency" }, + "priceRange": { "@id": "schema:priceRange" }, + "priceSpecification": { "@id": "schema:priceSpecification" }, + "priceType": { "@id": "schema:priceType" }, + "priceValidUntil": { "@id": "schema:priceValidUntil", "@type": "Date" }, + "primaryImageOfPage": { "@id": "schema:primaryImageOfPage" }, + "primaryPrevention": { "@id": "schema:primaryPrevention" }, + "printColumn": { "@id": "schema:printColumn" }, + "printEdition": { "@id": "schema:printEdition" }, + "printPage": { "@id": "schema:printPage" }, + "printSection": { "@id": "schema:printSection" }, + "procedure": { "@id": "schema:procedure" }, + "procedureType": { "@id": "schema:procedureType" }, + "processingTime": { "@id": "schema:processingTime" }, + "processorRequirements": { "@id": "schema:processorRequirements" }, + "producer": { "@id": "schema:producer" }, + "produces": { "@id": "schema:produces" }, + "productID": { "@id": "schema:productID" }, + "productReturnDays": { "@id": "schema:productReturnDays" }, + "productReturnLink": { "@id": "schema:productReturnLink", "@type": "@id" }, + "productSupported": { "@id": "schema:productSupported" }, + "productionCompany": { "@id": "schema:productionCompany" }, + "productionDate": { "@id": "schema:productionDate", "@type": "Date" }, + "proficiencyLevel": { "@id": "schema:proficiencyLevel" }, + "programMembershipUsed": { "@id": "schema:programMembershipUsed" }, + "programName": { "@id": "schema:programName" }, + "programmingLanguage": { "@id": "schema:programmingLanguage" }, + "programmingModel": { "@id": "schema:programmingModel" }, + "propertyID": { "@id": "schema:propertyID" }, + "proprietaryName": { "@id": "schema:proprietaryName" }, + "proteinContent": { "@id": "schema:proteinContent" }, + "provider": { "@id": "schema:provider" }, + "providerMobility": { "@id": "schema:providerMobility" }, + "providesBroadcastService": { "@id": "schema:providesBroadcastService" }, + "providesService": { "@id": "schema:providesService" }, + "publicAccess": { "@id": "schema:publicAccess" }, + "publication": { "@id": "schema:publication" }, + "publicationType": { "@id": "schema:publicationType" }, + "publishedBy": { "@id": "schema:publishedBy" }, + "publishedOn": { "@id": "schema:publishedOn" }, + "publisher": { "@id": "schema:publisher" }, + "publisherImprint": { "@id": "schema:publisherImprint" }, + "publishingPrinciples": { + "@id": "schema:publishingPrinciples", + "@type": "@id" + }, + "purchaseDate": { "@id": "schema:purchaseDate", "@type": "Date" }, + "purpose": { "@id": "schema:purpose" }, + "qualifications": { "@id": "schema:qualifications" }, + "query": { "@id": "schema:query" }, + "quest": { "@id": "schema:quest" }, + "question": { "@id": "schema:question" }, + "rangeIncludes": { "@id": "schema:rangeIncludes" }, + "ratingCount": { "@id": "schema:ratingCount" }, + "ratingValue": { "@id": "schema:ratingValue" }, + "readBy": { "@id": "schema:readBy" }, + "readonlyValue": { "@id": "schema:readonlyValue" }, + "realEstateAgent": { "@id": "schema:realEstateAgent" }, + "recipe": { "@id": "schema:recipe" }, + "recipeCategory": { "@id": "schema:recipeCategory" }, + "recipeCuisine": { "@id": "schema:recipeCuisine" }, + "recipeIngredient": { "@id": "schema:recipeIngredient" }, + "recipeInstructions": { "@id": "schema:recipeInstructions" }, + "recipeYield": { "@id": "schema:recipeYield" }, + "recipient": { "@id": "schema:recipient" }, + "recognizedBy": { "@id": "schema:recognizedBy" }, + "recognizingAuthority": { "@id": "schema:recognizingAuthority" }, + "recommendationStrength": { "@id": "schema:recommendationStrength" }, + "recommendedIntake": { "@id": "schema:recommendedIntake" }, + "recordLabel": { "@id": "schema:recordLabel" }, + "recordedAs": { "@id": "schema:recordedAs" }, + "recordedAt": { "@id": "schema:recordedAt" }, + "recordedIn": { "@id": "schema:recordedIn" }, + "recordingOf": { "@id": "schema:recordingOf" }, + "recourseLoan": { "@id": "schema:recourseLoan" }, + "referenceQuantity": { "@id": "schema:referenceQuantity" }, + "referencesOrder": { "@id": "schema:referencesOrder" }, + "refundType": { "@id": "schema:refundType" }, + "regionDrained": { "@id": "schema:regionDrained" }, + "regionsAllowed": { "@id": "schema:regionsAllowed" }, + "relatedAnatomy": { "@id": "schema:relatedAnatomy" }, + "relatedCondition": { "@id": "schema:relatedCondition" }, + "relatedDrug": { "@id": "schema:relatedDrug" }, + "relatedLink": { "@id": "schema:relatedLink", "@type": "@id" }, + "relatedStructure": { "@id": "schema:relatedStructure" }, + "relatedTherapy": { "@id": "schema:relatedTherapy" }, + "relatedTo": { "@id": "schema:relatedTo" }, + "releaseDate": { "@id": "schema:releaseDate", "@type": "Date" }, + "releaseNotes": { "@id": "schema:releaseNotes" }, + "releaseOf": { "@id": "schema:releaseOf" }, + "releasedEvent": { "@id": "schema:releasedEvent" }, + "relevantOccupation": { "@id": "schema:relevantOccupation" }, + "relevantSpecialty": { "@id": "schema:relevantSpecialty" }, + "remainingAttendeeCapacity": { "@id": "schema:remainingAttendeeCapacity" }, + "renegotiableLoan": { "@id": "schema:renegotiableLoan" }, + "repeatCount": { "@id": "schema:repeatCount" }, + "repeatFrequency": { "@id": "schema:repeatFrequency" }, + "repetitions": { "@id": "schema:repetitions" }, + "replacee": { "@id": "schema:replacee" }, + "replacer": { "@id": "schema:replacer" }, + "replyToUrl": { "@id": "schema:replyToUrl", "@type": "@id" }, + "reportNumber": { "@id": "schema:reportNumber" }, + "representativeOfPage": { "@id": "schema:representativeOfPage" }, + "requiredCollateral": { "@id": "schema:requiredCollateral" }, + "requiredGender": { "@id": "schema:requiredGender" }, + "requiredMaxAge": { "@id": "schema:requiredMaxAge" }, + "requiredMinAge": { "@id": "schema:requiredMinAge" }, + "requiredQuantity": { "@id": "schema:requiredQuantity" }, + "requirements": { "@id": "schema:requirements" }, + "requiresSubscription": { "@id": "schema:requiresSubscription" }, + "reservationFor": { "@id": "schema:reservationFor" }, + "reservationId": { "@id": "schema:reservationId" }, + "reservationStatus": { "@id": "schema:reservationStatus" }, + "reservedTicket": { "@id": "schema:reservedTicket" }, + "responsibilities": { "@id": "schema:responsibilities" }, + "restPeriods": { "@id": "schema:restPeriods" }, + "result": { "@id": "schema:result" }, + "resultComment": { "@id": "schema:resultComment" }, + "resultReview": { "@id": "schema:resultReview" }, + "returnFees": { "@id": "schema:returnFees" }, + "returnPolicyCategory": { "@id": "schema:returnPolicyCategory" }, + "review": { "@id": "schema:review" }, + "reviewAspect": { "@id": "schema:reviewAspect" }, + "reviewBody": { "@id": "schema:reviewBody" }, + "reviewCount": { "@id": "schema:reviewCount" }, + "reviewRating": { "@id": "schema:reviewRating" }, + "reviewedBy": { "@id": "schema:reviewedBy" }, + "reviews": { "@id": "schema:reviews" }, + "riskFactor": { "@id": "schema:riskFactor" }, + "risks": { "@id": "schema:risks" }, + "roleName": { "@id": "schema:roleName" }, + "roofLoad": { "@id": "schema:roofLoad" }, + "rsvpResponse": { "@id": "schema:rsvpResponse" }, + "runsTo": { "@id": "schema:runsTo" }, + "runtime": { "@id": "schema:runtime" }, + "runtimePlatform": { "@id": "schema:runtimePlatform" }, + "rxcui": { "@id": "schema:rxcui" }, + "safetyConsideration": { "@id": "schema:safetyConsideration" }, + "salaryCurrency": { "@id": "schema:salaryCurrency" }, + "sameAs": { "@id": "schema:sameAs", "@type": "@id" }, + "sampleType": { "@id": "schema:sampleType" }, + "saturatedFatContent": { "@id": "schema:saturatedFatContent" }, + "scheduledPaymentDate": { + "@id": "schema:scheduledPaymentDate", + "@type": "Date" + }, + "scheduledTime": { "@id": "schema:scheduledTime", "@type": "DateTime" }, + "schemaVersion": { "@id": "schema:schemaVersion" }, + "screenCount": { "@id": "schema:screenCount" }, + "screenshot": { "@id": "schema:screenshot", "@type": "@id" }, + "sdDatePublished": { "@id": "schema:sdDatePublished", "@type": "Date" }, + "sdLicense": { "@id": "schema:sdLicense", "@type": "@id" }, + "sdPublisher": { "@id": "schema:sdPublisher" }, + "season": { "@id": "schema:season" }, + "seasonNumber": { "@id": "schema:seasonNumber" }, + "seasons": { "@id": "schema:seasons" }, + "seatNumber": { "@id": "schema:seatNumber" }, + "seatRow": { "@id": "schema:seatRow" }, + "seatSection": { "@id": "schema:seatSection" }, + "seatingCapacity": { "@id": "schema:seatingCapacity" }, + "seatingType": { "@id": "schema:seatingType" }, + "secondaryPrevention": { "@id": "schema:secondaryPrevention" }, + "securityScreening": { "@id": "schema:securityScreening" }, + "seeks": { "@id": "schema:seeks" }, + "seller": { "@id": "schema:seller" }, + "sender": { "@id": "schema:sender" }, + "sensoryUnit": { "@id": "schema:sensoryUnit" }, + "serialNumber": { "@id": "schema:serialNumber" }, + "seriousAdverseOutcome": { "@id": "schema:seriousAdverseOutcome" }, + "serverStatus": { "@id": "schema:serverStatus" }, + "servesCuisine": { "@id": "schema:servesCuisine" }, + "serviceArea": { "@id": "schema:serviceArea" }, + "serviceAudience": { "@id": "schema:serviceAudience" }, + "serviceLocation": { "@id": "schema:serviceLocation" }, + "serviceOperator": { "@id": "schema:serviceOperator" }, + "serviceOutput": { "@id": "schema:serviceOutput" }, + "servicePhone": { "@id": "schema:servicePhone" }, + "servicePostalAddress": { "@id": "schema:servicePostalAddress" }, + "serviceSmsNumber": { "@id": "schema:serviceSmsNumber" }, + "serviceType": { "@id": "schema:serviceType" }, + "serviceUrl": { "@id": "schema:serviceUrl", "@type": "@id" }, + "servingSize": { "@id": "schema:servingSize" }, + "sharedContent": { "@id": "schema:sharedContent" }, + "sibling": { "@id": "schema:sibling" }, + "siblings": { "@id": "schema:siblings" }, + "signDetected": { "@id": "schema:signDetected" }, + "signOrSymptom": { "@id": "schema:signOrSymptom" }, + "significance": { "@id": "schema:significance" }, + "significantLink": { "@id": "schema:significantLink", "@type": "@id" }, + "significantLinks": { "@id": "schema:significantLinks", "@type": "@id" }, + "skills": { "@id": "schema:skills" }, + "sku": { "@id": "schema:sku" }, + "slogan": { "@id": "schema:slogan" }, + "smokingAllowed": { "@id": "schema:smokingAllowed" }, + "sodiumContent": { "@id": "schema:sodiumContent" }, + "softwareAddOn": { "@id": "schema:softwareAddOn" }, + "softwareHelp": { "@id": "schema:softwareHelp" }, + "softwareRequirements": { "@id": "schema:softwareRequirements" }, + "softwareVersion": { "@id": "schema:softwareVersion" }, + "source": { "@id": "schema:source" }, + "sourceOrganization": { "@id": "schema:sourceOrganization" }, + "sourcedFrom": { "@id": "schema:sourcedFrom" }, + "spatial": { "@id": "schema:spatial" }, + "spatialCoverage": { "@id": "schema:spatialCoverage" }, + "speakable": { "@id": "schema:speakable", "@type": "@id" }, + "specialCommitments": { "@id": "schema:specialCommitments" }, + "specialOpeningHoursSpecification": { + "@id": "schema:specialOpeningHoursSpecification" + }, + "specialty": { "@id": "schema:specialty" }, + "speed": { "@id": "schema:speed" }, + "spokenByCharacter": { "@id": "schema:spokenByCharacter" }, + "sponsor": { "@id": "schema:sponsor" }, + "sport": { "@id": "schema:sport" }, + "sportsActivityLocation": { "@id": "schema:sportsActivityLocation" }, + "sportsEvent": { "@id": "schema:sportsEvent" }, + "sportsTeam": { "@id": "schema:sportsTeam" }, + "spouse": { "@id": "schema:spouse" }, + "stage": { "@id": "schema:stage" }, + "stageAsNumber": { "@id": "schema:stageAsNumber" }, + "starRating": { "@id": "schema:starRating" }, + "startDate": { "@id": "schema:startDate", "@type": "Date" }, + "startOffset": { "@id": "schema:startOffset" }, + "startTime": { "@id": "schema:startTime", "@type": "DateTime" }, + "status": { "@id": "schema:status" }, + "steeringPosition": { "@id": "schema:steeringPosition" }, + "step": { "@id": "schema:step" }, + "stepValue": { "@id": "schema:stepValue" }, + "steps": { "@id": "schema:steps" }, + "storageRequirements": { "@id": "schema:storageRequirements" }, + "streetAddress": { "@id": "schema:streetAddress" }, + "strengthUnit": { "@id": "schema:strengthUnit" }, + "strengthValue": { "@id": "schema:strengthValue" }, + "structuralClass": { "@id": "schema:structuralClass" }, + "study": { "@id": "schema:study" }, + "studyDesign": { "@id": "schema:studyDesign" }, + "studyLocation": { "@id": "schema:studyLocation" }, + "studySubject": { "@id": "schema:studySubject" }, + "stupidProperty": { "@id": "schema:stupidProperty" }, + "subEvent": { "@id": "schema:subEvent" }, + "subEvents": { "@id": "schema:subEvents" }, + "subOrganization": { "@id": "schema:subOrganization" }, + "subReservation": { "@id": "schema:subReservation" }, + "subStageSuffix": { "@id": "schema:subStageSuffix" }, + "subStructure": { "@id": "schema:subStructure" }, + "subTest": { "@id": "schema:subTest" }, + "subTrip": { "@id": "schema:subTrip" }, + "subjectOf": { "@id": "schema:subjectOf" }, + "subtitleLanguage": { "@id": "schema:subtitleLanguage" }, + "subtype": { "@id": "schema:subtype" }, + "successorOf": { "@id": "schema:successorOf" }, + "sugarContent": { "@id": "schema:sugarContent" }, + "suggestedAnswer": { "@id": "schema:suggestedAnswer" }, + "suggestedGender": { "@id": "schema:suggestedGender" }, + "suggestedMaxAge": { "@id": "schema:suggestedMaxAge" }, + "suggestedMinAge": { "@id": "schema:suggestedMinAge" }, + "suitableForDiet": { "@id": "schema:suitableForDiet" }, + "superEvent": { "@id": "schema:superEvent" }, + "supersededBy": { "@id": "schema:supersededBy" }, + "supply": { "@id": "schema:supply" }, + "supplyTo": { "@id": "schema:supplyTo" }, + "supportingData": { "@id": "schema:supportingData" }, + "surface": { "@id": "schema:surface" }, + "target": { "@id": "schema:target" }, + "targetCollection": { "@id": "schema:targetCollection" }, + "targetDescription": { "@id": "schema:targetDescription" }, + "targetName": { "@id": "schema:targetName" }, + "targetPlatform": { "@id": "schema:targetPlatform" }, + "targetPopulation": { "@id": "schema:targetPopulation" }, + "targetProduct": { "@id": "schema:targetProduct" }, + "targetUrl": { "@id": "schema:targetUrl", "@type": "@id" }, + "taxID": { "@id": "schema:taxID" }, + "telephone": { "@id": "schema:telephone" }, + "temporal": { "@id": "schema:temporal" }, + "temporalCoverage": { "@id": "schema:temporalCoverage" }, + "termCode": { "@id": "schema:termCode" }, + "termsOfService": { "@id": "schema:termsOfService" }, + "text": { "@id": "schema:text" }, + "thumbnail": { "@id": "schema:thumbnail" }, + "thumbnailUrl": { "@id": "schema:thumbnailUrl", "@type": "@id" }, + "tickerSymbol": { "@id": "schema:tickerSymbol" }, + "ticketNumber": { "@id": "schema:ticketNumber" }, + "ticketToken": { "@id": "schema:ticketToken" }, + "ticketedSeat": { "@id": "schema:ticketedSeat" }, + "timeRequired": { "@id": "schema:timeRequired" }, + "tissueSample": { "@id": "schema:tissueSample" }, + "title": { "@id": "schema:title" }, + "toLocation": { "@id": "schema:toLocation" }, + "toRecipient": { "@id": "schema:toRecipient" }, + "tongueWeight": { "@id": "schema:tongueWeight" }, + "tool": { "@id": "schema:tool" }, + "torque": { "@id": "schema:torque" }, + "totalPaymentDue": { "@id": "schema:totalPaymentDue" }, + "totalPrice": { "@id": "schema:totalPrice" }, + "totalTime": { "@id": "schema:totalTime" }, + "touristType": { "@id": "schema:touristType" }, + "track": { "@id": "schema:track" }, + "trackingNumber": { "@id": "schema:trackingNumber" }, + "trackingUrl": { "@id": "schema:trackingUrl", "@type": "@id" }, + "tracks": { "@id": "schema:tracks" }, + "trailer": { "@id": "schema:trailer" }, + "trailerWeight": { "@id": "schema:trailerWeight" }, + "trainName": { "@id": "schema:trainName" }, + "trainNumber": { "@id": "schema:trainNumber" }, + "transFatContent": { "@id": "schema:transFatContent" }, + "transcript": { "@id": "schema:transcript" }, + "translationOfWork": { "@id": "schema:translationOfWork" }, + "translator": { "@id": "schema:translator" }, + "transmissionMethod": { "@id": "schema:transmissionMethod" }, + "trialDesign": { "@id": "schema:trialDesign" }, + "tributary": { "@id": "schema:tributary" }, + "typeOfBed": { "@id": "schema:typeOfBed" }, + "typeOfGood": { "@id": "schema:typeOfGood" }, + "typicalAgeRange": { "@id": "schema:typicalAgeRange" }, + "typicalTest": { "@id": "schema:typicalTest" }, + "underName": { "@id": "schema:underName" }, + "unitCode": { "@id": "schema:unitCode" }, + "unitText": { "@id": "schema:unitText" }, + "unnamedSourcesPolicy": { + "@id": "schema:unnamedSourcesPolicy", + "@type": "@id" + }, + "unsaturatedFatContent": { "@id": "schema:unsaturatedFatContent" }, + "uploadDate": { "@id": "schema:uploadDate", "@type": "Date" }, + "upvoteCount": { "@id": "schema:upvoteCount" }, + "url": { "@id": "schema:url", "@type": "@id" }, + "urlTemplate": { "@id": "schema:urlTemplate" }, + "usedToDiagnose": { "@id": "schema:usedToDiagnose" }, + "userInteractionCount": { "@id": "schema:userInteractionCount" }, + "usesDevice": { "@id": "schema:usesDevice" }, + "usesHealthPlanIdStandard": { "@id": "schema:usesHealthPlanIdStandard" }, + "validFor": { "@id": "schema:validFor" }, + "validFrom": { "@id": "schema:validFrom", "@type": "Date" }, + "validIn": { "@id": "schema:validIn" }, + "validThrough": { "@id": "schema:validThrough", "@type": "Date" }, + "validUntil": { "@id": "schema:validUntil", "@type": "Date" }, + "value": { "@id": "schema:value" }, + "valueAddedTaxIncluded": { "@id": "schema:valueAddedTaxIncluded" }, + "valueMaxLength": { "@id": "schema:valueMaxLength" }, + "valueMinLength": { "@id": "schema:valueMinLength" }, + "valueName": { "@id": "schema:valueName" }, + "valuePattern": { "@id": "schema:valuePattern" }, + "valueReference": { "@id": "schema:valueReference" }, + "valueRequired": { "@id": "schema:valueRequired" }, + "variableMeasured": { "@id": "schema:variableMeasured" }, + "variablesMeasured": { "@id": "schema:variablesMeasured" }, + "variantCover": { "@id": "schema:variantCover" }, + "vatID": { "@id": "schema:vatID" }, + "vehicleConfiguration": { "@id": "schema:vehicleConfiguration" }, + "vehicleEngine": { "@id": "schema:vehicleEngine" }, + "vehicleIdentificationNumber": { + "@id": "schema:vehicleIdentificationNumber" + }, + "vehicleInteriorColor": { "@id": "schema:vehicleInteriorColor" }, + "vehicleInteriorType": { "@id": "schema:vehicleInteriorType" }, + "vehicleModelDate": { "@id": "schema:vehicleModelDate", "@type": "Date" }, + "vehicleSeatingCapacity": { "@id": "schema:vehicleSeatingCapacity" }, + "vehicleSpecialUsage": { "@id": "schema:vehicleSpecialUsage" }, + "vehicleTransmission": { "@id": "schema:vehicleTransmission" }, + "vendor": { "@id": "schema:vendor" }, + "verificationFactCheckingPolicy": { + "@id": "schema:verificationFactCheckingPolicy", + "@type": "@id" + }, + "version": { "@id": "schema:version" }, + "video": { "@id": "schema:video" }, + "videoFormat": { "@id": "schema:videoFormat" }, + "videoFrameSize": { "@id": "schema:videoFrameSize" }, + "videoQuality": { "@id": "schema:videoQuality" }, + "volumeNumber": { "@id": "schema:volumeNumber" }, + "warning": { "@id": "schema:warning" }, + "warranty": { "@id": "schema:warranty" }, + "warrantyPromise": { "@id": "schema:warrantyPromise" }, + "warrantyScope": { "@id": "schema:warrantyScope" }, + "webCheckinTime": { "@id": "schema:webCheckinTime", "@type": "DateTime" }, + "weight": { "@id": "schema:weight" }, + "weightTotal": { "@id": "schema:weightTotal" }, + "wheelbase": { "@id": "schema:wheelbase" }, + "width": { "@id": "schema:width" }, + "winner": { "@id": "schema:winner" }, + "wordCount": { "@id": "schema:wordCount" }, + "workExample": { "@id": "schema:workExample" }, + "workFeatured": { "@id": "schema:workFeatured" }, + "workHours": { "@id": "schema:workHours" }, + "workLocation": { "@id": "schema:workLocation" }, + "workPerformed": { "@id": "schema:workPerformed" }, + "workPresented": { "@id": "schema:workPresented" }, + "workTranslation": { "@id": "schema:workTranslation" }, + "workload": { "@id": "schema:workload" }, + "worksFor": { "@id": "schema:worksFor" }, + "worstRating": { "@id": "schema:worstRating" }, + "xpath": { "@id": "schema:xpath" }, + "yearlyRevenue": { "@id": "schema:yearlyRevenue" }, + "yearsInOperation": { "@id": "schema:yearsInOperation" }, + "yield": { "@id": "schema:yield" }, + "http://publications.europa.eu/mdr/eli/index.html": { + "@id": "http://publications.europa.eu/mdr/eli/index.html" + }, + "httpMethod": { "@id": "schema:httpMethod" }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Automotive_Ontology_Working_Group": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Automotive_Ontology_Working_Group" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#FIBO": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#FIBO" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#GLEIF": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#GLEIF" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#IIT-CNR.it": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#IIT-CNR.it" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#MBZ": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#MBZ" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Tourism": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Tourism" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_ActionCollabClass": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_ActionCollabClass" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_DatasetClass": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_DatasetClass" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsClass": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsClass" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsTerms": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsTerms" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_LRMIClass": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_LRMIClass" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_QAStackExchange": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_QAStackExchange" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_WikiDoc": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_WikiDoc" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex" + }, + "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews": { + "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews" + }, + "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#STI_Accommodation_Ontology": { + "@id": "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#STI_Accommodation_Ontology" + }, + "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP": { + "@id": "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP" + }, + "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP-draws": { + "@id": "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP-draws" + } + } +} diff --git a/src/utils/vc/contexts/security-v1.json b/packages/credential-sdk/src/vc/contexts/security-v1.json similarity index 72% rename from src/utils/vc/contexts/security-v1.json rename to packages/credential-sdk/src/vc/contexts/security-v1.json index 752950526..ccb402459 100644 --- a/src/utils/vc/contexts/security-v1.json +++ b/packages/credential-sdk/src/vc/contexts/security-v1.json @@ -20,28 +20,28 @@ "cipherAlgorithm": "sec:cipherAlgorithm", "cipherData": "sec:cipherData", "cipherKey": "sec:cipherKey", - "created": {"@id": "dc:created", "@type": "xsd:dateTime"}, - "creator": {"@id": "dc:creator", "@type": "@id"}, + "created": { "@id": "dc:created", "@type": "xsd:dateTime" }, + "creator": { "@id": "dc:creator", "@type": "@id" }, "digestAlgorithm": "sec:digestAlgorithm", "digestValue": "sec:digestValue", "domain": "sec:domain", "encryptionKey": "sec:encryptionKey", - "expiration": {"@id": "sec:expiration", "@type": "xsd:dateTime"}, - "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"}, + "expiration": { "@id": "sec:expiration", "@type": "xsd:dateTime" }, + "expires": { "@id": "sec:expiration", "@type": "xsd:dateTime" }, "initializationVector": "sec:initializationVector", "iterationCount": "sec:iterationCount", "nonce": "sec:nonce", "normalizationAlgorithm": "sec:normalizationAlgorithm", - "owner": {"@id": "sec:owner", "@type": "@id"}, + "owner": { "@id": "sec:owner", "@type": "@id" }, "password": "sec:password", - "privateKey": {"@id": "sec:privateKey", "@type": "@id"}, + "privateKey": { "@id": "sec:privateKey", "@type": "@id" }, "privateKeyPem": "sec:privateKeyPem", - "publicKey": {"@id": "sec:publicKey", "@type": "@id"}, + "publicKey": { "@id": "sec:publicKey", "@type": "@id" }, "publicKeyBase58": "sec:publicKeyBase58", "publicKeyPem": "sec:publicKeyPem", "publicKeyWif": "sec:publicKeyWif", - "publicKeyService": {"@id": "sec:publicKeyService", "@type": "@id"}, - "revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"}, + "publicKeyService": { "@id": "sec:publicKeyService", "@type": "@id" }, + "revoked": { "@id": "sec:revoked", "@type": "xsd:dateTime" }, "salt": "sec:salt", "signature": "sec:signature", "signatureAlgorithm": "sec:signingAlgorithm", diff --git a/packages/credential-sdk/src/vc/contexts/security_context.js b/packages/credential-sdk/src/vc/contexts/security_context.js new file mode 100644 index 000000000..04fc7576d --- /dev/null +++ b/packages/credential-sdk/src/vc/contexts/security_context.js @@ -0,0 +1,99 @@ +// TODO: Check if this can be used an extension to https://w3id.org/security/v2 + +export default { + '@context': [ + { + '@version': 1.1, + }, + 'https://w3id.org/security/v1', + { + AesKeyWrappingKey2019: 'sec:AesKeyWrappingKey2019', + DeleteKeyOperation: 'sec:DeleteKeyOperation', + DeriveSecretOperation: 'sec:DeriveSecretOperation', + EcdsaSecp256k1Signature2019: 'sec:EcdsaSecp256k1Signature2019', + EcdsaSecp256r1Signature2019: 'sec:EcdsaSecp256r1Signature2019', + EcdsaSecp256k1VerificationKey2019: + 'sec:EcdsaSecp256k1VerificationKey2019', + EcdsaSecp256r1VerificationKey2019: + 'sec:EcdsaSecp256r1VerificationKey2019', + Ed25519Signature2018: 'sec:Ed25519Signature2018', + Ed25519VerificationKey2018: 'sec:Ed25519VerificationKey2018', + Sr25519Signature2020: 'sec:Sr25519Signature2020', + Sr25519VerificationKey2020: 'sec:Sr25519VerificationKey2020', + EquihashProof2018: 'sec:EquihashProof2018', + ExportKeyOperation: 'sec:ExportKeyOperation', + GenerateKeyOperation: 'sec:GenerateKeyOperation', + KmsOperation: 'sec:KmsOperation', + RevokeKeyOperation: 'sec:RevokeKeyOperation', + RsaSignature2018: 'sec:RsaSignature2018', + RsaVerificationKey2018: 'sec:RsaVerificationKey2018', + Sha256HmacKey2019: 'sec:Sha256HmacKey2019', + SignOperation: 'sec:SignOperation', + UnwrapKeyOperation: 'sec:UnwrapKeyOperation', + VerifyOperation: 'sec:VerifyOperation', + WrapKeyOperation: 'sec:WrapKeyOperation', + X25519KeyAgreementKey2019: 'sec:X25519KeyAgreementKey2019', + + allowedAction: 'sec:allowedAction', + assertionMethod: { + '@id': 'sec:assertionMethod', + '@type': '@id', + '@container': '@set', + }, + authentication: { + '@id': 'sec:authenticationMethod', + '@type': '@id', + '@container': '@set', + }, + capability: { '@id': 'sec:capability', '@type': '@id' }, + capabilityAction: 'sec:capabilityAction', + capabilityChain: { + '@id': 'sec:capabilityChain', + '@type': '@id', + '@container': '@list', + }, + capabilityDelegation: { + '@id': 'sec:capabilityDelegationMethod', + '@type': '@id', + '@container': '@set', + }, + capabilityInvocation: { + '@id': 'sec:capabilityInvocationMethod', + '@type': '@id', + '@container': '@set', + }, + caveat: { '@id': 'sec:caveat', '@type': '@id', '@container': '@set' }, + challenge: 'sec:challenge', + ciphertext: 'sec:ciphertext', + controller: { '@id': 'sec:controller', '@type': '@id' }, + delegator: { '@id': 'sec:delegator', '@type': '@id' }, + equihashParameterK: { + '@id': 'sec:equihashParameterK', + '@type': 'xsd:integer', + }, + equihashParameterN: { + '@id': 'sec:equihashParameterN', + '@type': 'xsd:integer', + }, + invocationTarget: { '@id': 'sec:invocationTarget', '@type': '@id' }, + invoker: { '@id': 'sec:invoker', '@type': '@id' }, + jws: 'sec:jws', + keyAgreement: { + '@id': 'sec:keyAgreementMethod', + '@type': '@id', + '@container': '@set', + }, + kmsModule: { '@id': 'sec:kmsModule' }, + parentCapability: { '@id': 'sec:parentCapability', '@type': '@id' }, + plaintext: 'sec:plaintext', + proof: { '@id': 'sec:proof', '@type': '@id', '@container': '@graph' }, + proofPurpose: { '@id': 'sec:proofPurpose', '@type': '@vocab' }, + proofValue: 'sec:proofValue', + referenceId: 'sec:referenceId', + unwrappedKey: 'sec:unwrappedKey', + verificationMethod: { '@id': 'sec:verificationMethod', '@type': '@id' }, + verifyData: 'sec:verifyData', + wrappedKey: 'sec:wrappedKey', + }, + ], +}; diff --git a/src/utils/vc/contexts/sr25519-context.json b/packages/credential-sdk/src/vc/contexts/sr25519-context.json similarity index 100% rename from src/utils/vc/contexts/sr25519-context.json rename to packages/credential-sdk/src/vc/contexts/sr25519-context.json diff --git a/src/utils/vc/contexts/status-list-21.js b/packages/credential-sdk/src/vc/contexts/status-list-21.js similarity index 59% rename from src/utils/vc/contexts/status-list-21.js rename to packages/credential-sdk/src/vc/contexts/status-list-21.js index cfd8d91b4..e08fc291f 100644 --- a/src/utils/vc/contexts/status-list-21.js +++ b/packages/credential-sdk/src/vc/contexts/status-list-21.js @@ -4,8 +4,7 @@ export default { '@protected': true, StatusList2021Credential: { - '@id': - 'https://w3id.org/vc/status-list#StatusList2021Credential', + '@id': 'https://w3id.org/vc/status-list#StatusList2021Credential', '@context': { '@protected': true, @@ -18,36 +17,30 @@ export default { }, StatusList2021: { - '@id': - 'https://w3id.org/vc/status-list#StatusList2021', + '@id': 'https://w3id.org/vc/status-list#StatusList2021', '@context': { '@protected': true, id: '@id', type: '@type', - statusPurpose: - 'https://w3id.org/vc/status-list#statusPurpose', + statusPurpose: 'https://w3id.org/vc/status-list#statusPurpose', encodedList: 'https://w3id.org/vc/status-list#encodedList', }, }, StatusList2021Entry: { - '@id': - 'https://w3id.org/vc/status-list#StatusList2021Entry', + '@id': 'https://w3id.org/vc/status-list#StatusList2021Entry', '@context': { '@protected': true, id: '@id', type: '@type', - statusPurpose: - 'https://w3id.org/vc/status-list#statusPurpose', - statusListIndex: - 'https://w3id.org/vc/status-list#statusListIndex', + statusPurpose: 'https://w3id.org/vc/status-list#statusPurpose', + statusListIndex: 'https://w3id.org/vc/status-list#statusListIndex', statusListCredential: { - '@id': - 'https://w3id.org/vc/status-list#statusListCredential', + '@id': 'https://w3id.org/vc/status-list#statusListCredential', '@type': '@id', }, }, diff --git a/src/utils/vc/contexts/vc-examples-v1.js b/packages/credential-sdk/src/vc/contexts/vc-examples-v1.js similarity index 100% rename from src/utils/vc/contexts/vc-examples-v1.js rename to packages/credential-sdk/src/vc/contexts/vc-examples-v1.js diff --git a/src/utils/vc/credentials.js b/packages/credential-sdk/src/vc/credentials.js similarity index 89% rename from src/utils/vc/credentials.js rename to packages/credential-sdk/src/vc/credentials.js index 4b8d2ba48..8f78cf220 100644 --- a/src/utils/vc/credentials.js +++ b/packages/credential-sdk/src/vc/credentials.js @@ -1,9 +1,15 @@ import jsonld from 'jsonld'; import jsigs from 'jsonld-signatures'; -import { checkStatus, statusTypeMatches } from '@digitalcredentials/vc-status-list'; +import { + statusTypeMatches, + checkStatus, +} from '@digitalcredentials/vc-status-list'; import base64url from 'base64url'; -import { CredentialBuilder, CredentialSchema } from '@docknetwork/crypto-wasm-ts'; +import { + CredentialBuilder, + CredentialSchema, +} from '@docknetwork/crypto-wasm-ts'; import CredentialIssuancePurpose from './CredentialIssuancePurpose'; import defaultDocumentLoader from './document-loader'; import { getAndValidateSchemaIfPresent } from './schema'; @@ -14,39 +20,44 @@ import { isAccumulatorRevocationStatus, isRegistryRevocationStatus, RevRegType, -} from '../revocation'; +} from './revocation'; + import { - expandJSONLD, getKeyFromDIDDocument, getSuiteFromKeyDoc, processIfKvac, + getSuiteFromKeyDoc, + expandJSONLD, + getKeyFromDIDDocument, + processIfKvac, } from './helpers'; import { DEFAULT_CONTEXT_V1_URL, - DockStatusList2021Qualifier, + credentialContextField, PrivateStatusList2021EntryType, - PrivateStatusList2021Qualifier, + DockStatusList2021Qualifier, StatusList2021EntryType, + PrivateStatusList2021Qualifier, } from './constants'; -import { ensureValidDatetime } from '../type-helpers'; +import { ensureValidDatetime } from '../utils/type-helpers'; import { - Bls12381BBS23SigDockSigName, - Bls12381BBS23SigProofDockSigName, - Bls12381BBSSigDockSigName, + EcdsaSecp256k1Signature2019, + Ed25519Signature2018, + Ed25519Signature2020, + // Sr25519Signature2020, + Bls12381PSSignatureDock2023, + Bls12381PSSignatureProofDock2023, Bls12381BBSSignatureDock2022, - Bls12381BBSSignatureDock2023, Bls12381BBSSignatureProofDock2022, + Bls12381BBSSignatureDock2023, Bls12381BBSSignatureProofDock2023, + Bls12381BBS23SigProofDockSigName, + Bls12381PSSigProofDockSigName, + JsonWebSignature2020, + Bls12381PSSigDockSigName, + Bls12381BBSSigDockSigName, Bls12381BBSSigProofDockSigName, + Bls12381BBS23SigDockSigName, Bls12381BBDT16MacDockName, Bls12381BBDT16MacProofDockName, - Bls12381PSSigDockSigName, - Bls12381PSSignatureDock2023, - Bls12381PSSignatureProofDock2023, - Bls12381PSSigProofDockSigName, - EcdsaSecp256k1Signature2019, - Ed25519Signature2018, - Ed25519Signature2020, - JsonWebSignature2020, - Sr25519Signature2020, } from './custom_crypto'; import { signJWS } from './jws'; import Bls12381BBDT16MACProofDock2024 from './crypto/Bls12381BBDT16MACProofDock2024'; @@ -157,7 +168,7 @@ export function checkCredentialJSONLD(credential) { * @param {object} credential - An object that could be a VerifiableCredential. * @throws {Error} */ -export function checkCredentialRequired(credential, isJWT) { +export function checkCredentialRequired(credential) { // Ensure first context is DEFAULT_CONTEXT_V1_URL if (credential['@context'][0] !== DEFAULT_CONTEXT_V1_URL) { throw new Error( @@ -175,23 +186,21 @@ export function checkCredentialRequired(credential, isJWT) { throw new Error('"credentialSubject" property is required.'); } - // Ensure issuer and issue date is valid, only for non-jwt as that is defined in the header - if (!isJWT) { - const issuer = getId(credential.issuer); - if (!issuer) { - throw new Error( - `"issuer" must be an object with ID property or a string. Got: ${credential.issuer}`, - ); - } else if (!issuer.includes(':')) { - throw new Error('"issuer" id must be in URL format.'); - } + // Ensure issuer is valid + const issuer = getId(credential.issuer); + if (!issuer) { + throw new Error( + `"issuer" must be an object with ID property or a string. Got: ${credential.issuer}`, + ); + } else if (!issuer.includes(':')) { + throw new Error('"issuer" id must be in URL format.'); + } - // Ensure there is an issuance date, if exists - if (!credential.issuanceDate) { - throw new Error('"issuanceDate" property is required.'); - } else { - ensureValidDatetime(credential.issuanceDate); - } + // Ensure there is an issuance date, if exists + if (!credential.issuanceDate) { + throw new Error('"issuanceDate" property is required.'); + } else { + ensureValidDatetime(credential.issuanceDate); } } @@ -220,8 +229,8 @@ export function checkCredentialOptional(credential) { * @param {object} credential - An object that could be a VerifiableCredential. * @throws {Error} */ -export function checkCredential(credential, isJWT) { - checkCredentialRequired(credential, isJWT); +export function checkCredential(credential) { + checkCredentialRequired(credential); checkCredentialOptional(credential); checkCredentialJSONLD(credential); } @@ -286,7 +295,7 @@ export async function verifyCredential( } // Check credential is valid - checkCredential(credential, isJWT); + checkCredential(credential); // Check expiration date if (verifyDates && 'expirationDate' in credential) { @@ -322,7 +331,8 @@ export async function verifyCredential( const isAnoncredsDerived = isAnoncredsProofType(credential); if (!skipSchemaCheck && !isAnoncredsDerived) { await getAndValidateSchemaIfPresent( - credential, + expandedCredential, + credential[credentialContextField], docLoader, ); } @@ -364,13 +374,16 @@ export async function verifyCredential( // Specify certain parameters for anoncreds const anoncredsParams = { - accumulatorPublicKeys, predicateParams, circomOutputs, blindedAttributesCircomOutputs, + accumulatorPublicKeys, + predicateParams, + circomOutputs, + blindedAttributesCircomOutputs, }; const fullSuite = [ new Ed25519Signature2018(), new Ed25519Signature2020(), new EcdsaSecp256k1Signature2019(), - new Sr25519Signature2020(), + // new Sr25519Signature2020(), new JsonWebSignature2020(), new Bls12381BBSSignatureDock2022(anoncredsParams), new Bls12381BBSSignatureProofDock2022(anoncredsParams), @@ -441,7 +454,12 @@ export async function verifyCredential( // part of the credential and evolves over time const isAccumStatus = isAccumulatorRevocationStatus(status); - if (!isStatusList2021Status && !isRegRevStatus && !isPrivStatus && !isAccumStatus) { + if ( + !isStatusList2021Status + && !isRegRevStatus + && !isPrivStatus + && !isAccumStatus + ) { throw new Error(`Unsupported \`credentialStatus\`: \`${status}\``); } } @@ -553,7 +571,9 @@ export function getJsonSchemaFromCredential(credential, full = false) { throw new Error('`credentialSchema` key must be defined in the credential'); } if (typeof credential.credentialSchema.id !== 'string') { - throw new Error(`credentialSchema was expected to be string but was ${typeof credential.credentialSchema}`); + throw new Error( + `credentialSchema was expected to be string but was ${typeof credential.credentialSchema}`, + ); } const schema = CredentialSchema.fromJSON(credential.credentialSchema); return full ? schema.getEmbeddedJsonSchema() : schema.jsonSchema; @@ -565,7 +585,10 @@ export function getJsonSchemaFromCredential(credential, full = false) { * @returns {*|Object|undefined} */ export function getPrivateStatus(credential) { - return credential.credentialStatus && credential.credentialStatus.type === PrivateStatusList2021EntryType ? credential.credentialStatus : undefined; + return credential.credentialStatus + && credential.credentialStatus.type === PrivateStatusList2021EntryType + ? credential.credentialStatus + : undefined; } /** @@ -579,13 +602,20 @@ export function getPrivateStatus(credential) { * @param expectedIssuer - Checks whether the issuer of the private status list credential matches the given * @returns {Promise<{verified: boolean}>} */ -export async function verifyPrivateStatus(credentialStatus, privateStatusListCredential, { - documentLoader = null, suite = [], verifyStatusListCredential = true, expectedIssuer = null, -}) { +export async function verifyPrivateStatus( + credentialStatus, + privateStatusListCredential, + { + documentLoader = null, + suite = [], + verifyStatusListCredential = true, + expectedIssuer = null, + }, +) { const fullSuite = [ new Ed25519Signature2018(), new EcdsaSecp256k1Signature2019(), - new Sr25519Signature2020(), + // new Sr25519Signature2020(), new JsonWebSignature2020(), ...suite, ]; @@ -599,20 +629,29 @@ export async function verifyPrivateStatus(credentialStatus, privateStatusListCre // ensure that the issuer of the verifiable credential matches if (typeof expectedIssuer === 'string') { - const issuer = typeof privateStatusListCredential.issuer === 'object' ? privateStatusListCredential.issuer.id : privateStatusListCredential.issuer; + const issuer = typeof privateStatusListCredential.issuer === 'object' + ? privateStatusListCredential.issuer.id + : privateStatusListCredential.issuer; if (issuer !== expectedIssuer) { - throw new Error(`Expected issuer to be ${expectedIssuer} but found ${issuer}`); + throw new Error( + `Expected issuer to be ${expectedIssuer} but found ${issuer}`, + ); } } // verify VC if (verifyStatusListCredential) { - const verifyResult = await verifyCredential(privateStatusListCredential.toJSON(), { - suite: fullSuite, - documentLoader, - }); + const verifyResult = await verifyCredential( + privateStatusListCredential.toJSON(), + { + suite: fullSuite, + documentLoader, + }, + ); if (!verifyResult.verified) { - throw new Error(`Status list credential failed to verify with error: ${verifyResult.error}`); + throw new Error( + `Status list credential failed to verify with error: ${verifyResult.error}`, + ); } } @@ -695,7 +734,9 @@ export function addPrivateStatusListEntryToCredential( function validateStatusPurpose(purpose) { if (purpose !== 'suspension' && purpose !== 'revocation') { - throw new Error(`statusPurpose must 'suspension' or 'revocation' but was '${purpose}'`); + throw new Error( + `statusPurpose must 'suspension' or 'revocation' but was '${purpose}'`, + ); } } diff --git a/src/utils/vc/crypto/Bls12381BBDT16KeyPairDock2024.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBDT16KeyPairDock2024.js similarity index 86% rename from src/utils/vc/crypto/Bls12381BBDT16KeyPairDock2024.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBDT16KeyPairDock2024.js index 3458aebc7..1c71f7836 100644 --- a/src/utils/vc/crypto/Bls12381BBDT16KeyPairDock2024.js +++ b/packages/credential-sdk/src/vc/crypto/Bls12381BBDT16KeyPairDock2024.js @@ -1,6 +1,10 @@ import { - BBDT16_MAC_PARAMS_LABEL_BYTES, BBDT16KeypairG1, BBDT16MacPublicKeyG1, - BBDT16Mac, BBDT16MacParams, BBDT16MacSecretKey, + BBDT16_MAC_PARAMS_LABEL_BYTES, + BBDT16KeypairG1, + BBDT16MacPublicKeyG1, + BBDT16Mac, + BBDT16MacParams, + BBDT16MacSecretKey, } from '@docknetwork/crypto-wasm-ts'; import { Bls12381BBDT16DockVerKeyName } from './constants'; diff --git a/src/utils/vc/crypto/Bls12381BBDT16MACDock2024.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBDT16MACDock2024.js similarity index 100% rename from src/utils/vc/crypto/Bls12381BBDT16MACDock2024.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBDT16MACDock2024.js diff --git a/src/utils/vc/crypto/Bls12381BBDT16MACProofDock2024.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBDT16MACProofDock2024.js similarity index 95% rename from src/utils/vc/crypto/Bls12381BBDT16MACProofDock2024.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBDT16MACProofDock2024.js index 1eb4baafe..0302e0f25 100644 --- a/src/utils/vc/crypto/Bls12381BBDT16MACProofDock2024.js +++ b/packages/credential-sdk/src/vc/crypto/Bls12381BBDT16MACProofDock2024.js @@ -1,5 +1,6 @@ import { - Bls12381BBDT16MacProofDockName, Bls12381BBDT16MacDockName, + Bls12381BBDT16MacProofDockName, + Bls12381BBDT16MacDockName, } from './constants'; import DockCryptoSignatureProof from './common/DockCryptoSignatureProof'; diff --git a/src/utils/vc/crypto/Bls12381BBSKeyPairDock2023.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBSKeyPairDock2023.js similarity index 100% rename from src/utils/vc/crypto/Bls12381BBSKeyPairDock2023.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBSKeyPairDock2023.js diff --git a/src/utils/vc/crypto/Bls12381BBSSignatureDock2022.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureDock2022.js similarity index 83% rename from src/utils/vc/crypto/Bls12381BBSSignatureDock2022.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureDock2022.js index d5896eac3..8a8df3428 100644 --- a/src/utils/vc/crypto/Bls12381BBSSignatureDock2022.js +++ b/packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureDock2022.js @@ -18,7 +18,15 @@ export default class Bls12381BBSSignatureDock2022 extends DockCryptoSignature { */ constructor(options = {}) { super( - { ...options, signer: options.signer || Bls12381BBSSignatureDock2022.signerFactory(options.keypair, options.verificationMethod) }, + { + ...options, + signer: + options.signer + || Bls12381BBSSignatureDock2022.signerFactory( + options.keypair, + options.verificationMethod, + ), + }, Bls12381BBSSigDockSigName, Bls12381G2KeyPairDock2022, 'https://ld.dock.io/security/bbs/v1', diff --git a/src/utils/vc/crypto/Bls12381BBSSignatureDock2023.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureDock2023.js similarity index 100% rename from src/utils/vc/crypto/Bls12381BBSSignatureDock2023.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureDock2023.js diff --git a/src/utils/vc/crypto/Bls12381BBSSignatureProofDock2022.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureProofDock2022.js similarity index 100% rename from src/utils/vc/crypto/Bls12381BBSSignatureProofDock2022.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureProofDock2022.js diff --git a/src/utils/vc/crypto/Bls12381BBSSignatureProofDock2023.js b/packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureProofDock2023.js similarity index 100% rename from src/utils/vc/crypto/Bls12381BBSSignatureProofDock2023.js rename to packages/credential-sdk/src/vc/crypto/Bls12381BBSSignatureProofDock2023.js diff --git a/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16KeyPairDock2024.js b/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16KeyPairDock2024.js new file mode 100644 index 000000000..1c71f7836 --- /dev/null +++ b/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16KeyPairDock2024.js @@ -0,0 +1,28 @@ +import { + BBDT16_MAC_PARAMS_LABEL_BYTES, + BBDT16KeypairG1, + BBDT16MacPublicKeyG1, + BBDT16Mac, + BBDT16MacParams, + BBDT16MacSecretKey, +} from '@docknetwork/crypto-wasm-ts'; + +import { Bls12381BBDT16DockVerKeyName } from './constants'; +import DockCryptoKeyPair from './common/DockCryptoKeyPair'; + +export default class Bls12381BBDT16KeyPairDock2024 extends DockCryptoKeyPair { + constructor(options) { + super(options, Bls12381BBDT16DockVerKeyName); + } + + static get paramGenerator() { + return this.SignatureParams.getMacParamsOfRequiredSize; + } +} + +Bls12381BBDT16KeyPairDock2024.SecretKey = BBDT16MacSecretKey; +Bls12381BBDT16KeyPairDock2024.PublicKey = BBDT16MacPublicKeyG1; +Bls12381BBDT16KeyPairDock2024.SignatureParams = BBDT16MacParams; +Bls12381BBDT16KeyPairDock2024.Signature = BBDT16Mac; +Bls12381BBDT16KeyPairDock2024.KeyPair = BBDT16KeypairG1; +Bls12381BBDT16KeyPairDock2024.defaultLabelBytes = BBDT16_MAC_PARAMS_LABEL_BYTES; diff --git a/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16MACDock2024.js b/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16MACDock2024.js new file mode 100644 index 000000000..a746d62c6 --- /dev/null +++ b/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16MACDock2024.js @@ -0,0 +1,48 @@ +import { + BBDT16Credential, + BBDT16CredentialBuilder, +} from '@docknetwork/crypto-wasm-ts/'; + +import { Bls12381BBDT16MacDockName } from './constants'; + +import DockCryptoSignature from './common/DockCryptoSignature'; +import Bls12381BBDT16KeyPairDock2024 from './Bls12381BBDT16KeyPairDock2024'; + +/** + * A BBDT16 signature suite for use with BLS12-381 Dock key pairs + */ +export default class Bls12381BBDT16MACDock2024 extends DockCryptoSignature { + /** + * Default constructor + * @param options {SignatureSuiteOptions} options for constructing the signature suite + */ + constructor(options = {}) { + super( + { + ...options, + signer: + options.signer + || Bls12381BBDT16MACDock2024.signerFactory( + options.keypair, + options.verificationMethod, + ), + }, + Bls12381BBDT16MacDockName, + Bls12381BBDT16KeyPairDock2024, + 'https://ld.dock.io/security/bbdt16/v1', + ); + } + + static get paramGenerator() { + return this.KeyPair.SignatureParams.getMacParamsOfRequiredSize; + } +} + +Bls12381BBDT16MACDock2024.KeyPair = Bls12381BBDT16KeyPairDock2024; +Bls12381BBDT16MACDock2024.CredentialBuilder = BBDT16CredentialBuilder; +Bls12381BBDT16MACDock2024.Credential = BBDT16Credential; +Bls12381BBDT16MACDock2024.proofType = [ + Bls12381BBDT16MacDockName, + `sec:${Bls12381BBDT16MacDockName}`, + `https://w3id.org/security#${Bls12381BBDT16MacDockName}`, +]; diff --git a/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16MACProofDock2024.js b/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16MACProofDock2024.js new file mode 100644 index 000000000..0302e0f25 --- /dev/null +++ b/packages/credential-sdk/src/vc/crypto/Bls12381BDDT16MACProofDock2024.js @@ -0,0 +1,42 @@ +import { + Bls12381BBDT16MacProofDockName, + Bls12381BBDT16MacDockName, +} from './constants'; + +import DockCryptoSignatureProof from './common/DockCryptoSignatureProof'; +import Bls12381BBDT16KeyPairDock2024 from './Bls12381BBDT16KeyPairDock2024'; +import Bls12381BBDT16MACDock2024 from './Bls12381BBDT16MACDock2024'; + +/** + * A BBDT16 signature suite for use with derived BBDT16 credentials aka BBDT16 presentations + */ +export default class Bls12381BBDT16MACProofDock2024 extends DockCryptoSignatureProof { + /** + * Default constructor + * @param options {SignatureSuiteOptions} options for constructing the signature suite + */ + constructor(options = {}) { + super( + options, + Bls12381BBDT16MacProofDockName, + Bls12381BBDT16KeyPairDock2024, + 'https://ld.dock.io/security/bbdt16/v1', + ); + } + + /** + * + * @param _ + * @returns {Promise} - Public key isn't used for verifying KVACs + */ + // eslint-disable-next-line no-empty-function + async getVerificationMethod(_) {} +} + +Bls12381BBDT16MACProofDock2024.Signature = Bls12381BBDT16MACDock2024; +Bls12381BBDT16MACProofDock2024.sigName = Bls12381BBDT16MacDockName; +Bls12381BBDT16MACProofDock2024.proofType = [ + Bls12381BBDT16MacProofDockName, + `sec:${Bls12381BBDT16MacProofDockName}`, + `https://w3id.org/security#${Bls12381BBDT16MacProofDockName}`, +]; diff --git a/src/utils/vc/crypto/Bls12381G2KeyPairDock2022.js b/packages/credential-sdk/src/vc/crypto/Bls12381G2KeyPairDock2022.js similarity index 100% rename from src/utils/vc/crypto/Bls12381G2KeyPairDock2022.js rename to packages/credential-sdk/src/vc/crypto/Bls12381G2KeyPairDock2022.js diff --git a/src/utils/vc/crypto/Bls12381PSKeyPairDock2023.js b/packages/credential-sdk/src/vc/crypto/Bls12381PSKeyPairDock2023.js similarity index 100% rename from src/utils/vc/crypto/Bls12381PSKeyPairDock2023.js rename to packages/credential-sdk/src/vc/crypto/Bls12381PSKeyPairDock2023.js diff --git a/src/utils/vc/crypto/Bls12381PSSignatureDock2023.js b/packages/credential-sdk/src/vc/crypto/Bls12381PSSignatureDock2023.js similarity index 76% rename from src/utils/vc/crypto/Bls12381PSSignatureDock2023.js rename to packages/credential-sdk/src/vc/crypto/Bls12381PSSignatureDock2023.js index d587d6920..6fb78b835 100644 --- a/src/utils/vc/crypto/Bls12381PSSignatureDock2023.js +++ b/packages/credential-sdk/src/vc/crypto/Bls12381PSSignatureDock2023.js @@ -1,7 +1,4 @@ -import { - PSCredential, - PSCredentialBuilder, -} from '@docknetwork/crypto-wasm-ts'; +import { PSCredential, PSCredentialBuilder } from '@docknetwork/crypto-wasm-ts'; import { Bls12381PSSigDockSigName } from './constants'; @@ -18,7 +15,15 @@ export default class Bls12381PSSignatureDock2023 extends DockCryptoSignature { */ constructor(options = {}) { super( - { ...options, signer: options.signer || Bls12381PSSignatureDock2023.signerFactory(options.keypair, options.verificationMethod) }, + { + ...options, + signer: + options.signer + || Bls12381PSSignatureDock2023.signerFactory( + options.keypair, + options.verificationMethod, + ), + }, Bls12381PSSigDockSigName, Bls12381PSKeyPairDock2023, 'https://ld.dock.io/security/ps/v1', diff --git a/src/utils/vc/crypto/Bls12381PSSignatureProofDock2023.js b/packages/credential-sdk/src/vc/crypto/Bls12381PSSignatureProofDock2023.js similarity index 100% rename from src/utils/vc/crypto/Bls12381PSSignatureProofDock2023.js rename to packages/credential-sdk/src/vc/crypto/Bls12381PSSignatureProofDock2023.js diff --git a/src/utils/vc/crypto/EcdsaSecp256k1Signature2019.js b/packages/credential-sdk/src/vc/crypto/EcdsaSecp256k1Signature2019.js similarity index 78% rename from src/utils/vc/crypto/EcdsaSecp256k1Signature2019.js rename to packages/credential-sdk/src/vc/crypto/EcdsaSecp256k1Signature2019.js index 2c22df691..0999953a1 100644 --- a/src/utils/vc/crypto/EcdsaSecp256k1Signature2019.js +++ b/packages/credential-sdk/src/vc/crypto/EcdsaSecp256k1Signature2019.js @@ -1,4 +1,3 @@ -import { sha256 } from 'js-sha256'; import { EcdsaSecp256k1SigName, EcdsaSecp256k1VerKeyName } from './constants'; import EcdsaSecp256k1VerificationKey2019 from './EcdsaSecp256k1VerificationKey2019'; import CustomLinkedDataSignature from './common/CustomLinkedDataSignature'; @@ -12,14 +11,20 @@ export default class EcdsaSecp256k1Signature2019 extends CustomLinkedDataSignatu * @param {object} config - Configuration options */ constructor({ - keypair, verificationMethod, verifier, signer, useProofValue, + keypair, + verificationMethod, + verifier, + signer, + useProofValue, } = {}) { super({ type: EcdsaSecp256k1SigName, LDKeyClass: EcdsaSecp256k1VerificationKey2019, contextUrl: SUITE_CONTEXT_URL, alg: 'ES256K', - signer: signer || EcdsaSecp256k1Signature2019.signerFactory(keypair, verificationMethod), + signer: + signer + || EcdsaSecp256k1Signature2019.signerFactory(keypair, verificationMethod), verifier, useProofValue, }); @@ -36,8 +41,9 @@ export default class EcdsaSecp256k1Signature2019 extends CustomLinkedDataSignatu return { id: verificationMethod, async sign({ data }) { - const hash = sha256.digest(data); - return new Uint8Array(keypair.sign(hash).toDER()); + return new Uint8Array( + keypair.keyPair.sign(keypair.constructor.hash(data)).toDER(), + ); }, }; } diff --git a/src/utils/vc/crypto/EcdsaSecp256k1VerificationKey2019.js b/packages/credential-sdk/src/vc/crypto/EcdsaSecp256k1VerificationKey2019.js similarity index 66% rename from src/utils/vc/crypto/EcdsaSecp256k1VerificationKey2019.js rename to packages/credential-sdk/src/vc/crypto/EcdsaSecp256k1VerificationKey2019.js index 33fcaeff0..60ebbf5b6 100644 --- a/src/utils/vc/crypto/EcdsaSecp256k1VerificationKey2019.js +++ b/packages/credential-sdk/src/vc/crypto/EcdsaSecp256k1VerificationKey2019.js @@ -1,12 +1,8 @@ import b58 from 'bs58'; import * as base64 from '@juanelas/base64'; -import { u8aToU8a } from '@polkadot/util'; -import { sha256 } from 'js-sha256'; -import elliptic from 'elliptic'; +import { u8aToU8a } from '../../utils/bytes'; import { EcdsaSecp256k1VerKeyName } from './constants'; - -const EC = elliptic.ec; -const secp256k1Curve = new EC('secp256k1'); +import Secp256k1Keypair from '../../keypairs/keypair-secp256k1'; export default class EcdsaSecp256k1VerificationKey2019 { constructor(publicKey) { @@ -19,8 +15,13 @@ export default class EcdsaSecp256k1VerificationKey2019 { * @returns {EcdsaSecp256k1VerificationKey2019} */ static from(verificationMethod) { - if (!verificationMethod.type || verificationMethod.type.indexOf(EcdsaSecp256k1VerKeyName) === -1) { - throw new Error(`verification method should have type ${EcdsaSecp256k1VerKeyName} - got: ${verificationMethod.type}`); + if ( + !verificationMethod.type + || verificationMethod.type.indexOf(EcdsaSecp256k1VerKeyName) === -1 + ) { + throw new Error( + `verification method should have type ${EcdsaSecp256k1VerKeyName} - got: ${verificationMethod.type}`, + ); } if (verificationMethod.publicKeyBase58) { @@ -31,7 +32,9 @@ export default class EcdsaSecp256k1VerificationKey2019 { return new this(base64.decode(verificationMethod.publicKeyBase64)); } - throw new Error(`Unsupported signature encoding for ${EcdsaSecp256k1VerKeyName}`); + throw new Error( + `Unsupported signature encoding for ${EcdsaSecp256k1VerKeyName}`, + ); } /** @@ -50,8 +53,7 @@ export default class EcdsaSecp256k1VerificationKey2019 { static verifierFactory(publicKey) { return { async verify({ data, signature }) { - const hash = sha256.digest(data); - return secp256k1Curve.verify(hash, signature, publicKey); + return Secp256k1Keypair.verify(data, signature, publicKey); }, }; } diff --git a/src/utils/vc/crypto/Ed25519Signature2018.js b/packages/credential-sdk/src/vc/crypto/Ed25519Signature2018.js similarity index 84% rename from src/utils/vc/crypto/Ed25519Signature2018.js rename to packages/credential-sdk/src/vc/crypto/Ed25519Signature2018.js index fc365aaa0..df95faa80 100644 --- a/src/utils/vc/crypto/Ed25519Signature2018.js +++ b/packages/credential-sdk/src/vc/crypto/Ed25519Signature2018.js @@ -1,6 +1,7 @@ import { Ed25519SigName, Ed25519VerKeyName } from './constants'; import Ed25519VerificationKey2018 from './Ed25519VerificationKey2018'; import CustomLinkedDataSignature from './common/CustomLinkedDataSignature'; +import { valueBytes } from '../../utils/bytes'; const SUITE_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1'; @@ -18,7 +19,9 @@ export default class Ed25519Signature2018 extends CustomLinkedDataSignature { LDKeyClass: Ed25519VerificationKey2018, contextUrl: SUITE_CONTEXT_URL, alg: 'EdDSA', - signer: signer || Ed25519Signature2018.signerFactory(keypair, verificationMethod), + signer: + signer + || Ed25519Signature2018.signerFactory(keypair, verificationMethod), verifier, }); this.requiredKeyType = Ed25519VerKeyName; @@ -34,7 +37,7 @@ export default class Ed25519Signature2018 extends CustomLinkedDataSignature { return { id: verificationMethod, async sign({ data }) { - return keypair.sign(data); + return valueBytes(keypair.sign(data)); }, }; } diff --git a/src/utils/vc/crypto/Ed25519Signature2020.js b/packages/credential-sdk/src/vc/crypto/Ed25519Signature2020.js similarity index 84% rename from src/utils/vc/crypto/Ed25519Signature2020.js rename to packages/credential-sdk/src/vc/crypto/Ed25519Signature2020.js index 946dede67..b644d6e94 100644 --- a/src/utils/vc/crypto/Ed25519Signature2020.js +++ b/packages/credential-sdk/src/vc/crypto/Ed25519Signature2020.js @@ -1,6 +1,7 @@ import { Ed255192020SigName, Ed255192020VerKeyName } from './constants'; import Ed25519VerificationKey2020 from './Ed25519VerificationKey2020'; import CustomLinkedDataSignature from './common/CustomLinkedDataSignature'; +import { valueBytes } from '../../utils/bytes'; const SUITE_CONTEXT_URL = 'https://w3id.org/security/suites/ed25519-2020/v1'; @@ -18,7 +19,9 @@ export default class Ed25519Signature2020 extends CustomLinkedDataSignature { LDKeyClass: Ed25519VerificationKey2020, contextUrl: SUITE_CONTEXT_URL, alg: 'EdDSA', - signer: signer || Ed25519Signature2020.signerFactory(keypair, verificationMethod), + signer: + signer + || Ed25519Signature2020.signerFactory(keypair, verificationMethod), verifier, }); this.requiredKeyType = Ed255192020VerKeyName; @@ -34,7 +37,7 @@ export default class Ed25519Signature2020 extends CustomLinkedDataSignature { return { id: verificationMethod, async sign({ data }) { - return keypair.sign(data); + return valueBytes(keypair.sign(data)); }, }; } diff --git a/src/utils/vc/crypto/Ed25519VerificationKey2018.js b/packages/credential-sdk/src/vc/crypto/Ed25519VerificationKey2018.js similarity index 73% rename from src/utils/vc/crypto/Ed25519VerificationKey2018.js rename to packages/credential-sdk/src/vc/crypto/Ed25519VerificationKey2018.js index 7993927ca..1eaf8897b 100644 --- a/src/utils/vc/crypto/Ed25519VerificationKey2018.js +++ b/packages/credential-sdk/src/vc/crypto/Ed25519VerificationKey2018.js @@ -1,7 +1,7 @@ import b58 from 'bs58'; import * as base64 from '@juanelas/base64'; -import { u8aToHex, u8aToU8a } from '@polkadot/util'; -import { signatureVerify } from '@polkadot/util-crypto/signature'; +import { u8aToU8a } from '../../utils/bytes'; +import Ed25519Keypair from '../../keypairs/keypair-ed25519'; import { Ed25519VerKeyName } from './constants'; export default class Ed25519VerificationKey2018 { @@ -15,8 +15,13 @@ export default class Ed25519VerificationKey2018 { * @returns {Ed25519VerificationKey2018} */ static from(verificationMethod) { - if (!verificationMethod.type || verificationMethod.type.indexOf(Ed25519VerKeyName) === -1) { - throw new Error(`verification method should have type ${Ed25519VerKeyName} - got: ${verificationMethod.type}`); + if ( + !verificationMethod.type + || verificationMethod.type.indexOf(Ed25519VerKeyName) === -1 + ) { + throw new Error( + `verification method should have type ${Ed25519VerKeyName} - got: ${verificationMethod.type}`, + ); } if (verificationMethod.publicKeyBase58) { @@ -46,8 +51,7 @@ export default class Ed25519VerificationKey2018 { static verifierFactory(publicKey) { return { async verify({ data, signature }) { - const pk = u8aToHex(publicKey); - return signatureVerify(data, signature, pk).isValid; + return Ed25519Keypair.verify(data, signature, publicKey); }, }; } diff --git a/src/utils/vc/crypto/Ed25519VerificationKey2020.js b/packages/credential-sdk/src/vc/crypto/Ed25519VerificationKey2020.js similarity index 81% rename from src/utils/vc/crypto/Ed25519VerificationKey2020.js rename to packages/credential-sdk/src/vc/crypto/Ed25519VerificationKey2020.js index 68d2cb35e..4daf142fa 100644 --- a/src/utils/vc/crypto/Ed25519VerificationKey2020.js +++ b/packages/credential-sdk/src/vc/crypto/Ed25519VerificationKey2020.js @@ -13,7 +13,9 @@ export default class Ed25519VerificationKey2020 extends Ed25519VerificationKey20 const isEd25519Type = verificationMethod.type.indexOf(Ed255192020VerKeyName) !== -1 || verificationMethod.type.indexOf(Ed25519VerKeyName) !== -1; if (!verificationMethod.type || !isEd25519Type) { - throw new Error(`verification method should have type ${Ed255192020VerKeyName} - got: ${verificationMethod.type}`); + throw new Error( + `verification method should have type ${Ed255192020VerKeyName} - got: ${verificationMethod.type}`, + ); } if (verificationMethod.publicKeyBase58) { @@ -24,7 +26,9 @@ export default class Ed25519VerificationKey2020 extends Ed25519VerificationKey20 return new this(base64.decode(verificationMethod.publicKeyBase64)); } - throw new Error(`Unsupported signature encoding for ${Ed255192020VerKeyName}`); + throw new Error( + `Unsupported signature encoding for ${Ed255192020VerKeyName}`, + ); } // NOTE: Ed255192020 has the same cryptography as Ed255192018, so we inherit the verifier methods diff --git a/src/utils/vc/crypto/JsonWebSignature2020.js b/packages/credential-sdk/src/vc/crypto/JsonWebSignature2020.js similarity index 96% rename from src/utils/vc/crypto/JsonWebSignature2020.js rename to packages/credential-sdk/src/vc/crypto/JsonWebSignature2020.js index c982017e9..d8e17e66f 100644 --- a/src/utils/vc/crypto/JsonWebSignature2020.js +++ b/packages/credential-sdk/src/vc/crypto/JsonWebSignature2020.js @@ -43,7 +43,10 @@ export default class JsonWebSignature2020 extends CustomLinkedDataSignature { */ async sign({ verifyData, proof }) { const finalProof = { ...proof }; - finalProof.jws = await this.signer.sign({ data: verifyData, detached: true }); + finalProof.jws = await this.signer.sign({ + data: verifyData, + detached: true, + }); return finalProof; } diff --git a/src/utils/vc/crypto/common/CustomLinkedDataSignature.js b/packages/credential-sdk/src/vc/crypto/common/CustomLinkedDataSignature.js similarity index 89% rename from src/utils/vc/crypto/common/CustomLinkedDataSignature.js rename to packages/credential-sdk/src/vc/crypto/common/CustomLinkedDataSignature.js index 53f197890..0e19b1340 100644 --- a/src/utils/vc/crypto/common/CustomLinkedDataSignature.js +++ b/packages/credential-sdk/src/vc/crypto/common/CustomLinkedDataSignature.js @@ -14,7 +14,8 @@ export function decodeBase64UrlToString(string) { return base64url.decode(string); } -export default class CustomLinkedDataSignature extends jsigs.suites.LinkedDataSignature { +export default class CustomLinkedDataSignature extends jsigs.suites + .LinkedDataSignature { /** * Creates a new CustomLinkedDataSignature instance * @constructor @@ -42,9 +43,12 @@ export default class CustomLinkedDataSignature extends jsigs.suites.LinkedDataSi const { proofValue, jws } = proof; if (proofValue && typeof proofValue === 'string') { - signatureBytes = base58btc.decode(CustomLinkedDataSignature.fromJsigProofValue(proofValue)); - } else if (jws && typeof jws === 'string') { // Fallback to older jsonld-signature implementations - const [encodedHeader, /* payload */, encodedSignature] = jws.split('.'); + signatureBytes = base58btc.decode( + CustomLinkedDataSignature.fromJsigProofValue(proofValue), + ); + } else if (jws && typeof jws === 'string') { + // Fallback to older jsonld-signature implementations + const [encodedHeader /* payload */, , encodedSignature] = jws.split('.'); let header; try { @@ -107,14 +111,16 @@ export default class CustomLinkedDataSignature extends jsigs.suites.LinkedDataSi finalProof.proofValue = CustomLinkedDataSignature.encodeProofValue(signatureBytes); } else { if (!this.alg) { - throw new Error('Suite doesn\'t contain required alg parameter'); + throw new Error("Suite doesn't contain required alg parameter"); } const header = { alg: this.alg, b64: false, crit: ['b64'] }; const encodedHeader = base64url.encode(JSON.stringify(header)); const jwsData = createJws({ encodedHeader, verifyData }); const signatureBytesJWS = await getSigBytes(jwsData); - finalProof.jws = `${encodedHeader}..${base64url.encode(signatureBytesJWS)}`; + finalProof.jws = `${encodedHeader}..${base64url.encode( + signatureBytesJWS, + )}`; } return finalProof; diff --git a/src/utils/vc/crypto/common/DockCryptoKeyPair.js b/packages/credential-sdk/src/vc/crypto/common/DockCryptoKeyPair.js similarity index 89% rename from src/utils/vc/crypto/common/DockCryptoKeyPair.js rename to packages/credential-sdk/src/vc/crypto/common/DockCryptoKeyPair.js index b42b900e7..a67a323c8 100644 --- a/src/utils/vc/crypto/common/DockCryptoKeyPair.js +++ b/packages/credential-sdk/src/vc/crypto/common/DockCryptoKeyPair.js @@ -1,6 +1,6 @@ -import { u8aToU8a } from '@polkadot/util'; import b58 from 'bs58'; -import { withExtendedStaticProperties } from '../../../inheritance'; +import { u8aToU8a } from '../../../utils/bytes'; +import { withExtendedStaticProperties } from '../../../utils/inheritance'; /** * Defines commons for the `@docknetwork/crypto-wasm-ts` keypairs. @@ -29,7 +29,7 @@ export default withExtendedStaticProperties( this.privateKeyBuffer = options.privateKeyBase58 ? b58.decode(options.privateKeyBase58) : undefined; - this.publicKeyBuffer = b58.decode(options.publicKeyBase58); + this.publicKeyBuffer = b58.decode(String(options.publicKeyBase58)); } } @@ -55,11 +55,7 @@ export default withExtendedStaticProperties( seed, params, controller, id, msgCount = 1, } = {}) { const keypair = this.KeyPair.generate( - params - || this.paramGenerator( - msgCount, - this.defaultLabelBytes, - ), + params || this.paramGenerator(msgCount, this.defaultLabelBytes), seed, ); return new this({ keypair, controller, id }); @@ -85,11 +81,7 @@ export default withExtendedStaticProperties( }, }; } - const { - SecretKey, - Signature, - defaultLabelBytes, - } = this; + const { SecretKey, Signature, defaultLabelBytes } = this; const keypairClass = this; return { @@ -130,9 +122,7 @@ export default withExtendedStaticProperties( }; } - const { - PublicKey, Signature, defaultLabelBytes, - } = this; + const { PublicKey, Signature, defaultLabelBytes } = this; const keypairClass = this; return { diff --git a/src/utils/vc/crypto/common/DockCryptoSignature.js b/packages/credential-sdk/src/vc/crypto/common/DockCryptoSignature.js similarity index 85% rename from src/utils/vc/crypto/common/DockCryptoSignature.js rename to packages/credential-sdk/src/vc/crypto/common/DockCryptoSignature.js index d411adefd..a796b2dfe 100644 --- a/src/utils/vc/crypto/common/DockCryptoSignature.js +++ b/packages/credential-sdk/src/vc/crypto/common/DockCryptoSignature.js @@ -1,14 +1,18 @@ -import { CredentialSchema, DefaultSchemaParsingOpts, initializeWasm } from '@docknetwork/crypto-wasm-ts'; +import { + initializeWasm, + CredentialSchema, + DefaultSchemaParsingOpts, +} from '@docknetwork/crypto-wasm-ts'; import jsonld from 'jsonld'; -import { SECURITY_CONTEXT_URL } from 'jsonld-signatures'; +import jsigs from 'jsonld-signatures'; -import { u8aToU8a } from '@polkadot/util'; import stringify from 'json-stringify-deterministic'; import semver from 'semver/preload'; -import { withExtendedStaticProperties } from '../../../inheritance'; +import { u8aToU8a } from '../../../utils/bytes'; +import { withExtendedStaticProperties } from '../../../utils/inheritance'; import CustomLinkedDataSignature from './CustomLinkedDataSignature'; -import { deepClone } from '../../../common'; +import { deepClone } from '../../../utils/misc'; const SUITE_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1'; @@ -107,18 +111,19 @@ export default withExtendedStaticProperties( } } else { // Serialize the data for signing - [serializedCredential, credSchema] = await this.constructor.convertCredentialToSerializedForSigning(options); + [serializedCredential, credSchema] = await this.constructor.convertCredentialToSerializedForSigning( + options, + ); } const useConstantTimeEncoder = semver.gte(credSchema.version, '0.5.0'); // Encode messages, retrieve names/values array - const nameValues = useConstantTimeEncoder ? credSchema.encoder.encodeMessageObjectConstantTime( - serializedCredential, - false, - ) : credSchema.encoder.encodeMessageObject( - serializedCredential, - false, - ); + const nameValues = useConstantTimeEncoder + ? credSchema.encoder.encodeMessageObjectConstantTime( + serializedCredential, + false, + ) + : credSchema.encoder.encodeMessageObject(serializedCredential, false); return nameValues[1]; } @@ -134,7 +139,10 @@ export default withExtendedStaticProperties( proof: explicitProof /* documentLoader */, signingOptions = { requireAllFieldsFromSchema: false }, }) { - const [trimmedProof] = this.getTrimmedProofAndValue(document, explicitProof); + const [trimmedProof] = this.getTrimmedProofAndValue( + document, + explicitProof, + ); const [credSchema] = this.extractSchema(document); @@ -179,7 +187,10 @@ export default withExtendedStaticProperties( // this is a bit hacky, but its the only way right now if (document.credentialSchema) { const fullSchema = builtAnoncreds.credentialSchema; - Object.assign(document.credentialSchema, typeof fullSchema === 'string' ? JSON.parse(fullSchema) : fullSchema); + Object.assign( + document.credentialSchema, + typeof fullSchema === 'string' ? JSON.parse(fullSchema) : fullSchema, + ); } // Return the built anoncreds credential and the schema associated @@ -196,7 +207,10 @@ export default withExtendedStaticProperties( document, proof: explicitProof /* documentLoader */, }) { - const [trimmedProof, proofVal] = this.getTrimmedProofAndValue(document, explicitProof); + const [trimmedProof, proofVal] = this.getTrimmedProofAndValue( + document, + explicitProof, + ); const [credSchema, wasExactSchema] = this.extractSchema(document); @@ -211,9 +225,15 @@ export default withExtendedStaticProperties( } this.formatMandatoryFields(credJson, document); - const cred = this.Credential.fromJSON(credJson, CustomLinkedDataSignature.fromJsigProofValue(proofVal)); + const cred = this.Credential.fromJSON( + credJson, + CustomLinkedDataSignature.fromJsigProofValue(proofVal), + ); if (!wasExactSchema) { - cred.schema = CredentialSchema.generateAppropriateSchema(credJson, credSchema); + cred.schema = CredentialSchema.generateAppropriateSchema( + credJson, + credSchema, + ); } return cred; @@ -229,7 +249,10 @@ export default withExtendedStaticProperties( document, proof: explicitProof /* documentLoader */, }) { - const [trimmedProof] = this.getTrimmedProofAndValue(document, explicitProof); + const [trimmedProof] = this.getTrimmedProofAndValue( + document, + explicitProof, + ); const s = this.extractSchema(document); let credSchema = s[0]; @@ -246,14 +269,21 @@ export default withExtendedStaticProperties( if (credJson.credentialSchema === undefined) { credJson.credentialSchema = JSON.stringify(credSchema.toJSON()); } - credSchema = CredentialSchema.generateAppropriateSchema(credJson, credSchema); + credSchema = CredentialSchema.generateAppropriateSchema( + credJson, + credSchema, + ); } - const schemaJson = semver.gte(credSchema.version, '0.4.0') ? credSchema.toJSON() : credSchema.toJSONOlder(); + const schemaJson = semver.gte(credSchema.version, '0.4.0') + ? credSchema.toJSON() + : credSchema.toJSONOlder(); if (credJson.cryptoVersion && isCredVerGte060(credJson.cryptoVersion)) { credJson.credentialSchema = schemaJson; } else { // Older versions used JSON.stringify but newer use deterministic conversion - credJson.credentialSchema = wasExactSchema ? stringify(schemaJson) : JSON.stringify(schemaJson); + credJson.credentialSchema = wasExactSchema + ? stringify(schemaJson) + : JSON.stringify(schemaJson); } if (document.credentialSchema) { @@ -276,7 +306,10 @@ export default withExtendedStaticProperties( }) { const [trimmedProof] = this.getTrimmedProofAndValue(document, proof); - const [credSchema] = await this.extractSchemaForSigning(document, documentLoader); + const [credSchema] = await this.extractSchemaForSigning( + document, + documentLoader, + ); const credBuilder = new this.CredentialBuilder(); credBuilder.schema = credSchema; @@ -303,15 +336,15 @@ export default withExtendedStaticProperties( // To work with JSON-LD credentials/presentations, we must always reveal the context and type // NOTE: that they are encoded as JSON strings here to reduce message count and so its *always known* - credBuilder.setTopLevelField( - '@context', - stringify(document['@context']), - ); + credBuilder.setTopLevelField('@context', stringify(document['@context'])); credBuilder.setTopLevelField('type', stringify(document.type)); const serializedCred = credBuilder.serializeForSigning(); - credBuilder.schema = CredentialSchema.generateAppropriateSchema(serializedCred, credSchema); + credBuilder.schema = CredentialSchema.generateAppropriateSchema( + serializedCred, + credSchema, + ); // Update `document` so that generated credential has `credentialSchema` and `cryptoVersion` set const updatedSchemaJson = credBuilder.schema.toJSON(); @@ -332,9 +365,13 @@ export default withExtendedStaticProperties( // NOTE: that they are encoded as JSON strings here to reduce message count and so its *always known* const newVersion = credJson.cryptoVersion && isCredVerGte060(credJson.cryptoVersion); // eslint-disable-next-line no-param-reassign - credJson['@context'] = newVersion ? stringify(document['@context']) : JSON.stringify(document['@context']); + credJson['@context'] = newVersion + ? stringify(document['@context']) + : JSON.stringify(document['@context']); // eslint-disable-next-line no-param-reassign - credJson.type = newVersion ? stringify(document.type) : JSON.stringify(document.type); + credJson.type = newVersion + ? stringify(document.type) + : JSON.stringify(document.type); } /** @@ -352,7 +389,7 @@ export default withExtendedStaticProperties( } // `jws`,`signatureValue`,`proofValue` must not be included in the proof const trimmedProof = { - '@context': document['@context'] || SECURITY_CONTEXT_URL, + '@context': document['@context'] || jsigs.SECURITY_CONTEXT_URL, ...proof, }; @@ -394,14 +431,22 @@ export default withExtendedStaticProperties( const schemaJson = deepClone(document.credentialSchema); // Passing all the default parsing options. Ideally `document.credentialSchema` should contain these if (schemaJson.details === undefined) { - schemaJson.details = stringify({ parsingOptions: DefaultSchemaParsingOpts }); + schemaJson.details = stringify({ + parsingOptions: DefaultSchemaParsingOpts, + }); } else { const details = JSON.parse(schemaJson.details); - details.parsingOptions = { ...DefaultSchemaParsingOpts, ...details.parsingOptions }; + details.parsingOptions = { + ...DefaultSchemaParsingOpts, + ...details.parsingOptions, + }; schemaJson.details = stringify(details); } // If we already have a schema to use, add that first and then generate relaxed values later on - credSchema = await CredentialSchema.fromJSONWithPotentiallyExternalSchema(schemaJson, getSchema); + credSchema = await CredentialSchema.fromJSONWithPotentiallyExternalSchema( + schemaJson, + getSchema, + ); } else { credSchema = this.extractSchemaWhenIdNotSet(document); wasExactSchema = false; @@ -432,7 +477,10 @@ export default withExtendedStaticProperties( let credSchema; if (document.credentialSchema) { // schema object exists but no ID means the SDK is signalling for the suite to generate a schema - credSchema = new CredentialSchema(CredentialSchema.essential(), this.getParsingOptions(document)); + credSchema = new CredentialSchema( + CredentialSchema.essential(), + this.getParsingOptions(document), + ); } else { // Else, no schema was found so just use the essentials and v0.0.1 schema version // NOTE: version is important here and MUST be 0.0.1 otherwise it will invalidate BBS+ credentials @@ -443,7 +491,7 @@ export default withExtendedStaticProperties( // Passing old parsing options and version { useDefaults: false, - defaultMinimumInteger: -((2 ** 32) - 1), + defaultMinimumInteger: -(2 ** 32 - 1), defaultDecimalPlaces: 0, }, false, @@ -457,7 +505,10 @@ export default withExtendedStaticProperties( } static getParsingOptions(document) { - if (document.credentialSchema && document.credentialSchema.details !== undefined) { + if ( + document.credentialSchema + && document.credentialSchema.details !== undefined + ) { const details = JSON.parse(document.credentialSchema.details); return details.parsingOptions; } @@ -470,7 +521,10 @@ export default withExtendedStaticProperties( newSchemaJson.details = stringify({ parsingOptions }); } else { const details = JSON.parse(schemaJson.details); - details.parsingOptions = { ...details.parsingOptions, ...parsingOptions }; + details.parsingOptions = { + ...details.parsingOptions, + ...parsingOptions, + }; newSchemaJson.details = stringify(details); } return newSchemaJson; @@ -494,14 +548,14 @@ export default withExtendedStaticProperties( const result = await jsonld.frame( verificationMethod, { - '@context': SECURITY_CONTEXT_URL, + '@context': jsigs.SECURITY_CONTEXT_URL, '@embed': '@always', id: verificationMethod, }, { documentLoader, compactToRelative: false, - expandContext: SECURITY_CONTEXT_URL, + expandContext: jsigs.SECURITY_CONTEXT_URL, }, ); if (!result) { @@ -544,10 +598,7 @@ export default withExtendedStaticProperties( } const msgCount = data.length; - const sigParams = paramGetter( - msgCount, - KeyPair.defaultLabelBytes, - ); + const sigParams = paramGetter(msgCount, KeyPair.defaultLabelBytes); const sk = KeyPair.adaptKey( new KeyPair.SecretKey(u8aToU8a(keypair.privateKeyBuffer)), data.length, diff --git a/src/utils/vc/crypto/common/DockCryptoSignatureProof.js b/packages/credential-sdk/src/vc/crypto/common/DockCryptoSignatureProof.js similarity index 82% rename from src/utils/vc/crypto/common/DockCryptoSignatureProof.js rename to packages/credential-sdk/src/vc/crypto/common/DockCryptoSignatureProof.js index 92e0c9fe2..d30b52299 100644 --- a/src/utils/vc/crypto/common/DockCryptoSignatureProof.js +++ b/packages/credential-sdk/src/vc/crypto/common/DockCryptoSignatureProof.js @@ -1,7 +1,7 @@ import { Presentation } from '@docknetwork/crypto-wasm-ts'; import b58 from 'bs58'; import stringify from 'json-stringify-deterministic'; -import { withExtendedStaticProperties } from '../../../inheritance'; +import { withExtendedStaticProperties } from '../../../utils/inheritance'; import CustomLinkedDataSignature from './CustomLinkedDataSignature'; @@ -75,19 +75,31 @@ export default withExtendedStaticProperties( const recreatedPres = Presentation.fromJSON(presentationJSON); // NOTE: Another example that this credential derivation doesn't work for presentation with more than 1 credential - const pks = verificationMethod !== undefined ? [verificationMethod].map((keyDocument) => { - const pkRaw = b58.decode(keyDocument.publicKeyBase58); - return new this.constructor.Signature.KeyPair.PublicKey(pkRaw); - }) : []; + const pks = verificationMethod !== undefined + ? [verificationMethod].map((keyDocument) => { + const pkRaw = b58.decode(keyDocument.publicKeyBase58); + return new this.constructor.Signature.KeyPair.PublicKey(pkRaw); + }) + : []; const { - accumulatorPublicKeys, predicateParams, - circomOutputs, blindedAttributesCircomOutputs, + accumulatorPublicKeys, + predicateParams, + circomOutputs, + blindedAttributesCircomOutputs, } = this; - const res = recreatedPres.verify(pks, accumulatorPublicKeys, predicateParams, circomOutputs, blindedAttributesCircomOutputs); + const res = recreatedPres.verify( + pks, + accumulatorPublicKeys, + predicateParams, + circomOutputs, + blindedAttributesCircomOutputs, + ); if (!res.verified) { - throw new Error(`Invalid anoncreds presentation due to error: ${res.error}`); + throw new Error( + `Invalid anoncreds presentation due to error: ${res.error}`, + ); } return { verified: true, verificationMethod }; @@ -131,13 +143,17 @@ export default withExtendedStaticProperties( sigType: proof.sigType, version: credVersion, bounds: proof.bounds, - schema: newCredVersion ? credentialSchema : JSON.stringify(credentialSchema), + schema: newCredVersion + ? credentialSchema + : JSON.stringify(credentialSchema), revealedAttributes: { proof: { type: this.sigName, verificationMethod: proof.verificationMethod, }, - '@context': newCredVersion ? stringify(context) : JSON.stringify(context), + '@context': newCredVersion + ? stringify(context) + : JSON.stringify(context), type: newCredVersion ? stringify(type) : JSON.stringify(type), ...revealedAttributes, }, @@ -149,13 +165,12 @@ export default withExtendedStaticProperties( // Old credentials incorrectly set the presentation version as credential version which was fine because coincidentally // both versions were same. Correcting this mistake now. Once all dependents have upgraded and old presentations don't // need to be supported, `proof.presVersion` should be used. - version: proof.presVersion !== undefined ? proof.presVersion : proof.version, + version: + proof.presVersion !== undefined ? proof.presVersion : proof.version, nonce: proof.nonce, context: proof.context, spec: { - credentials: [ - c, - ], + credentials: [c], attributeEqualities: proof.attributeEqualities, boundedPseudonyms: proof.boundedPseudonyms, unboundedPseudonyms: proof.unboundedPseudonyms, diff --git a/src/utils/vc/crypto/constants.js b/packages/credential-sdk/src/vc/crypto/constants.js similarity index 100% rename from src/utils/vc/crypto/constants.js rename to packages/credential-sdk/src/vc/crypto/constants.js diff --git a/src/utils/vc/custom_crypto.js b/packages/credential-sdk/src/vc/custom_crypto.js similarity index 92% rename from src/utils/vc/custom_crypto.js rename to packages/credential-sdk/src/vc/custom_crypto.js index 36d1e44d2..d3b108894 100644 --- a/src/utils/vc/custom_crypto.js +++ b/packages/credential-sdk/src/vc/custom_crypto.js @@ -25,8 +25,8 @@ import EcdsaSecp256k1Signature2019 from './crypto/EcdsaSecp256k1Signature2019'; import Ed25519VerificationKey2018 from './crypto/Ed25519VerificationKey2018'; import Ed25519Signature2018 from './crypto/Ed25519Signature2018'; import Ed25519Signature2020 from './crypto/Ed25519Signature2020'; -import Sr25519VerificationKey2020 from './crypto/Sr25519VerificationKey2020'; -import Sr25519Signature2020 from './crypto/Sr25519Signature2020'; +// import Sr25519VerificationKey2020 from './crypto/Sr25519VerificationKey2020'; +// import Sr25519Signature2020 from './crypto/Sr25519Signature2020'; import Bls12381BBSSignatureDock2022 from './crypto/Bls12381BBSSignatureDock2022'; import Bls12381BBSSignatureProofDock2022 from './crypto/Bls12381BBSSignatureProofDock2022'; import Bls12381BBSSignatureDock2023 from './crypto/Bls12381BBSSignatureDock2023'; @@ -49,8 +49,8 @@ export { Ed25519VerificationKey2018, Ed25519Signature2018, Ed25519Signature2020, - Sr25519VerificationKey2020, - Sr25519Signature2020, + // Sr25519VerificationKey2020, + // Sr25519Signature2020, Bls12381BBSSignatureDock2022, Bls12381BBSSignatureProofDock2022, Bls12381BBSSignatureDock2023, diff --git a/src/utils/vc/document-loader.js b/packages/credential-sdk/src/vc/document-loader.js similarity index 95% rename from src/utils/vc/document-loader.js rename to packages/credential-sdk/src/vc/document-loader.js index 6199071a6..ddbc6c4f1 100644 --- a/src/utils/vc/document-loader.js +++ b/packages/credential-sdk/src/vc/document-loader.js @@ -1,6 +1,6 @@ import cachedUris from './contexts'; -import Resolver from "../../resolver/generic/resolver"; // eslint-disable-line -import jsonFetch from '../json-fetch'; +import Resolver from "../resolver/generic/resolver"; // eslint-disable-line +import jsonFetch from '../utils/json-fetch'; function parseEmbeddedDataURI(embedded) { // Strip new lines diff --git a/src/utils/vc/helpers.js b/packages/credential-sdk/src/vc/helpers.js similarity index 92% rename from src/utils/vc/helpers.js rename to packages/credential-sdk/src/vc/helpers.js index 9546ca469..4a0720df1 100644 --- a/src/utils/vc/helpers.js +++ b/packages/credential-sdk/src/vc/helpers.js @@ -3,23 +3,27 @@ import { JsonWebKey } from '@transmute/json-web-signature'; import defaultDocumentLoader from './document-loader'; import { - Bls12381BBS23DockVerKeyName, - Bls12381BBSDockVerKeyName, + EcdsaSecp256k1VerKeyName, + Ed25519VerKeyName, + EcdsaSecp256k1Signature2019, + Ed25519Signature2018, + // Sr25519Signature2020, Bls12381BBSSignatureDock2022, + Bls12381BBSDockVerKeyName, + Bls12381BBS23DockVerKeyName, Bls12381BBSSignatureDock2023, - Bls12381PSDockVerKeyName, Bls12381PSSignatureDock2023, - EcdsaSecp256k1Signature2019, - EcdsaSecp256k1VerKeyName, - Ed25519Signature2018, - Ed25519Signature2020, - Ed25519VerKeyName, + Bls12381PSDockVerKeyName, JsonWebSignature2020, - Sr25519Signature2020, - Sr25519VerKeyName, + Ed25519Signature2020, } from './custom_crypto'; -import { Bls12381BBDT16DockVerKeyName, Bls12381BBDT16MacDockName, Ed255192020VerKeyName } from './crypto/constants'; +import { + Bls12381BBDT16DockVerKeyName, + Bls12381BBDT16MacDockName, + Ed255192020VerKeyName, +} from './crypto/constants'; import Bls12381BBDT16MACDock2024 from './crypto/Bls12381BBDT16MACDock2024'; +import { DidKeypair } from '../keypairs'; /** * @typedef {object} KeyDoc The Options to use in the function createUser. @@ -39,12 +43,14 @@ import Bls12381BBDT16MACDock2024 from './crypto/Bls12381BBDT16MACDock2024'; * @param {string} id - the ID of the key for future resolution * @returns {KeyDoc} */ -export function getKeyDoc(did, keypair, type, id) { +export function getKeyDoc(did, kp, type, id) { + const keypair = kp instanceof DidKeypair ? kp.keyPair : kp; + return { id: id || `${did}#keys-1`, controller: String(did), - type: type || keypair.verKeyType, - keypair: keypair.keyPair || keypair, + type: type || keypair.constructor.VerKeyType, + keypair, }; } @@ -71,9 +77,9 @@ export async function getSuiteFromKeyDoc(keyDoc, useProofValue, options) { case Ed255192020VerKeyName: Cls = Ed25519Signature2020; break; - case Sr25519VerKeyName: + /* case Sr25519VerKeyName: Cls = Sr25519Signature2020; - break; + break; */ case Bls12381BBSDockVerKeyName: Cls = Bls12381BBSSignatureDock2022; break; diff --git a/src/utils/vc/index.js b/packages/credential-sdk/src/vc/index.js similarity index 74% rename from src/utils/vc/index.js rename to packages/credential-sdk/src/vc/index.js index 00791e21f..3541b44a6 100644 --- a/src/utils/vc/index.js +++ b/packages/credential-sdk/src/vc/index.js @@ -1,11 +1,7 @@ import { signPresentation, verifyPresentation } from './presentations'; import { issueCredential, verifyCredential } from './credentials'; -import { expandJSONLD } from './helpers'; -import { - DEFAULT_TYPE, - DEFAULT_CONTEXT, -} from './constants'; +import { DEFAULT_TYPE, DEFAULT_CONTEXT } from './constants'; /** * Check that credential is verified, i.e. the credential has VCDM compliant structure and the `proof` @@ -34,7 +30,6 @@ export async function isVerifiedPresentation(presentation, params) { // TODO: export more methods supplied in revocation/credentials export { - expandJSONLD, verifyCredential, issueCredential, signPresentation, @@ -42,3 +37,11 @@ export { DEFAULT_TYPE, DEFAULT_CONTEXT, }; + +export { default as Presentation } from './presentation'; +export { default as VerifiableCredential } from './verifiable-credential'; +export { default as VerifiablePresentation } from './verifiable-presentation'; +export { default as StatusList2021Credential } from './status-list2021-credential'; +export { default as PrivateStatusList2021Credential } from './private-status-list2021-credential'; +export * from './helpers'; +export { validateCredentialSchema } from './schema'; diff --git a/src/utils/vc/jws.js b/packages/credential-sdk/src/vc/jws.js similarity index 100% rename from src/utils/vc/jws.js rename to packages/credential-sdk/src/vc/jws.js diff --git a/src/presentation.js b/packages/credential-sdk/src/vc/presentation.js similarity index 88% rename from src/presentation.js rename to packages/credential-sdk/src/vc/presentation.js index 1c7d5381c..ff18589e4 100644 --- a/src/presentation.js +++ b/packages/credential-sdk/src/vc/presentation.js @@ -4,30 +4,33 @@ import { isWasmInitialized, BBSPublicKey, PSPublicKey, - PresentationBuilder, flattenObjectToKeyValuesList, + PresentationBuilder, + flattenObjectToKeyValuesList, } from '@docknetwork/crypto-wasm-ts'; import b58 from 'bs58'; -import { stringToU8a } from '@polkadot/util'; -import { ensureArray } from './utils/type-helpers'; +import { normalizeOrConvertStringToU8a } from '../utils/bytes'; +import { ensureArray } from '../utils/type-helpers'; -import Bls12381BBSSignatureDock2022 from './utils/vc/crypto/Bls12381BBSSignatureDock2022'; -import { DOCK_ANON_CREDENTIAL_ID } from './utils/vc/crypto/common/DockCryptoSignatureProof'; +import Bls12381BBSSignatureDock2022 from './crypto/Bls12381BBSSignatureDock2022'; +import { DOCK_ANON_CREDENTIAL_ID } from './crypto/common/DockCryptoSignatureProof'; import { Bls12381BBSSigDockSigName, Bls12381PSSigDockSigName, Bls12381BBS23SigDockSigName, Bls12381PSSigProofDockSigName, Bls12381BBS23SigProofDockSigName, - Bls12381BBSSigProofDockSigName, Bls12381BBDT16MacDockName, Bls12381BBDT16MacProofDockName, -} from './utils/vc/crypto/constants'; -import defaultDocumentLoader from './utils/vc/document-loader'; + Bls12381BBSSigProofDockSigName, + Bls12381BBDT16MacDockName, + Bls12381BBDT16MacProofDockName, +} from './crypto/constants'; +import defaultDocumentLoader from './document-loader'; import { Bls12381BBSSignatureDock2023, Bls12381PSSignatureDock2023, -} from './utils/vc/custom_crypto'; -import Bls12381BBDT16MACDock2024 from './utils/vc/crypto/Bls12381BBDT16MACDock2024'; +} from './custom_crypto'; +import Bls12381BBDT16MACDock2024 from './crypto/Bls12381BBDT16MACDock2024'; -import { isCredVerGte060 } from './utils/vc/crypto/common/DockCryptoSignature'; +import { isCredVerGte060 } from './crypto/common/DockCryptoSignature'; const SIG_NAME_TO_PROOF_NAME = Object.setPrototypeOf( { @@ -69,7 +72,7 @@ export default class Presentation { createPresentation(options = {}) { const { nonce, context } = options; if (nonce) { - this.presBuilder.nonce = stringToU8a(nonce); + this.presBuilder.nonce = normalizeOrConvertStringToU8a(nonce); } if (context) { this.presBuilder.context = context; @@ -143,7 +146,9 @@ export default class Presentation { pk = new PublicKey(pkRaw); } - const convertedCredential = Signature.convertCredentialForPresBuilding({ document: json }); + const convertedCredential = Signature.convertCredentialForPresBuilding({ + document: json, + }); const idx = this.presBuilder.addCredential(convertedCredential, pk); // Enforce revealing of verificationMethod and type @@ -199,7 +204,9 @@ export default class Presentation { id: credential.revealedAttributes.id || DOCK_ANON_CREDENTIAL_ID, '@context': JSON.parse(credential.revealedAttributes['@context']), type: JSON.parse(credential.revealedAttributes.type), - credentialSchema: isCredVerGte060(credential.version) ? credential.schema : JSON.parse(credential.schema), + credentialSchema: isCredVerGte060(credential.version) + ? credential.schema + : JSON.parse(credential.schema), issuer: credential.revealedAttributes.issuer || credential.revealedAttributes.proof.verificationMethod.split('#')[0], diff --git a/src/utils/vc/presentations.js b/packages/credential-sdk/src/vc/presentations.js similarity index 93% rename from src/utils/vc/presentations.js rename to packages/credential-sdk/src/vc/presentations.js index 68be2b0f6..6b69eaff3 100644 --- a/src/utils/vc/presentations.js +++ b/packages/credential-sdk/src/vc/presentations.js @@ -9,7 +9,8 @@ import { } from '@docknetwork/crypto-wasm-ts'; import b58 from 'bs58'; import { getPrivateStatus, verifyCredential } from './credentials'; -import DIDResolver from "../../resolver/did/did-resolver"; // eslint-disable-line +import DIDResolver from "../resolver/did/did-resolver"; // eslint-disable-line +import { isCredVerGte060 } from './crypto/common/DockCryptoSignature'; import defaultDocumentLoader from './document-loader'; import { getSuiteFromKeyDoc } from './helpers'; @@ -19,7 +20,9 @@ import { Bls12381BBS23SigDockSigName, Bls12381BBSDockVerKeyName, Bls12381PSDockVerKeyName, - Bls12381BBS23DockVerKeyName, Bls12381BBDT16DockVerKeyName, Bls12381BBDT16MacDockName, + Bls12381BBS23DockVerKeyName, + Bls12381BBDT16DockVerKeyName, + Bls12381BBDT16MacDockName, } from './crypto/constants'; import { DEFAULT_CONTEXT_V1_URL } from './constants'; @@ -28,13 +31,12 @@ import { EcdsaSecp256k1Signature2019, Ed25519Signature2018, Ed25519Signature2020, - Sr25519Signature2020, + // Sr25519Signature2020, JsonWebSignature2020, Bls12381BBSSignatureDock2022, Bls12381BBSSignatureDock2023, Bls12381PSSignatureDock2023, } from './custom_crypto'; -import { isCredVerGte060 } from './crypto/common/DockCryptoSignature'; const { AuthenticationProofPurpose } = jsigs.purposes; @@ -57,7 +59,7 @@ function checkPresentation(presentation) { if (context[0] !== DEFAULT_CONTEXT_V1_URL) { throw new Error( `"${DEFAULT_CONTEXT_V1_URL}" needs to be first in the ` - + 'list of contexts.', + + 'list of contexts.', ); } @@ -160,7 +162,7 @@ export async function verifyPresentation(presentation, options = {}) { new Ed25519Signature2018(), new Ed25519Signature2020(), new EcdsaSecp256k1Signature2019(), - new Sr25519Signature2020(), + // new Sr25519Signature2020(), new JsonWebSignature2020(), ...suite, ], @@ -284,8 +286,10 @@ export function isAnoncreds(presentation) { export async function verifyAnoncreds(presentation, options = {}) { const documentLoader = options.documentLoader || defaultDocumentLoader(options.resolver); const { - predicateParams, accumulatorPublicKeys, - circomOutputs, blindedAttributesCircomOutputs, + predicateParams, + accumulatorPublicKeys, + circomOutputs, + blindedAttributesCircomOutputs, } = options; const keyDocuments = await Promise.all( @@ -323,11 +327,15 @@ export async function verifyAnoncreds(presentation, options = {}) { keyDocuments.forEach((keyDocument, i) => { if (!keyDocument.type) { - throw new Error(`No type provided for key document ${JSON.stringify(keyDocument)}`); + throw new Error( + `No type provided for key document ${JSON.stringify(keyDocument)}`, + ); } // Question: Why would keyDocument.type start with `did:` - const keyType = keyDocument.type.startsWith('did:') ? keyDocument.type.slice(4) : keyDocument.type; + const keyType = keyDocument.type.startsWith('did:') + ? keyDocument.type.slice(4) + : keyDocument.type; let Cls; switch (keyType) { @@ -350,7 +358,13 @@ export async function verifyAnoncreds(presentation, options = {}) { pks.set(i, new Cls(pkRaw)); }); - return recreatedPres.verify(pks, accumulatorPublicKeys, predicateParams, circomOutputs, blindedAttributesCircomOutputs); + return recreatedPres.verify( + pks, + accumulatorPublicKeys, + predicateParams, + circomOutputs, + blindedAttributesCircomOutputs, + ); } /** @@ -375,7 +389,9 @@ export function getKeyedProofsFromVerifiedPresentation(presentation) { */ export function getJsonSchemasFromPresentation(presentation, full = false) { return presentation.spec.credentials.map((cred) => { - const schema = isCredVerGte060(cred.version) ? CredentialSchema.fromJSON(cred.schema) : CredentialSchema.fromJSON(JSON.parse(cred.schema)); + const schema = isCredVerGte060(cred.version) + ? CredentialSchema.fromJSON(cred.schema) + : CredentialSchema.fromJSON(JSON.parse(cred.schema)); return full ? schema.getEmbeddedJsonSchema() : schema.jsonSchema; }); } diff --git a/src/status-list-credential/private-status-list2021-credential.js b/packages/credential-sdk/src/vc/private-status-list2021-credential.js similarity index 82% rename from src/status-list-credential/private-status-list2021-credential.js rename to packages/credential-sdk/src/vc/private-status-list2021-credential.js index 2ed0de381..0c3b6f3f5 100644 --- a/src/status-list-credential/private-status-list2021-credential.js +++ b/packages/credential-sdk/src/vc/private-status-list2021-credential.js @@ -1,5 +1,5 @@ -import { StatusList2021Credential } from '../index'; -import { PrivateStatusList2021Qualifier } from '../utils/vc/constants'; +import StatusList2021Credential from './status-list2021-credential'; +import { PrivateStatusList2021Qualifier } from './constants'; import { ensurePrivateStatusListId } from '../utils/type-helpers'; /** diff --git a/src/utils/revocation.js b/packages/credential-sdk/src/vc/revocation.js similarity index 88% rename from src/utils/revocation.js rename to packages/credential-sdk/src/vc/revocation.js index 3cf5bf160..eca03cf0b 100644 --- a/src/utils/revocation.js +++ b/packages/credential-sdk/src/vc/revocation.js @@ -1,8 +1,12 @@ -import { randomAsHex, blake2AsHex } from '@polkadot/util-crypto'; +import { blake2b } from 'blakejs'; import jsonld from 'jsonld'; -import { VB_ACCUMULATOR_22, KB_UNI_ACCUMULATOR_24 } from '@docknetwork/crypto-wasm-ts'; -import OneOfPolicy from './revocation/one-of-policy'; +import { + VB_ACCUMULATOR_22, + KB_UNI_ACCUMULATOR_24, +} from '@docknetwork/crypto-wasm-ts'; +import { randomAsHex, u8aToHex } from '../utils/bytes'; +import { OneOfPolicy } from '../types/policy'; import { RevRegType, @@ -10,7 +14,7 @@ import { expandedStatusProperty, credentialIDField, credentialTypeField, -} from './vc/constants'; +} from './constants'; // The revocation registry has id with the byte size `RevRegIdByteSize` export const RevRegIdByteSize = 32; @@ -36,7 +40,7 @@ export function buildDockCredentialStatus(registryId) { */ export function getDockRevIdFromCredential(credential) { // The hash outputs the same number of bytes as required by Dock - return blake2AsHex(credential[credentialIDField], RevEntryByteSize * 8); + return u8aToHex(blake2b(credential[credentialIDField], RevEntryByteSize * 8)); } /** @@ -75,7 +79,9 @@ export function getCredentialStatus(expanded) { const ldTypeGen = (typ) => [typ, `${LD_SEC_TERM}${typ}`, `/${typ}`]; const REV_REG_LD_TYPES = [RevRegType].flatMap(ldTypeGen); -const ACCUMULATOR_LD_TYPES = [VB_ACCUMULATOR_22, KB_UNI_ACCUMULATOR_24].flatMap(ldTypeGen); +const ACCUMULATOR_LD_TYPES = [VB_ACCUMULATOR_22, KB_UNI_ACCUMULATOR_24].flatMap( + ldTypeGen, +); /** * Returns `true` if supplied status is a registry revocation status. @@ -89,7 +95,9 @@ export const isRegistryRevocationStatus = ({ [credentialTypeField]: type }) => R * @param status * @returns {boolean} */ -export const isAccumulatorRevocationStatus = ({ [credentialTypeField]: type }) => ACCUMULATOR_LD_TYPES.some((t) => type.includes(t)); +export const isAccumulatorRevocationStatus = ({ + [credentialTypeField]: type, +}) => ACCUMULATOR_LD_TYPES.some((t) => type.includes(t)); /** * Checks if a credential status has a registry revocation. diff --git a/src/utils/vc/schema.js b/packages/credential-sdk/src/vc/schema.js similarity index 64% rename from src/utils/vc/schema.js rename to packages/credential-sdk/src/vc/schema.js index 8bd698bd4..f3803a050 100644 --- a/src/utils/vc/schema.js +++ b/packages/credential-sdk/src/vc/schema.js @@ -1,7 +1,12 @@ +import jsonld from 'jsonld'; import { validate } from 'jsonschema'; +import defaultDocumentLoader from './document-loader'; import { + expandedSubjectProperty, + expandedSchemaProperty, credentialIDField, + credentialContextField, } from './constants'; /** @@ -9,14 +14,18 @@ import { * schema `schema` * @param {object} credential - The credential to use, must be expanded JSON-LD * @param {object} schema - The schema to use - * @returns {Boolean} - Returns a boolean or throws error + * @param context + * @param documentLoader + * @returns {Promise} - Returns promise to a boolean or throws error */ -export function validateCredentialSchema( +export async function validateCredentialSchema( credential, schema, + context, + documentLoader, ) { const requiresID = schema.required && schema.required.indexOf('id') > -1; - const credentialSubject = credential.credentialSubject || []; + const credentialSubject = credential[expandedSubjectProperty] || []; const subjects = credentialSubject.length ? credentialSubject : [credentialSubject]; @@ -27,13 +36,22 @@ export function validateCredentialSchema( delete subject[credentialIDField]; } + // eslint-disable-next-line + const compacted = await jsonld.compact(subject, context, { + documentLoader: documentLoader || defaultDocumentLoader(), + }); + delete compacted[credentialContextField]; + + if (Object.keys(compacted).length === 0) { + throw new Error('Compacted subject is empty, likely invalid'); + } + const schemaObj = schema.schema || schema; const subjectSchema = (schemaObj.properties && schemaObj.properties.credentialSubject) || schemaObj; - validate(subject, subjectSchema, { + validate(compacted, subjectSchema, { throwError: true, - throwFirst: true, }); } return true; @@ -42,19 +60,21 @@ export function validateCredentialSchema( /** * Get schema and run validation on credential if it contains both a credentialSubject and credentialSchema * @param {object} credential - a verifiable credential JSON object + * @param {object} context - the context * @param {object} documentLoader - the document loader * @returns {Promise} */ // eslint-disable-next-line sonarjs/cognitive-complexity export async function getAndValidateSchemaIfPresent( credential, + context, documentLoader, ) { - const schemaList = Array.isArray(credential.credentialSchema) ? credential.credentialSchema : [credential.credentialSchema]; + const schemaList = credential[expandedSchemaProperty]; if (schemaList) { const schema = schemaList[0]; - if (credential.credentialSubject && schema) { - const schemaUri = schema.id; + if (credential[expandedSubjectProperty] && schema) { + const schemaUri = schema[credentialIDField]; let schemaObj; const { document } = await documentLoader(schemaUri); @@ -68,16 +88,18 @@ export async function getAndValidateSchemaIfPresent( schemaObj = { ...data, id: schemaUri, - author: author.toQualifiedEncodedString(), + author: String(author), }; } else { schemaObj = document; } try { - validateCredentialSchema( + await validateCredentialSchema( credential, schemaObj, + context, + documentLoader, ); } catch (e) { throw new Error(`Schema validation failed: ${e}`); diff --git a/packages/credential-sdk/src/vc/schemas/schema-draft-07.js b/packages/credential-sdk/src/vc/schemas/schema-draft-07.js new file mode 100644 index 000000000..f8a1ca2f7 --- /dev/null +++ b/packages/credential-sdk/src/vc/schemas/schema-draft-07.js @@ -0,0 +1,165 @@ +/* eslint-disable */ + +export default { + $schema: "http://json-schema.org/draft-07/schema#", + $id: "http://json-schema.org/draft-07/schema#", + title: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" }, + }, + nonNegativeInteger: { + type: "integer", + minimum: 0, + }, + nonNegativeIntegerDefault0: { + allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }], + }, + simpleTypes: { + enum: [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string", + ], + }, + stringArray: { + type: "array", + items: { type: "string" }, + uniqueItems: true, + default: [], + }, + }, + type: ["object", "boolean"], + properties: { + $id: { + type: "string", + format: "uri-reference", + }, + $schema: { + type: "string", + format: "uri", + }, + $ref: { + type: "string", + format: "uri-reference", + }, + $comment: { + type: "string", + }, + title: { + type: "string", + }, + description: { + type: "string", + }, + default: true, + readOnly: { + type: "boolean", + default: false, + }, + writeOnly: { + type: "boolean", + default: false, + }, + examples: { + type: "array", + items: true, + }, + multipleOf: { + type: "number", + exclusiveMinimum: 0, + }, + maximum: { + type: "number", + }, + exclusiveMaximum: { + type: "number", + }, + minimum: { + type: "number", + }, + exclusiveMinimum: { + type: "number", + }, + maxLength: { $ref: "#/definitions/nonNegativeInteger" }, + minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, + pattern: { + type: "string", + format: "regex", + }, + additionalItems: { $ref: "#" }, + items: { + anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }], + default: true, + }, + maxItems: { $ref: "#/definitions/nonNegativeInteger" }, + minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false, + }, + contains: { $ref: "#" }, + maxProperties: { $ref: "#/definitions/nonNegativeInteger" }, + minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { $ref: "#" }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: {}, + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: {}, + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + propertyNames: { format: "regex" }, + default: {}, + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }], + }, + }, + propertyNames: { $ref: "#" }, + const: true, + enum: { + type: "array", + items: true, + minItems: 1, + uniqueItems: true, + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true, + }, + ], + }, + format: { type: "string" }, + contentMediaType: { type: "string" }, + contentEncoding: { type: "string" }, + if: { $ref: "#" }, + then: { $ref: "#" }, + else: { $ref: "#" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" }, + }, + default: true, +}; diff --git a/src/status-list-credential/status-list2021-credential.js b/packages/credential-sdk/src/vc/status-list2021-credential.js similarity index 93% rename from src/status-list-credential/status-list2021-credential.js rename to packages/credential-sdk/src/vc/status-list2021-credential.js index 97bf0117b..42dda3e4e 100644 --- a/src/status-list-credential/status-list2021-credential.js +++ b/packages/credential-sdk/src/vc/status-list2021-credential.js @@ -4,17 +4,19 @@ import { createCredential, StatusList, // eslint-disable-line } from '@digitalcredentials/vc-status-list'; -import { u8aToHex, u8aToU8a } from '@polkadot/util'; import { gzip, ungzip } from 'pako'; -import { DockStatusList2021Qualifier } from '../utils/vc/constants'; -import VerifiableCredential from '../verifiable-credential'; +import { u8aToU8a } from '../utils/bytes'; +import { DockStatusList2021Qualifier } from './constants'; +import VerifiableCredential from './verifiable-credential'; import { ensureStatusListId } from '../utils/type-helpers'; -import { KeyDoc } from "../utils/vc/helpers"; // eslint-disable-line +import { KeyDoc } from "./helpers"; // eslint-disable-line /** * Status list 2021 verifiable credential as per https://www.w3.org/TR/vc-status-list/#statuslist2021credential. */ export default class StatusList2021Credential extends VerifiableCredential { + static Type = 'statusList2021'; + /** * Create a new Status List 2021 Verifiable Credential instance. * @param {string} id - id of the credential @@ -87,7 +89,7 @@ export default class StatusList2021Credential extends VerifiableCredential { async update(keyDoc, { revokeIndices = [], unsuspendIndices = [] }) { const currentStatusList = await this.decodedStatusList(); const statusList = new StatusList({ - buffer: new Uint8Array((currentStatusList).bitstring.bits), + buffer: new Uint8Array(currentStatusList.bitstring.bits), }); this.constructor.updateStatusList( @@ -115,10 +117,7 @@ export default class StatusList2021Credential extends VerifiableCredential { async decodedStatusList() { const { encoded, decoded } = this.internalCachedStatusList; - if ( - encoded === this.credentialSubject.encodedList - && decoded !== void 0 - ) { + if (encoded === this.credentialSubject.encodedList && decoded !== void 0) { return decoded; } else { this.internalCachedStatusList = { @@ -204,15 +203,6 @@ export default class StatusList2021Credential extends VerifiableCredential { return gzip(bufferCred); } - /** - * Converts given credentials to the substrate-compatible representation. - * - * @returns {{ StatusList2021Credential: string }} - */ - toSubstrate() { - return { StatusList2021Credential: u8aToHex(this.toBytes()) }; - } - /** * Validates underlying `StatusList2021Credential`. */ diff --git a/src/verifiable-credential.js b/packages/credential-sdk/src/vc/verifiable-credential.js similarity index 95% rename from src/verifiable-credential.js rename to packages/credential-sdk/src/vc/verifiable-credential.js index e03e6a473..f85a05eb7 100644 --- a/src/verifiable-credential.js +++ b/packages/credential-sdk/src/vc/verifiable-credential.js @@ -1,11 +1,8 @@ -import { - issueCredential, - verifyCredential, - DEFAULT_CONTEXT, - DEFAULT_TYPE, -} from './utils/vc/index'; +import { expandJSONLD } from './helpers'; +import { issueCredential, verifyCredential } from './credentials'; +import { DEFAULT_CONTEXT, DEFAULT_TYPE } from './constants'; -import { validateCredentialSchema } from './utils/vc/schema'; +import { validateCredentialSchema } from './schema'; import { ensureObjectWithId, @@ -13,8 +10,8 @@ import { ensureString, ensureURI, ensureValidDatetime, -} from './utils/type-helpers'; -import { getUniqueElementsFromArray } from './utils/misc'; +} from '../utils/type-helpers'; +import { getUniqueElementsFromArray } from '../utils/misc'; /** * @typedef {object} VerifiableCredentialVerificationResult The credential verification result @@ -106,7 +103,8 @@ class VerifiableCredential { throw new Error('No credential subject defined'); } - return validateCredentialSchema(this.toJSON(), schema); + const expanded = await expandJSONLD(this.toJSON()); + return validateCredentialSchema(expanded, schema, this.context); } /** diff --git a/src/verifiable-presentation.js b/packages/credential-sdk/src/vc/verifiable-presentation.js similarity index 96% rename from src/verifiable-presentation.js rename to packages/credential-sdk/src/vc/verifiable-presentation.js index b92b12c14..b6db87d85 100644 --- a/src/verifiable-presentation.js +++ b/packages/credential-sdk/src/vc/verifiable-presentation.js @@ -1,15 +1,15 @@ -import { signPresentation, verifyPresentation } from './utils/vc/index'; +import { signPresentation, verifyPresentation } from './presentations'; import { ensureObjectWithId, ensureString, ensureURI, isObject, -} from './utils/type-helpers'; +} from '../utils/type-helpers'; -import { getUniqueElementsFromArray } from './utils/misc'; +import { getUniqueElementsFromArray } from '../utils/misc'; import VerifiableCredential from './verifiable-credential'; -import DIDResolver from "./resolver/did/did-resolver"; // eslint-disable-line +import DIDResolver from "../resolver/did/did-resolver"; // eslint-disable-line const DEFAULT_CONTEXT = 'https://www.w3.org/2018/credentials/v1'; const DEFAULT_TYPE = 'VerifiablePresentation'; diff --git a/packages/credential-sdk/tests/__snapshots__/did.test.js.snap b/packages/credential-sdk/tests/__snapshots__/did.test.js.snap new file mode 100644 index 000000000..0071a7cbe --- /dev/null +++ b/packages/credential-sdk/tests/__snapshots__/did.test.js.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`\`DockDidOrDidMethodKey.from\` \`DidMethodKey.from\` work for a raw did:key 1`] = `"Unsupported qualified string: \`zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme\`, expected with either prefix: [did:dock:, did:key:]"`; + +exports[`\`DockDidOrDidMethodKey.from\` \`DockDid.from\` work for a raw did 1`] = `"Unsupported qualified string: \`5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk\`, expected with either prefix: [did:dock:, did:key:]"`; diff --git a/packages/credential-sdk/tests/__snapshots__/document.test.js.snap b/packages/credential-sdk/tests/__snapshots__/document.test.js.snap new file mode 100644 index 000000000..935618de3 --- /dev/null +++ b/packages/credential-sdk/tests/__snapshots__/document.test.js.snap @@ -0,0 +1,181 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`\`DIDDocument\` \`DIDDocument.create\` works 1`] = ` +{ + "@context": [ + "https://www.w3.org/ns/did/v1", + ], + "alsoKnownAs": [], + "assertionMethod": [], + "authentication": [], + "capabilityDelegation": [], + "capabilityInvocation": [], + "controller": [], + "https://rdf.dock.io/alpha/2021#attestsDocumentContents": null, + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "keyAgreement": [], + "service": [], + "verificationMethod": [], +} +`; + +exports[`\`DIDDocument\` \`DIDDocument.create\` works 2`] = ` +{ + "@context": [ + "https://www.w3.org/ns/did/v1", + ], + "alsoKnownAs": [], + "assertionMethod": [ + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-2", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-4", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-6", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-7", + ], + "authentication": [ + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-1", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-4", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-5", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-7", + ], + "capabilityDelegation": [], + "capabilityInvocation": [ + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-3", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-5", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-6", + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-7", + ], + "controller": [ + "did:key:z6MktvqCyLxTsXUH1tUZncNdVeEZ7hNh7npPRbUU27GTrYb8", + ], + "https://rdf.dock.io/alpha/2021#attestsDocumentContents": null, + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "keyAgreement": [ + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-8", + ], + "service": [], + "verificationMethod": [ + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-1", + "publicKeyBase58": "Bt5Mafvpcqou1pBF8SnW1BJMvpkSzZnPEgWunTUFwHZm", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-2", + "publicKeyBase58": "GxmaKA52SZGQtZS3Usa6Az48gky2AZRKzRKxsXM6ystc", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-3", + "publicKeyBase58": "5FBSa4xAs54osiMs75JcepL695v1XhccQmQePBZQaad9", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-4", + "publicKeyBase58": "EaNp37NGpe8KViTKxAdknyvUP44doH1fHnFpYqEcfUjE", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-5", + "publicKeyBase58": "A462rFkYENhY6kf9zLVPg6qvtQhXJ6RuL8CNdHTWzNqa", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-6", + "publicKeyBase58": "Amb3kf4if5Av1sz6UdYtEw2iy6DzufRAtch6hiXEWHcw", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-7", + "publicKeyBase58": "FwUvnTThdnNPv23Rbq2SXtxxYAT21Atvdd1cZBHPYue4", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-8", + "publicKeyBase58": "BaGbEav6KzvWhgBWPyZK2vWX5EDDFc4a8rfUwAZ3x8Jn", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + ], +} +`; + +exports[`\`DIDDocument\` \`DIDDocument.create\` works 3`] = ` +{ + "@context": [ + "overriden", + ], + "alsoKnownAs": [], + "assertionMethod": [], + "authentication": [], + "capabilityDelegation": [], + "capabilityInvocation": [], + "controller": [], + "https://rdf.dock.io/alpha/2021#attestsDocumentContents": null, + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "keyAgreement": [], + "service": [], + "verificationMethod": [], +} +`; + +exports[`\`DIDDocument\` DIDDocument.from works 1`] = ` +{ + "@context": [ + "test", + ], + "alsoKnownAs": null, + "assertionMethod": null, + "authentication": null, + "capabilityDelegation": null, + "capabilityInvocation": null, + "controller": [ + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + ], + "https://rdf.dock.io/alpha/2021#attestsDocumentContents": null, + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "keyAgreement": null, + "service": null, + "verificationMethod": [ + { + "controller": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + "id": "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-3", + "publicKeyBase58": "EaNp37NGpe8KViTKxAdknyvUP44doH1fHnFpYqEcfUjE", + "publicKeyBase64": null, + "publicKeyHex": null, + "publicKeyJwk": null, + "type": "Ed25519VerificationKey2018", + }, + ], +} +`; diff --git a/tests/unit/__snapshots__/pattern.test.js.snap b/packages/credential-sdk/tests/__snapshots__/pattern.test.js.snap similarity index 97% rename from tests/unit/__snapshots__/pattern.test.js.snap rename to packages/credential-sdk/tests/__snapshots__/pattern.test.js.snap index 102a7fea6..81d65d401 100644 --- a/tests/unit/__snapshots__/pattern.test.js.snap +++ b/packages/credential-sdk/tests/__snapshots__/pattern.test.js.snap @@ -164,7 +164,7 @@ exports[`ensureMatchesPattern $mapOf 15`] = ` exports[`ensureMatchesPattern $mapOf 16`] = `[]`; -exports[`ensureMatchesPattern $mapOf 17`] = `"Invalid value key provided, expected one of \`\`[A]\`\`, received \`B\`"`; +exports[`ensureMatchesPattern $mapOf 17`] = `"Invalid value key provided, expected one of \`[A]\`, received \`B\`"`; exports[`ensureMatchesPattern $mapOf 18`] = `[]`; @@ -228,7 +228,7 @@ exports[`ensureMatchesPattern $matchIterable 7`] = ` exports[`ensureMatchesPattern $matchIterable 8`] = `[]`; -exports[`ensureMatchesPattern $matchIterable 9`] = `"Value iterable is shorter than expected, received: \`[]\`"`; +exports[`ensureMatchesPattern $matchIterable 9`] = `"Value iterable is shorter than expected, received: []"`; exports[`ensureMatchesPattern $matchIterable 10`] = `[]`; @@ -247,7 +247,7 @@ exports[`ensureMatchesPattern $matchIterable 11`] = ` exports[`ensureMatchesPattern $matchIterable 12`] = `[]`; -exports[`ensureMatchesPattern $matchIterable 13`] = `"Value iterable is shorter than expected, received: \`[1]\`"`; +exports[`ensureMatchesPattern $matchIterable 13`] = `"Value iterable is shorter than expected, received: [1]"`; exports[`ensureMatchesPattern $matchIterable 14`] = `[]`; @@ -282,7 +282,7 @@ exports[`ensureMatchesPattern $matchIterable 19`] = ` exports[`ensureMatchesPattern $matchIterable 20`] = `[]`; -exports[`ensureMatchesPattern $matchObject 1`] = `"Invalid property \`c\`, expected keys: \`[a, b]\`"`; +exports[`ensureMatchesPattern $matchObject 1`] = `"Invalid property \`c\`, expected keys: [a, b]"`; exports[`ensureMatchesPattern $matchObject 2`] = `[]`; diff --git a/tests/unit/__snapshots__/utils.test.js.snap b/packages/credential-sdk/tests/__snapshots__/utils.test.js.snap similarity index 100% rename from tests/unit/__snapshots__/utils.test.js.snap rename to packages/credential-sdk/tests/__snapshots__/utils.test.js.snap diff --git a/packages/credential-sdk/tests/canonicalize.test.js b/packages/credential-sdk/tests/canonicalize.test.js new file mode 100644 index 000000000..a1b53996b --- /dev/null +++ b/packages/credential-sdk/tests/canonicalize.test.js @@ -0,0 +1,32 @@ +import deepEqual from "deep-equal"; +import { canon } from "../src/rdf-and-cd/canonicalize"; + +describe("Canonicalization.", () => { + test("canon: ∀ A, B ∈ Node: canon(A) = canon(B) <-> A = B", async () => { + const samples = [ + { Iri: "did:example:ebfeb1f712ebc6f1c276e12ec21" }, + { Iri: "http://schema.org/alumniOf" }, + { + Literal: { + value: "Example University", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + { + Literal: { + // the keys in this are swapped but the canonical representation shouldn't change + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + value: "Example University", + }, + }, + { Iri: "https://example.com/credentials/1872" }, + { Iri: "https://w3id.org/security#proof" }, + { Blank: "_:b1" }, + ]; + for (const A of samples) { + for (const B of samples) { + expect(deepEqual(A, B)).toEqual(canon(A) === canon(B)); + } + } + }); +}); diff --git a/packages/credential-sdk/tests/claim-deduction.test.js b/packages/credential-sdk/tests/claim-deduction.test.js new file mode 100644 index 000000000..15cf290f0 --- /dev/null +++ b/packages/credential-sdk/tests/claim-deduction.test.js @@ -0,0 +1,630 @@ +import b58 from "bs58"; +import { randomAsHex } from "../src/utils"; + +import jsonld from "jsonld"; +import { + expandedLogicProperty, + acceptCompositeClaims, + proveh, + validateh, + presentationToEEClaimGraph, + proveCompositeClaims, +} from "../src/rdf-and-cd"; +import { + issueCredential, + verifyPresentation, + verifyCredential, +} from "../src/vc"; +import { createPresentation } from "./utils/create-presentation"; +import { + documentLoader, + addDocument, + registered, + modifyDocument, +} from "./utils/cached-document-loader"; + +import { Secp256k1Keypair } from "../src/keypairs"; + +describe("Composite claim soundness checker", () => { + test("control: issue and verify", async () => { + const { did: issuer, suite: kp } = await newDid(); + + const cred = { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential"], + issuer, + issuanceDate: "2010-01-01T19:23:24Z", + credentialSubject: { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + }; + const credential = await issueCredential(kp, cred, true, documentLoader); + const vresult = await verifyC(credential); + console.log(vresult); + expect(vresult).toHaveProperty("verified", true); + credential.issuanceDate = "9010-01-01T19:23:24Z"; + expect(await verifyC(credential)).toHaveProperty("verified", false); + }); + + test("assumption: credential with false issuer will fail", async () => { + const { did: issuera, suite: kpa } = await newDid(); + const { did: issuerb, suite: kpb } = await newDid(); + + // fyi signing a cred does modify the cred by adding a proof + const cred = () => ({ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential"], + issuer: issuera, + issuanceDate: "2010-01-01T19:23:24Z", + credentialSubject: { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + }); + + expect( + await verifyC(await issueCredential(kpa, cred(), true, documentLoader)) + ).toHaveProperty("verified", true); + + let err; + err = await verifyC( + await issueCredential(kpb, cred(), true, documentLoader) + ); + expect(err).toHaveProperty("verified", false); + expect(err.results[0].error.toString()).toMatch( + "Error: Credential issuer must match the verification method controller." + ); + + // modify the attackers keydoc to assert it's controller is issuera + await modifyDocument(`${issuerb}#keys-1`, (original) => ({ + ...original, + controller: issuera, + })); + expect( + (await documentLoader(`${issuerb}#keys-1`)).document.controller + ).toBe(issuera); + + err = await verifyC( + await issueCredential(kpb, cred(), true, documentLoader) + ); + expect(err).toHaveProperty("verified", false); + expect(err.results[0].error.toString()).toMatch( + /not authorized by controller/ + ); + }); + + test("behavior on empty input", () => { + const premises = []; + const to_prove = []; + const rules = []; + const proof = proveh(premises, to_prove, rules); + const valid = validateh(rules, proof); + expect(valid).toEqual({ assumed: [], implied: [] }); + }); + + // The user is able to input a set of credentials, along with an associated proof of composite + // claim[s]. + // + // The proof validator(DCK-70) correctly validates the proof. + // + // The verification result is provided to the user. + // + // The program reports all composite claims which were proven. + test("end to end, presentation to result", async () => { + const rules = sampleRules(); + const presentation = await validPresentation(); + const { issuer } = presentation.verifiableCredential[0]; + // here we prove that [a frobs b], a pretty easy proof as the axiom used is unconditional + presentation[expandedLogicProperty] = jsonLiteral([ + { + rule_index: 0, + instantiations: [], + }, + ]); + const all = await checkSoundness(presentation, rules); + expect(all).toEqual([ + [ + { Iri: "did:example:ebfeb1f712ebc6f1c276e12ec21" }, + { Iri: "http://schema.org/alumniOf" }, + { + Literal: { + value: "Example University", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + { Iri: issuer }, + ], + [ + { Iri: "https://example.com/credentials/1872" }, + { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }, + { Iri: "https://www.w3.org/2018/credentials#VerifiableCredential" }, + { Iri: issuer }, + ], + [ + { Iri: "https://example.com/credentials/1872" }, + { Iri: "https://www.w3.org/2018/credentials#credentialSubject" }, + { Iri: "did:example:ebfeb1f712ebc6f1c276e12ec21" }, + { Iri: issuer }, + ], + [ + { Iri: "https://example.com/credentials/1872" }, + { Iri: "https://www.w3.org/2018/credentials#issuanceDate" }, + { + Literal: { + value: "2010-01-01T19:23:24Z", + datatype: "http://www.w3.org/2001/XMLSchema#dateTime", + }, + }, + { Iri: issuer }, + ], + [ + { Iri: "https://example.com/credentials/1872" }, + { Iri: "https://www.w3.org/2018/credentials#issuer" }, + { Iri: issuer }, + { Iri: issuer }, + ], + [ + { Iri: "https://example.com/a" }, + { Iri: "https://example.com/frobs" }, + { Iri: "https://example.com/b" }, + { DefaultGraph: true }, + ], + ]); + }, 30000); + + // Soundness checking fails if and only if one of the following conditions occurs: + // - Proof assumes claims not attested to by the provided credentials and is therefore not verifiable. + // - Credential claims are not verifiable(credential verification fails) so proof is not verifiable. + + test("Proof including unstated claims should fail.", async () => { + const rules = sampleRules(); + const presentation = await validPresentation(); + presentation[expandedLogicProperty] = jsonLiteral([ + { + rule_index: 1, + instantiations: [{ Iri: "http://example.com/joeThePig" }], + }, + ]); + await expect(checkSoundness(presentation, rules)).rejects.toHaveProperty( + "unverifiedAssumption", + [ + { Iri: "http://example.com/joeThePig" }, + { Iri: "https://example.com/Ability" }, + { Iri: "https://example.com/Flight" }, + { DefaultGraph: true }, + ] + ); + }); + + test("Proof including inapplicable rule should fail.", async () => { + const rules = sampleRules(); + const presentation = await validPresentation(); + presentation[expandedLogicProperty] = jsonLiteral([ + { + rule_index: 0, + instantiations: [{ Iri: "http://example.com" }], + }, + ]); + await expect(checkSoundness(presentation, rules)).rejects.toEqual({ + InvalidProof: "BadRuleApplication", + }); + }); + + test("Unverifiable credential should fail.", async () => { + const rules = sampleRules(); + const presentation = await validPresentation(); + presentation.verifiableCredential[0].issuer = "did:dock:bobert"; // tamper + presentation[expandedLogicProperty] = jsonLiteral([ + { rule_index: 0, instantiations: [] }, + ]); + await expect( + checkSoundness(presentation, rules).catch((err) => + Promise.reject(JSON.stringify(err)) + ) + ).rejects.toMatch(/Invalid signature/); + }); + + test("bddap is named Gorgadon because joe is a pig that can fly", async () => { + const { did: pigchecker, suite: pigchecker_kp } = await newDid(); + const { did: faa, suite: faa_kp } = await newDid(); + + // if pigs can fly, then bddap is Gorgadon + const gorg = { + if_all: [ + [ + { Unbound: "pig" }, + { Bound: { Iri: "https://example.com/Ability" } }, + { Bound: { Iri: "https://example.com/Flight" } }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Unbound: "pig" }, + { Bound: rdf("type") }, + { Bound: { Iri: "https://example.com/Pig" } }, + { Bound: { DefaultGraph: true } }, + ], + ], + then: [ + [ + { Bound: { Iri: "did:dock:bddap" } }, + { Bound: { Iri: "http://xmlns.com/foaf/spec/#term_firstName" } }, + { + Bound: { + Literal: { + value: "Gorgadon", + datatype: + "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral", + }, + }, + }, + { Bound: { DefaultGraph: true } }, + ], + ], + }; + const licensing = { + // if a? lp? lo? licenser? + // and licenser? mayLicence li? + // and li? predicate lp? + // and li? object lo? + if_all: [ + [ + { Unbound: "a" }, + { Unbound: "lp" }, + { Unbound: "lo" }, + { Unbound: "licenser" }, + ], + [ + { Unbound: "licenser" }, + { Bound: { Iri: "https://example.com/mayLicense" } }, + { Unbound: "li" }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Unbound: "li" }, + { Bound: rdf("predicate") }, + { Unbound: "lp" }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Unbound: "li" }, + { Bound: rdf("object") }, + { Unbound: "lo" }, + { Bound: { DefaultGraph: true } }, + ], + ], + // then [a? lp? lo?], + then: [ + [ + { Unbound: "a" }, + { Unbound: "lp" }, + { Unbound: "lo" }, + { Bound: { DefaultGraph: true } }, + ], + ], + }; + const licenses = { + if_all: [], + then: [ + // the Federal Aviation Administration may grant the ability to fly + [ + { Bound: { Iri: faa } }, + { Bound: { Iri: "https://example.com/mayLicense" } }, + { Bound: { Iri: "uuid:5c4cfa6b-d96f-4a53-8786-2cce46cc51c4" } }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Bound: { Iri: "uuid:5c4cfa6b-d96f-4a53-8786-2cce46cc51c4" } }, + { Bound: rdf("predicate") }, + { Bound: { Iri: "https://example.com/Ability" } }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Bound: { Iri: "uuid:5c4cfa6b-d96f-4a53-8786-2cce46cc51c4" } }, + { Bound: rdf("object") }, + { Bound: { Iri: "https://example.com/Flight" } }, + { Bound: { DefaultGraph: true } }, + ], + // pigchecker is trusted to check whether something is a pig + [ + { Bound: { Iri: pigchecker } }, + { Bound: { Iri: "https://example.com/mayLicense" } }, + { Bound: { Iri: "uuid:6f165460-894a-4e51-a2a5-79b537678720" } }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Bound: { Iri: "uuid:6f165460-894a-4e51-a2a5-79b537678720" } }, + { Bound: rdf("predicate") }, + { Bound: rdf("type") }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Bound: { Iri: "uuid:6f165460-894a-4e51-a2a5-79b537678720" } }, + { Bound: rdf("object") }, + { Bound: { Iri: "https://example.com/Pig" } }, + { Bound: { DefaultGraph: true } }, + ], + ], + }; + const rules = [gorg, licensing, licenses]; + + const joe_is_a_pig = await issueCredential( + pigchecker_kp, + { + "@context": ["https://www.w3.org/2018/credentials/v1"], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential"], + issuer: pigchecker, + issuanceDate: "2010-01-01T19:23:24Z", + credentialSubject: { + "@id": "did:example:joe", + "@type": "https://example.com/Pig", + }, + }, + true, + documentLoader + ); + + const joe_can_fly = await issueCredential( + faa_kp, + { + "@context": ["https://www.w3.org/2018/credentials/v1"], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential"], + issuer: faa, + issuanceDate: "2010-01-01T19:23:24Z", + credentialSubject: { + "@id": "did:example:joe", + "https://example.com/Ability": { + "@id": "https://example.com/Flight", + }, + }, + }, + true, + documentLoader + ); + + const presentation = createPresentation( + [joe_can_fly, joe_is_a_pig], + "uuid:ce0d9145-934a-42b3-aa48-af1d27f33c2a", + "uuid:078644cf-de19-436c-9691-fbe8a569a1d4" + ); + + // create a proof that bddap is Gorgadon + const presentation_claimgraph = await presentationToEEClaimGraph( + await jsonld.expand(presentation, { documentLoader }) + ); + const claim_to_prove = [ + { Iri: "did:dock:bddap" }, + { Iri: "http://xmlns.com/foaf/spec/#term_firstName" }, + { + Literal: { + value: "Gorgadon", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral", + }, + }, + { DefaultGraph: true }, + ]; + expect(presentation_claimgraph).not.toContainEqual(claim_to_prove); + const proof = proveh(presentation_claimgraph, [claim_to_prove], rules); + presentation[expandedLogicProperty] = jsonLiteral(proof); + + const cg = await checkSoundness(presentation, rules); + expect(cg).toContainEqual(claim_to_prove); + }); + + test("holder: prove composite claim", async () => { + const presentation = await validPresentation(); + const expandedPresentation = await jsonld.expand(presentation, { + documentLoader, + }); + const compositeClaim = [ + { Iri: "https://example.com/a" }, + { Iri: "https://example.com/frobs" }, + { Iri: "https://example.com/b" }, + { DefaultGraph: true }, + ]; + const rules = sampleRules(); + const proof = await proveCompositeClaims( + expandedPresentation, + [compositeClaim], + rules + ); + expect(await checkSoundness(presentation, rules)).not.toContainEqual( + compositeClaim + ); + presentation[expandedLogicProperty] = proof; + expect(await checkSoundness(presentation, rules)).toContainEqual( + compositeClaim + ); + }, 30000); +}); + +// takes a verifiable presentation and rules, returns all claims which are known to be true under +// the given set of rules +// This function is intentionally not exposed publicly. +async function checkSoundness(presentation, rules) { + const ver = await verifyP(presentation); + if (!ver.verified) { + throw ver; + } + // Pre-expand the presentaion using local cache. Tests run pretty slow otherwise. + presentation = await jsonld.expand(presentation, { documentLoader }); + return acceptCompositeClaims(presentation, rules); +} + +function registerDid(did, keypair) { + if (registered(did)) { + throw `${did} already registered`; + } + + const publicKeyBase58 = b58.encode(keypair.publicKey.value.bytes); + const pk = { + id: `${did}#keys-1`, + type: keypair.type, + publicKeyBase58, + controller: did, + publicKey: keypair.publicKey.value, + }; + const doc = { + "@context": "https://www.w3.org/ns/did/v1", + id: did, + authentication: [pk.id], + assertionMethod: [pk.id], + publicKey: [pk], + }; + addDocument(did, doc); + addDocument(pk.id, { + "@context": "https://www.w3.org/ns/did/v1", + ...pk, + pkdoc: true, + }); +} + +function randoDID() { + return `did:dock:${randomAsHex(32).substring(2, 2 + 20)}`; +} + +async function verifyC(credential) { + return verifyCredential(credential, { + documentLoader, + }); +} + +async function verifyP(presentation) { + return verifyPresentation(presentation, { + documentLoader, + unsignedPresentation: true, + }); +} + +function getSampleKey(randomDID, keypair) { + return { + id: `${randomDID}#keys-1`, + controller: randomDID, + type: "EcdsaSecp256k1VerificationKey2019", + keypair, + thisisstring: "yes", + publicKey: keypair.publicKey(), + }; +} + +async function newDid() { + const kp = Secp256k1Keypair.random(); + const randomDID = randoDID(); + const keypair = getSampleKey(randomDID, kp); + registerDid(randomDID, keypair); + return { + did: randomDID, + suite: keypair, + }; +} + +async function validCredential() { + const { did: issuer, suite: kp } = await newDid(); + const cred = { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential"], + issuer, + issuanceDate: "2010-01-01T19:23:24Z", + credentialSubject: { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + }; + const credential = await issueCredential(kp, cred, true, documentLoader); + expect(await verifyC(credential)).toHaveProperty("verified", true); + return credential; +} + +/// makes an unsigned presentation +async function validPresentation() { + const creds = [await validCredential()]; + const { did: holder } = await newDid(); + const presentation = createPresentation( + creds, + `urn:${randomAsHex(16)}`, + holder + ); + expect(await verifyP(presentation)).toHaveProperty("verified", true); + return presentation; +} + +// https://w3c.github.io/json-ld-syntax/#json-literals +function jsonLiteral(json) { + return { + "@type": "@json", + "@value": JSON.parse(JSON.stringify(json)), + }; +} + +function sampleRules() { + return [ + { + if_all: [], + then: [ + [ + { Bound: { Iri: "https://example.com/a" } }, + { Bound: { Iri: "https://example.com/frobs" } }, + { Bound: { Iri: "https://example.com/b" } }, + { Bound: { DefaultGraph: true } }, + ], + ], + }, + { + if_all: [ + [ + { Unbound: "pig" }, + { Bound: { Iri: "https://example.com/Ability" } }, + { Bound: { Iri: "https://example.com/Flight" } }, + { Bound: { DefaultGraph: true } }, + ], + [ + { Unbound: "pig" }, + { + Bound: { Iri: "https://www.w3.org/1999/02/22-rdf-syntax-ns#type" }, + }, + { Bound: { Iri: "https://example.com/Pig" } }, + { Bound: { DefaultGraph: true } }, + ], + ], + then: [ + [ + { Bound: { Iri: "did:dock:bddap" } }, + { Bound: { Iri: "http://xmlns.com/foaf/spec/#term_firstName" } }, + { + Bound: { + Literal: { + value: "Gorgadon", + datatype: + "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral", + }, + }, + }, + { Bound: { DefaultGraph: true } }, + ], + ], + }, + ]; +} + +// It's common to use shorthand like `rdf:type`. This function let's us do something similar. +// expect(rdf('type')).toEqual({ Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' }); +function rdf(keyword) { + if (!["type", "subject", "predicate", "object"].includes(keyword)) { + throw `are you sure ${keyword} is part of the rdf: context?`; + } + return { Iri: `http://www.w3.org/1999/02/22-rdf-syntax-ns#${keyword}` }; +} diff --git a/packages/credential-sdk/tests/claimgraph.test.js b/packages/credential-sdk/tests/claimgraph.test.js new file mode 100644 index 000000000..2fa50cbcf --- /dev/null +++ b/packages/credential-sdk/tests/claimgraph.test.js @@ -0,0 +1,241 @@ +import jsonld from "jsonld"; +import { fromJsonldjsCg, merge } from "../src/rdf-and-cd"; + +describe("Claimgraph operations.", () => { + test("merge", async () => { + const cg1 = [ + [ + { Iri: "https://example.com/credentials/1872" }, + { + Literal: { + value: "Example University", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + { Blank: "_:b1" }, + { DefaultGraph: true }, + ], + [ + { Blank: "_:b1" }, + { Blank: "_:b3" }, + { Blank: "_:b5" }, + { Blank: "_:b6" }, + ], + ]; + const cg2 = [ + [ + { Blank: "_:b1" }, + { Blank: "_:b4" }, + { Blank: "_:b5" }, + { Blank: "_:b6" }, + ], + ]; + expect(merge([])).toEqual([]); + expect(merge([cg1])).toEqual([ + [ + { Iri: "https://example.com/credentials/1872" }, + { + Literal: { + value: "Example University", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + { Blank: "_:b0" }, + { DefaultGraph: true }, + ], + [ + { Blank: "_:b0" }, + { Blank: "_:b1" }, + { Blank: "_:b2" }, + { Blank: "_:b3" }, + ], + ]); + expect(merge([cg2])).toEqual([ + [ + { Blank: "_:b0" }, + { Blank: "_:b1" }, + { Blank: "_:b2" }, + { Blank: "_:b3" }, + ], + ]); + expect(merge([cg2, cg2])).toEqual([ + [ + { Blank: "_:b0" }, + { Blank: "_:b1" }, + { Blank: "_:b2" }, + { Blank: "_:b3" }, + ], + [ + { Blank: "_:b4" }, + { Blank: "_:b5" }, + { Blank: "_:b6" }, + { Blank: "_:b7" }, + ], + ]); + expect(merge([cg1, cg2])).toEqual([ + [ + { Iri: "https://example.com/credentials/1872" }, + { + Literal: { + value: "Example University", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + { Blank: "_:b0" }, + { DefaultGraph: true }, + ], + [ + { Blank: "_:b0" }, + { Blank: "_:b1" }, + { Blank: "_:b2" }, + { Blank: "_:b3" }, + ], + [ + { Blank: "_:b4" }, + { Blank: "_:b5" }, + { Blank: "_:b6" }, + { Blank: "_:b7" }, + ], + ]); + }); + + test("convert claimgraph from jsonld-js represention", async () => { + const jcg = [ + { + subject: { + termType: "NamedNode", + value: "did:example:ebfeb1f712ebc6f1c276e12ec21", + }, + predicate: { + termType: "NamedNode", + value: "http://schema.org/alumniOf", + }, + object: { + termType: "Literal", + value: "Example University", + datatype: { + termType: "NamedNode", + value: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + graph: { termType: "BlankNode", value: "_:b0" }, + }, + { + subject: { + termType: "NamedNode", + value: "https://example.com/credentials/1872", + }, + predicate: { + termType: "NamedNode", + value: "https://w3id.org/security#proof", + }, + object: { termType: "BlankNode", value: "_:b1" }, + graph: { termType: "BlankNode", value: "_:b0" }, + }, + ]; + expect(fromJsonldjsCg(jcg)).toEqual([ + [ + { Iri: "did:example:ebfeb1f712ebc6f1c276e12ec21" }, + { Iri: "http://schema.org/alumniOf" }, + { + Literal: { + value: "Example University", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML", + }, + }, + { Blank: "_:b0" }, + ], + [ + { Iri: "https://example.com/credentials/1872" }, + { Iri: "https://w3id.org/security#proof" }, + { Blank: "_:b1" }, + { Blank: "_:b0" }, + ], + ]); + }); + + // The claim graphs of credentials are combined in a safe manner; blank nodes from one credential + // must not be conflated with those from another. Depending on the claim graph representation, + // this may require renaming of blank nodes, or rejection of credential sets where blank node + // names are shared between credentials. + test("no blank_node conflations", () => { + const cg1 = [ + [ + { Iri: "https://example.com/a" }, + { Iri: "https://example.com/parent" }, + { Blank: "_:b0" }, + { DefaultGraph: true }, + ], + ]; + const cg2 = [ + [ + { Blank: "_:b0" }, + { Iri: "https://example.com/parent" }, + { Iri: "https://example.com/b" }, + { DefaultGraph: true }, + ], + ]; + const merged = merge([cg1, cg2]); + + // It should not be provable that [a grandparent b] because `_:b0` in + // cg1 is not the same as `_:b0` in cg2. Given this result, this property + // is apparent. + expect(merged).toEqual([ + [ + { Iri: "https://example.com/a" }, + { Iri: "https://example.com/parent" }, + { Blank: "_:b0" }, + { DefaultGraph: true }, + ], + [ + { Blank: "_:b1" }, + { Iri: "https://example.com/parent" }, + { Iri: "https://example.com/b" }, + { DefaultGraph: true }, + ], + ]); + }); + + test("moron != carrot. https://github.com/docknetwork/sdk/issues/173", async () => { + const jld = { + "https://example.com/a": [ + { + "@value": "moron", + "@language": "en", + }, + { + "@value": "moron", + "@language": "cy", + }, + ], + }; + const cg = fromJsonldjsCg(await jsonld.toRDF(jld)); + expect(cg[0]).not.toEqual(cg[1]); + expect(cg).toEqual([ + [ + { Blank: "_:b0" }, + { Iri: "https://example.com/a" }, + { + Literal: { + value: "moron", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", + language: "en", + }, + }, + { DefaultGraph: true }, + ], + [ + { Blank: "_:b0" }, + { Iri: "https://example.com/a" }, + { + Literal: { + value: "moron", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", + language: "cy", + }, + }, + { DefaultGraph: true }, + ], + ]); + }); +}); diff --git a/packages/credential-sdk/tests/crawl.test.js b/packages/credential-sdk/tests/crawl.test.js new file mode 100644 index 000000000..123151470 --- /dev/null +++ b/packages/credential-sdk/tests/crawl.test.js @@ -0,0 +1,215 @@ +import { newEngine } from "@comunica/actor-init-sparql-rdfjs"; + +import { crawl } from "../src/rdf-and-cd"; +import { ANYCLAIM, MAYCLAIM, MAYCLAIM_DEF_1 } from "../src/rdf-and-cd"; +import { assertValidNode } from "../src/rdf-and-cd/common"; + +const ATTESTS = "https://rdf.dock.io/alpha/2021#attestsDocumentContents"; +const LIKES = "http://purl.org/spar/cito/likes"; +const IDENT = "http://purl.org/dc/terms/identifier"; +const KNOWS = "http://xmlns.com/foaf/0.1/knows"; + +describe("Crawler unit tests", () => { + test("happy path", async () => { + const RULES = [ + ...MAYCLAIM_DEF_1, + { + if_all: [ + [ + { Unbound: "a" }, + { Bound: { Iri: ATTESTS } }, + { Unbound: "doc" }, + { Unbound: "a" }, + ], + ], + then: [ + [ + { Unbound: "doc" }, + { Bound: { Iri: MAYCLAIM } }, + { Bound: { Iri: ANYCLAIM } }, + { Unbound: "a" }, + ], + ], + }, + ]; + const CURIOSITY = ` + prefix dockalpha: + + select ?lookupNext where { + graph { + ?lookupNext dockalpha:mayClaim dockalpha:ANYCLAIM . + } + } + `; + const supergraph = { + "did:root": [[{ Iri: "did:b" }, { Iri: MAYCLAIM }, { Iri: ANYCLAIM }]], + "did:b": [ + [{ Iri: "did:b" }, { Iri: ATTESTS }, { Iri: "b:attestations" }], + // this tests blank node hygiene by using the same blank node name in separate documents + [{ Iri: "did:b" }, { Iri: KNOWS }, { Blank: "_:b0" }], + ], + "b:attestations": [ + [{ Iri: "did:c" }, { Iri: MAYCLAIM }, { Iri: ANYCLAIM }], + [{ Iri: "did:b" }, { Iri: LIKES }, { Blank: "_:b0" }], + [ + { Blank: "_:b0" }, + { Iri: IDENT }, + { + Literal: { + value: "978-0-06-245871-1", + datatype: "https://www.w3.org/2001/XMLSchema#string", + }, + }, + ], + ], + // did:c makes no attestations + }; + const resolveGraph = graphResolver(supergraph); + + const initialFacts = await resolveGraph({ Iri: "did:root" }); + const allFacts = await crawl( + initialFacts, + RULES, + CURIOSITY, + resolveGraph, + newEngine() + ); + expect(allFacts).toEqual([ + [ + { Iri: "did:b" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:b" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { Iri: "b:attestations" }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://xmlns.com/foaf/0.1/knows" }, + { Blank: "_:b0" }, + { Iri: "did:b" }, + ], + [ + { Iri: "b:attestations" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://xmlns.com/foaf/0.1/knows" }, + { Blank: "_:b0" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:b" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { Iri: "b:attestations" }, + { Iri: "did:root" }, + ], + [ + { Iri: "b:attestations" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "b:attestations" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Blank: "_:b1" }, + { Iri: "b:attestations" }, + ], + [ + { Blank: "_:b1" }, + { Iri: "http://purl.org/dc/terms/identifier" }, + { + Literal: { + value: "978-0-06-245871-1", + datatype: "https://www.w3.org/2001/XMLSchema#string", + }, + }, + { Iri: "b:attestations" }, + ], + [ + { Blank: "_:b1" }, + { Iri: "http://purl.org/dc/terms/identifier" }, + { + Literal: { + datatype: "https://www.w3.org/2001/XMLSchema#string", + value: "978-0-06-245871-1", + }, + }, + { Iri: "did:b" }, + ], + [ + { Blank: "_:b1" }, + { Iri: "http://purl.org/dc/terms/identifier" }, + { + Literal: { + datatype: "https://www.w3.org/2001/XMLSchema#string", + value: "978-0-06-245871-1", + }, + }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Blank: "_:b1" }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Blank: "_:b1" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + ]); + }, 10000); +}); + +function graphResolver(sg) { + async function resolveGraph(term) { + assertValidNode(term); + if (!("Iri" in term)) { + return []; + } + const iri = term.Iri; + if (!(iri in sg)) { + // Some users may wish to customize what happens when a lookup fails + // for example they may want to log an error, that is up to them. + // Here we just return the empty graph. + return []; + } + return sg[iri].map((triple) => [ + triple[0], + triple[1], + triple[2], + { Iri: iri }, + ]); + } + + return resolveGraph; +} diff --git a/tests/data/static-bbs-cred-610.json b/packages/credential-sdk/tests/data/static-bbs-cred-610.json similarity index 94% rename from tests/data/static-bbs-cred-610.json rename to packages/credential-sdk/tests/data/static-bbs-cred-610.json index da1267a9b..dd2a8b2b5 100644 --- a/tests/data/static-bbs-cred-610.json +++ b/packages/credential-sdk/tests/data/static-bbs-cred-610.json @@ -8,10 +8,7 @@ } ], "id": "https://creds-staging.dock.io/be2b56a51e0ec8aa2ee5e92a0267a82bff6cc11a5f2275cfc8b014f3b9422a21", - "type": [ - "VerifiableCredential", - "BasicCredential" - ], + "type": ["VerifiableCredential", "BasicCredential"], "credentialSubject": { "id": "mysnjid", "name": "sbj name" diff --git a/tests/data/static-bbs-cred-630.json b/packages/credential-sdk/tests/data/static-bbs-cred-630.json similarity index 94% rename from tests/data/static-bbs-cred-630.json rename to packages/credential-sdk/tests/data/static-bbs-cred-630.json index 8a9eabb42..5198daad7 100644 --- a/tests/data/static-bbs-cred-630.json +++ b/packages/credential-sdk/tests/data/static-bbs-cred-630.json @@ -8,10 +8,7 @@ } ], "id": "https://creds-staging.dock.io/0985a64f2910e74c48e4066fa683e4cdd9c54d021f6b83a9fd8cb56db9c460e3", - "type": [ - "VerifiableCredential", - "BasicCredential" - ], + "type": ["VerifiableCredential", "BasicCredential"], "credentialSubject": { "name": "basic bbs static" }, @@ -39,4 +36,4 @@ "proofPurpose": "assertionMethod", "proofValue": "zaEUvk9cmVeVrHueiKMKPwxtV3zab2fRiVkGmah74rFnyXbQtYBtyrGs4zmVTs2jrrWQzeHsgNjf4H1MYMqVjvQmKCfnw4PPjMXS2p8gYQiwm8XaJJwSjT94p1af1ygHrbkpjQmMafPf3gfVqRbyvULW2G" } -} +} diff --git a/tests/data/static-did-dock.json b/packages/credential-sdk/tests/data/static-did-dock.json similarity index 88% rename from tests/data/static-did-dock.json rename to packages/credential-sdk/tests/data/static-did-dock.json index 443f87978..c55b070ee 100644 --- a/tests/data/static-did-dock.json +++ b/packages/credential-sdk/tests/data/static-did-dock.json @@ -1,11 +1,7 @@ { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], + "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:dock:5GZn9zQTggPWijzgnoV8sZ5a74rFqC8qrz2ncp7GggeGCtKd", - "controller": [ - "did:dock:5GZn9zQTggPWijzgnoV8sZ5a74rFqC8qrz2ncp7GggeGCtKd" - ], + "controller": ["did:dock:5GZn9zQTggPWijzgnoV8sZ5a74rFqC8qrz2ncp7GggeGCtKd"], "publicKey": [ { "id": "did:dock:5GZn9zQTggPWijzgnoV8sZ5a74rFqC8qrz2ncp7GggeGCtKd#keys-1", diff --git a/packages/credential-sdk/tests/data/test-keys.js b/packages/credential-sdk/tests/data/test-keys.js new file mode 100644 index 000000000..84657df27 --- /dev/null +++ b/packages/credential-sdk/tests/data/test-keys.js @@ -0,0 +1,41 @@ +import { Secp256k1Keypair } from "../../src/keypairs"; + +const keypairEcdsaSecp256k1 = new Secp256k1Keypair( + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" +); + +// TODO: add more testing keys (ed25519 etc) +export default [ + { + sigType: "JsonWebSignature2020", + keyDocument: { + "@context": "https://w3id.org/security/suites/jws-2020/v1", + id: "urn:JsonWebKey2020#keys-1", + controller: "urn:JsonWebKey2020", + type: "JsonWebKey2020", + publicKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + }, + privateKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + d: "Wq5_KgqjvYh_EGvBDYtSs_0ufJJP0y0tkAXl6GqxHMkY0QP8vmD76mniXD-BWhd_", + }, + }, + }, + { + sigType: "EcdsaSecp256k1Signature2019", + keyDocument: { + id: "urn:EcdsaSecp256k1VerificationKey2019#keys-1", + controller: "urn:EcdsaSecp256k1VerificationKey2019", + type: "EcdsaSecp256k1VerificationKey2019", + keypair: keypairEcdsaSecp256k1, + publicKey: keypairEcdsaSecp256k1.publicKey(), + }, + }, +]; diff --git a/packages/credential-sdk/tests/did.test.js b/packages/credential-sdk/tests/did.test.js new file mode 100644 index 000000000..562a803f6 --- /dev/null +++ b/packages/credential-sdk/tests/did.test.js @@ -0,0 +1,164 @@ +import { randomAsHex, encodeAsSS58 } from "../src/utils"; + +import { DockDidOrDidMethodKey, DockDid, DidMethodKey } from "../src/types/did"; + +const hexDid = (did) => DockDid.from(did).toHex(); + +describe("`DockDidOrDidMethodKey.from`", () => { + test("`DockDid.from` work for a raw did", () => { + const result = DockDid.from( + "5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk" + ); + expect(result.did.value).toEqual( + "0x338afad72761cffcd0619b8e00fe64a32f79463143e0e812a76b1030c593bb4e" + ); + + expect(() => + DockDidOrDidMethodKey.from( + "5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk" + ) + ).toThrowErrorMatchingSnapshot(); + }); + + test("`DidMethodKey.from` work for a raw did:key", () => { + const result = DidMethodKey.from( + "zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme" + ); + expect(result.didMethodKey.secp256k1.value).toEqual( + "0x03874c15c7fda20e539c6e5ba573c139884c351188799f5458b4b41f7924f235cd" + ); + expect(result.toString()).toEqual( + "did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme" + ); + + expect(() => + DockDidOrDidMethodKey.from( + "zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme" + ) + ).toThrowErrorMatchingSnapshot(); + }); + + test("`DockDidOrDidMethodKey.from`/`DockDid.from` work for did:dock", () => { + const classes = [DockDidOrDidMethodKey, DockDid]; + + for (const Did of classes) { + const result = Did.from( + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk" + ); + expect(result.did.value).toEqual( + "0x338afad72761cffcd0619b8e00fe64a32f79463143e0e812a76b1030c593bb4e" + ); + } + }); + + test("`DockDidOrDidMethodKey.from`/`DidMethodKey.from` works for did:key secp256k1", () => { + const classes = [DockDidOrDidMethodKey, DidMethodKey]; + + for (const Did of classes) { + const result = Did.from( + "did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme" + ); + expect(result.didMethodKey.secp256k1.value).toEqual( + "0x03874c15c7fda20e539c6e5ba573c139884c351188799f5458b4b41f7924f235cd" + ); + expect(result.toString()).toEqual( + "did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme" + ); + } + }); + + test("`DockDidOrDidMethodKey.from`/`DidMethodKey.from` works for did:key ed25519", () => { + const classes = [DockDidOrDidMethodKey, DidMethodKey]; + + for (const Did of classes) { + const result = Did.from( + "did:key:z6MktvqCyLxTsXUH1tUZncNdVeEZ7hNh7npPRbUU27GTrYb8" + ); + expect(result.didMethodKey.ed25519.value).toEqual( + "0xd713cb7f8624d8648496e01010f2bd72f0dcbbdecdb7036f38c20475f5f429bf" + ); + expect(result.toString()).toEqual( + "did:key:z6MktvqCyLxTsXUH1tUZncNdVeEZ7hNh7npPRbUU27GTrYb8" + ); + } + }); +}); + +describe("DID utilities", () => { + test("On input as 40 byte hex, validateDockDIDIdentifier throws error", () => { + expect(() => new DockDid(randomAsHex(40))).toThrow( + /Received `40` items while expected `32` by `DockDidValue`/ + ); + }); + + test("On input as 30 byte hex, validateDockDIDIdentifier throws error", () => { + expect(() => new DockDid(randomAsHex(30))).toThrow( + /Received `30` items while expected `32` by `DockDidValue`/ + ); + }); + + test("On input as 32 byte hex, validateDockDIDIdentifier does not throw error", () => { + expect(() => new DockDid(randomAsHex(32))).not.toThrow(); + }); + + test("On input as 33 byte hex, hexDid throws error", () => { + const hex = randomAsHex(33); + expect(() => hexDid(hex)).toThrow( + /Received `33` items while expected `32` by `DockDidValue`/ + ); + }); + + test("On input as 32 byte hex, hexDid returns the input", () => { + const hex = randomAsHex(32); + expect(hexDid(hex)).toBe(hex); + }); + + test("On input invalid ss58 but with qualifier, hexDid throws error", () => { + const did = `${DockDid.Qualifier}oO12`; + // Without the qualifier, the function tries to parse as hex + expect(() => hexDid(did)).toThrow(/Invalid ss58/); + }); + + test("On input fully qualified Dock DID, hexDid returns valid hex representation", () => { + // create a valid DID + const hex = randomAsHex(32); + const did = `${DockDid.Qualifier}${encodeAsSS58(hex)}`; + expect(hexDid(did)).toBe(hex); + }); + + test("On input valid SS58 and with qualifier but smaller than 32 bytes, hexDid throws error", () => { + const hex = randomAsHex(8); + const did = `${DockDid.Qualifier}${encodeAsSS58(hex)}`; + // Without the qualifier, the function tries to parse as hex + expect(() => hexDid(did)).toThrow( + /Received `8` items while expected `32` by `DockDidValue`/ + ); + }); + + test("On input valid SS58 and with qualifier but larger than 32 bytes, hexDid throws error", () => { + const ss58 = encodeAsSS58(randomAsHex(32)); + const did = `${DockDid.Qualifier}${ss58}${ss58}`; + // Without the qualifier, the function tries to parse as hex + expect(() => hexDid(did)).toThrow(/Invalid ss58/); + }); + + test("On input valid SS58 identifier but smaller than 32 bytes, validateDockDIDSS58Identifier throws error", () => { + const ss58 = encodeAsSS58(randomAsHex(8)); + expect(() => DockDid.fromQualifiedString(ss58)).toThrow( + /Received `8` items while expected `32` by `DockDidValue`/ + ); + }); + + test("On input valid SS58 identifier but larger than 32 bytes, DockDid.fromQualifiedString throws error", () => { + const ss58 = encodeAsSS58(randomAsHex(32)); + const did = `${ss58}${ss58}`; + expect(() => DockDid.fromQualifiedString(did)).toThrow( + /Invalid ss58 address/ + ); + }); + + test("On input valid SS58 identifier, DockDid.fromQualifiedString does not throw error", () => { + const ss58 = encodeAsSS58(randomAsHex(32)); + expect(() => DockDid.fromQualifiedString(ss58)).not.toThrow(); + }); +}); diff --git a/packages/credential-sdk/tests/document.test.js b/packages/credential-sdk/tests/document.test.js new file mode 100644 index 000000000..5989fe094 --- /dev/null +++ b/packages/credential-sdk/tests/document.test.js @@ -0,0 +1,82 @@ +import { VerificationRelationship, DidKey } from "../src/types/did"; +import { DIDDocument } from "../src/types/did/document"; +import { PublicKeyEd25519 } from "../src/types"; + +const RANDOM_PKS = [ + "0xa1aa6a2058dd190e284a64e72adaf4e16a9ae9fbf0673d7575924e6aca3b21dc", + "0xed28a616e8f8cfd2232b62dac57281b24fc0d538150f8f5d91a0b6c3255cc2c9", + "0x3f10af3f08a442251510f61ef2395b6419f30f5eaac2114864f72731452a71ec", + "0xc9b4c22c2f5738b0adaf605a8233cdc2451c5ece045c25a3bc2b4c840fe9b11d", + "0x86839d44e6f15cd21ede6e4db64c60b57cb4c5f6030212f48468090c1ed823ed", + "0x91253c4b3401eade456953934325153c908444b8ea2705f8ee71e600bee6b0bc", + "0xddf88ee3d89f5890ab0b14d37b9189e62cf88baf375557f917994edaec8b296d", + "0x9d1aa9f5f7990737f670accdbdb8808ab4cbf256e6aaac73cba8bd89aa04befb", + "0xacfa7cba73ee6d09d280c157b5e25c4354da462103568f3c2036f714de1a8b18", + "0x853a2e866edb66d965326c019f039bc9c3b83d02ee5aa316fbe41edf55c45e0f", + "0x97349a1977e401a9472587c2f81473fb20967c0f24b6dd1d1c8fb2a3833f6374", +].map((bytes) => new PublicKeyEd25519(bytes)); + +describe("`DIDDocument`", () => { + const AUTH = new VerificationRelationship().setAuthentication(); + const ASSERT = new VerificationRelationship().setAssertion(); + const CAP_INV = new VerificationRelationship().setCapabilityInvocation(); + const KEY_AGR = new VerificationRelationship().setKeyAgreement(); + + test(`DIDDocument.from works`, () => { + const doc = { + "@context": ["test"], + id: "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + controller: ["did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk"], + verificationMethod: [ + { + controller: + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + id: "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk#keys-3", + publicKeyBase58: "EaNp37NGpe8KViTKxAdknyvUP44doH1fHnFpYqEcfUjE", + type: "Ed25519VerificationKey2018", + }, + ], + }; + + expect(DIDDocument.from(doc)).toMatchSnapshot(); + }); + + test("`DIDDocument.create` works", () => { + expect( + DIDDocument.create( + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + [], + [], + [] + ) + ).toMatchSnapshot(); + + expect( + DIDDocument.create( + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + [ + new DidKey(RANDOM_PKS[0], AUTH), + new DidKey(RANDOM_PKS[1], ASSERT), + new DidKey(RANDOM_PKS[2], CAP_INV), + new DidKey(RANDOM_PKS[3], AUTH | ASSERT), + new DidKey(RANDOM_PKS[4], AUTH | CAP_INV), + new DidKey(RANDOM_PKS[5], ASSERT | CAP_INV), + new DidKey(RANDOM_PKS[6], AUTH | ASSERT | CAP_INV), + new DidKey(RANDOM_PKS[7], KEY_AGR), + ], + ["did:key:z6MktvqCyLxTsXUH1tUZncNdVeEZ7hNh7npPRbUU27GTrYb8"], + [] + ) + ).toMatchSnapshot(); + + expect( + DIDDocument.create( + "did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk", + [], + [], + [], + { context: ["overriden"] } + ) + ).toMatchSnapshot(); + }); +}); diff --git a/packages/credential-sdk/tests/ipfs/crawl.test.disabled.js b/packages/credential-sdk/tests/ipfs/crawl.test.disabled.js new file mode 100644 index 000000000..1fe585fa2 --- /dev/null +++ b/packages/credential-sdk/tests/ipfs/crawl.test.disabled.js @@ -0,0 +1,228 @@ +import { newEngine } from "@comunica/actor-init-sparql-rdfjs"; +import { createHelia } from "helia"; +import { strings } from "@helia/strings"; +import { + crawl, + graphResolver, + ANYCLAIM, + MAYCLAIM, + MAYCLAIM_DEF_1, +} from "../../dist/esm/rdf-and-cd"; +import { documentLoader, addDocument } from "../utils/cached-document-loader"; + +const ipfsDefaultConfig = "http://127.0.0.1:5001"; + +const ATTESTS = "https://rdf.dock.io/alpha/2021#attestsDocumentContents"; + +const ipfsContent = { + rootatt: ` + @prefix dockalpha: . + dockalpha:mayClaim dockalpha:ANYCLAIM . + `, + batt: ` + @prefix dockalpha: . + dockalpha:mayClaim dockalpha:ANYCLAIM . + . + `, +}; + +async function ipfsAdd(ipfsClient, content) { + const cid = await ipfsClient.add(content); + return `ipfs://${cid.toV1()}`; +} + +describe("Crawler", () => { + let ipfsClient; + let rootattIri; + let battIri; + + beforeAll(async () => { + ipfsClient = strings(await createHelia(ipfsDefaultConfig)); + + rootattIri = await ipfsAdd(ipfsClient, ipfsContent.rootatt); + battIri = await ipfsAdd(ipfsClient, ipfsContent.batt); + + addDocument("did:root", { + "@id": "did:root", + [ATTESTS]: { "@id": rootattIri }, + }); + addDocument("did:b", { + "@id": "did:root", + [ATTESTS]: { "@id": battIri }, + }); + }); + + test("happy path", async () => { + const RULES = [ + ...MAYCLAIM_DEF_1, + { + if_all: [ + [ + { Unbound: "a" }, + { Bound: { Iri: ATTESTS } }, + { Unbound: "doc" }, + { Unbound: "a" }, + ], + ], + then: [ + [ + { Unbound: "doc" }, + { Bound: { Iri: MAYCLAIM } }, + { Bound: { Iri: ANYCLAIM } }, + { Unbound: "a" }, + ], + ], + }, + ]; + const CURIOSITY = ` + prefix dockalpha: + + select ?lookupNext where { + graph { + ?lookupNext dockalpha:mayClaim dockalpha:ANYCLAIM . + } + } + `; + + const failedLookups = []; + const resolveGraph = graphResolver( + ipfsClient, + documentLoader, + (term, _err) => failedLookups.push(term) + ); + const initialFacts = await resolveGraph({ Iri: "did:root" }); + const allFacts = await crawl( + initialFacts, + RULES, + CURIOSITY, + resolveGraph, + newEngine() + ); + expect(failedLookups).toEqual([{ Iri: "did:c" }]); + expect(allFacts).toEqual([ + [ + { Iri: "did:root" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { Iri: rootattIri }, + { Iri: "did:root" }, + ], + [ + { Iri: rootattIri }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:b" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: rootattIri }, + ], + [ + { Iri: "did:b" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:root" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { Iri: battIri }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:root" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { Iri: battIri }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:root" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { Iri: battIri }, + { Iri: rootattIri }, + ], + [ + { Iri: battIri }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:b" }, + ], + [ + { Iri: battIri }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + [ + { Iri: battIri }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: rootattIri }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: battIri }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Iri: "isbn:978-0-06-245871-1" }, + { Iri: battIri }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Iri: "isbn:978-0-06-245871-1" }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Iri: "isbn:978-0-06-245871-1" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:b" }, + { Iri: "http://purl.org/spar/cito/likes" }, + { Iri: "isbn:978-0-06-245871-1" }, + { Iri: rootattIri }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:b" }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:root" }, + ], + [ + { Iri: "did:c" }, + { Iri: "https://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "https://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: rootattIri }, + ], + ]); + }); + + test("graphResolver", async () => { + const resolveGraph = graphResolver(ipfsClient, documentLoader); + const initialfacts = await resolveGraph({ Iri: "did:root" }); + expect(initialfacts).toEqual([ + [ + { Iri: "did:root" }, + { Iri: "https://rdf.dock.io/alpha/2021#attestsDocumentContents" }, + { + Iri: "ipfs://bafkreiddpez3cqhuje7j3b3xwuhyydis5lzsihdavxnigejhtpnod6eiha", + }, + { Iri: "did:root" }, + ], + ]); + }); +}); diff --git a/tests/ipfs/ipfs.test.js b/packages/credential-sdk/tests/ipfs/ipfs.test.disabled.js similarity index 54% rename from tests/ipfs/ipfs.test.js rename to packages/credential-sdk/tests/ipfs/ipfs.test.disabled.js index 6e98a0fdc..19264b59a 100644 --- a/tests/ipfs/ipfs.test.js +++ b/packages/credential-sdk/tests/ipfs/ipfs.test.disabled.js @@ -1,21 +1,21 @@ -const ipfsDefaultConfig = 'http://localhost:5001'; +const ipfsDefaultConfig = "http://localhost:5001"; const rdfInput = ` @prefix : . :a :b ( "apple" "banana" ) . `; -const rdfCID = 'bafkreia2fxwzy4hs6pkl7aygxl4t7ws2euxs7jbkp7qacmljqful2anwei'; +const rdfCID = "bafkreia2fxwzy4hs6pkl7aygxl4t7ws2euxs7jbkp7qacmljqful2anwei"; -describe('IPFS', () => { +describe("IPFS", () => { let ipfsClient; beforeAll(async () => { - const { createHelia } = await import('helia'); - const { strings } = await import('@helia/strings'); + const { createHelia } = await import("helia"); + const { strings } = await import("@helia/strings"); ipfsClient = strings(await createHelia(ipfsDefaultConfig)); }); - test('Can dereference document from IPFs', async () => { + test("Can dereference document from IPFs", async () => { // Write document to node const cid = await ipfsClient.add(rdfInput); expect(cid.toString()).toEqual(rdfCID); @@ -25,9 +25,9 @@ describe('IPFS', () => { expect(document).toEqual(rdfInput); }, 10000); - test('Dereference from IPNS fails', async () => { + test("Dereference from IPNS fails", async () => { await expect( - ipfsClient.get('/ipns/QmSrPmbaUKA3ZodhzPWZnpFgcPMFWF4QsxXbkWfEptTBJd'), + ipfsClient.get("/ipns/QmSrPmbaUKA3ZodhzPWZnpFgcPMFWF4QsxXbkWfEptTBJd") ).rejects.toThrow(); }, 10000); }); diff --git a/packages/credential-sdk/tests/issuing.test.js b/packages/credential-sdk/tests/issuing.test.js new file mode 100644 index 000000000..149d42d03 --- /dev/null +++ b/packages/credential-sdk/tests/issuing.test.js @@ -0,0 +1,542 @@ +// Mock fetch +import mockFetch from "./mocks/fetch"; + +import { + issueCredential, + verifyCredential, + verifyPresentation, + signPresentation, +} from "../src/vc"; +import VerifiableCredential from "../src/vc/verifiable-credential"; +import VerifiablePresentation from "../src/vc/verifiable-presentation"; +import testingKeys from "./data/test-keys"; + +mockFetch(); + +// Test constants +const issuanceDate = "2020-04-15T09:05:35Z"; + +const vpId = "https://example.com/credentials/12345"; +const vpHolder = "https://example.com/credentials/1234567890"; +const sampleId = "http://example.edu/credentials/2803"; +const fakeContext = { + "@context": { + "@protected": true, + id: "@id", + type: "@type", + }, +}; + +function getSampleCredential() { + return { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential", "AlumniCredential"], + issuanceDate, + credentialSubject: { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + }; +} + +function getSamplePres(presentationCredentials) { + return { + "@context": ["https://www.w3.org/2018/credentials/v1"], + type: ["VerifiablePresentation"], + verifiableCredential: presentationCredentials, + id: vpId, + holder: vpHolder, + }; +} + +testingKeys.forEach((testKey) => { + const { sigType, keyDocument } = testKey; + const keyUrl = keyDocument.id; + const controllerUrl = keyDocument.controller; + + describe(`Verifiable Credential Issuing [${keyDocument.type}]`, () => { + test("Issuing should return an object with a proof, and it must pass validation.", async () => { + const credential = await issueCredential( + testKey.keyDocument, + getSampleCredential() + ); + expect(credential.id).toBe("https://example.com/credentials/1872"); + expect(credential.type).toContain("VerifiableCredential"); + expect(credential.type).toContain("AlumniCredential"); + expect(credential.issuanceDate).toBe(issuanceDate); + expect(credential.credentialSubject.id).toBe( + "did:example:ebfeb1f712ebc6f1c276e12ec21" + ); + expect(credential.credentialSubject.alumniOf).toBe("Example University"); + expect(credential.issuer).toBe(controllerUrl); + expect(credential.proof.type).toBe(sigType); + expect(credential.proof.created).toBeDefined(); + expect(credential.proof.proofPurpose).toBe("assertionMethod"); + expect(credential.proof.verificationMethod).toBe(keyUrl); + + const result = await verifyCredential(credential); + expect(result.verified).toBe(true); + expect(result.results[0].proof).toBeDefined(); + expect(result.results[0].proof.proofPurpose).toBe("assertionMethod"); + expect(result.results[0].proof.type).toBe(sigType); + expect(result.results[0].proof.verificationMethod).toBe(keyUrl); + expect(result.results[0].verified).toBe(true); + }, 30000); + + // JsonWebKey signatures cant use proofValue + if (keyDocument.type !== "JsonWebKey2020") { + test("Issuing should return an object with a proof, and it must pass validation (using proofValue).", async () => { + const credential = await issueCredential( + testKey.keyDocument, + getSampleCredential(), + true, + null, + null, + null, + null, + false, + "proofValue" + ); + expect(credential.proof.proofValue).toBeDefined(); + const result = await verifyCredential(credential); + expect(result.verified).toBe(true); + }, 30000); + } + + test("Issuing should return a valid JWT, and it must pass validation", async () => { + const credential = await issueCredential( + testKey.keyDocument, + getSampleCredential(), + true, + null, + null, + null, + null, + false, + "jwt" + ); + expect(typeof credential).toEqual("string"); + const result = await verifyCredential(credential); + expect(result.verified).toBe(true); + }, 30000); + + test("Tampered Credential should not pass validation.", async () => { + const credential = await issueCredential( + testKey.keyDocument, + getSampleCredential() + ); + credential.issuanceDate = "9020-04-15T09:05:35Z"; + const result = await verifyCredential(credential); + expect(result.verified).toBe(false); + }, 30000); + + test("Expired Credential should not pass validation with verifyDates as true", async () => { + const credential = await issueCredential(testKey.keyDocument, { + ...getSampleCredential(), + expirationDate: new Date("2000-01-01T09:05:35Z").toISOString(), + }); + const result = await verifyCredential(credential); + expect(result.verified).toBe(false); + expect(result.error.message).toEqual("Credential has expired"); + }, 30000); + + test("Expired Credential should pass validation with verifyDates as false", async () => { + const credential = await issueCredential(testKey.keyDocument, { + ...getSampleCredential(), + expirationDate: new Date("2000-01-01T09:05:35Z").toISOString(), + }); + const result = await verifyCredential(credential, { verifyDates: false }); + expect(result.verified).toBe(true); + }, 30000); + + test("Credential With incorrect issuer should not pass validation.", async () => { + const keydoc = { ...testKey.keyDocument }; + keydoc.controller = "did:rando:id"; + const credential = await issueCredential(keydoc, getSampleCredential()); + const result = await verifyCredential(credential); + expect(result.verified).toBe(false); + }, 30000); + }); + + describe(`Verifiable Presentation creation [${keyDocument.type}]`, () => { + let presentationCredentials; + beforeAll(async () => { + const sampleIssuedCredential = await issueCredential( + testKey.keyDocument, + getSampleCredential() + ); + presentationCredentials = [ + sampleIssuedCredential, + sampleIssuedCredential, + ]; + }); + + test("A verifiable presentation should contain a proof once signed, and it should pass verification.", async () => { + const signedVp = await signPresentation( + getSamplePres(presentationCredentials), + testKey.keyDocument, + "some_challenge", + "some_domain" + ); + + const results = await verifyPresentation(signedVp, { + challenge: "some_challenge", + domain: "some_domain", + }); + + expect(results.verified).toBe(true); + expect(results.error).toBe(undefined); + expect(results.presentationResult.verified).toBe(true); + // expect(results.presentationResult.results[0].proof['@context']).toBe('https://w3id.org/security/v2'); + expect(results.presentationResult.results[0].proof.type).toBe(sigType); + expect(results.presentationResult.results[0].proof.challenge).toBe( + "some_challenge" + ); + expect(results.presentationResult.results[0].proof.domain).toBe( + "some_domain" + ); + expect(results.presentationResult.results[0].proof.proofPurpose).toBe( + "authentication" + ); + expect( + results.presentationResult.results[0].proof.verificationMethod + ).toBe(keyUrl); + expect(results.presentationResult.results[0].verified).toBe(true); + expect(results.credentialResults[0].verified).toBe(true); + expect(results.credentialResults[0].results).toBeDefined(); + expect(results.credentialResults[1].verified).toBe(true); + expect(results.credentialResults[1].results).toBeDefined(); + }, 30000); + }); + + describe(`Verifiable Credential incremental creation [${keyDocument.type}]`, () => { + test("VC creation with only id should be possible, yet bring default values", async () => { + const credential = new VerifiableCredential(sampleId); + expect(credential.id).toBe(sampleId); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + ]); + expect(credential.type).toEqual(["VerifiableCredential"]); + expect(credential.issuanceDate).toEqual(expect.anything()); + }); + + test("VC creation with an object context should be possible", async () => { + const credential = new VerifiableCredential(sampleId); + credential.addContext(fakeContext); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + fakeContext, + ]); + }); + + test("JSON representation of a VC should bring the proper keys", async () => { + const credential = new VerifiableCredential(sampleId); + const credentialJSON = credential.toJSON(); + expect(credentialJSON["@context"]).toContain( + "https://www.w3.org/2018/credentials/v1" + ); + expect(credentialJSON.id).toBe(sampleId); + expect(credentialJSON.credentialSubject).toEqual([]); + expect(credentialJSON.type).toEqual(["VerifiableCredential"]); + expect(credentialJSON.issuanceDate).toBeDefined(); + }); + + test("Incremental VC creation should be possible", async () => { + const credential = new VerifiableCredential(sampleId); + expect(credential.id).toBe(sampleId); + + credential.addContext("https://www.w3.org/2018/credentials/examples/v1"); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ]); + credential.addType("some_type"); + expect(credential.type).toEqual(["VerifiableCredential", "some_type"]); + credential.addSubject({ id: "some_subject_id" }); + expect(credential.credentialSubject).toEqual([{ id: "some_subject_id" }]); + credential.setStatus({ + id: "some_status_id", + type: "CredentialStatusList2017", + }); + expect(credential.status).toEqual({ + id: "some_status_id", + type: "CredentialStatusList2017", + }); + credential.setIssuanceDate("2020-03-18T19:23:24Z"); + expect(credential.issuanceDate).toEqual("2020-03-18T19:23:24Z"); + credential.setExpirationDate("2021-03-18T19:23:24Z"); + expect(credential.expirationDate).toEqual("2021-03-18T19:23:24Z"); + }); + + test("Duplicates in context, types and subjects are omitted.", async () => { + const credential = new VerifiableCredential(sampleId); + + credential.addContext("https://www.w3.org/2018/credentials/examples/v1"); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ]); + credential.addContext("https://www.w3.org/2018/credentials/examples/v1"); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ]); + credential.addContext({ "@context": "https://www.google.com" }); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + { "@context": "https://www.google.com" }, + ]); + credential.addContext({ "@context": "https://www.google.com" }); + expect(credential.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + { "@context": "https://www.google.com" }, + ]); + + credential.addType("some_type"); + expect(credential.type).toEqual(["VerifiableCredential", "some_type"]); + credential.addType("some_type"); + expect(credential.type).toEqual(["VerifiableCredential", "some_type"]); + + credential.addSubject({ + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }); + expect(credential.credentialSubject).toEqual([ + { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + ]); + credential.addSubject({ + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }); + expect(credential.credentialSubject).toEqual([ + { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + ]); + }); + + test("Incremental VC creations runs basic validation", async () => { + const credential = new VerifiableCredential(sampleId); + expect(() => { + credential.addContext(123); + }).toThrowError("needs to be a string."); + + expect(() => { + credential.setStatus({ some: "value", type: "something" }); + }).toThrowError("\"credentialStatus\" must include the 'id' property."); + expect(() => { + credential.setStatus({ id: "value", some: "value" }); + }).toThrowError('"credentialStatus" must include a type.'); + + expect(() => { + credential.setIssuanceDate("2020"); + }).toThrowError("needs to be a valid datetime."); + + expect(() => { + credential.setExpirationDate("2020"); + }).toThrowError("needs to be a valid datetime."); + + await expect(credential.verify()).rejects.toThrowError( + "The current Verifiable Credential has no proof." + ); + }); + + test("Issuing an incrementally-created VC should return an object with a proof, and it must pass validation.", async () => { + const unsignedCredential = new VerifiableCredential( + "https://example.com/credentials/1872" + ); + unsignedCredential.addContext( + "https://www.w3.org/2018/credentials/examples/v1" + ); + const signedCredential = await unsignedCredential.sign( + testKey.keyDocument + ); + expect(signedCredential.proof).toBeDefined(); + const result = await signedCredential.verify(); + expect(result.verified).toBe(true); + expect(result.results[0].proof).toBeDefined(); + expect(result.results[0].verified).toBe(true); + }, 30000); + }); + + describe(`Verifiable Presentation incremental creation [${keyDocument.type}]`, () => { + let presentationCredentials; + beforeAll(async () => { + const sampleIssuedCredential = await issueCredential( + testKey.keyDocument, + getSampleCredential() + ); + presentationCredentials = [ + sampleIssuedCredential, + sampleIssuedCredential, + ]; + }); + + test("VP creation with only id should be possible, yet bring default values", async () => { + const vp = new VerifiablePresentation(sampleId); + expect(vp.id).toBe(sampleId); + expect(vp.context).toEqual(["https://www.w3.org/2018/credentials/v1"]); + expect(vp.type).toEqual(["VerifiablePresentation"]); + expect(vp.credentials).toEqual([]); + }); + + test("VP creation with an object context should be possible", async () => { + const vp = new VerifiablePresentation(sampleId); + vp.addContext(fakeContext); + expect(vp.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + fakeContext, + ]); + }); + + test("The JSON representation of a VP should bring the proper keys", async () => { + const vp = new VerifiablePresentation(sampleId); + const vpJSON = vp.toJSON(); + expect(vpJSON["@context"]).toContain( + "https://www.w3.org/2018/credentials/v1" + ); + expect(vpJSON.id).toBe(sampleId); + expect(vpJSON.type).toEqual(["VerifiablePresentation"]); + expect(vpJSON.verifiableCredential).toEqual([]); + }); + + test("Incremental VP creation should be possible", async () => { + const vp = new VerifiablePresentation(sampleId); + expect(vp.id).toBe(sampleId); + + vp.addContext("https://www.w3.org/2018/credentials/examples/v1"); + expect(vp.context).toEqual([ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ]); + vp.addType("some_type"); + expect(vp.type).toEqual(["VerifiablePresentation", "some_type"]); + vp.addCredential({ id: "some_credential_id" }); + expect(vp.credentials).toEqual([{ id: "some_credential_id" }]); + }); + + test("Incremental VP creations runs basic validation", async () => { + const vp = new VerifiablePresentation(sampleId); + expect(() => { + vp.addContext(123); + }).toThrowError("needs to be a string."); + expect(() => { + vp.addContext("123"); + }).toThrowError("needs to be a valid URI."); + + expect(() => { + vp.addCredential({ some: "value" }); + }).toThrowError("\"credential\" must include the 'id' property."); + + await expect( + vp.verify({ + challenge: "some_challenge", + domain: "some_domain", + }) + ).rejects.toThrowError( + "The current VerifiablePresentation has no proof." + ); + }); + + test("Incremental VP creation from external VCs should be possible", async () => { + const vp = new VerifiablePresentation(vpId); + vp.addCredential(presentationCredentials[0]); + expect(vp.credentials).toEqual([presentationCredentials[0]]); + await vp.sign(testKey.keyDocument, "some_challenge", "some_domain"); + expect(vp.proof).toMatchObject({ type: sigType }); + expect(vp.proof).toMatchObject({ created: expect.anything() }); + expect(vp.proof).toMatchObject({ challenge: "some_challenge" }); + expect(vp.proof).toMatchObject({ domain: "some_domain" }); + expect(vp.proof).toMatchObject({ jws: expect.anything() }); + expect(vp.proof).toMatchObject({ proofPurpose: "authentication" }); + expect(vp.proof).toMatchObject({ verificationMethod: expect.anything() }); + + const results = await vp.verify({ + challenge: "some_challenge", + domain: "some_domain", + }); + + expect(results.presentationResult).toMatchObject({ verified: true }); + expect(results.presentationResult.results[0]).toMatchObject({ + verified: true, + }); + expect(results.presentationResult.results[0]).toMatchObject({ + proof: expect.anything(), + }); + expect(results.credentialResults[0]).toMatchObject({ verified: true }); + expect(results.credentialResults[0]).toMatchObject({ + results: expect.anything(), + }); + }, 20000); + + test("Issuing an incrementally-created VP from an incrementally created VC should return an object with a proof, and it must pass validation.", async () => { + const vc = new VerifiableCredential( + "https://example.com/credentials/1872" + ); + vc.addContext("https://www.w3.org/2018/credentials/examples/v1"); + vc.addType("AlumniCredential"); + vc.addSubject({ + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }); + await vc.sign(testKey.keyDocument); + const vcVerificationResult = await vc.verify(); + expect(vcVerificationResult).toMatchObject({ verified: true }); + + const vp = new VerifiablePresentation(vpId); + vp.setHolder(vpHolder); + vp.addCredential(vc); + await vp.sign(testKey.keyDocument, "some_challenge", "some_domain"); + expect(vp.proof).toMatchObject({ type: sigType }); + expect(vp.proof).toMatchObject({ created: expect.anything() }); + expect(vp.proof).toMatchObject({ challenge: "some_challenge" }); + expect(vp.proof).toMatchObject({ domain: "some_domain" }); + expect(vp.proof).toMatchObject({ jws: expect.anything() }); + expect(vp.proof).toMatchObject({ proofPurpose: "authentication" }); + expect(vp.proof).toMatchObject({ verificationMethod: expect.anything() }); + + const results = await vp.verify({ + challenge: "some_challenge", + domain: "some_domain", + }); + expect(results.presentationResult).toMatchObject({ verified: true }); + expect(results.presentationResult.results[0]).toMatchObject({ + verified: true, + }); + expect(results.presentationResult.results[0]).toMatchObject({ + proof: expect.anything(), + }); + expect(results.credentialResults[0]).toMatchObject({ verified: true }); + expect(results.credentialResults[0]).toMatchObject({ + results: expect.anything(), + }); + }, 30000); + + test("Support contexts without @context key", () => { + const credential = new VerifiableCredential(sampleId); + const context = { + name: "http://schema.org/name", + image: { + "@id": "http://schema.org/image", + "@type": "@id", + }, + homepage: { + "@id": "http://schema.org/url", + "@type": "@id", + }, + }; + credential.setContext(context); + expect(credential.context).toEqual(context); + }); + }); +}); diff --git a/packages/credential-sdk/tests/logic.test.js b/packages/credential-sdk/tests/logic.test.js new file mode 100644 index 000000000..8efb80649 --- /dev/null +++ b/packages/credential-sdk/tests/logic.test.js @@ -0,0 +1,136 @@ +import jsonld from "jsonld"; +import { randomAsHex } from "../src/utils"; +import { + presentationToEEClaimGraph, + proveh, + ANYCLAIM, + MAYCLAIM, + MAYCLAIM_DEF_1, + MAYCLAIM_DEF_2, +} from "../src/rdf-and-cd"; +import { documentLoader } from "./utils/cached-document-loader.js"; + +const COOLNESS = "https://example.com/coolnessLevel"; + +describe("logic", () => { + test("delegation chain", async () => { + const cred = { + "@context": "https://www.w3.org/2018/credentials/v1", + type: "VerifiableCredential", + issuer: "did:example:c", + credentialSubject: { + id: "did:example:d", + [COOLNESS]: 1, + }, + }; + + const del1 = { + "@context": "https://www.w3.org/2018/credentials/v1", + type: "VerifiableCredential", + issuer: "did:example:a", + credentialSubject: { + id: "did:example:b", + [MAYCLAIM]: { "@id": ANYCLAIM }, + }, + }; + + const del2 = { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ], + type: "VerifiableCredential", + issuer: "did:example:b", + credentialSubject: { + id: "did:example:c", + [MAYCLAIM]: { "@id": ANYCLAIM }, + }, + }; + + const to_prove = [ + [ + { Iri: "did:example:d" }, + { Iri: COOLNESS }, + { + Literal: { + datatype: "http://www.w3.org/2001/XMLSchema#integer", + value: "1", + }, + }, + { DefaultGraph: true }, + ], + ]; + + // Manually grant 'did:example:a' authority to make claims. This makes 'did:example:a' a root authority. + const assumed = [ + [ + { Iri: "did:example:a" }, + { Iri: MAYCLAIM }, + { Iri: ANYCLAIM }, + { DefaultGraph: true }, + ], + ]; + + let cg; + + // happy path + cg = cat(await asCg([cred, del1, del2]), assumed); + proveh(cg, to_prove, MAYCLAIM_DEF_1); + proveh(cg, to_prove, MAYCLAIM_DEF_2); + + // the assumption assigning a root authority is not included in the claimgraph + cg = await asCg([cred, del1, del2]); + assert_error(() => proveh(cg, to_prove, MAYCLAIM_DEF_1), { + CantProve: "NovelName", + }); + assert_error(() => proveh(cg, to_prove, MAYCLAIM_DEF_2), { + CantProve: "ExhaustedSearchSpace", + }); + + // a link in the delegation chain is broken + cg = cat(await asCg([cred, del1]), assumed); + assert_error(() => proveh(cg, to_prove, MAYCLAIM_DEF_1), { + CantProve: "ExhaustedSearchSpace", + }); + assert_error(() => proveh(cg, to_prove, MAYCLAIM_DEF_2), { + CantProve: "ExhaustedSearchSpace", + }); + }); +}); + +// bundle a list of creds into a presentation +// return the bundle as a claimgraph as if the presentation were verified +async function asCg(creds) { + const exp = await expand(present(creds)); + return presentationToEEClaimGraph(exp); +} + +async function expand(jld) { + return jsonld.expand(jld, { documentLoader }); +} + +function assert_error(cb, expected_error) { + try { + cb(); + } catch (err) { + expect(err).toEqual(expected_error); + } +} + +function present(creds) { + return { + "@context": ["https://www.w3.org/2018/credentials/v1"], + "@type": ["VerifiablePresentation"], + id: `urn:${randomAsHex(16)}`, + holder: `urn:${randomAsHex(16)}`, + verifiableCredential: creds, + }; +} + +function cat(...arrays) { + let ret = []; + for (const array of arrays) { + ret = ret.concat(array); + } + return ret; +} diff --git a/packages/credential-sdk/tests/mocks/fetch.js b/packages/credential-sdk/tests/mocks/fetch.js new file mode 100644 index 000000000..92a0dcde3 --- /dev/null +++ b/packages/credential-sdk/tests/mocks/fetch.js @@ -0,0 +1,27 @@ +import networkCache from "../utils/network-cache"; + +// Mock the global fetch function +global.fetch = jest.fn(); + +// Function to set up a mock response for fetch +const mockFetchResponse = (status, data) => { + const response = new Response(JSON.stringify(data), { + status, + headers: { + "Content-type": "application/json", + }, + }); + return Promise.resolve(response); +}; + +export default function mockFetch() { + // Set up a mock response for all GET requests + fetch.mockImplementation((url) => { + if (networkCache[url]) { + return mockFetchResponse(200, networkCache[url]); + } + + console.error(`Test should cache this URL: ${url}`); + throw new Error(`Test should cache this URL: ${url}`); + }); +} diff --git a/tests/unit/pattern.test.js b/packages/credential-sdk/tests/pattern.test.js similarity index 77% rename from tests/unit/pattern.test.js rename to packages/credential-sdk/tests/pattern.test.js index c5d623aa4..d8b1f6537 100644 --- a/tests/unit/pattern.test.js +++ b/packages/credential-sdk/tests/pattern.test.js @@ -1,4 +1,4 @@ -import { ensureMatchesPattern } from '../../src/utils/misc'; +import { ensureMatchesPattern } from "../src/utils/misc"; const checkError = (fn) => { let thrown = false; @@ -6,32 +6,32 @@ const checkError = (fn) => { try { fn(); } catch (err) { - for (const key of ['message', 'path', 'pattern', 'errors']) { + for (const key of ["message", "path", "pattern", "errors"]) { expect(err[key]).toMatchSnapshot(); } thrown = true; } if (!thrown) { - throw new Error('Expected an error to be thrown'); + throw new Error("Expected an error to be thrown"); } }; -describe('ensureMatchesPattern', () => { - test('$matchType', () => { - const pat = { $matchType: 'number' }; - checkError(() => ensureMatchesPattern(pat, 'sasda')); +describe("ensureMatchesPattern", () => { + test("$matchType", () => { + const pat = { $matchType: "number" }; + checkError(() => ensureMatchesPattern(pat, "sasda")); ensureMatchesPattern(pat, 10); }); - test('$matchValue', () => { + test("$matchValue", () => { const pat = { $matchValue: 11 }; checkError(() => ensureMatchesPattern(pat, 10)); ensureMatchesPattern(pat, 11); }); - test('$matchObject', () => { + test("$matchObject", () => { const pat = { $matchObject: { a: { $matchValue: 1 }, b: { $matchValue: 2 } }, }; @@ -45,7 +45,7 @@ describe('ensureMatchesPattern', () => { ensureMatchesPattern(pat, { a: 1, b: 2 }); }); - test('$matchIterable', () => { + test("$matchIterable", () => { const pat = { $matchIterable: [{ $matchValue: 1 }, { $matchValue: 2 }] }; checkError(() => ensureMatchesPattern(pat, [3])); checkError(() => ensureMatchesPattern(pat, [1, 3])); @@ -56,12 +56,12 @@ describe('ensureMatchesPattern', () => { expect(ensureMatchesPattern(pat, [1, 2])); }); - test('$instanceOf', () => { + test("$instanceOf", () => { checkError(() => ensureMatchesPattern({ $instanceOf: Function }, {})); ensureMatchesPattern({ $instanceOf: Object }, {}); }); - test('$iterableOf', () => { + test("$iterableOf", () => { const pat = { $iterableOf: { $matchValue: 1 } }; checkError(() => ensureMatchesPattern(pat, [3])); @@ -76,23 +76,25 @@ describe('ensureMatchesPattern', () => { ensureMatchesPattern(pat, [1, 1, 1, 1, 1]); }); - test('$mapOf', () => { + test("$mapOf", () => { const pat = { $mapOf: [{ $matchValue: 1 }, { $matchValue: 2 }] }; checkError(() => ensureMatchesPattern(pat, new Map([[1, 3]]))); checkError(() => ensureMatchesPattern(pat, new Map([[3, 2]]))); - checkError(() => ensureMatchesPattern( - pat, - new Map([ - [1, 2], - [3, 1], - ]), - )); + checkError(() => + ensureMatchesPattern( + pat, + new Map([ + [1, 2], + [3, 1], + ]) + ) + ); ensureMatchesPattern(pat, new Map([])); ensureMatchesPattern(pat, new Map([[1, 2]])); }); - test('$anyOf', () => { + test("$anyOf", () => { const pat = { $anyOf: [{ $matchValue: 1 }, { $matchValue: 2 }] }; checkError(() => ensureMatchesPattern(pat, 3)); @@ -100,7 +102,7 @@ describe('ensureMatchesPattern', () => { ensureMatchesPattern(pat, 2); }); - test('$mapOf', () => { + test("$mapOf", () => { const pat = { $objOf: { A: { $matchValue: 1 } } }; checkError(() => ensureMatchesPattern(pat, { A: 5 })); diff --git a/packages/credential-sdk/tests/presigned-validation.test.js b/packages/credential-sdk/tests/presigned-validation.test.js new file mode 100644 index 000000000..ed61f0d4f --- /dev/null +++ b/packages/credential-sdk/tests/presigned-validation.test.js @@ -0,0 +1,43 @@ +// Mock fetch +import mockFetch from "./mocks/fetch"; + +import { verifyCredential } from "../src/vc"; + +mockFetch(); + +const controllerUrl = + "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw"; +const keyUrl = + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw"; + +function getSamplePresignedCredential() { + return { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + ], + id: "https://example.com/credentials/1872", + type: ["VerifiableCredential", "AlumniCredential"], + issuanceDate: "2020-04-15T09:05:35Z", + credentialSubject: { + id: "did:example:ebfeb1f712ebc6f1c276e12ec21", + alumniOf: "Example University", + }, + issuer: controllerUrl, + proof: { + type: "EcdsaSecp256k1Signature2019", + created: "2021-11-24T21:47:28Z", + proofValue: + "zAN1rKvtBajWcQS61LU4wX8hB4tUNFze44pHKwkVYoZaGMRxXquAaKcnUiwarZyWmMQzB4ttFLCEFXQq6F9dnq5pWJSC1WZgga", + proofPurpose: "assertionMethod", + verificationMethod: keyUrl, + }, + }; +} + +describe("Static pre-signed credential validation", () => { + test("Presigned credential should verify", async () => { + const results = await verifyCredential(getSamplePresignedCredential()); + expect(results.verified).toBe(true); + }); +}); diff --git a/tests/unit/rdf-turtle.test.js b/packages/credential-sdk/tests/rdf-turtle.test.js similarity index 51% rename from tests/unit/rdf-turtle.test.js rename to packages/credential-sdk/tests/rdf-turtle.test.js index 73f7d1bdb..c42a23555 100644 --- a/tests/unit/rdf-turtle.test.js +++ b/packages/credential-sdk/tests/rdf-turtle.test.js @@ -1,5 +1,5 @@ -import { newEngine } from '@comunica/actor-init-sparql-rdfjs'; -import { parseRDFDocument, queryNextLookup } from '../../src/utils/rdf'; +import { newEngine } from "@comunica/actor-init-sparql-rdfjs"; +import { parseRDFDocument, queryNextLookup } from "../src/rdf-and-cd"; const rdfInputs = [ ` @@ -26,49 +26,36 @@ const rdfInputs = [ ]; const dbpediaSource = [ - [ - { Iri: 'a' }, - { Iri: 'b' }, - { Iri: 'http://dbpedia.org/resource/Belgium' }, - ], - [ - { Iri: 'c' }, - { Iri: 'd' }, - { Iri: 'http://dbpedia.org/resource/Ghent' }, - ], - [ - { Iri: 'c' }, - { Iri: 'd' }, - { Iri: 'http://dbpedia.org/resource/Austria' }, - ], + [{ Iri: "a" }, { Iri: "b" }, { Iri: "http://dbpedia.org/resource/Belgium" }], + [{ Iri: "c" }, { Iri: "d" }, { Iri: "http://dbpedia.org/resource/Ghent" }], + [{ Iri: "c" }, { Iri: "d" }, { Iri: "http://dbpedia.org/resource/Austria" }], ]; const claimgraph = [ [ - { Iri: 'did:a' }, - { Iri: 'http://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'http://rdf.dock.io/alpha/2021#ANYCLAIM' }, + { Iri: "did:a" }, + { Iri: "http://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "http://rdf.dock.io/alpha/2021#ANYCLAIM" }, { DefaultGraph: true }, ], [ - { Iri: 'did:b' }, - { Iri: 'http://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'http://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:a' }, + { Iri: "did:b" }, + { Iri: "http://rdf.dock.io/alpha/2021#mayClaim" }, + { Iri: "http://rdf.dock.io/alpha/2021#ANYCLAIM" }, + { Iri: "did:a" }, ], ]; -describe('RDF SPARQL', () => { - test('Can query an RDF source (dbpedia)', async () => { +describe("RDF SPARQL", () => { + test("Can query an RDF source (dbpedia)", async () => { const engine = newEngine(); - const query = 'SELECT * { ?s ?p . ?s ?p ?lookupNext } LIMIT 2'; + const query = + "SELECT * { ?s ?p . ?s ?p ?lookupNext } LIMIT 2"; const newGraph = await queryNextLookup(dbpediaSource, query, engine); - expect(newGraph).toEqual([ - { Iri: 'http://dbpedia.org/resource/Belgium' }, - ]); + expect(newGraph).toEqual([{ Iri: "http://dbpedia.org/resource/Belgium" }]); }); - test('Can query a claimgraph', async () => { + test("Can query a claimgraph", async () => { const engine = newEngine(); const query = `prefix dockalpha: select * { @@ -78,49 +65,47 @@ describe('RDF SPARQL', () => { } }`; const queryResult = await queryNextLookup(claimgraph, query, engine); - expect(queryResult).toEqual([ - { Iri: 'did:b' }, - ]); + expect(queryResult).toEqual([{ Iri: "did:b" }]); }); }); -describe('RDF Turtle Parsing', () => { - test('Can parse and format RDF test 1', async () => { +describe("RDF Turtle Parsing", () => { + test("Can parse and format RDF test 1", async () => { const result = parseRDFDocument(rdfInputs[0]); const expectedResult = [ [ { Blank: expect.anything() }, - { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first' }, + { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" }, { Literal: { - value: 'apple', - datatype: 'http://www.w3.org/2001/XMLSchema#string', + value: "apple", + datatype: "http://www.w3.org/2001/XMLSchema#string", }, }, ], [ { Blank: expect.anything() }, - { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest' }, + { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" }, { Blank: expect.anything() }, ], [ { Blank: expect.anything() }, - { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first' }, + { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" }, { Literal: { - value: 'banana', - datatype: 'http://www.w3.org/2001/XMLSchema#string', + value: "banana", + datatype: "http://www.w3.org/2001/XMLSchema#string", }, }, ], [ { Blank: expect.anything() }, - { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest' }, - { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' }, + { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" }, + { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, ], [ - { Iri: 'http://example.org/stuff/1.0/a' }, - { Iri: 'http://example.org/stuff/1.0/b' }, + { Iri: "http://example.org/stuff/1.0/a" }, + { Iri: "http://example.org/stuff/1.0/b" }, { Blank: expect.anything() }, ], ]; @@ -129,38 +114,38 @@ describe('RDF Turtle Parsing', () => { expect(result).toEqual(expect.arrayContaining(expectedResult)); }); - test('Can parse and format RDF test 2', async () => { + test("Can parse and format RDF test 2", async () => { const result = parseRDFDocument(rdfInputs[1]); const expectedResult = [ [ - { Iri: 'http://www.w3.org/TR/rdf-syntax-grammar' }, - { Iri: 'http://purl.org/dc/elements/1.1/title' }, + { Iri: "http://www.w3.org/TR/rdf-syntax-grammar" }, + { Iri: "http://purl.org/dc/elements/1.1/title" }, { Literal: { - value: 'RDF/XML Syntax Specification (Revised)', - datatype: 'http://www.w3.org/2001/XMLSchema#string', + value: "RDF/XML Syntax Specification (Revised)", + datatype: "http://www.w3.org/2001/XMLSchema#string", }, }, ], [ - { Iri: 'http://www.w3.org/TR/rdf-syntax-grammar' }, - { Iri: 'http://example.org/stuff/1.0/editor' }, + { Iri: "http://www.w3.org/TR/rdf-syntax-grammar" }, + { Iri: "http://example.org/stuff/1.0/editor" }, { Blank: expect.anything() }, ], [ { Blank: expect.anything() }, - { Iri: 'http://example.org/stuff/1.0/fullname' }, + { Iri: "http://example.org/stuff/1.0/fullname" }, { Literal: { - value: 'Dave Beckett', - datatype: 'http://www.w3.org/2001/XMLSchema#string', + value: "Dave Beckett", + datatype: "http://www.w3.org/2001/XMLSchema#string", }, }, ], [ { Blank: expect.anything() }, - { Iri: 'http://example.org/stuff/1.0/homePage' }, - { Iri: 'http://purl.org/net/dajobe/' }, + { Iri: "http://example.org/stuff/1.0/homePage" }, + { Iri: "http://purl.org/net/dajobe/" }, ], ]; @@ -168,7 +153,7 @@ describe('RDF Turtle Parsing', () => { expect(result).toEqual(expect.arrayContaining(expectedResult)); }); - test('Cannot parse RDF document with non-default graph', async () => { + test("Cannot parse RDF document with non-default graph", async () => { expect(() => { parseRDFDocument(rdfInputs[2]); }).toThrowError(/Unexpected graph/); diff --git a/packages/credential-sdk/tests/resolvers.test.js b/packages/credential-sdk/tests/resolvers.test.js new file mode 100644 index 000000000..6dfbf5b87 --- /dev/null +++ b/packages/credential-sdk/tests/resolvers.test.js @@ -0,0 +1,226 @@ +import { MultiResolver, WILDCARD, createResolver } from "../src/resolver"; + +class APrefixBMethodFull extends MultiResolver { + static PREFIX = "a"; + static METHOD = "b"; + + async resolve(id) { + return this.supports(id) ? `ab-full-${id}` : null; + } +} + +class CPrefixDMethodFull extends MultiResolver { + static PREFIX = "c"; + static METHOD = "d"; + + async resolve(id) { + return this.supports(id) ? `cd-full-${id}` : null; + } +} + +class BMethod extends MultiResolver { + static METHOD = "b"; +} + +class APrefix extends MultiResolver { + static PREFIX = "a"; +} + +class APrefixBMethod extends APrefix { + static METHOD = "b"; +} + +class APrefixBMethodFullExtended extends APrefixBMethod { + async resolve(id) { + return this.supports(id) ? `ab-extended-${id}` : null; + } +} + +class APrefixCDMethod extends MultiResolver { + static PREFIX = "a"; + static METHOD = ["c", "d"]; + + async resolve(id) { + return this.supports(id) ? `a-cd-${id}` : null; + } +} + +class APrefixWildcardMethodFull extends MultiResolver { + static PREFIX = "a"; + static METHOD = WILDCARD; + + async resolve(id) { + return this.supports(id) ? `a-wildcard-${id}` : null; + } +} + +class WildcardPrefixBMethodFull extends MultiResolver { + static PREFIX = WILDCARD; + static METHOD = "b"; + + async resolve(id) { + return this.supports(id) ? `wildcard-b-${id}` : null; + } +} + +class WildcardPrefixAndMethod extends MultiResolver { + static PREFIX = WILDCARD; + static METHOD = WILDCARD; +} + +class WildcardPrefixAndMethodFull extends WildcardPrefixAndMethod { + async resolve(id) { + return this.supports(id) ? `wildcard-wildcard-${id}` : null; + } +} + +describe("Resolvers", () => { + it("checks `MultiResolver`", async () => { + expect(() => new MultiResolver()).toThrowError( + "Static property `PREFIX` of `MultiResolver` isn't extended properly" + ); + expect(() => new BMethod()).toThrowError( + "Static property `PREFIX` of `BMethod` isn't extended properly" + ); + expect(() => new APrefixBMethod()).toThrowError( + "No resolvers were provided. You need to either implement `resolve` or provide a list of resolvers" + ); + expect(() => new APrefix()).toThrowError( + "Static property `METHOD` of `APrefix` isn't extended properly" + ); + expect(() => new MultiResolver([new APrefixBMethodFull()])).toThrowError( + "Static property `PREFIX` of `MultiResolver` isn't extended properly" + ); + expect( + () => + new APrefixBMethod([new APrefixBMethodFull(), new APrefixBMethodFull()]) + ).toThrowError( + "Two resolvers for the same prefix and method - `a:b:`: `APrefixBMethodFull` and `APrefixBMethodFull`" + ); + expect(await new APrefixBMethodFull().resolve("a:b:123")).toBe( + "ab-full-a:b:123" + ); + expect(new APrefixBMethodFull().supports("a:b:123")).toBe(true); + expect(new APrefixBMethodFull().supports("a:c:123")).toBe(false); + expect(new APrefixBMethodFull().supports("c:b:123")).toBe(false); + expect(new APrefixBMethodFull().supports("a:b:123")).toBe(true); + expect(new APrefixBMethodFull().supports("a:c:123")).toBe(false); + expect(new APrefixBMethodFull().supports("c:b:123")).toBe(false); + + expect(await new APrefixBMethodFullExtended().resolve("a:b:456")).toBe( + "ab-extended-a:b:456" + ); + expect( + await new APrefixBMethod([new APrefixBMethodFull()]).resolve("a:b:456") + ).toBe("ab-full-a:b:456"); + expect( + await new APrefixBMethod([new APrefixBMethodFullExtended()]).resolve( + "a:b:456" + ) + ).toBe("ab-extended-a:b:456"); + + const wildcard = new WildcardPrefixAndMethod([ + new APrefixBMethodFull(), + new CPrefixDMethodFull(), + new APrefixWildcardMethodFull(), + new WildcardPrefixBMethodFull(), + new WildcardPrefixAndMethodFull(), + ]); + + expect(await wildcard.resolve("a:b:")).toBe("ab-full-a:b:"); + expect(await wildcard.resolve("a:asdasdas:")).toBe( + "a-wildcard-a:asdasdas:" + ); + expect(await wildcard.resolve("asdasdasd:b:")).toBe( + "wildcard-b-asdasdasd:b:" + ); + expect(await wildcard.resolve("c:d:")).toBe("cd-full-c:d:"); + expect(await wildcard.resolve("asdasdasd:asdasdasd:")).toBe( + "wildcard-wildcard-asdasdasd:asdasdasd:" + ); + + const nestedWildcard = new WildcardPrefixAndMethod([ + new APrefixBMethodFullExtended(), + new WildcardPrefixAndMethod([wildcard]), + ]); + expect(await nestedWildcard.resolve("a:b:")).toBe("ab-extended-a:b:"); + expect(await nestedWildcard.resolve("c:d:")).toBe("cd-full-c:d:"); + expect(await wildcard.resolve("a:asdasdas:")).toBe( + "a-wildcard-a:asdasdas:" + ); + expect(await nestedWildcard.resolve("asdasdasd:asdasdasd:")).toBe( + "wildcard-wildcard-asdasdasd:asdasdasd:" + ); + + const abTop = new APrefixBMethodFullExtended(); + const ab = new APrefixBMethodFull(); + const cd = new CPrefixDMethodFull(); + const acdTop = new APrefixCDMethod(); + const awildcard = new APrefixWildcardMethodFull(); + const widlcardb = new WildcardPrefixBMethodFull(); + + const discreteWrappedInWildcard = new WildcardPrefixAndMethod([ + new WildcardPrefixAndMethod([ab, cd, awildcard, widlcardb]), + acdTop, + abTop, + ]); + + expect(discreteWrappedInWildcard.matchingResolver("a:b:")).toBe(abTop); + expect( + discreteWrappedInWildcard + .matchingResolver("c:d:") + .matchingResolver("c:d:") + ).toBe(cd); + expect(discreteWrappedInWildcard.matchingResolver("a:c:")).toBe(acdTop); + expect(discreteWrappedInWildcard.matchingResolver("a:d:")).toBe(acdTop); + expect( + discreteWrappedInWildcard + .matchingResolver("a:e:") + .matchingResolver("a:e:") + ).toBe(awildcard); + expect(discreteWrappedInWildcard.matchingResolver("c:f:")).toBe(null); + expect( + discreteWrappedInWildcard + .matchingResolver("x:b:") + .matchingResolver("x:b:") + ).toBe(widlcardb); + expect(discreteWrappedInWildcard.matchingResolver("e:a:")).toBe(null); + }); + + it("checks `createResolver`", async () => { + const resolve = async () => 1; + + expect(() => + createResolver(new APrefixBMethodFull(), { prefix: "c" }) + ).toThrowError("Item not found in [c]: `a`"); + + expect(() => + createResolver(new APrefixBMethodFull(), { method: "c" }) + ).toThrowError("Item not found in [c]: `b`"); + + const singleResolver = createResolver(resolve, { + prefix: "abc", + method: "cde", + }); + + expect(await singleResolver.resolve("abc:cde:1")).toBe(1); + expect(singleResolver.supports("abc:cde:1")).toBe(true); + expect(singleResolver.supports("abc:de:1")).toBe(false); + + const wildcardResolver = createResolver( + createResolver(resolve, { prefix: "abc", method: "cde" }) + ); + + expect(await wildcardResolver.resolve("abc:cde:1")).toBe(1); + expect(wildcardResolver.supports("abc:cde:1")).toBe(true); + expect(wildcardResolver.supports("abc:de:1")).toBe(true); + + const multiResolver = createResolver(resolve, { + prefix: ["abc"], + method: ["cde"], + }); + expect(await multiResolver.resolve("abc:cde:1")).toBe(1); + expect(multiResolver.supports("abc:cde:1")).toBe(true); + expect(multiResolver.supports("abc:de:1")).toBe(false); + }); +}); diff --git a/packages/credential-sdk/tests/schema.test.js b/packages/credential-sdk/tests/schema.test.js new file mode 100644 index 000000000..d33f04b90 --- /dev/null +++ b/packages/credential-sdk/tests/schema.test.js @@ -0,0 +1,213 @@ +// Mock fetch + +import VerifiableCredential from "../src/vc/verifiable-credential"; +import { Schema } from "../src/modules/schema"; +import { BlobId } from "../src/types/blob"; + +import { expandJSONLD } from "../src/vc/helpers"; + +import { validateCredentialSchema } from "../src/vc/schema"; + +import { expandedSubjectProperty } from "../src/vc/constants"; + +import exampleCredential from "./utils/example-credential"; +import exampleSchema from "./utils/example-schema"; + +describe("VerifiableCredential Tests", () => { + const vc = new VerifiableCredential(exampleCredential.id); + vc.addSubject(exampleCredential.credentialSubject); + vc.setContext(exampleCredential["@context"]); + + test("VerifiableCredential's setSchema should appropriately set credentialSchema.", () => { + vc.setSchema( + exampleCredential.credentialSchema.id, + exampleCredential.credentialSchema.type + ); + expect(vc.credentialSchema).toMatchObject( + expect.objectContaining({ + id: expect.anything(), + type: expect.anything(), + }) + ); + }); + + test("VerifiableCredential's validateSchema should validate the credentialSubject with given JSON schema.", async () => { + const result = await vc.validateSchema(exampleSchema); + expect(result).toBe(true); + }, 20000); +}); + +describe("Basic Schema Tests", () => { + let schema; + beforeAll(async () => { + schema = new Schema(); + }, 10000); + + test("accepts the id optionally and generates id of correct size when id is not given", () => { + const schemaNoID = new Schema(); + const encodedIDByteSize = 48; + expect(String(schemaNoID.id).length).toBe( + encodedIDByteSize + BlobId.Qualifier.length + ); + }); + + test("setJSONSchema will only accept valid JSON schema and set the schema key of the object.", async () => { + await expect( + schema.setJSONSchema({ + invalidSchema: true, + }) + ).rejects.toThrow(); + + await schema.setJSONSchema(exampleSchema); + expect(schema.schema).toBe(exampleSchema); + }); + + test("validateSchema will check that the given schema is a valid JSON-schema.", async () => { + await expect(Schema.validateSchema(exampleSchema)).resolves.toBeDefined(); + }); + + test("toJSON will generate a JSON that can be sent to chain.", () => { + const result = schema.toJSON(); + expect(result).toMatchObject( + expect.objectContaining({ + id: expect.anything(), + schema: expect.anything(), + }) + ); + }); + + test("toBlob will generate a JSON that can be sent to written with blob module", () => { + const result = schema.toBlob(); + expect(result).toMatchObject( + expect.objectContaining({ + id: expect.anything(), + blob: expect.anything(), + }) + ); + }); +}); + +describe("Validate Credential Schema utility", () => { + const schema = new Schema(); + schema.setJSONSchema(exampleSchema); + + let expandedCredential; + beforeAll(async () => { + expandedCredential = await expandJSONLD(exampleCredential); + }, 10000); + + test("credentialSubject has same fields and fields have same types as JSON-schema", () => { + expect( + validateCredentialSchema( + expandedCredential, + schema, + exampleCredential["@context"] + ) + ).toBeDefined(); + }); + + test("credentialSubject has same fields but fields have different type than JSON-schema", async () => { + await expect( + validateCredentialSchema( + { + [`${expandedSubjectProperty}`]: { + invalid: true, + }, + }, + schema, + exampleCredential["@context"] + ) + ).rejects.toThrow(); + }, 100000); + + test("credentialSubject is missing required fields from the JSON-schema and it should fail to validate.", async () => { + const credentialSubject = { + ...expandedCredential[expandedSubjectProperty], + }; + delete credentialSubject["https://schema.org/alumniOf"]; + await expect( + validateCredentialSchema( + { + [`${expandedSubjectProperty}`]: credentialSubject, + }, + schema, + exampleCredential["@context"] + ) + ).rejects.toThrow(); + }, 100000); + + test("The schema's properties is missing the required key and credentialSubject can omit some of the properties.", async () => { + const nonRequiredSchema = { ...exampleSchema }; + delete nonRequiredSchema.required; + await schema.setJSONSchema(nonRequiredSchema); + + const credentialSubject = { + ...expandedCredential[expandedSubjectProperty][0], + }; + delete credentialSubject["https://schema.org/alumniOf"]; + + await expect( + validateCredentialSchema( + { + [`${expandedSubjectProperty}`]: credentialSubject, + }, + schema, + exampleCredential["@context"] + ) + ).resolves.toBeDefined(); + }); + + test("credentialSubject has extra fields than given schema specifies and additionalProperties has certain type.", async () => { + const credentialSubject = { + ...expandedCredential[expandedSubjectProperty][0], + additionalString: "mystring", + }; + await schema.setJSONSchema({ + ...exampleSchema, + additionalProperties: { type: "string" }, + }); + + await expect( + validateCredentialSchema( + { + [`${expandedSubjectProperty}`]: credentialSubject, + }, + schema, + exampleCredential["@context"] + ) + ).resolves.toBeDefined(); + }); + + test("credentialSubject has nested fields and given schema specifies the nested structure.", async () => { + const credentialSubject = { + ...expandedCredential[expandedSubjectProperty][0], + nestedFields: { + test: true, + }, + }; + + await schema.setJSONSchema({ + ...exampleSchema, + properties: { + ...exampleSchema.properties, + nestedFields: { + properties: { + test: { + type: "boolean", + }, + }, + }, + }, + }); + + await expect( + validateCredentialSchema( + { + [`${expandedSubjectProperty}`]: credentialSubject, + }, + schema, + exampleCredential["@context"] + ) + ).resolves.toBeDefined(); + }); +}); diff --git a/packages/credential-sdk/tests/serialize.test.js b/packages/credential-sdk/tests/serialize.test.js new file mode 100644 index 000000000..119ebe45c --- /dev/null +++ b/packages/credential-sdk/tests/serialize.test.js @@ -0,0 +1,90 @@ +import VerifiableCredential from "../src/vc/verifiable-credential"; +import VerifiablePresentation from "../src/vc/verifiable-presentation"; +import { Schema } from "../src/modules/schema"; + +import exampleCredential from "./utils/example-credential"; + +describe("Serialization", () => { + test("VerifiableCredential fromJSON should fail if no type is provided", () => { + expect(() => + VerifiableCredential.fromJSON({ + ...exampleCredential, + type: undefined, + }) + ).toThrow(); + }); + + test("VerifiableCredential fromJSON should fail if no context is provided", () => { + expect(() => + VerifiableCredential.fromJSON({ + ...exampleCredential, + "@context": undefined, + }) + ).toThrow(); + }); + + test("VerifiablePresentation fromJSON should fail if no type is provided", () => { + expect(() => + VerifiablePresentation.fromJSON({ + "@context": "https://www.w3.org/2018/credentials/v1", + type: undefined, + }) + ).toThrow(); + }); + + test("VerifiablePresentation fromJSON should fail if no context is provided", () => { + expect(() => + VerifiablePresentation.fromJSON({ + "@context": undefined, + }) + ).toThrow(); + }); + + test("VerifiableCredential from/to JSON serialization", () => { + const vc = VerifiableCredential.fromJSON(exampleCredential); + const vcJson = vc.toJSON(); + expect(vcJson).toMatchObject(exampleCredential); + }); + + test("VerifiablePresentation from/to JSON serialization", () => { + const presentationId = "http://example.edu/credentials/2803"; + const vp = new VerifiablePresentation(presentationId); + vp.addContext("https://www.w3.org/2018/credentials/examples/v1"); + vp.addType("some_type"); + + const vc = VerifiableCredential.fromJSON(exampleCredential); + vp.addCredential(vc); + + const vpJson = vp.toJSON(); + + const constructedVP = VerifiablePresentation.fromJSON(vpJson); + expect(vpJson).toMatchObject(constructedVP.toJSON()); + }); + + test("Schema from/to JSON serialization", async () => { + const schema = new Schema(); + await schema.setJSONSchema({ + $schema: "http://json-schema.org/draft-07/schema#", + description: "Dock Schema Example", + type: "object", + properties: { + id: { + type: "string", + }, + emailAddress: { + type: "string", + format: "email", + }, + alumniOf: { + type: "string", + }, + }, + required: ["emailAddress", "alumniOf"], + additionalProperties: false, + }); + + const shemaJSON = schema.toJSON(); + const constructedSchema = Schema.fromJSON(shemaJSON); + expect(shemaJSON).toMatchObject(constructedSchema.toJSON()); + }); +}); diff --git a/packages/credential-sdk/tests/setup-test-env.js b/packages/credential-sdk/tests/setup-test-env.js new file mode 100644 index 000000000..32651f5d8 --- /dev/null +++ b/packages/credential-sdk/tests/setup-test-env.js @@ -0,0 +1,2 @@ +import "core-js/stable"; +import "regenerator-runtime/runtime"; diff --git a/tests/unit/static-bbs.test.js b/packages/credential-sdk/tests/static-bbs.test.js similarity index 69% rename from tests/unit/static-bbs.test.js rename to packages/credential-sdk/tests/static-bbs.test.js index 0601ce2f8..f4c7e6d47 100644 --- a/tests/unit/static-bbs.test.js +++ b/packages/credential-sdk/tests/static-bbs.test.js @@ -1,7 +1,7 @@ -import { verifyCredential } from '../../src/utils/vc/index'; -import defaultDocumentLoader from '../../src/utils/vc/document-loader'; -import didDocument from '../data/static-did-dock.json'; -import staticCred610 from '../data/static-bbs-cred-610.json'; +import { verifyCredential } from "../src/vc"; +import defaultDocumentLoader from "../src/vc/document-loader"; +import didDocument from "./data/static-did-dock.json"; +import staticCred610 from "./data/static-bbs-cred-610.json"; // import staticCred630 from '../data/static-bbs-cred-630.json'; // TODO: add a credential from 6.3.0 const loadDocumentDefault = defaultDocumentLoader(null); @@ -18,8 +18,8 @@ async function documentLoader(doc) { return loadDocumentDefault(doc); } -describe('Static BBS+ Credential Verification (backwards compatibility)', () => { - test('verifies BBS+ credential from SDK 6.1.0', async () => { +describe("Static BBS+ Credential Verification (backwards compatibility)", () => { + test("verifies BBS+ credential from SDK 6.1.0", async () => { const result = await verifyCredential(staticCred610, { documentLoader, }); diff --git a/packages/credential-sdk/tests/test-environment.js b/packages/credential-sdk/tests/test-environment.js new file mode 100644 index 000000000..21ed00ac3 --- /dev/null +++ b/packages/credential-sdk/tests/test-environment.js @@ -0,0 +1,27 @@ +import { TestEnvironment as NodeEnvironment } from "jest-environment-node"; + +class MyEnvironment extends NodeEnvironment { + constructor(config, context) { + super( + { + ...config, + globals: { + ...config.globals, + Uint32Array, + Uint8Array, + ArrayBuffer, + TextDecoder, + TextEncoder, + Buffer, + }, + }, + context + ); + } + + async setup() {} + + async teardown() {} +} + +export default MyEnvironment; diff --git a/packages/credential-sdk/tests/utils.test.js b/packages/credential-sdk/tests/utils.test.js new file mode 100644 index 000000000..6d38f8548 --- /dev/null +++ b/packages/credential-sdk/tests/utils.test.js @@ -0,0 +1,340 @@ +import { initializeWasm } from "@docknetwork/crypto-wasm-ts"; + +import { ReusablePromiseMap, retry, timeout } from "../src/utils/async"; +import { + PublicKeyEd25519, + PublicKeySr25519, + PublicKeySecp256k1, + SignatureEd25519, + SignatureSr25519, + SignatureSecp256k1, +} from "../src/types"; +import { isHexWithGivenByteSize } from "../src/utils/bytes"; +import { expandJSONLD } from "../src/vc"; +import { + getCredentialStatus, + isAccumulatorRevocationStatus, +} from "../src/vc/revocation"; +import { Ed25519Keypair, Secp256k1Keypair } from "../src/keypairs"; + +describe("Testing isHexWithGivenByteSize", () => { + test("isHexWithGivenByteSize rejects strings not starting with 0x", () => { + expect(isHexWithGivenByteSize("12")).toBe(false); + }); + + test("isHexWithGivenByteSize rejects strings with invalid hex", () => { + expect(isHexWithGivenByteSize("0x1h")).toBe(false); + }); + + test("isHexWithGivenByteSize rejects strings with non-full byte", () => { + expect(isHexWithGivenByteSize("0x123")).toBe(false); + }); + + test("isHexWithGivenByteSize rejects strings with byte size 0", () => { + expect(isHexWithGivenByteSize("0x")).toBe(false); + }); + + test("isHexWithGivenByteSize rejects strings not matching expected byte size", () => { + expect(isHexWithGivenByteSize("0x12", 2)).toBe(false); + expect(isHexWithGivenByteSize("0x1234", 1)).toBe(false); + expect(isHexWithGivenByteSize("0x1234", 0)).toBe(false); + }); + + test("isHexWithGivenByteSize accepts correct hex string with full bytes", () => { + expect(isHexWithGivenByteSize("0x12")).toBe(true); + expect(isHexWithGivenByteSize("0x1234")).toBe(true); + expect(isHexWithGivenByteSize("0x1234ef")).toBe(true); + }); + + test("isHexWithGivenByteSize accepts correct hex string matching expected byte size", () => { + expect(isHexWithGivenByteSize("0x12", 1)).toBe(true); + expect(isHexWithGivenByteSize("0x1234", 2)).toBe(true); + expect(isHexWithGivenByteSize("0x1234ef", 3)).toBe(true); + }); + + const crateElapsedTimeSec = () => { + const start = +new Date(); + + return (expected) => + expect(Math.round((+new Date() - start) / 1e2) / 10).toBe(expected); + }; + + test("`timeout` works properly", async () => { + const expectElapsedTimeSec = crateElapsedTimeSec(); + + await Promise.all( + [ + async () => { + expect(await timeout(1e2)).toBe(void 0); + expectElapsedTimeSec(0.1); + }, + async () => { + expect(await timeout(3e2, () => "a")).toBe("a"); + expectElapsedTimeSec(0.3); + }, + async () => { + await expect(() => + timeout(2e2, () => { + throw new Error("Rejected timeout"); + }) + ).rejects.toThrowErrorMatchingSnapshot(); + expectElapsedTimeSec(0.2); + }, + ].map((f) => f()) + ); + }); + + test("`ReusablePromiseMap` works properly", async () => { + const map = new ReusablePromiseMap(); + + const results = await Promise.all([ + map.callByKey(1, () => timeout(5e2, () => 10)), + timeout(2e2, () => map.callByKey(1, () => Promise.resolve(2))), + timeout(7e2, () => map.callByKey(1, () => Promise.resolve(1))), + ]); + + expect(results).toEqual([10, 10, 1]); + + await expect(() => map.callByKey(10, () => Promise.reject(1))).rejects; + expect(map.map.size).toBe(0); + }); + + test("`ReusablePromiseMap` capacity", async () => { + const map = new ReusablePromiseMap({ capacity: 2 }); + + const expectElapsedTimeSec = crateElapsedTimeSec(); + + let results = await Promise.all( + Array.from({ length: 10 }, (_, i) => + map.callByKey(i, () => timeout(5e2, () => i)) + ) + ); + + expect(results).toEqual(Array.from({ length: 10 }, (_, i) => i)); + expect(map.map.size).toBe(0); + expect(map.queue.length).toBe(0); + + expectElapsedTimeSec(2.5); + + const mapWithBoundQueue = new ReusablePromiseMap({ + capacity: 1, + queueCapacity: 3, + }); + + results = await Promise.all( + [ + () => mapWithBoundQueue.callByKey(1, () => timeout(5e2, () => 1)), + () => mapWithBoundQueue.callByKey(2, () => timeout(5e2, () => 2)), + () => mapWithBoundQueue.callByKey(3, () => timeout(5e2, () => 3)), + () => mapWithBoundQueue.callByKey(3, () => timeout(5e2, () => 4)), + () => + expect(() => + mapWithBoundQueue.callByKey(4, () => timeout(5e2, () => 5)) + ).rejects.toThrowErrorMatchingSnapshot(), + ].map((f) => f()) + ); + + expect(results).toEqual([1, 2, 3, 4, undefined]); + }); + + test("`retry` works properly", async () => { + const makeCtrFn = + (ctr, placeholder = new Promise((_) => {})) => + async () => { + if (!ctr--) { + return 0; + } else { + return placeholder; + } + }; + const expectElapsedTimeSec = crateElapsedTimeSec(); + + await Promise.all( + [ + async () => { + const onTimeoutExceeded = jest.fn((retrySym) => retrySym); + + expect( + await retry(makeCtrFn(5), 3e2, { delay: 2e2, onTimeoutExceeded }) + ).toBe(0); + expectElapsedTimeSec(2.5); + + expect(onTimeoutExceeded).toBeCalledTimes(5); + }, + async () => { + expect(await retry(makeCtrFn(5), 3e2)).toBe(0); + expectElapsedTimeSec(1.5); + }, + async () => { + expect(await retry(makeCtrFn(0), 3e2)).toBe(0); + expectElapsedTimeSec(0); + }, + async () => { + await expect(() => + retry(makeCtrFn(5), 3e2, { maxAttempts: 3 }) + ).rejects.toThrowErrorMatchingSnapshot(); + expectElapsedTimeSec(1.2); + }, + async () => { + expect( + await retry(makeCtrFn(5), 3e2, { maxAttempts: 5, delay: 2e2 }) + ).toBe(0); + expectElapsedTimeSec(2.5); + }, + async () => { + await expect(() => + retry(makeCtrFn(100), 1, { maxAttempts: 99 }) + ).rejects.toThrowErrorMatchingSnapshot(); + expectElapsedTimeSec(0.1); + }, + async () => { + expect( + await retry(makeCtrFn(4, Promise.reject(1)), 3e2, { + onError: (_, next) => next, + }) + ).toBe(0); + expectElapsedTimeSec(0); + }, + async () => { + expect( + await retry(makeCtrFn(4, Promise.reject(1)), 3e2, { + onError: (error) => error, + }) + ).toBe(1); + expectElapsedTimeSec(0); + }, + async () => { + await expect(() => + retry(makeCtrFn(4, Promise.reject(1)), 3e2, { + onError: () => { + throw new Error("From `onError` callback"); + }, + }) + ).rejects.toThrowErrorMatchingSnapshot(); + expectElapsedTimeSec(0); + }, + ].map((f) => f()) + ); + }); +}); + +describe("Testing public key and signature instantiation from keyring", () => { + beforeAll(async () => { + await initializeWasm(); + }); + + test("Pair's publicKey returns correct public key from ed25519 pair", () => { + const pair = Ed25519Keypair.random(); + const pk = pair.publicKey(); + expect(pk instanceof PublicKeyEd25519).toBe(true); + }); + + test("Pair's publicKey returns correct public key from secp256k1 pair", () => { + const pair = Secp256k1Keypair.random(); + const pk = pair.publicKey(); + expect(pk instanceof PublicKeySecp256k1).toBe(true); + }); + + test("Pair's sign method returns correct signature from ed25519 pair", () => { + const pair = Ed25519Keypair.random(); + const sig = pair.sign([1, 2]); + expect(sig instanceof SignatureEd25519).toBe(true); + }); + + test("Pair's sign method returns correct signature from secp256k1 pair", () => { + const pair = Secp256k1Keypair.random(); + const sig = pair.sign([1, 2]); + expect(sig instanceof SignatureSecp256k1).toBe(true); + }); +}); + +describe("Testing Ecdsa with secp256k1", () => { + test("Signing and verification works", () => { + const msg = [ + 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, + 2, 3, 4, 5, 6, 7, 8, + ]; + const entropy = + "0x4c94485e0c21ae6c41ce1dfe7b6bfaceea5ab68e40a2476f50208e526f506080"; + const pair = new Secp256k1Keypair(entropy); + const pk = pair.publicKey(); + const sig = new Uint8Array( + pair.keyPair.sign(Secp256k1Keypair.hash(msg)).toDER() + ); + expect(Secp256k1Keypair.verify(msg, sig, pk)).toBe(true); + + const msg1 = [ + 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, + 2, 3, 4, 5, 6, 7, 8, 9, + ]; + const sig1 = new Uint8Array( + pair.keyPair.sign(Secp256k1Keypair.hash(msg1)).toDER() + ); + expect(Secp256k1Keypair.verify(msg1, sig1, pk)).toBe(true); + expect(msg !== msg1).toBe(true); + expect(sig !== sig1).toBe(true); + + const msg2 = [ + 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, + 2, 3, 4, 5, 6, 7, + ]; + const sig2 = new Uint8Array( + pair.keyPair.sign(Secp256k1Keypair.hash(msg2)).toDER() + ); + expect(Secp256k1Keypair.verify(msg2, sig2, pk)).toBe(true); + expect(msg2 !== msg1).toBe(true); + expect(sig2 !== sig1).toBe(true); + }); +}); + +describe("Detecting accumulator status", () => { + test("works", async () => { + const credential = { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + { + dk: "https://ld.dock.io/credentials#", + PermanentResidentCard: "dk:PermanentResidentCard", + PermanentResident: "dk:PermanentResident", + Person: "dk:Person", + givenName: "dk:givenName", + familyName: "dk:familyName", + lprNumber: "dk:lprNumber", + name: "http://schema.org/name", + description: "http://schema.org/description", + }, + ], + credentialStatus: { + id: "dock:accumulator:0x4e8ae3b33f1601844f31dd9d121adb0157bd609b04d3449d0fabe45bd057c93f", + type: "DockVBAccumulator2022", + revocationCheck: "membership", + revocationId: "4", + }, + id: "http://localhost:3001/8c818a2fbf84bb14720ceea764af21a7023141b231b319e45f0753d57955ecf8", + type: ["VerifiableCredential", "PermanentResidentCard"], + credentialSubject: { + id: "did:dock:5GLu8vCdG2CUTpuq3f7TehjYbM3izoo64vovKgwbAdrv6Dq2", + type: ["PermanentResident", "Person"], + givenName: "JOHN", + familyName: "SMITH", + lprNumber: 1234, + }, + issuer: "did:dock:5GLu8vCdG2CUTpuq3f7TehjYbM3izoo64vovKgwbAdrv6Dq2", + name: "Permanent Resident Card", + description: "Government of Example Permanent Resident Card.", + }; + + let expandedCredential = await expandJSONLD(credential); + let status = getCredentialStatus(expandedCredential); + expect(isAccumulatorRevocationStatus(status)).toEqual(true); + + credential.credentialStatus = { + id: "rev-reg:dock:0x0194", + type: "CredentialStatusList2017", + }; + + expandedCredential = await expandJSONLD(credential); + status = getCredentialStatus(expandedCredential); + expect(isAccumulatorRevocationStatus(status)).toEqual(false); + }); +}); diff --git a/tests/cached-document-loader.js b/packages/credential-sdk/tests/utils/cached-document-loader.js similarity index 74% rename from tests/cached-document-loader.js rename to packages/credential-sdk/tests/utils/cached-document-loader.js index 32a7ba081..07cfe885c 100644 --- a/tests/cached-document-loader.js +++ b/packages/credential-sdk/tests/utils/cached-document-loader.js @@ -1,6 +1,6 @@ -import contexts from '../src/utils/vc/contexts'; -import network_cache from './network-cache'; -import jsonFetch from '../src/utils/json-fetch'; +import contexts from "../../src/vc/contexts"; +import network_cache from "./network-cache"; +import jsonFetch from "../../src/utils/json-fetch"; // global document cache, replaces the internet and acts as a did method const documentRegistry = {}; @@ -14,14 +14,14 @@ for (const k of Object.keys(network_cache)) { /// document loader that pulls documents from the local documentRegistry export async function documentLoader(url) { if (documentRegistry[url] === undefined) { - if (!(url.startsWith('http://') || url.startsWith('https://'))) { + if (!(url.startsWith("http://") || url.startsWith("https://"))) { throw new Error(`failed to resolve ${url}`); } documentRegistry[url] = await jsonFetch(url); console.warn( - 'Unit test is making web requests. This is slow. Please update ./test/network-cache.js', - 'with: ', - JSON.stringify({ [url]: documentRegistry[url] }, null, 2), + "Unit test is making web requests. This is slow. Please update ./test/network-cache.js", + "with: ", + JSON.stringify({ [url]: documentRegistry[url] }, null, 2) ); } return { diff --git a/tests/create-presentation.js b/packages/credential-sdk/tests/utils/create-presentation.js similarity index 89% rename from tests/create-presentation.js rename to packages/credential-sdk/tests/utils/create-presentation.js index 332c32c32..098c14898 100644 --- a/tests/create-presentation.js +++ b/packages/credential-sdk/tests/utils/create-presentation.js @@ -1,4 +1,4 @@ -import VerifiablePresentation from "../src/verifiable-presentation"; +import VerifiablePresentation from "../../src/vc/verifiable-presentation"; /** * Create an unsigned Verifiable Presentation @@ -10,7 +10,7 @@ import VerifiablePresentation from "../src/verifiable-presentation"; export function createPresentation( verifiableCredential, id = "http://example.edu/presentation/2803", - holder = null, + holder = null ) { const presentation = new VerifiablePresentation(id); if (Array.isArray(verifiableCredential)) { diff --git a/packages/credential-sdk/tests/utils/example-credential.js b/packages/credential-sdk/tests/utils/example-credential.js new file mode 100644 index 000000000..675fa90bd --- /dev/null +++ b/packages/credential-sdk/tests/utils/example-credential.js @@ -0,0 +1,36 @@ +export default { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + { + emailAddress: "https://schema.org/email", + alumniOf: "https://schema.org/alumniOf", + }, + ], + id: "uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc", + type: ["VerifiableCredential", "AlumniCredential"], + issuanceDate: "2020-03-18T19:23:24Z", + credentialSchema: { + // this is the schema + id: "blob:dock:5C78GCA", + type: "JsonSchemaValidator2018", + }, + credentialSubject: { + id: "did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", + emailAddress: "johnsmith@example.com", + alumniOf: "Example University", + }, + credentialStatus: { + id: "rev-reg:dock:0x0194...", + type: "CredentialStatusList2017", + }, + issuer: "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr", + proof: { + type: "Ed25519Signature2018", + created: "2020-04-22T07:50:13Z", + jws: "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg", + proofPurpose: "assertionMethod", + verificationMethod: + "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1", + }, +}; diff --git a/packages/credential-sdk/tests/utils/example-schema.js b/packages/credential-sdk/tests/utils/example-schema.js new file mode 100644 index 000000000..d70b5ddf4 --- /dev/null +++ b/packages/credential-sdk/tests/utils/example-schema.js @@ -0,0 +1,19 @@ +export default { + $schema: "http://json-schema.org/draft-07/schema#", + description: "Alumni", + type: "object", + properties: { + id: { + type: "string", + }, + emailAddress: { + type: "string", + format: "email", + }, + alumniOf: { + type: "string", + }, + }, + required: ["emailAddress", "alumniOf"], + additionalProperties: false, +}; diff --git a/packages/credential-sdk/tests/utils/network-cache.js b/packages/credential-sdk/tests/utils/network-cache.js new file mode 100644 index 000000000..fa670fe97 --- /dev/null +++ b/packages/credential-sdk/tests/utils/network-cache.js @@ -0,0 +1,55 @@ +export default { + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw": + { + id: "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw", + type: "EcdsaSecp256k1VerificationKey2019", + publicKeyBase58: "222iuczftmixHLkW6wszwyeAfYCZA7bzQMhkEXpeNVJrk", + "@context": "https://w3id.org/security/v2", + controller: + "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw", + }, + "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw": + { + "@context": "https://w3id.org/security/v2", + id: "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw", + assertionMethod: [ + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw", + ], + authentication: [ + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw", + ], + }, + + "urn:EcdsaSecp256k1VerificationKey2019#keys-1": { + id: "urn:EcdsaSecp256k1VerificationKey2019#keys-1", + type: "EcdsaSecp256k1VerificationKey2019", + publicKeyBase58: "222iuczftmixHLkW6wszwyeAfYCZA7bzQMhkEXpeNVJrk", + "@context": "https://w3id.org/security/v2", + controller: "urn:EcdsaSecp256k1VerificationKey2019", + }, + "urn:EcdsaSecp256k1VerificationKey2019": { + "@context": "https://w3id.org/security/v2", + id: "urn:EcdsaSecp256k1VerificationKey2019", + assertionMethod: ["urn:EcdsaSecp256k1VerificationKey2019#keys-1"], + authentication: ["urn:EcdsaSecp256k1VerificationKey2019#keys-1"], + }, + + "urn:JsonWebKey2020": { + "@context": "https://w3id.org/security/v2", + id: "urn:JsonWebKey2020", + assertionMethod: ["urn:JsonWebKey2020#keys-1"], + authentication: ["urn:JsonWebKey2020#keys-1"], + }, + "urn:JsonWebKey2020#keys-1": { + "@context": "https://w3id.org/security/suites/jws-2020/v1", + id: "urn:JsonWebKey2020#keys-1", + controller: "urn:JsonWebKey2020", + type: "JsonWebKey2020", + publicKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + }, + }, +}; diff --git a/packages/credential-sdk/tests/utils/test-keys.js b/packages/credential-sdk/tests/utils/test-keys.js new file mode 100644 index 000000000..84657df27 --- /dev/null +++ b/packages/credential-sdk/tests/utils/test-keys.js @@ -0,0 +1,41 @@ +import { Secp256k1Keypair } from "../../src/keypairs"; + +const keypairEcdsaSecp256k1 = new Secp256k1Keypair( + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" +); + +// TODO: add more testing keys (ed25519 etc) +export default [ + { + sigType: "JsonWebSignature2020", + keyDocument: { + "@context": "https://w3id.org/security/suites/jws-2020/v1", + id: "urn:JsonWebKey2020#keys-1", + controller: "urn:JsonWebKey2020", + type: "JsonWebKey2020", + publicKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + }, + privateKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + d: "Wq5_KgqjvYh_EGvBDYtSs_0ufJJP0y0tkAXl6GqxHMkY0QP8vmD76mniXD-BWhd_", + }, + }, + }, + { + sigType: "EcdsaSecp256k1Signature2019", + keyDocument: { + id: "urn:EcdsaSecp256k1VerificationKey2019#keys-1", + controller: "urn:EcdsaSecp256k1VerificationKey2019", + type: "EcdsaSecp256k1VerificationKey2019", + keypair: keypairEcdsaSecp256k1, + publicKey: keypairEcdsaSecp256k1.publicKey(), + }, + }, +]; diff --git a/packages/credential-sdk/tests/utils/type-helpers.test.js b/packages/credential-sdk/tests/utils/type-helpers.test.js new file mode 100644 index 000000000..fd1d139cb --- /dev/null +++ b/packages/credential-sdk/tests/utils/type-helpers.test.js @@ -0,0 +1,15 @@ +import { ensureValidDatetime } from "../../src/utils/type-helpers"; + +describe("ensureValidDatetime.", () => { + test("happy path", () => { + expect(ensureValidDatetime("2023-10-09T20:05:44.039Z")).toBe(true); + expect(ensureValidDatetime("2020-01-01T20:12:08.613Z")).toBe(true); + expect(ensureValidDatetime("1970-01-01T20:12:08.613Z")).toBe(true); + }); + + test("unhappy path", () => { + expect(() => ensureValidDatetime("2023-13-09T15:12:08.613Z")).toThrow(); + expect(() => ensureValidDatetime("2020-01-01")).toThrow(); + expect(() => ensureValidDatetime("not a date")).toThrow(); + }); +}); diff --git a/packages/dock-blockchain-api/.npmignore b/packages/dock-blockchain-api/.npmignore new file mode 100644 index 000000000..a35bd89d5 --- /dev/null +++ b/packages/dock-blockchain-api/.npmignore @@ -0,0 +1,10 @@ +src/ +scripts/ +jest.config.js +rollup.config.mjs +out/ +node_modules/ +.vscode/ +.turbo/ +tests/ +*.log diff --git a/packages/dock-blockchain-api/CHANGELOG.md b/packages/dock-blockchain-api/CHANGELOG.md new file mode 100644 index 000000000..9602a8403 --- /dev/null +++ b/packages/dock-blockchain-api/CHANGELOG.md @@ -0,0 +1,12 @@ +# @docknetwork/dock-blockchain-api + +## 0.1.1 + +### Minor Changes + +- Improved READMEs + +### Patch Changes + +- Updated dependencies + - @docknetwork/credential-sdk@0.1.1 diff --git a/packages/dock-blockchain-api/README.md b/packages/dock-blockchain-api/README.md new file mode 100644 index 000000000..d8f951f40 --- /dev/null +++ b/packages/dock-blockchain-api/README.md @@ -0,0 +1,21 @@ +# @docknetwork/dock-blockchain-api + +Built with PolkadotJS, for use with the Dock Substrate Node or our public main/test networks. + +## Initialize + +```javascript +import { DockAPI } from "@docknetwork/dock-blockchain-api"; + +const dock = new DockAPI(); +dock.init(...); +``` + +## Use + +```javascript +import { DockCoreModules } from "@docknetwork/dock-blockchain-modules"; + +const modules = new DockCoreModules(dock); +... +``` diff --git a/packages/dock-blockchain-api/index.js b/packages/dock-blockchain-api/index.js new file mode 100644 index 000000000..38c47a249 --- /dev/null +++ b/packages/dock-blockchain-api/index.js @@ -0,0 +1 @@ +module.exports = require("./dist/cjs/index.cjs"); diff --git a/packages/dock-blockchain-api/jest.config.js b/packages/dock-blockchain-api/jest.config.js new file mode 100644 index 000000000..ae170031f --- /dev/null +++ b/packages/dock-blockchain-api/jest.config.js @@ -0,0 +1,30 @@ +export default { + bail: true, + moduleNameMapper: { + "^@docknetwork/credential-sdk/(.*)$": + "/packages/credential-sdk/$1", + "^@docknetwork/dock-blockchain-api/(.*)$": + "/packages/dock-blockchain-api/$1/", + "^@docknetwork/dock-blockchain-modules/(.*)$": + "/packages/dock-blockchain-modules/$1", + }, + clearMocks: true, + testTimeout: 30000, + testEnvironment: "./tests/test-environment", + transform: { + "^.+\\.(ts|js)$": ["babel-jest", { rootMode: "upward" }], + }, + transformIgnorePatterns: [ + "/node_modules/(?!@polkadot|@babel|multiformats|@docknetwork|@stablelib)", + ], + workerIdleMemoryLimit: "1G", + verbose: true, + globals: { + Uint8Array, + Uint32Array, + ArrayBuffer, + TextDecoder, + TextEncoder, + Buffer, + }, +}; diff --git a/packages/dock-blockchain-api/package.json b/packages/dock-blockchain-api/package.json new file mode 100644 index 000000000..0d94afbbe --- /dev/null +++ b/packages/dock-blockchain-api/package.json @@ -0,0 +1,113 @@ +{ + "name": "@docknetwork/dock-blockchain-api", + "version": "0.1.1", + "license": "MIT", + "main": "./dist/esm/index.js", + "type": "module", + "files": [ + "dist", + "index.js" + ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "default": "./dist/esm/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*", + "default": "./dist/esm/*" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/docknetwork/sdk" + }, + "engines": { + "node": ">=18.0.0" + }, + "devDependencies": { + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.3", + "@babel/node": "^7.23.9", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.3", + "@comunica/actor-init-sparql-rdfjs": "^1.22.3", + "@comunica/types": "^1.0.0", + "@helia/strings": "^3.0.1", + "@rollup/plugin-alias": "^4.0.2", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-wasm": "^5.1.0", + "@types/jest": "^29.5.12", + "aws-sdk": "^2.1057.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^29.7.0", + "eslint": "^8.0.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-sonarjs": "0.5.0", + "eslint-plugin-unused-imports": "^3.0.0", + "eth-revert-reason": "^1.0.3", + "ethers": "^5.4", + "ethr-did-resolver": "^2.2.0", + "glob": "^7.1.6", + "helia": "^4.0.1", + "jest": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jsdoc": "^3.6.3", + "jsdoc-typeof-plugin": "^1.0.0", + "node-datachannel": "^0.5.4", + "parity-scale-codec": "^0.5.3", + "r1csfile": "0.0.41", + "ramda": "^0.27.2", + "rollup": "2.78.0", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-multi-input": "^1.3.2", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2", + "rxjs": "^7.4.0", + "typescript": "5.0.4" + }, + "scripts": { + "exc": "babel-node", + "lint": "eslint \"src/**/*.js\"", + "build": "rollup -c", + "watch": "rollup -c -w", + "prepublishOnly": "yarn build", + "docs": "rm -rf out && mkdir out && touch out/.nojekyll && jsdoc src -r -c ../../.jsdoc -d out/reference", + "type-check": "tsc --allowJs --checkJs --noEmit --moduleResolution node --resolveJsonModule --target ES6 --skipLibCheck true --allowSyntheticDefaultImports true" + }, + "resolutions": { + "@polkadot/api": "10.12.4" + }, + "dependencies": { + "@docknetwork/credential-sdk": "0.1.1", + "@docknetwork/node-types": "^0.17.0", + "@juanelas/base64": "^1.0.5", + "@polkadot/api": "10.12.4", + "@transmute/json-web-signature": "^0.7.0-unstable.80", + "base64url": "3.0.1", + "blake2b": "2.1.4", + "bs58": "5.0.0", + "cross-fetch": "3.1.6", + "deep-equal": "2.0.5", + "dotenv": "16.0.1", + "elliptic": "6.5.4", + "flat": "^5.0.2", + "js-sha256": "0.9.0", + "json-canonicalize": "1.0.4", + "json-stringify-deterministic": "^1.0.11", + "jsonschema": "1.4.1", + "key-did-resolver": "^1.4.0", + "mrklt": "^0.2.0", + "multiformats": "^9.5.4", + "n3": "1.16.2", + "pako": "^2.1.0", + "rify": "^0.7.1", + "semver": "^7.6.0" + } +} diff --git a/packages/dock-blockchain-api/rollup.config.mjs b/packages/dock-blockchain-api/rollup.config.mjs new file mode 100644 index 000000000..779150c18 --- /dev/null +++ b/packages/dock-blockchain-api/rollup.config.mjs @@ -0,0 +1,40 @@ +import json from "@rollup/plugin-json"; +import multiInput from "rollup-plugin-multi-input"; +import commonjs from "@rollup/plugin-commonjs"; +import { terser } from "rollup-plugin-terser"; +// import { wasm } from '@rollup/plugin-wasm'; +// import pkg from './package.json'; + +export default async function () { + return [ + { + plugins: [ + multiInput(), + json(), + // terser(), + commonjs(), + // Temporarily disabled, not sure if required + // since rify is a node module doesnt seem to work + // but would be nice to try embed it + // wasm({ + // sync: ['*.wasm'], + // }), + ], + input: ["src/**/*.js"], + output: [ + { + sourcemap: true, + dir: "dist/esm", + format: "esm", + entryFileNames: "[name].js", + }, + { + sourcemap: true, + dir: "dist/cjs", + format: "cjs", + entryFileNames: "[name].cjs", + }, + ], + }, + ]; +} diff --git a/scripts/chain_traffic_data.js b/packages/dock-blockchain-api/scripts/chain_traffic_data.js similarity index 73% rename from scripts/chain_traffic_data.js rename to packages/dock-blockchain-api/scripts/chain_traffic_data.js index 92ccc683e..980fdb504 100644 --- a/scripts/chain_traffic_data.js +++ b/packages/dock-blockchain-api/scripts/chain_traffic_data.js @@ -1,10 +1,8 @@ -import dock from '../src/index'; -import { - getLastBlock, getBlock, -} from '../src/utils/chain-ops'; -import { median } from './helpers'; +import dock from "../src/index"; +import { getLastBlock, getBlock } from "../src/utils/chain-ops"; +import { median } from "./helpers"; -require('dotenv').config(); +require("dotenv").config(); const { FullNodeEndpoint } = process.env; @@ -21,11 +19,21 @@ async function getWeight(blockHash) { const evs = events.map((e) => e.toJSON()); let weight = 0; evs.forEach((e) => { - if (e.phase && e.phase.ApplyExtrinsic !== undefined && e.event && e.event.index === '0x0000') { - if (e.event && e.event.data && e.event.data.length > 0 && e.event.data[0].weight) { + if ( + e.phase && + e.phase.ApplyExtrinsic !== undefined && + e.event && + e.event.index === "0x0000" + ) { + if ( + e.event && + e.event.data && + e.event.data.length > 0 && + e.event.data[0].weight + ) { weight += e.event.data[0].weight; } else { - console.log('Weight could not be found'); + console.log("Weight could not be found"); console.log(e.event.data); } } @@ -56,7 +64,9 @@ async function getTxnsStatsInLastBlocks(count) { const mid = median(extrinsicsCounts); const avgWeight = weight / count; const blPc = Math.round((avgWeight * 100) / blockCap); - console.log(`For ${blocks.length} blocks, total extrinsic count is ${total}, mean is ${mean} and median is ${mid}. Block fill % is ${blPc}`); + console.log( + `For ${blocks.length} blocks, total extrinsic count is ${total}, mean is ${mean} and median is ${mid}. Block fill % is ${blPc}` + ); return [blocks.length, total, mean, mid]; } @@ -78,6 +88,6 @@ main() process.exit(0); }) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/compare-state.js b/packages/dock-blockchain-api/scripts/compare-state.js similarity index 82% rename from scripts/compare-state.js rename to packages/dock-blockchain-api/scripts/compare-state.js index bf254a5f4..8c1249d89 100644 --- a/scripts/compare-state.js +++ b/packages/dock-blockchain-api/scripts/compare-state.js @@ -1,22 +1,23 @@ -import R from 'ramda'; -import dock from '../src'; -import { timestampLogger } from './helpers'; +import R from "ramda"; +import dock from "../src"; +import { timestampLogger } from "./helpers"; const { FullNodeEndpoint, FirstBlockNumber, SecondBlockNumber = +FirstBlockNumber + 1, - Transform = 'toHuman', + Transform = "toHuman", } = process.env; const info = timestampLogger.error; const output = console.log; -const KeyedSymbol = Symbol('Keyed'); +const KeyedSymbol = Symbol("Keyed"); const ToSkip = new Set([ - 'offences::reports', - 'substrate::code', - 'democracy::preimages', + "offences::reports", + "substrate::code", + "democracy::preimages", ]); +const ToScan = new Set(["didModule::dids", "didModule::didControllers"]); /** * Documentation for storage entry migration process: @@ -60,34 +61,22 @@ const ToSkip = new Set([ async function main() { await dock.init({ address: FullNodeEndpoint }); - info('Scanning the first block state'); + info(`Scanning the first block state ${+FirstBlockNumber}`); const first = await grabState( - await dock.api.at(await dock.api.rpc.chain.getBlockHash(+FirstBlockNumber)), + await dock.api.at(await dock.api.rpc.chain.getBlockHash(+FirstBlockNumber)) ); - info('-'.repeat(50)); - info('Scanning the second block state'); + info("-".repeat(50)); + info(`Scanning the second block state ${+SecondBlockNumber}`); const second = await grabState( - await dock.api.at( - await dock.api.rpc.chain.getBlockHash(+SecondBlockNumber), - ), + await dock.api.at(await dock.api.rpc.chain.getBlockHash(+SecondBlockNumber)) ); - info('-'.repeat(50)); + info("-".repeat(50)); const entries = new Set([...Object.keys(first), ...Object.keys(second)]); const res = {}; for (const entry of entries) { - if (entry in first && entry in second) { - if (!R.equals(first[entry], second[entry])) { - res[entry] = buildDiff(first[entry], second[entry]); - } - } else if (entry in first) { - res[entry] = 'REMOVED'; - info(`Removed storage entry: ${entry}`); - } else { - res[entry] = 'ADDED'; - info(`New storage entry: ${entry}`); - } + res[entry] = second[entry]; } output(JSON.stringify(res, null, 2)); @@ -105,12 +94,12 @@ const keysValuesDiff = R.pipe( [key]: R.pipe( R.map(R.o(R.defaultTo([]), R.map(R.nth(idx)))), R.apply(diff), - R.reject(R.isEmpty), + R.reject(R.isEmpty) ), })), R.mergeAll, - R.applySpec, -)(['keys', 'values']); + R.applySpec +)(["keys", "values"]); /** Calculates the difference between the first and second states. */ const buildDiff = R.curryN( @@ -124,17 +113,17 @@ const buildDiff = R.curryN( R.pipe( keysValuesDiff, R.reject(R.isEmpty), - R.unless(R.pipe(R.keys, R.length, R.equals(1)), R.F), - ), + R.unless(R.pipe(R.keys, R.length, R.equals(1)), R.F) + ) ), - R.apply(diff), + R.apply(diff) ), R.applySpec({ stateBefore: R.nth(0), stateAfter: R.nth(1), - }), - ), - ), + }) + ) + ) ); /** @@ -161,13 +150,13 @@ const grabState = async (api) => { const key = `${moduleName}::${memberName}`; - if (ToSkip.has(key)) { + if (ToSkip.has(key) || !ToScan.has(key)) { info(`Skipping ${key}`); continue; } info(`Scanning ${key}`); - if (typeof member === 'function') { + if (typeof member === "function") { try { data[key] = parseObj((await member())[Transform]()); } catch { diff --git a/scripts/dump_state.js b/packages/dock-blockchain-api/scripts/dump_state.js similarity index 83% rename from scripts/dump_state.js rename to packages/dock-blockchain-api/scripts/dump_state.js index fe806f1c1..69a03ffc1 100644 --- a/scripts/dump_state.js +++ b/packages/dock-blockchain-api/scripts/dump_state.js @@ -1,16 +1,16 @@ // Download important state from node and write to JSON file in the same directory -import dock from '../src/index'; -import { asDockAddress } from '../src/utils/codec'; +import dock from "../src/index"; +import { asDockAddress } from "@docknetwork/credential-sdk/utils"; -require('dotenv').config(); +require("dotenv").config(); -const fs = require('fs'); +const fs = require("fs"); const { FullNodeEndpoint, Network } = process.env; if (process.argv.length !== 3) { - console.error('Need only 1 argument which is the name of dump file'); + console.error("Need only 1 argument which is the name of dump file"); process.exit(1); } @@ -115,16 +115,24 @@ async function downloadBbsPlus() { const paramsCounter = await dock.api.query.bbsPlus.paramsCounter.entries(); const params = await dock.api.query.bbsPlus.bbsPlusParams.entries(); const keys = await dock.api.query.bbsPlus.bbsPlusKeys.entries(); - return { bbsPlusParamsCounter: storageMapEntriesToObject(paramsCounter), bbsPlusParams: storageDoubleMapEntriesToObject(params), bbsPlusKeys: storageDoubleMapEntriesToObject(keys) }; + return { + bbsPlusParamsCounter: storageMapEntriesToObject(paramsCounter), + bbsPlusParams: storageDoubleMapEntriesToObject(params), + bbsPlusKeys: storageDoubleMapEntriesToObject(keys), + }; } async function downloadAccum() { - const counter = await dock.api.query.accumulator.accumulatorOwnerCounters.entries(); + const counter = + await dock.api.query.accumulator.accumulatorOwnerCounters.entries(); const params = await dock.api.query.accumulator.accumulatorParams.entries(); const keys = await dock.api.query.accumulator.accumulatorKeys.entries(); const accum = await dock.api.query.accumulator.accumulators.entries(); return { - accumulatorCounter: storageMapEntriesToObject(counter), accumulatorParams: storageDoubleMapEntriesToObject(params), accumulatorKeys: storageDoubleMapEntriesToObject(keys), accumulators: storageMapEntriesToObject(accum), + accumulatorCounter: storageMapEntriesToObject(counter), + accumulatorParams: storageDoubleMapEntriesToObject(params), + accumulatorKeys: storageDoubleMapEntriesToObject(keys), + accumulators: storageMapEntriesToObject(accum), }; } @@ -143,9 +151,7 @@ async function downloadState() { const blobs = await downloadBlobs(); - const { - dids, controllers, keys, serviceEndpoints, - } = await downloadDids(); + const { dids, controllers, keys, serviceEndpoints } = await downloadDids(); const regs = await downloadRegs(); @@ -188,11 +194,12 @@ async function downloadState() { process.exit(0); } -dock.init({ - address: FullNodeEndpoint, -}) +dock + .init({ + address: FullNodeEndpoint, + }) .then(downloadState) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/email_utils.js b/packages/dock-blockchain-api/scripts/email_utils.js similarity index 75% rename from scripts/email_utils.js rename to packages/dock-blockchain-api/scripts/email_utils.js index 0fc6dc626..1141d7e28 100644 --- a/scripts/email_utils.js +++ b/packages/dock-blockchain-api/scripts/email_utils.js @@ -1,6 +1,6 @@ -import SESV2 from 'aws-sdk/clients/sesv2'; -import { curry, identity } from 'ramda'; -import { envObj, notNilAnd } from './helpers'; +import SESV2 from "aws-sdk/clients/sesv2"; +import { curry, identity } from "ramda"; +import { envObj, notNilAnd } from "./helpers"; const { AWS_ACCESS_KEY_ID, @@ -22,12 +22,14 @@ const { * @param {string} body * @returns {Promise} */ -export const sendAlarmEmailText = curry(async (toAddr, subject, text) => sendAlarmEmailWithBody(toAddr, subject, { - Text: { - Data: text, - Charset: 'UTF-8', - }, -})); +export const sendAlarmEmailText = curry(async (toAddr, subject, text) => + sendAlarmEmailWithBody(toAddr, subject, { + Text: { + Data: text, + Charset: "UTF-8", + }, + }) +); /** * Sends an email with the given subject and html body to the supplied addresses. @@ -37,16 +39,18 @@ export const sendAlarmEmailText = curry(async (toAddr, subject, text) => sendAla * @param {string} body * @returns {Promise} */ -export const sendAlarmEmailHtml = curry(async (toAddr, subject, html) => sendAlarmEmailWithBody(toAddr, subject, { - Html: { - Data: html, - Charset: 'UTF-8', - }, -})); +export const sendAlarmEmailHtml = curry(async (toAddr, subject, html) => + sendAlarmEmailWithBody(toAddr, subject, { + Html: { + Data: html, + Charset: "UTF-8", + }, + }) +); const sendAlarmEmailWithBody = curry(async (toAddr, subject, body) => { const ses = new SESV2({ - apiVersion: '2019-09-27', + apiVersion: "2019-09-27", accessKeyId: AWS_ACCESS_KEY_ID, secretAccessKey: AWS_SECRET_ACCESS_KEY, sessionToken: AWS_SESSION_TOKEN, @@ -64,7 +68,7 @@ const sendAlarmEmailWithBody = curry(async (toAddr, subject, body) => { Body: body, Subject: { Data: subject, - Charset: 'UTF-8', + Charset: "UTF-8", }, }, }, @@ -72,7 +76,7 @@ const sendAlarmEmailWithBody = curry(async (toAddr, subject, body) => { }; const res = await ses.sendEmail(params).promise(); - console.log('Email sent.'); + console.log("Email sent."); console.log(res); return res; diff --git a/scripts/eth/ERC20.sol b/packages/dock-blockchain-api/scripts/eth/ERC20.sol similarity index 100% rename from scripts/eth/ERC20.sol rename to packages/dock-blockchain-api/scripts/eth/ERC20.sol diff --git a/scripts/eth/PalletStorageAccessor.sol b/packages/dock-blockchain-api/scripts/eth/PalletStorageAccessor.sol similarity index 100% rename from scripts/eth/PalletStorageAccessor.sol rename to packages/dock-blockchain-api/scripts/eth/PalletStorageAccessor.sol diff --git a/packages/dock-blockchain-api/scripts/eth/bytecodes-and-abis.js b/packages/dock-blockchain-api/scripts/eth/bytecodes-and-abis.js new file mode 100644 index 000000000..f399daa9d --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/bytecodes-and-abis.js @@ -0,0 +1,563 @@ +// Contract is ERC20.sol +export const ERC20_BYTECODE = + "0x608060405234801561001057600080fd5b5060405160208061064383398101604090815290516002819055336000908152602081905291909120556105fa806100496000396000f3006080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461009d578063095ea7b31461012757806318160ddd1461015f57806323b872dd14610186578063313ce567146101b057806370a08231146101db57806395d89b41146101fc578063a9059cbb14610211578063dd62ed3e14610235575b600080fd5b3480156100a957600080fd5b506100b261025c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100ec5781810151838201526020016100d4565b50505050905090810190601f1680156101195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013357600080fd5b5061014b600160a060020a0360043516602435610293565b604080519115158252519081900360200190f35b34801561016b57600080fd5b506101746102f9565b60408051918252519081900360200190f35b34801561019257600080fd5b5061014b600160a060020a03600435811690602435166044356102ff565b3480156101bc57600080fd5b506101c561045a565b6040805160ff9092168252519081900360200190f35b3480156101e757600080fd5b50610174600160a060020a036004351661045f565b34801561020857600080fd5b506100b261047a565b34801561021d57600080fd5b5061014b600160a060020a03600435166024356104b1565b34801561024157600080fd5b50610174600160a060020a036004358116906024351661057b565b60408051808201909152600a81527f4552433230426173696300000000000000000000000000000000000000000000602082015281565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561032457600080fd5b600160a060020a038416600090815260016020908152604080832033845290915290205482111561035457600080fd5b600160a060020a03841660009081526020819052604090205461037d908363ffffffff6105a616565b600160a060020a0385166000908152602081815260408083209390935560018152828220338352905220546103b8908363ffffffff6105a616565b600160a060020a03808616600090815260016020908152604080832033845282528083209490945591861681529081905220546103fb908363ffffffff6105b816565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b601281565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600381527f4253430000000000000000000000000000000000000000000000000000000000602082015281565b336000908152602081905260408120548211156104cd57600080fd5b336000908152602081905260409020546104ed908363ffffffff6105a616565b3360009081526020819052604080822092909255600160a060020a0385168152205461051f908363ffffffff6105b816565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b6000828211156105b257fe5b50900390565b6000828201838110156105c757fe5b93925050505600a165627a7a723058208b433dca186d93c36f5f1faf8177cf393794bf9a16db68df7d493e7ddb832c2b0029"; +export const ERC20_ABI = [ + { + constant: true, + inputs: [], + name: "name", + outputs: [{ name: "", type: "string" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "delegate", type: "address" }, + { name: "numTokens", type: "uint256" }, + ], + name: "approve", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "totalSupply", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "owner", type: "address" }, + { name: "buyer", type: "address" }, + { name: "numTokens", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "decimals", + outputs: [{ name: "", type: "uint8" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [{ name: "tokenOwner", type: "address" }], + name: "balanceOf", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "symbol", + outputs: [{ name: "", type: "string" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "receiver", type: "address" }, + { name: "numTokens", type: "uint256" }, + ], + name: "transfer", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "owner", type: "address" }, + { name: "delegate", type: "address" }, + ], + name: "allowance", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + inputs: [{ name: "total", type: "uint256" }], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "tokenOwner", type: "address" }, + { indexed: true, name: "spender", type: "address" }, + { indexed: false, name: "tokens", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "from", type: "address" }, + { indexed: true, name: "to", type: "address" }, + { indexed: false, name: "tokens", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, +]; + +// Contract is DummyAggregator +export const DUMMY_AGGREGATOR_BYTECODE = + "0x608060405234801561001057600080fd5b506040516102e73803806102e7833981810160405260a081101561003357600080fd5b5080516020820151604083015160608401516080909401519293919290919061006885858585856001600160e01b0361007216565b50505050506100af565b600080546001600160501b039687166001600160501b03199182161790915560019490945560029290925560035560048054919093169116179055565b610229806100be6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638cd221c91161005b5780638cd221c9146100e8578063c22c24991461010c578063f21f537d14610114578063feaf968c1461011c5761007d565b80636444bd16146100825780637519ab50146100c657806385bb7d69146100e0575b600080fd5b6100c4600480360360a081101561009857600080fd5b506001600160501b03813581169160208101359160408201359160608101359160809091013516610160565b005b6100ce6101a0565b60408051918252519081900360200190f35b6100ce6101a6565b6100f06101ac565b604080516001600160501b039092168252519081900360200190f35b6100f06101bb565b6100ce6101ca565b6101246101d0565b604080516001600160501b0396871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b600080546001600160501b0396871669ffffffffffffffffffff199182161790915560019490945560029290925560035560048054919093169116179055565b60035481565b60015481565b6000546001600160501b031681565b6004546001600160501b031681565b60025481565b6000546001546002546003546004546001600160501b039485169416909192939456fea2646970667358221220739aa4f0c3ea9e475a476da24e7b66931c23a245f6542d41d7b936cd62e75e1264736f6c63430006050033"; +export const DUMMY_AGGREGATOR_ABI = [ + { + inputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "_answer", + type: "int256", + }, + { + internalType: "uint256", + name: "_startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "_updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "_answeredInRound", + type: "uint80", + }, + ], + name: "setData", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "_answer", + type: "int256", + }, + { + internalType: "uint256", + name: "_startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "_updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "_answeredInRound", + type: "uint80", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "answer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "answeredInRound", + outputs: [ + { + internalType: "uint80", + name: "", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRoundData", + outputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "_answer", + type: "int256", + }, + { + internalType: "uint256", + name: "_startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "_updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "_answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roundId", + outputs: [ + { + internalType: "uint80", + name: "", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "startedAt", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "updatedAt", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +export const PALLET_STORAGE_ACCESSOR_ABI = [ + { + inputs: [ + { + internalType: "bytes", + name: "key", + type: "bytes", + }, + ], + name: "getStorageRaw", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "pallet", + type: "string", + }, + { + internalType: "string", + name: "member", + type: "string", + }, + { + internalType: "enum PalletStorageAccessor.KeyType", + name: "keyType", + type: "uint8", + }, + { + internalType: "bytes", + name: "firstKey", + type: "bytes", + }, + { + internalType: "bytes", + name: "secondKey", + type: "bytes", + }, + ], + name: "getStorage", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "pallet", + type: "string", + }, + { + internalType: "string", + name: "member", + type: "string", + }, + { + internalType: "enum PalletStorageAccessor.KeyType", + name: "keyType", + type: "uint8", + }, + { + internalType: "bytes", + name: "firstKey", + type: "bytes", + }, + { + internalType: "bytes", + name: "secondKey", + type: "bytes", + }, + { + internalType: "uint32", + name: "offset", + type: "uint32", + }, + ], + name: "getStorageWithOffset", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "pallet", + type: "string", + }, + { + internalType: "string", + name: "member", + type: "string", + }, + { + internalType: "enum PalletStorageAccessor.KeyType", + name: "keyType", + type: "uint8", + }, + { + internalType: "bytes", + name: "firstKey", + type: "bytes", + }, + { + internalType: "bytes", + name: "secondKey", + type: "bytes", + }, + { + internalType: "uint32", + name: "len", + type: "uint32", + }, + ], + name: "getStorageWithLen", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "pallet", + type: "string", + }, + { + internalType: "string", + name: "member", + type: "string", + }, + { + internalType: "enum PalletStorageAccessor.KeyType", + name: "keyType", + type: "uint8", + }, + { + internalType: "bytes", + name: "firstKey", + type: "bytes", + }, + { + internalType: "bytes", + name: "secondKey", + type: "bytes", + }, + { + internalType: "uint32", + name: "offset", + type: "uint32", + }, + { + internalType: "uint32", + name: "len", + type: "uint32", + }, + ], + name: "getStorageWithOffsetLen", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +]; +export const PALLET_STORAGE_ACCESSOR_BYTECODE = + "0x608060405234801561001057600080fd5b50611643806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806341af69231461005c57806342c60d781461008d578063721b15c6146100be578063baa6a4e6146100ef578063f0f980ce14610120575b600080fd5b61007660048036038101906100719190610c64565b610151565b604051610084929190611367565b60405180910390f35b6100a760048036038101906100a29190610d4c565b6102b8565b6040516100b5929190611367565b60405180910390f35b6100d860048036038101906100d39190610c1f565b610430565b6040516100e6929190611367565b60405180910390f35b61010960048036038101906101049190610d4c565b6104df565b604051610117929190611367565b60405180910390f35b61013a60048036038101906101359190610e48565b610657565b604051610148929190611367565b60405180910390f35b600060606000600e9050600061016a89898989896107e0565b905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff1661021f8351610a59565b8361022a8451610a59565b84876000604051602001610243969594939291906110f2565b60405160208183030381529060405260405161025f91906110a4565b6000604051808303816000865af19150503d806000811461029c576040519150601f19603f3d011682016040523d82523d6000602084013e6102a1565b606091505b509550955050505050995099975050505050505050565b600060606000600e905060006102d18a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166103868351610a59565b836103918451610a59565b848760026103a48e63ffffffff16610a59565b6040516020016103ba979695949392919061114e565b6040516020818303038152906040526040516103d691906110a4565b6000604051808303816000865af19150503d8060008114610413576040519150601f19603f3d011682016040523d82523d6000602084013e610418565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600f90508073ffffffffffffffffffffffffffffffffffffffff1661045d86869050610a59565b8686600060405160200161047494939291906110bb565b60405160208183030381529060405260405161049091906110a4565b6000604051808303816000865af19150503d80600081146104cd576040519150601f19603f3d011682016040523d82523d6000602084013e6104d2565b606091505b5092509250509250929050565b600060606000600e905060006104f88a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166105ad8351610a59565b836105b88451610a59565b848760016105cb8e63ffffffff16610a59565b6040516020016105e1979695949392919061114e565b6040516020818303038152906040526040516105fd91906110a4565b6000604051808303816000865af19150503d806000811461063a576040519150601f19603f3d011682016040523d82523d6000602084013e61063f565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600e905060006106708b8b8b8b8b6107e0565b905060008f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166107258351610a59565b836107308451610a59565b848760036107438f63ffffffff16610a59565b6107528f63ffffffff16610a59565b6040516020016107699897969594939291906111b7565b60405160208183030381529060405260405161078591906110a4565b6000604051808303816000865af19150503d80600081146107c2576040519150601f19603f3d011682016040523d82523d6000602084013e6107c7565b606091505b5095509550505050509b509b9950505050505050505050565b6060806000600281111561081d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610856577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561090f578660405160200161086d919061122d565b6040516020818303038152906040529050600086869050146108c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bb906113b7565b60405180910390fd5b6000848490501461090a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090190611397565b60405180910390fd5b610a4c565b60016002811115610949577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610982577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610a06578661099587879050610a59565b87876040516020016109aa9493929190611248565b604051602081830303815290604052905060008484905014610a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f890611397565b60405180910390fd5b610a4b565b86610a1387879050610a59565b8787610a2188889050610a59565b8888604051602001610a39979695949392919061127f565b60405160208183030381529060405290505b5b8091505095945050505050565b60606040821015610a925760028260ff16901b604051602001610a7c91906112d2565b6040516020818303038152906040529050610b5c565b614000821015610ad357600160028360ff16901b17600683901c604051602001610abd9291906112ed565b6040516020818303038152906040529050610b5c565b6340000000821015610b21576002808360ff16901b17600683901c600e84901c601685901c604051602001610b0b9493929190611319565b6040516020818303038152906040529050610b5c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b53906113d7565b60405180910390fd5b919050565b60008083601f840112610b7357600080fd5b8235905067ffffffffffffffff811115610b8c57600080fd5b602083019150836001820283011115610ba457600080fd5b9250929050565b600081359050610bba816115e6565b92915050565b60008083601f840112610bd257600080fd5b8235905067ffffffffffffffff811115610beb57600080fd5b602083019150836001820283011115610c0357600080fd5b9250929050565b600081359050610c19816115f6565b92915050565b60008060208385031215610c3257600080fd5b600083013567ffffffffffffffff811115610c4c57600080fd5b610c5885828601610b61565b92509250509250929050565b600080600080600080600080600060a08a8c031215610c8257600080fd5b60008a013567ffffffffffffffff811115610c9c57600080fd5b610ca88c828d01610bc0565b995099505060208a013567ffffffffffffffff811115610cc757600080fd5b610cd38c828d01610bc0565b97509750506040610ce68c828d01610bab565b95505060608a013567ffffffffffffffff811115610d0357600080fd5b610d0f8c828d01610b61565b945094505060808a013567ffffffffffffffff811115610d2e57600080fd5b610d3a8c828d01610b61565b92509250509295985092959850929598565b60008060008060008060008060008060c08b8d031215610d6b57600080fd5b60008b013567ffffffffffffffff811115610d8557600080fd5b610d918d828e01610bc0565b9a509a505060208b013567ffffffffffffffff811115610db057600080fd5b610dbc8d828e01610bc0565b98509850506040610dcf8d828e01610bab565b96505060608b013567ffffffffffffffff811115610dec57600080fd5b610df88d828e01610b61565b955095505060808b013567ffffffffffffffff811115610e1757600080fd5b610e238d828e01610b61565b935093505060a0610e368d828e01610c0a565b9150509295989b9194979a5092959850565b600080600080600080600080600080600060e08c8e031215610e6957600080fd5b60008c013567ffffffffffffffff811115610e8357600080fd5b610e8f8e828f01610bc0565b9b509b505060208c013567ffffffffffffffff811115610eae57600080fd5b610eba8e828f01610bc0565b99509950506040610ecd8e828f01610bab565b97505060608c013567ffffffffffffffff811115610eea57600080fd5b610ef68e828f01610b61565b965096505060808c013567ffffffffffffffff811115610f1557600080fd5b610f218e828f01610b61565b945094505060a0610f348e828f01610c0a565b92505060c0610f458e828f01610c0a565b9150509295989b509295989b9093969950565b610f618161142f565b82525050565b6000610f738385611413565b9350610f808385846114a2565b82840190509392505050565b6000610f97826113f7565b610fa18185611402565b9350610fb18185602086016114b1565b610fba81611525565b840191505092915050565b6000610fd0826113f7565b610fda8185611413565b9350610fea8185602086016114b1565b80840191505092915050565b6110076110028261147e565b6114e4565b82525050565b61101e61101982611490565b6114e4565b82525050565b600061103160188361141e565b915061103c82611543565b602082019050919050565b600061105460178361141e565b915061105f8261156c565b602082019050919050565b6000611077600d8361141e565b915061108282611595565b602082019050919050565b61109e61109982611471565b6114e4565b82525050565b60006110b08284610fc5565b915081905092915050565b60006110c78287610fc5565b91506110d4828587610f67565b91506110e0828461100d565b60018201915081905095945050505050565b60006110fe8289610fc5565b915061110a8288610fc5565b91506111168287610fc5565b91506111228286610fc5565b915061112e8285610fc5565b915061113a828461100d565b600182019150819050979650505050505050565b600061115a828a610fc5565b91506111668289610fc5565b91506111728288610fc5565b915061117e8287610fc5565b915061118a8286610fc5565b9150611196828561100d565b6001820191506111a68284610fc5565b915081905098975050505050505050565b60006111c3828b610fc5565b91506111cf828a610fc5565b91506111db8289610fc5565b91506111e78288610fc5565b91506111f38287610fc5565b91506111ff828661100d565b60018201915061120f8285610fc5565b915061121b8284610fc5565b91508190509998505050505050505050565b60006112398284610ff6565b60018201915081905092915050565b60006112548287610ff6565b6001820191506112648286610fc5565b9150611271828486610f67565b915081905095945050505050565b600061128b828a610ff6565b60018201915061129b8289610fc5565b91506112a8828789610f67565b91506112b48286610fc5565b91506112c1828486610f67565b915081905098975050505050505050565b60006112de828461108d565b60018201915081905092915050565b60006112f9828561108d565b600182019150611309828461108d565b6001820191508190509392505050565b6000611325828761108d565b600182019150611335828661108d565b600182019150611345828561108d565b600182019150611355828461108d565b60018201915081905095945050505050565b600060408201905061137c6000830185610f58565b818103602083015261138e8184610f8c565b90509392505050565b600060208201905081810360008301526113b081611024565b9050919050565b600060208201905081810360008301526113d081611047565b9050919050565b600060208201905081810360008301526113f08161106a565b9050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60008115159050919050565b6000819050611449826115be565b919050565b600081905061145c826115d2565b919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006114898261143b565b9050919050565b600061149b8261144e565b9050919050565b82818337600083830152505050565b60005b838110156114cf5780820151818401526020810190506114b4565b838111156114de576000848401525b50505050565b60006114ef82611536565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000601f19601f8301169050919050565b60008160f81b9050919050565b7f5365636f6e64206b6579206d75737420626520656d7074790000000000000000600082015250565b7f4669727374206b6579206d75737420626520656d707479000000000000000000600082015250565b7f556e696d706c656d656e74656400000000000000000000000000000000000000600082015250565b600381106115cf576115ce6114f6565b5b50565b600481106115e3576115e26114f6565b5b50565b600381106115f357600080fd5b50565b6115ff81611461565b811461160a57600080fd5b5056fea264697066735822122045902a2eca70e23c359f9ddaa922914d3d322f9636b96c5735a8d848a4fbb19264736f6c63430008020033"; +export const PALLET_STORAGE_ACCESSOR_DEPLOYED_BYTECODE = + "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806341af69231461005c57806342c60d781461008d578063721b15c6146100be578063baa6a4e6146100ef578063f0f980ce14610120575b600080fd5b61007660048036038101906100719190610c64565b610151565b604051610084929190611367565b60405180910390f35b6100a760048036038101906100a29190610d4c565b6102b8565b6040516100b5929190611367565b60405180910390f35b6100d860048036038101906100d39190610c1f565b610430565b6040516100e6929190611367565b60405180910390f35b61010960048036038101906101049190610d4c565b6104df565b604051610117929190611367565b60405180910390f35b61013a60048036038101906101359190610e48565b610657565b604051610148929190611367565b60405180910390f35b600060606000600e9050600061016a89898989896107e0565b905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff1661021f8351610a59565b8361022a8451610a59565b84876000604051602001610243969594939291906110f2565b60405160208183030381529060405260405161025f91906110a4565b6000604051808303816000865af19150503d806000811461029c576040519150601f19603f3d011682016040523d82523d6000602084013e6102a1565b606091505b509550955050505050995099975050505050505050565b600060606000600e905060006102d18a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166103868351610a59565b836103918451610a59565b848760026103a48e63ffffffff16610a59565b6040516020016103ba979695949392919061114e565b6040516020818303038152906040526040516103d691906110a4565b6000604051808303816000865af19150503d8060008114610413576040519150601f19603f3d011682016040523d82523d6000602084013e610418565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600f90508073ffffffffffffffffffffffffffffffffffffffff1661045d86869050610a59565b8686600060405160200161047494939291906110bb565b60405160208183030381529060405260405161049091906110a4565b6000604051808303816000865af19150503d80600081146104cd576040519150601f19603f3d011682016040523d82523d6000602084013e6104d2565b606091505b5092509250509250929050565b600060606000600e905060006104f88a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166105ad8351610a59565b836105b88451610a59565b848760016105cb8e63ffffffff16610a59565b6040516020016105e1979695949392919061114e565b6040516020818303038152906040526040516105fd91906110a4565b6000604051808303816000865af19150503d806000811461063a576040519150601f19603f3d011682016040523d82523d6000602084013e61063f565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600e905060006106708b8b8b8b8b6107e0565b905060008f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166107258351610a59565b836107308451610a59565b848760036107438f63ffffffff16610a59565b6107528f63ffffffff16610a59565b6040516020016107699897969594939291906111b7565b60405160208183030381529060405260405161078591906110a4565b6000604051808303816000865af19150503d80600081146107c2576040519150601f19603f3d011682016040523d82523d6000602084013e6107c7565b606091505b5095509550505050509b509b9950505050505050505050565b6060806000600281111561081d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610856577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561090f578660405160200161086d919061122d565b6040516020818303038152906040529050600086869050146108c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bb906113b7565b60405180910390fd5b6000848490501461090a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090190611397565b60405180910390fd5b610a4c565b60016002811115610949577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610982577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610a06578661099587879050610a59565b87876040516020016109aa9493929190611248565b604051602081830303815290604052905060008484905014610a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f890611397565b60405180910390fd5b610a4b565b86610a1387879050610a59565b8787610a2188889050610a59565b8888604051602001610a39979695949392919061127f565b60405160208183030381529060405290505b5b8091505095945050505050565b60606040821015610a925760028260ff16901b604051602001610a7c91906112d2565b6040516020818303038152906040529050610b5c565b614000821015610ad357600160028360ff16901b17600683901c604051602001610abd9291906112ed565b6040516020818303038152906040529050610b5c565b6340000000821015610b21576002808360ff16901b17600683901c600e84901c601685901c604051602001610b0b9493929190611319565b6040516020818303038152906040529050610b5c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b53906113d7565b60405180910390fd5b919050565b60008083601f840112610b7357600080fd5b8235905067ffffffffffffffff811115610b8c57600080fd5b602083019150836001820283011115610ba457600080fd5b9250929050565b600081359050610bba816115e6565b92915050565b60008083601f840112610bd257600080fd5b8235905067ffffffffffffffff811115610beb57600080fd5b602083019150836001820283011115610c0357600080fd5b9250929050565b600081359050610c19816115f6565b92915050565b60008060208385031215610c3257600080fd5b600083013567ffffffffffffffff811115610c4c57600080fd5b610c5885828601610b61565b92509250509250929050565b600080600080600080600080600060a08a8c031215610c8257600080fd5b60008a013567ffffffffffffffff811115610c9c57600080fd5b610ca88c828d01610bc0565b995099505060208a013567ffffffffffffffff811115610cc757600080fd5b610cd38c828d01610bc0565b97509750506040610ce68c828d01610bab565b95505060608a013567ffffffffffffffff811115610d0357600080fd5b610d0f8c828d01610b61565b945094505060808a013567ffffffffffffffff811115610d2e57600080fd5b610d3a8c828d01610b61565b92509250509295985092959850929598565b60008060008060008060008060008060c08b8d031215610d6b57600080fd5b60008b013567ffffffffffffffff811115610d8557600080fd5b610d918d828e01610bc0565b9a509a505060208b013567ffffffffffffffff811115610db057600080fd5b610dbc8d828e01610bc0565b98509850506040610dcf8d828e01610bab565b96505060608b013567ffffffffffffffff811115610dec57600080fd5b610df88d828e01610b61565b955095505060808b013567ffffffffffffffff811115610e1757600080fd5b610e238d828e01610b61565b935093505060a0610e368d828e01610c0a565b9150509295989b9194979a5092959850565b600080600080600080600080600080600060e08c8e031215610e6957600080fd5b60008c013567ffffffffffffffff811115610e8357600080fd5b610e8f8e828f01610bc0565b9b509b505060208c013567ffffffffffffffff811115610eae57600080fd5b610eba8e828f01610bc0565b99509950506040610ecd8e828f01610bab565b97505060608c013567ffffffffffffffff811115610eea57600080fd5b610ef68e828f01610b61565b965096505060808c013567ffffffffffffffff811115610f1557600080fd5b610f218e828f01610b61565b945094505060a0610f348e828f01610c0a565b92505060c0610f458e828f01610c0a565b9150509295989b509295989b9093969950565b610f618161142f565b82525050565b6000610f738385611413565b9350610f808385846114a2565b82840190509392505050565b6000610f97826113f7565b610fa18185611402565b9350610fb18185602086016114b1565b610fba81611525565b840191505092915050565b6000610fd0826113f7565b610fda8185611413565b9350610fea8185602086016114b1565b80840191505092915050565b6110076110028261147e565b6114e4565b82525050565b61101e61101982611490565b6114e4565b82525050565b600061103160188361141e565b915061103c82611543565b602082019050919050565b600061105460178361141e565b915061105f8261156c565b602082019050919050565b6000611077600d8361141e565b915061108282611595565b602082019050919050565b61109e61109982611471565b6114e4565b82525050565b60006110b08284610fc5565b915081905092915050565b60006110c78287610fc5565b91506110d4828587610f67565b91506110e0828461100d565b60018201915081905095945050505050565b60006110fe8289610fc5565b915061110a8288610fc5565b91506111168287610fc5565b91506111228286610fc5565b915061112e8285610fc5565b915061113a828461100d565b600182019150819050979650505050505050565b600061115a828a610fc5565b91506111668289610fc5565b91506111728288610fc5565b915061117e8287610fc5565b915061118a8286610fc5565b9150611196828561100d565b6001820191506111a68284610fc5565b915081905098975050505050505050565b60006111c3828b610fc5565b91506111cf828a610fc5565b91506111db8289610fc5565b91506111e78288610fc5565b91506111f38287610fc5565b91506111ff828661100d565b60018201915061120f8285610fc5565b915061121b8284610fc5565b91508190509998505050505050505050565b60006112398284610ff6565b60018201915081905092915050565b60006112548287610ff6565b6001820191506112648286610fc5565b9150611271828486610f67565b915081905095945050505050565b600061128b828a610ff6565b60018201915061129b8289610fc5565b91506112a8828789610f67565b91506112b48286610fc5565b91506112c1828486610f67565b915081905098975050505050505050565b60006112de828461108d565b60018201915081905092915050565b60006112f9828561108d565b600182019150611309828461108d565b6001820191508190509392505050565b6000611325828761108d565b600182019150611335828661108d565b600182019150611345828561108d565b600182019150611355828461108d565b60018201915081905095945050505050565b600060408201905061137c6000830185610f58565b818103602083015261138e8184610f8c565b90509392505050565b600060208201905081810360008301526113b081611024565b9050919050565b600060208201905081810360008301526113d081611047565b9050919050565b600060208201905081810360008301526113f08161106a565b9050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60008115159050919050565b6000819050611449826115be565b919050565b600081905061145c826115d2565b919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006114898261143b565b9050919050565b600061149b8261144e565b9050919050565b82818337600083830152505050565b60005b838110156114cf5780820151818401526020810190506114b4565b838111156114de576000848401525b50505050565b60006114ef82611536565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000601f19601f8301169050919050565b60008160f81b9050919050565b7f5365636f6e64206b6579206d75737420626520656d7074790000000000000000600082015250565b7f4669727374206b6579206d75737420626520656d707479000000000000000000600082015250565b7f556e696d706c656d656e74656400000000000000000000000000000000000000600082015250565b600381106115cf576115ce6114f6565b5b50565b600481106115e3576115e26114f6565b5b50565b600381106115f357600080fd5b50565b6115ff81611461565b811461160a57600080fd5b5056fea264697066735822122045902a2eca70e23c359f9ddaa922914d3d322f9636b96c5735a8d848a4fbb19264736f6c63430008020033"; + +// Contract is DummyAggregatorProxy +export const DUMMY_PROXY_BYTECODE = + "0x608060405234801561001057600080fd5b506040516101493803806101498339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b031990921691909117905560e5806100646000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063245a7bfc146037578063f9120af6146059575b600080fd5b603d607e565b604080516001600160a01b039092168252519081900360200190f35b607c60048036036020811015606d57600080fd5b50356001600160a01b0316608d565b005b6000546001600160a01b031690565b600080546001600160a01b0319166001600160a01b039290921691909117905556fea2646970667358221220e6ea90ae509c1e97b506e2a0f0a3696b49e7b564a2723832159db0e2ec54c73564736f6c63430006050033"; +export const DUMMY_PROXY_ABI = [ + { + inputs: [ + { + internalType: "address", + name: "_aggregator", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "aggregator", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_aggregator", + type: "address", + }, + ], + name: "setAggregator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/scripts/eth/chainlink/AccessControlledAggregator.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/AccessControlledAggregator.sol similarity index 100% rename from scripts/eth/chainlink/AccessControlledAggregator.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/AccessControlledAggregator.sol diff --git a/scripts/eth/chainlink/DeviationFlaggingValidator.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/DeviationFlaggingValidator.sol similarity index 100% rename from scripts/eth/chainlink/DeviationFlaggingValidator.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/DeviationFlaggingValidator.sol diff --git a/scripts/eth/chainlink/DummyAggregator.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/DummyAggregator.sol similarity index 100% rename from scripts/eth/chainlink/DummyAggregator.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/DummyAggregator.sol diff --git a/scripts/eth/chainlink/EACAggregatorProxy.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/EACAggregatorProxy.sol similarity index 100% rename from scripts/eth/chainlink/EACAggregatorProxy.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/EACAggregatorProxy.sol diff --git a/scripts/eth/chainlink/Flags.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/Flags.sol similarity index 100% rename from scripts/eth/chainlink/Flags.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/Flags.sol diff --git a/scripts/eth/chainlink/FluxAggregator.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/FluxAggregator.sol similarity index 100% rename from scripts/eth/chainlink/FluxAggregator.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/FluxAggregator.sol diff --git a/scripts/eth/chainlink/LinkToken.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/LinkToken.sol similarity index 100% rename from scripts/eth/chainlink/LinkToken.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/LinkToken.sol diff --git a/scripts/eth/chainlink/Oracle.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/Oracle.sol similarity index 100% rename from scripts/eth/chainlink/Oracle.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/Oracle.sol diff --git a/scripts/eth/chainlink/PriceQuery.sol b/packages/dock-blockchain-api/scripts/eth/chainlink/PriceQuery.sol similarity index 100% rename from scripts/eth/chainlink/PriceQuery.sol rename to packages/dock-blockchain-api/scripts/eth/chainlink/PriceQuery.sol diff --git a/packages/dock-blockchain-api/scripts/eth/chainlink/access-controlled-aggregator-proxy.js b/packages/dock-blockchain-api/scripts/eth/chainlink/access-controlled-aggregator-proxy.js new file mode 100644 index 000000000..bb12ed391 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/access-controlled-aggregator-proxy.js @@ -0,0 +1,177 @@ +import { + deployContract, + getTestEVMAccountsFromWeb3, + getWeb3, + endowEVMAddressWithDefault, + sendEVMTxn, +} from "../helpers"; +import { + AccessControlledAggregatorByteCode, + AccessControlledAggregatorABI, + EACAggregatorProxyByteCode, + EACAggregatorProxyABI, + DeviationFlaggingValidatorABI, + FlagsABI, +} from "./bytecodes-and-abis"; +import { addOracles, fund } from "./helpers"; + +async function deployAggregator( + web3, + signer, + linkTokenAddr, + paymentAmount, + timeout, + validator, + minSubmissionValue, + maxSubmissionValue, + decimals, + description +) { + console.log("Deploying AccessControlledAggregator"); + const argsABI = web3.eth.abi.encodeParameters( + [ + "address", + "uint128", + "uint32", + "address", + "int256", + "int256", + "uint8", + "string", + ], + [ + linkTokenAddr, + paymentAmount, + timeout, + validator, + minSubmissionValue, + maxSubmissionValue, + decimals, + description, + ] + ); + const contractBytecode = + AccessControlledAggregatorByteCode + argsABI.slice(2); + return deployContract(web3, signer, contractBytecode); +} + +async function deployProxy(web3, signer, aggregatorAddr) { + console.log("Deploying EACAggregatorProxy"); + // The aggregator contract extends the access controller as well, thus both arguments are same. + const contractBytecode = + EACAggregatorProxyByteCode + + web3.eth.abi + .encodeParameters( + ["address", "address"], + [aggregatorAddr, aggregatorAddr] + ) + .slice(2); + return deployContract(web3, signer, contractBytecode); +} + +async function main() { + const web3 = getWeb3(); + + const [alice, bob, carol] = getTestEVMAccountsFromWeb3(web3); + await endowEVMAddressWithDefault(alice.address); + await endowEVMAddressWithDefault(bob.address); + await endowEVMAddressWithDefault(carol.address); + + // Link token contract address + const linkTokenAddr = "0xa8F3e277740b7c40Ab684cB1b69F69159EF592f6"; + const paymentAmount = 10; + const timeout = 600; + // Deviation flagging validator, check script deviation-flag-validator.js + const validatorAddr = "0xF4F1d669D0D9Ccb14eF2463fB22cB998F4D8FC12"; + const minSubmissionValue = 0; + const maxSubmissionValue = 10000; + const decimals = 3; + const description = "AccessControlledAggregator for Dock USD price feed"; + + const aggregatorAddr = await deployAggregator( + web3, + alice, + linkTokenAddr, + paymentAmount, + timeout, + validatorAddr, + minSubmissionValue, + maxSubmissionValue, + decimals, + description + ); + const aggregator = new web3.eth.Contract( + AccessControlledAggregatorABI, + aggregatorAddr + ); + + // Fund the aggregator + await fund(web3, alice, linkTokenAddr, aggregatorAddr, aggregator); + + // Add 2 oracles + await addOracles(web3, alice, aggregatorAddr, aggregator, bob, carol); + + // Adding an address for testing that access control works. Not needed in real deployment. + await sendEVMTxn( + web3, + alice, + aggregatorAddr, + aggregator.methods + .addAccess("0x0000000000000000000000000000000000000000") + .encodeABI() + ); + + const proxyAddr = await deployProxy(web3, alice, aggregatorAddr); + const proxy = new web3.eth.Contract(EACAggregatorProxyABI, proxyAddr); + + // Fetch current aggregator address from proxy + const aggrFromProxyAddr = await proxy.methods.aggregator().call(); + const aggrFromProxyContract = new web3.eth.Contract( + AccessControlledAggregatorABI, + aggrFromProxyAddr + ); + + console.log( + await aggrFromProxyContract.methods + .hasAccess("0x0000000000000000000000000000000000000000", []) + .call() + ); + console.log( + await aggrFromProxyContract.methods + .hasAccess("0x0000000000000000000000000000000000000001", []) + .call() + ); + console.log( + await aggrFromProxyContract.methods.hasAccess(alice.address, []).call() + ); + + // Load Flags contract + const validator = new web3.eth.Contract( + DeviationFlaggingValidatorABI, + validatorAddr + ); + const flagsAddr = await validator.methods.flags().call(); + const flagsContract = new web3.eth.Contract(FlagsABI, flagsAddr); + + // Oracle's round state above should decide the round number + const submitCall1 = aggrFromProxyContract.methods.submit(1, 50).encodeABI(); + await sendEVMTxn(web3, bob, aggrFromProxyAddr, submitCall1); + + // There would be no flags raised for the aggregator + console.log(await flagsContract.methods.getFlag(aggrFromProxyAddr).call()); + + console.log(await aggrFromProxyContract.methods.latestRoundData().call()); + + // Need to wait for timeout. + // const submitCall2 = aggrFromProxyContract.methods.submit(2, 60).encodeABI(); + // await sendEVMTxn(web3, carol, aggrFromProxyAddr, submitCall2); + // + // // There would be a flag raised + // console.log((await flagsContract.methods.getFlag(aggrFromProxyAddr).call())); + + process.exit(0); +} + +main().catch((err) => { + console.log("Error", err); +}); diff --git a/packages/dock-blockchain-api/scripts/eth/chainlink/bytecodes-and-abis.js b/packages/dock-blockchain-api/scripts/eth/chainlink/bytecodes-and-abis.js new file mode 100644 index 000000000..f6b06dc42 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/bytecodes-and-abis.js @@ -0,0 +1,4372 @@ +export const LinkTokenByteCode = + "0x60806040523480156200001157600080fd5b50604080518082018252600f81526e21b430b4b72634b735902a37b5b2b760891b6020808301918252835180850190945260048452634c494e4b60e01b908401528151919291620000659160039162000246565b5080516200007b90600490602084019062000246565b50506005805460ff19166012179055506200009e6001600160e01b03620000a416565b620002eb565b620000c5336b033b2e3c9fd0803ce80000006001600160e01b03620000c716565b565b6001600160a01b03821662000123576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200013a600083836001600160e01b03620001df16565b6200015681600254620001e460201b6200091c1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620001899183906200091c620001e4821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b6000828201838110156200023f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028957805160ff1916838001178555620002b9565b82800160010185558215620002b9579182015b82811115620002b95782518255916020019190600101906200029c565b50620002c7929150620002cb565b5090565b620002e891905b80821115620002c75760008155600101620002d2565b90565b610e1980620002fb6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063661884631161008c578063a457c2d711610066578063a457c2d71461035b578063a9059cbb14610387578063d73dd623146103b3578063dd62ed3e146103df576100ea565b8063661884631461030157806370a082311461032d57806395d89b4114610353576100ea565b806323b872dd116100c857806323b872dd146101c6578063313ce567146101fc578063395093511461021a5780634000aea014610246576100ea565b806306fdde03146100ef578063095ea7b31461016c57806318160ddd146101ac575b600080fd5b6100f761040d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610131578181015183820152602001610119565b50505050905090810190601f16801561015e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101986004803603604081101561018257600080fd5b506001600160a01b0381351690602001356104a3565b604080519115158252519081900360200190f35b6101b46104c0565b60408051918252519081900360200190f35b610198600480360360608110156101dc57600080fd5b506001600160a01b038135811691602081013590911690604001356104c6565b610204610553565b6040805160ff9092168252519081900360200190f35b6101986004803603604081101561023057600080fd5b506001600160a01b03813516906020013561055c565b6101986004803603606081101561025c57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561028c57600080fd5b82018360208201111561029e57600080fd5b803590602001918460018302840111640100000000831117156102c057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105b0945050505050565b6101986004803603604081101561031757600080fd5b506001600160a01b03813516906020013561068b565b6101b46004803603602081101561034357600080fd5b50356001600160a01b031661069e565b6100f76106b9565b6101986004803603604081101561037157600080fd5b506001600160a01b03813516906020013561071a565b6101986004803603604081101561039d57600080fd5b506001600160a01b038135169060200135610788565b610198600480360360408110156103c957600080fd5b506001600160a01b03813516906020013561079c565b6101b4600480360360408110156103f557600080fd5b506001600160a01b03813581169160200135166107a8565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104995780601f1061046e57610100808354040283529160200191610499565b820191906000526020600020905b81548152906001019060200180831161047c57829003601f168201915b5050505050905090565b60006104b76104b06107d3565b84846107d7565b50600192915050565b60025490565b60006104d3848484610831565b610549846104df6107d3565b61054485604051806060016040528060288152602001610d4e602891396001600160a01b038a1660009081526001602052604081209061051d6107d3565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61088516565b6107d7565b5060019392505050565b60055460ff1690565b60006104b76105696107d3565b84610544856001600061057a6107d3565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61091c16565b60006105bc8484610788565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561063757818101518382015260200161061f565b50505050905090810190601f1680156106645780820380516001836020036101000a031916815260200191505b50935050505060405180910390a361067b84610976565b156105495761054984848461097c565b6000610697838361071a565b9392505050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104995780601f1061046e57610100808354040283529160200191610499565b60006104b76107276107d3565b8461054485604051806060016040528060258152602001610dbf60259139600160006107516107d3565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61088516565b60006104b76107956107d3565b8484610831565b6000610697838361055c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b816001600160a01b0381163014156108205760405162461bcd60e51b8152600401808060200182810382526034815260200180610cf46034913960400191505060405180910390fd5b61082b848484610a56565b50505050565b816001600160a01b03811630141561087a5760405162461bcd60e51b8152600401808060200182810382526034815260200180610cf46034913960400191505060405180910390fd5b61082b848484610b42565b600081848411156109145760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108d95781810151838201526020016108c1565b50505050905090810190601f1680156109065780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610697576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3b151590565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b838110156109ea5781810151838201526020016109d2565b50505050905090810190601f168015610a175780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610a3857600080fd5b505af1158015610a4c573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316610a9b5760405162461bcd60e51b8152600401808060200182810382526024815260200180610d9b6024913960400191505060405180910390fd5b6001600160a01b038216610ae05760405162461bcd60e51b8152600401808060200182810382526022815260200180610cd26022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b875760405162461bcd60e51b8152600401808060200182810382526025815260200180610d766025913960400191505060405180910390fd5b6001600160a01b038216610bcc5760405162461bcd60e51b8152600401808060200182810382526023815260200180610caf6023913960400191505060405180910390fd5b610bd7838383610ca9565b610c1a81604051806060016040528060268152602001610d28602691396001600160a01b038616600090815260208190526040902054919063ffffffff61088516565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610c4f908263ffffffff61091c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734c696e6b546f6b656e3a207472616e736665722f617070726f766520746f207468697320636f6e7472616374206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d29b8450660138e9996b73f57f08237acc3fab524eaedef2e93620fef7e5de6464736f6c63430006050033"; +export const LinkTokenABI = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "Transfer", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "spender", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256", + }, + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256", + }, + ], + name: "decreaseApproval", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256", + }, + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256", + }, + ], + name: "increaseApproval", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_to", + type: "address", + }, + { + internalType: "uint256", + name: "_value", + type: "uint256", + }, + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "transferAndCall", + outputs: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +]; + +export const OracleByteCode = + "0x6080604052600160045534801561001557600080fd5b506040516113363803806113368339818101604052602081101561003857600080fd5b5051600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600180546001600160a01b0319166001600160a01b0392909216919091179055611284806100b26000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80637fcd56db1161008c578063a4c0ed3611610066578063a4c0ed36146102a6578063d3e9c31414610361578063f2fde38b14610387578063f3fef3a3146103ad576100cf565b80637fcd56db146102685780638da5cb5b146102965780638f32d59b1461029e576100cf565b8063165d35e1146100d457806340429946146100f85780634ab0d190146101ab5780634b6022821461020d57806350188301146102275780636ee4d5531461022f575b600080fd5b6100dc6103d9565b604080516001600160a01b039092168252519081900360200190f35b6101a9600480360361010081101561010f57600080fd5b6001600160a01b038235811692602081013592604082013592606083013516916001600160e01b03196080820135169160a08201359160c081013591810190610100810160e082013564010000000081111561016a57600080fd5b82018360208201111561017c57600080fd5b8035906020019184600183028401116401000000008311171561019e57600080fd5b5090925090506103e8565b005b6101f9600480360360c08110156101c157600080fd5b508035906020810135906001600160a01b03604082013516906001600160e01b03196060820135169060808101359060a001356106be565b604080519115158252519081900360200190f35b6102156109b8565b60408051918252519081900360200190f35b6102156109be565b6101a96004803603608081101561024557600080fd5b508035906020810135906001600160e01b03196040820135169060600135610a20565b6101a96004803603604081101561027e57600080fd5b506001600160a01b0381351690602001351515610bda565b6100dc610c4c565b6101f9610c5b565b6101a9600480360360608110156102bc57600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156102ec57600080fd5b8201836020820111156102fe57600080fd5b8035906020019184600183028401116401000000008311171561032057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610c6c945050505050565b6101f96004803603602081101561037757600080fd5b50356001600160a01b0316610e99565b6101a96004803603602081101561039d57600080fd5b50356001600160a01b0316610eb7565b6101a9600480360360408110156103c357600080fd5b506001600160a01b038135169060200135610f0a565b6001546001600160a01b031690565b6103f06103d9565b6001600160a01b0316336001600160a01b03161461044b576040805162461bcd60e51b815260206004820152601360248201527226bab9ba103ab9b2902624a725903a37b5b2b760691b604482015290519081900360640190fd5b60015486906001600160a01b03808316911614156104b0576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f742063616c6c6261636b20746f204c494e4b000000000000000000604482015290519081900360640190fd5b604080516bffffffffffffffffffffffff1960608d901b166020808301919091526034808301899052835180840390910181526054909201835281519181019190912060008181526002909252919020541561054a576040805162461bcd60e51b8152602060048201526014602482015273135d5cdd081d5cd94818481d5b9a5c5d5948125160621b604482015290519081900360640190fd5b600061055e4261012c63ffffffff61104b16565b90508a89898360405160200180858152602001846001600160a01b03166001600160a01b031660601b8152601401836001600160e01b0319166001600160e01b0319168152600401828152602001945050505050604051602081830303815290604052805190602001206002600084815260200190815260200160002081905550897fd8d7ecc4800d25fa53ce0372f13a416d98907a7ef3d8d3bdd79cf4fe75529c658d848e8d8d878d8d8d604051808a6001600160a01b03166001600160a01b03168152602001898152602001888152602001876001600160a01b03166001600160a01b03168152602001866001600160e01b0319166001600160e01b0319168152602001858152602001848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039c50909a5050505050505050505050a2505050505050505050505050565b3360009081526003602052604081205460ff16806106f457506106df610c4c565b6001600160a01b0316336001600160a01b0316145b61072f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611205602a913960400191505060405180910390fd5b6000878152600260205260409020548790610791576040805162461bcd60e51b815260206004820152601b60248201527f4d757374206861766520612076616c6964207265717565737449640000000000604482015290519081900360640190fd5b6040805160208082018a90526bffffffffffffffffffffffff1960608a901b16828401526001600160e01b0319881660548301526058808301889052835180840390910181526078909201835281519181019190912060008b81526002909252919020548114610848576040805162461bcd60e51b815260206004820152601e60248201527f506172616d7320646f206e6f74206d6174636820726571756573742049440000604482015290519081900360640190fd5b60045461085b908963ffffffff61104b16565b60045560008981526002602052604081205562061a805a10156108c5576040805162461bcd60e51b815260206004820181905260248201527f4d7573742070726f7669646520636f6e73756d657220656e6f75676820676173604482015290519081900360640190fd5b60408051602481018b9052604480820187905282518083039091018152606490910182526020810180516001600160e01b03166001600160e01b03198a16178152915181516000936001600160a01b038c169392918291908083835b602083106109405780518252601f199092019160209182019101610921565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146109a2576040519150601f19603f3d011682016040523d82523d6000602084013e6109a7565b606091505b50909b9a5050505050505050505050565b61012c81565b60006109c8610c5b565b610a07576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b600454610a1b90600163ffffffff6110ac16565b905090565b6040805160208082018690523360601b828401526001600160e01b0319851660548301526058808301859052835180840390910181526078909201835281519181019190912060008781526002909252919020548114610ac7576040805162461bcd60e51b815260206004820152601e60248201527f506172616d7320646f206e6f74206d6174636820726571756573742049440000604482015290519081900360640190fd5b42821115610b15576040805162461bcd60e51b815260206004820152601660248201527514995c5d595cdd081a5cc81b9bdd08195e1c1a5c995960521b604482015290519081900360640190fd5b6000858152600260205260408082208290555186917fa7842b9ec549398102c0d91b1b9919b2f20558aefdadf57528a95c6cd3292e9391a26001546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610ba157600080fd5b505af1158015610bb5573d6000803e3d6000fd5b505050506040513d6020811015610bcb57600080fd5b5051610bd357fe5b5050505050565b610be2610c5b565b610c21576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b610c746103d9565b6001600160a01b0316336001600160a01b031614610ccf576040805162461bcd60e51b815260206004820152601360248201527226bab9ba103ab9b2902624a725903a37b5b2b760691b604482015290519081900360640190fd5b8051819060441115610d21576040805162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840e4cae2eacae6e840d8cadccee8d60531b604482015290519081900360640190fd5b602082015182906001600160e01b031981166320214ca360e11b14610d8d576040805162461bcd60e51b815260206004820152601e60248201527f4d757374207573652077686974656c69737465642066756e6374696f6e730000604482015290519081900360640190fd5b8560248501528460448501526000306001600160a01b0316856040518082805190602001908083835b60208310610dd55780518252601f199092019160209182019101610db6565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610e35576040519150601f19603f3d011682016040523d82523d6000602084013e610e3a565b606091505b5050905080610e90576040805162461bcd60e51b815260206004820152601860248201527f556e61626c6520746f2063726561746520726571756573740000000000000000604482015290519081900360640190fd5b50505050505050565b6001600160a01b031660009081526003602052604090205460ff1690565b610ebf610c5b565b610efe576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b610f0781611109565b50565b610f12610c5b565b610f51576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b80610f6381600163ffffffff61104b16565b6004541015610fa35760405162461bcd60e51b81526004018080602001828103825260358152602001806111d06035913960400191505060405180910390fd5b600454610fb6908363ffffffff6110ac16565b60049081556001546040805163a9059cbb60e01b81526001600160a01b0387811694820194909452602481018690529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561101457600080fd5b505af1158015611028573d6000803e3d6000fd5b505050506040513d602081101561103e57600080fd5b505161104657fe5b505050565b6000828201838110156110a5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600082821115611103576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b03811661114e5760405162461bcd60e51b81526004018080602001828103825260268152602001806111aa6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416d6f756e74207265717565737465642069732067726561746572207468616e20776974686472617761626c652062616c616e63654e6f7420616e20617574686f72697a6564206e6f646520746f2066756c66696c6c2072657175657374734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220880df1259ed41873ae139626f0469321944ef17f2f300986604e5bb00a6f353a64736f6c63430006050033"; +export const OracleABI = [ + { + inputs: [ + { + internalType: "address", + name: "_link", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "requestId", + type: "bytes32", + }, + ], + name: "CancelOracleRequest", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "specId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "requester", + type: "address", + }, + { + indexed: false, + internalType: "bytes32", + name: "requestId", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "payment", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "callbackAddr", + type: "address", + }, + { + indexed: false, + internalType: "bytes4", + name: "callbackFunctionId", + type: "bytes4", + }, + { + indexed: false, + internalType: "uint256", + name: "cancelExpiration", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "dataVersion", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "OracleRequest", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "EXPIRY_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_requestId", + type: "bytes32", + }, + { + internalType: "uint256", + name: "_payment", + type: "uint256", + }, + { + internalType: "bytes4", + name: "_callbackFunc", + type: "bytes4", + }, + { + internalType: "uint256", + name: "_expiration", + type: "uint256", + }, + ], + name: "cancelOracleRequest", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_requestId", + type: "bytes32", + }, + { + internalType: "uint256", + name: "_payment", + type: "uint256", + }, + { + internalType: "address", + name: "_callbackAddress", + type: "address", + }, + { + internalType: "bytes4", + name: "_callbackFunctionId", + type: "bytes4", + }, + { + internalType: "uint256", + name: "_expiration", + type: "uint256", + }, + { + internalType: "bytes32", + name: "_data", + type: "bytes32", + }, + ], + name: "fulfillOracleRequest", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_node", + type: "address", + }, + ], + name: "getAuthorizationStatus", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getChainlinkToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isOwner", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_sender", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "onTokenTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_sender", + type: "address", + }, + { + internalType: "uint256", + name: "_payment", + type: "uint256", + }, + { + internalType: "bytes32", + name: "_specId", + type: "bytes32", + }, + { + internalType: "address", + name: "_callbackAddress", + type: "address", + }, + { + internalType: "bytes4", + name: "_callbackFunctionId", + type: "bytes4", + }, + { + internalType: "uint256", + name: "_nonce", + type: "uint256", + }, + { + internalType: "uint256", + name: "_dataVersion", + type: "uint256", + }, + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "oracleRequest", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_node", + type: "address", + }, + { + internalType: "bool", + name: "_allowed", + type: "bool", + }, + ], + name: "setFulfillmentPermission", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_recipient", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "withdrawable", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +export const FluxAggregatorByteCode = + "0x60c06040523480156200001157600080fd5b5060405162004ad438038062004ad483398181016040526101008110156200003857600080fd5b815160208301516040808501516060860151608087015160a088015160c089015160e08a0180519651989a9799959894979396929591949391820192846401000000008211156200008857600080fd5b9083019060208201858111156200009e57600080fd5b8251640100000000811182820188101715620000b957600080fd5b82525081516020918201929091019080838360005b83811015620000e8578181015183820152602001620000ce565b50505050905090810190601f168015620001165780820380516001836020036101000a031916815260200191505b50604052505060008054336001600160a01b0319918216178255600280549091166001600160a01b038c16179055620001559150889080808a6200021f565b62000169856001600160e01b03620005fd16565b608084905260a08390526005805460ff191660ff8416179055805162000197906006906020840190620007e1565b50620001b88663ffffffff1642620006c760201b62002ef91790919060201c565b6000805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6c80546001600160401b03929092166801000000000000000002600160401b600160801b031990921691909117905550620008839650505050505050565b6000546001600160a01b031633146200027f576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6000620002946001600160e01b036200072a16565b60ff1690508463ffffffff168463ffffffff161015620002fb576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff1610156200035d576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff811615806200037c57508263ffffffff168163ffffffff16115b620003ce576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b620003eb6001600160801b0387166001600160e01b036200073116565b600d546001600160801b031610156200044b576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b6000620004606001600160e01b036200072a16565b60ff161115620004c65760008563ffffffff1611620004c6576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b031633146200065d576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6003546001600160a01b039081169082168114620006c357600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b6000828211156200071f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600c545b90565b600062000724600262000768620007506001600160e01b036200072a16565b60ff16856200077c60201b620037221790919060201c565b6200077c60201b620037221790919060201c565b6000826200078d5750600062000724565b828202828482816200079b57fe5b0414620007da5760405162461bcd60e51b815260040180806020018281038252602181526020018062004ab36021913960400191505060405180910390fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200082457805160ff191683800117855562000854565b8280016001018555821562000854579182015b828111156200085457825182559160200191906001019062000837565b506200086292915062000866565b5090565b6200072e91905b808211156200086257600081556001016200086d565b60805160a051614202620008b160003980610a845280610d08525080610a0f528061190052506142026000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c8063668a0f0211610146578063a4c0ed36116100c3578063c937450011610087578063c9374500146108b7578063d4cc54e4146108bf578063e2e40317146108c7578063e9ee6eeb146108ed578063f2fde38b1461091b578063feaf968c1461094157610253565b8063a4c0ed36146107c6578063b5ab58dc14610849578063b633620c14610866578063c107532914610883578063c35905c6146108af57610253565b80638205bf6a1161010a5780638205bf6a1461069557806388aa80e71461069d5780638da5cb5b1461072f57806398e5b12a146107375780639a6fc8f51461075e57610253565b8063668a0f02146105f857806370dea79a146106005780637284e4161461060857806379ba5097146106855780637c2b0b211461068d57610253565b806340884c52116101d457806357970e931161019857806357970e931461059457806358609e441461059c578063613d8fcc146105a4578063628806ef146105ac57806364efb22b146105d257610253565b806340884c521461050057806346fcff4c146105585780634f8fc3b51461057c57806350d25bcd1461058457806354fd4d501461058c57610253565b8063357ebb021161021b578063357ebb021461031557806338aa4c72146103365780633969c20f146103805780633a5381b5146104a65780633d3d7714146104ca57610253565b80631327d3d814610258578063202ee0ed1461028057806320ed0275146102a357806323ca2903146102dd578063313ce567146102f7575b600080fd5b61027e6004803603602081101561026e57600080fd5b50356001600160a01b0316610949565b005b61027e6004803603604081101561029657600080fd5b50803590602001356109ff565b61027e600480360360608110156102b957600080fd5b5080356001600160a01b03169060208101351515906040013563ffffffff16610bd1565b6102e5610d06565b60408051918252519081900360200190f35b6102ff610d2a565b6040805160ff9092168252519081900360200190f35b61031d610d33565b6040805163ffffffff9092168252519081900360200190f35b61027e600480360360a081101561034c57600080fd5b506001600160801b038135169063ffffffff6020820135811691604081013582169160608201358116916080013516610d46565b61027e600480360360c081101561039657600080fd5b810190602081018135600160201b8111156103b057600080fd5b8201836020820111156103c257600080fd5b803590602001918460208302840111600160201b831117156103e357600080fd5b919390929091602081019035600160201b81111561040057600080fd5b82018360208201111561041257600080fd5b803590602001918460208302840111600160201b8311171561043357600080fd5b919390929091602081019035600160201b81111561045057600080fd5b82018360208201111561046257600080fd5b803590602001918460208302840111600160201b8311171561048357600080fd5b919350915063ffffffff81358116916020810135821691604090910135166110e9565b6104ae6112b1565b604080516001600160a01b039092168252519081900360200190f35b61027e600480360360608110156104e057600080fd5b506001600160a01b038135811691602081013590911690604001356112c0565b6105086114b3565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561054457818101518382015260200161052c565b505050509050019250505060405180910390f35b610560611516565b604080516001600160801b039092168252519081900360200190f35b61027e611525565b6102e561163c565b6102e561165e565b6104ae611663565b61031d611672565b6102ff611685565b61027e600480360360208110156105c257600080fd5b50356001600160a01b031661168b565b6104ae600480360360208110156105e857600080fd5b50356001600160a01b0316611771565b6102e561179b565b61031d6117ae565b6106106117c1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561064a578181015183820152602001610632565b50505050905090810190601f1680156106775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61027e61184f565b6102e56118fe565b6102e5611922565b6106cf600480360360408110156106b357600080fd5b5080356001600160a01b0316906020013563ffffffff16611957565b60408051981515895263ffffffff9097166020890152878701959095526001600160401b0393841660608801529190921660808601526001600160801b0391821660a086015260ff1660c08501521660e083015251908190036101000190f35b6104ae611ab7565b61073f611ac6565b6040805169ffffffffffffffffffff9092168252519081900360200190f35b6107876004803603602081101561077457600080fd5b503569ffffffffffffffffffff16611be5565b6040805169ffffffffffffffffffff96871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b61027e600480360360608110156107dc57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561080b57600080fd5b82018360208201111561081d57600080fd5b803590602001918460018302840111600160201b8311171561083e57600080fd5b509092509050611d1f565b6102e56004803603602081101561085f57600080fd5b5035611d80565b6102e56004803603602081101561087c57600080fd5b5035611db4565b61027e6004803603604081101561089957600080fd5b506001600160a01b038135169060200135611df3565b610560611f95565b61031d611fa4565b610560611fb7565b6102e5600480360360208110156108dd57600080fd5b50356001600160a01b0316611fcd565b61027e6004803603604081101561090357600080fd5b506001600160a01b0381358116916020013516611ff1565b61027e6004803603602081101561093157600080fd5b50356001600160a01b03166120d4565b610787612172565b6000546001600160a01b03163314610996576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b6003546001600160a01b0390811690821681146109fb57600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b6060610a0b33846121ac565b90507f0000000000000000000000000000000000000000000000000000000000000000821215610a82576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652062656c6f77206d696e5375626d697373696f6e56616c75650000604482015290519081900360640190fd5b7f0000000000000000000000000000000000000000000000000000000000000000821315610af7576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652061626f7665206d61785375626d697373696f6e56616c75650000604482015290519081900360640190fd5b8051819015610b845760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b49578181015183820152602001610b31565b50505050905090810190601f168015610b765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50610b8e8361244f565b610b9882846124e3565b600080610ba4856125bc565b91509150610bb185612714565b610bba85612857565b8115610bca57610bca85826128b6565b5050505050565b6000546001600160a01b03163314610c1e576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b6001600160a01b0383166000908152600b602052604090205460ff1615158215151415610c4a57610d01565b8115610c8d576001600160a01b0383166000908152600b60205260409020805460ff19168315151764ffffffff00191661010063ffffffff841602179055610cb6565b6001600160a01b0383166000908152600b60205260409020805468ffffffffffffffffff191690555b60408051831515815263ffffffff8316602082015281516001600160a01b038616927fc3df5a754e002718f2e10804b99e6605e7c701d95cec9552c7680ca2b6f2820a928290030190a25b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60055460ff1681565b600454600160c01b900463ffffffff1681565b6000546001600160a01b03163314610d93576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b6000610d9d611685565b60ff1690508463ffffffff168463ffffffff161015610e03576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff161015610e64576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff81161580610e8257508263ffffffff168163ffffffff16115b610ed3576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b610ee5866001600160801b03166129af565b600d546001600160801b03161015610f44576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b6000610f4e611685565b60ff161115610fb25760008563ffffffff1611610fb2576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b03163314611136576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b60005b8881101561116d576111658a8a8381811061115057fe5b905060200201356001600160a01b03166129dd565b600101611139565b508584146111c2576040805162461bcd60e51b815260206004820181905260248201527f6e6565642073616d65206f7261636c6520616e642061646d696e20636f756e74604482015290519081900360640190fd5b604d6111df876111d0611685565b60ff169063ffffffff612bab16565b1115611228576040805162461bcd60e51b81526020600482015260136024820152721b585e081bdc9858db195cc8185b1b1bddd959606a1b604482015290519081900360640190fd5b60005b8681101561127b5761127388888381811061124257fe5b905060200201356001600160a01b031687878481811061125e57fe5b905060200201356001600160a01b0316612bfa565b60010161122b565b506004546112a6906001600160801b03811690859085908590600160e01b900463ffffffff16610d46565b505050505050505050565b6003546001600160a01b031681565b6001600160a01b03838116600090815260086020526040902060020154620100009004163314611330576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b03831660009081526008602052604090205481906001600160801b039081169082168110156113ad576040805162461bcd60e51b815260206004820152601f60248201527f696e73756666696369656e7420776974686472617761626c652066756e647300604482015290519081900360640190fd5b6113c66001600160801b0382168363ffffffff612e8a16565b6001600160a01b038616600090815260086020526040902080546001600160801b0319166001600160801b03928316179055600d5461140e91600160801b9091041683612e8a565b600d80546001600160801b03928316600160801b029083161790556002546040805163a9059cbb60e01b81526001600160a01b03888116600483015293861660248201529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561148157600080fd5b505af1158015611495573d6000803e3d6000fd5b505050506040513d60208110156114ab57600080fd5b5051610bca57fe5b6060600c80548060200260200160405190810160405280929190818152602001828054801561150b57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116114ed575b505050505090505b90565b600d546001600160801b031690565b61152d61405b565b50604080518082018252600d546001600160801b038082168352600160801b90910416602080830182905260025484516370a0823160e01b8152306004820152945193946000946115de94936001600160a01b03909316926370a082319260248082019391829003018186803b1580156115a657600080fd5b505afa1580156115ba573d6000803e3d6000fd5b505050506040513d60208110156115d057600080fd5b50519063ffffffff612ef916565b82519091506001600160801b031681146109fb57600d80546001600160801b0319166001600160801b03831617905560405181907ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f90600090a25050565b600754600160201b900463ffffffff1660009081526009602052604090205490565b600381565b6002546001600160a01b031681565b600454600160801b900463ffffffff1681565b600c5490565b6001600160a01b038181166000908152600860205260409020600301541633146116fc576040805162461bcd60e51b815260206004820152601e60248201527f6f6e6c792063616c6c61626c652062792070656e64696e672061646d696e0000604482015290519081900360640190fd5b6001600160a01b0381166000818152600860205260408082206003810180546001600160a01b0319169055600201805462010000600160b01b031916336201000081029190911790915590519092917f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90491a350565b6001600160a01b03808216600090815260086020526040902060020154620100009004165b919050565b600754600160201b900463ffffffff1690565b600454600160e01b900463ffffffff1681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156118475780601f1061181c57610100808354040283529160200191611847565b820191906000526020600020905b81548152906001019060200180831161182a57829003601f168201915b505050505081565b6001546001600160a01b031633146118a7576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b7f000000000000000000000000000000000000000000000000000000000000000081565b600754600160201b900463ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031690565b6000808080808080803332146119ad576040805162461bcd60e51b81526020600482015260166024820152756f66662d636861696e2072656164696e67206f6e6c7960501b604482015290519081900360640190fd5b63ffffffff891615611a905763ffffffff89166000908152600960209081526040808320600a9092529091206119e38c8c612f50565b6001600160a01b038d1660009081526008602052604090206001908101548482015491840154600d548f936001600160401b031691600160401b900463ffffffff16906001600160801b0316611a37611685565b60018901546001600160401b0316611a5a576004546001600160801b0316611a70565b6001880154600160601b90046001600160801b03165b8363ffffffff169350995099509950995099509950995099505050611aaa565b611a998a612fa5565b975097509750975097509750975097505b9295985092959890939650565b6000546001600160a01b031681565b336000908152600b602052604081205460ff16611b2a576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617574686f72697a6564207265717565737465720000000000000000604482015290519081900360640190fd5b60075463ffffffff16600081815260096020526040902060010154600160401b90046001600160401b0316151580611b665750611b6681613170565b611bb7576040805162461bcd60e51b815260206004820152601f60248201527f7072657620726f756e64206d75737420626520737570657273656461626c6500604482015290519081900360640190fd5b6000611bce63ffffffff808416906001906131fb16565b9050611bd98161324c565b63ffffffff1691505090565b6000806000806000611bf5614072565b5063ffffffff8087166000908152600960209081526040918290208251608081018452815481526001909101546001600160401b0380821693830193909352600160401b810490921692810192909252600160801b90049091166060820181905215801590611c745750611c748769ffffffffffffffffffff1661331a565b6040518060400160405280600f81526020016e139bc819185d18481c1c995cd95b9d608a1b81525090611ce85760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610b49578181015183820152602001610b31565b50805160208201516040830151606090930151989991986001600160401b0391821698509216955063ffffffff9091169350915050565b8015611d72576040805162461bcd60e51b815260206004820181905260248201527f7472616e7366657220646f65736e2774206163636570742063616c6c64617461604482015290519081900360640190fd5b611d7a611525565b50505050565b6000611d8b8261331a565b15611dac575063ffffffff8116600090815260096020526040902054611796565b506000919050565b6000611dbf8261331a565b15611dac575063ffffffff8116600090815260096020526040902060010154600160401b90046001600160401b0316611796565b6000546001600160a01b03163314611e40576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b600d546004546001600160801b03918216918391611e6f91611e6291166129af565b839063ffffffff612ef916565b1015611ec2576040805162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420726573657276652066756e6473000000000000604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611f1857600080fd5b505af1158015611f2c573d6000803e3d6000fd5b505050506040513d6020811015611f4257600080fd5b5051611f8d576040805162461bcd60e51b81526020600482015260156024820152741d1bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604482015290519081900360640190fd5b610d01611525565b6004546001600160801b031681565b600454600160a01b900463ffffffff1681565b600d54600160801b90046001600160801b031690565b6001600160a01b03166000908152600860205260409020546001600160801b031690565b6001600160a01b03828116600090815260086020526040902060020154620100009004163314612061576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b0382811660008181526008602090815260409182902060030180546001600160a01b0319169486169485179055815133815290810193909352805191927fb79bf2e89c2d70dde91d2991fb1ea69b7e478061ad7c04ed5b02b96bc52b8104929081900390910190a25050565b6000546001600160a01b03163314612121576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080600080600061219b600760049054906101000a900463ffffffff1663ffffffff16611be5565b945094509450945094509091929394565b6001600160a01b03821660009081526008602052604090205460075460609163ffffffff600160801b909104811691168161221557604051806040016040528060128152602001716e6f7420656e61626c6564206f7261636c6560701b81525092505050612449565b8363ffffffff168263ffffffff16111561226157604051806040016040528060168152602001756e6f742079657420656e61626c6564206f7261636c6560501b81525092505050612449565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160a01b9092041610156122d0576040518060400160405280601881526020017f6e6f206c6f6e67657220616c6c6f776564206f7261636c65000000000000000081525092505050612449565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160c01b909204161061233e576040518060400160405280602081526020017f63616e6e6f74207265706f7274206f6e2070726576696f757320726f756e647381525092505050612449565b8063ffffffff168463ffffffff161415801561237a575061236a63ffffffff808316906001906131fb16565b63ffffffff168463ffffffff1614155b801561238d575061238b8482613324565b155b156123d1576040518060400160405280601781526020017f696e76616c696420726f756e6420746f207265706f727400000000000000000081525092505050612449565b8363ffffffff1660011415801561240257506124006123fb63ffffffff8087169060019061338416565b6133e7565b155b15612446576040518060400160405280601f81526020017f70726576696f757320726f756e64206e6f7420737570657273656461626c650081525092505050612449565b50505b92915050565b61245881613421565b612461576124e0565b3360009081526008602052604090205460045463ffffffff600160e01b909204821691600160c01b90910481168201908316118015906124a057508015155b156124ab57506124e0565b6124b482613452565b5033600090815260086020526040902080546001600160e01b0316600160e01b63ffffffff8416021790555b50565b6124ec81613605565b61253d576040805162461bcd60e51b815260206004820152601f60248201527f726f756e64206e6f7420616363657074696e67207375626d697373696f6e7300604482015290519081900360640190fd5b63ffffffff81166000818152600a6020908152604080832080546001808201835591855283852001879055338085526008909352818420805463ffffffff60c01b1916600160c01b8702178155018690555190929185917f92e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68c9190a45050565b63ffffffff8082166000908152600a602052604081206001810154905491928392600160201b9092041611156125f75750600090508061270f565b63ffffffff83166000908152600a60209081526040808320805482518185028101850190935280835261265d9383018282801561265357602002820191906000526020600020905b81548152602001906001019080831161263f575b5050505050613625565b63ffffffff8516600081815260096020908152604091829020848155600101805467ffffffffffffffff60401b1916600160401b426001600160401b038116919091029190911763ffffffff60801b1916600160801b8602179091556007805467ffffffff000000001916600160201b860217905582519081529151939450919284927f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f928290030190a36001925090505b915091565b63ffffffff81166000908152600a6020526040902060010154600160601b90046001600160801b031661274561405b565b5060408051808201909152600d546001600160801b03808216808452600160801b90920416602083015261277f908363ffffffff612e8a16565b6001600160801b03908116825260208201516127a291168363ffffffff6136ce16565b6001600160801b0390811660208084018290528351600d8054600160801b9094029185166001600160801b031990941693909317841617909155336000908152600890915260409020546127fd91168363ffffffff6136ce16565b3360009081526008602052604080822080546001600160801b0319166001600160801b03948516179055835190519216917ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f9190a2505050565b63ffffffff8082166000908152600a602052604090206001810154905491161115612881576124e0565b63ffffffff81166000908152600a60205260408120906128a18282614099565b5060010180546001600160e01b031916905550565b6003546001600160a01b0316806128cd57506109fb565b60006128e463ffffffff8086169060019061338416565b63ffffffff808216600090815260096020908152604080832060018101549054825163beed9b5160e01b8152600160801b90920486166004830181905260248301829052958b166044830152606482018a90529151959650939490936001600160a01b0388169363beed9b5193620186a093608480850194929391928390030190829088803b15801561297657600080fd5b5087f19350505050801561299c57506040513d602081101561299757600080fd5b505160015b6129a5576129a7565b505b505050505050565b600061244960026129d16129c1611685565b859060ff1663ffffffff61372216565b9063ffffffff61372216565b6129e68161377b565b612a2c576040805162461bcd60e51b81526020600482015260126024820152711bdc9858db19481b9bdd08195b98589b195960721b604482015290519081900360640190fd5b600754612a459063ffffffff908116906001906131fb16565b6001600160a01b0382166000908152600860205260408120805463ffffffff93909316600160a01b0263ffffffff60a01b1990931692909217909155600c612a9f6001612a90611685565b60ff169063ffffffff612ef916565b81548110612aa957fe5b6000918252602080832091909101546001600160a01b0385811680855260089093526040808520600290810180549390941680875291862001805461ffff90931661ffff199384168117909155939094528154169055600c8054929350909183919083908110612b1557fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600c805480612b4e57fe5b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038516907f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e908390a3505050565b600082820183811015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b9392505050565b612c038261377b565b15612c4e576040805162461bcd60e51b81526020600482015260166024820152751bdc9858db1948185b1c9958591e48195b98589b195960521b604482015290519081900360640190fd5b6001600160a01b038116612ca1576040805162461bcd60e51b8152602060048201526015602482015274063616e6e6f74207365742061646d696e20746f203605c1b604482015290519081900360640190fd5b6001600160a01b03828116600090815260086020526040902060020154620100009004161580612cf657506001600160a01b038281166000908152600860205260409020600201546201000090048116908216145b612d47576040805162461bcd60e51b815260206004820152601c60248201527f6f776e65722063616e6e6f74206f76657277726974652061646d696e00000000604482015290519081900360640190fd5b612d50826137a6565b6001600160a01b03808416600081815260086020526040808220805463ffffffff60a01b1963ffffffff97909716600160801b0263ffffffff60801b19909116179590951663ffffffff60a01b178555600c80546002909601805461ffff90971661ffff19909716969096178655805460018181019092557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b031916851790558383528554948716620100000262010000600160b01b0319909516949094179094559251919290917f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e9190a3806001600160a01b0316826001600160a01b03167f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90460405160405180910390a35050565b6000826001600160801b0316826001600160801b03161115612ef3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082821115612ef3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b63ffffffff81166000908152600960205260408120600101546001600160401b031615612f9b57612f8082613605565b8015612f945750612f9183836121ac565b51155b9050612449565b612f808383613809565b6001600160a01b0381166000908152600860205260408120600754815483928392839283928392839283927fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b929091849163ffffffff908116600160c01b90920416148061302257506007546130209063ffffffff16613605565b155b6007549091506130379063ffffffff166133e7565b80156130405750805b156130995760075461305e9063ffffffff908116906001906131fb16565b63ffffffff81166000908152600960205260409020600454919b506001600160801b03909116945092506130928c8b613809565b9a506130e3565b60075463ffffffff166000818152600960209081526040808320600a90925290912060010154919b50600160601b9091046001600160801b0316945092506130e08a613605565b9a505b6130ed8c8b6121ac565b51156130f85760009a505b6001808301548482015463ffffffff808e166000908152600a6020526040902090930154600d548f948f94936001600160401b031692600160401b900416906001600160801b0316613148611685565b8a8363ffffffff1693509a509a509a509a509a509a509a509a50505050919395975091939597565b63ffffffff8082166000908152600960209081526040808320600190810154600a909352908320015491926001600160401b0390911691600160401b90041681158015906131c4575060008163ffffffff16115b80156131f35750426131e86001600160401b03841663ffffffff8085169061385316565b6001600160401b0316105b949350505050565b600082820163ffffffff8085169082161015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b61325581613421565b61325e576124e0565b336000908152600b602052604090205463ffffffff6501000000000082048116916101009004811682019083161180613295575080155b6132dc576040805162461bcd60e51b81526020600482015260136024820152726d7573742064656c617920726571756573747360681b604482015290519081900360640190fd5b6132e582613452565b50336000908152600b60205260409020805463ffffffff8316650100000000000268ffffffff00000000001990911617905550565b63ffffffff101590565b60008163ffffffff1661334760018563ffffffff166131fb90919063ffffffff16565b63ffffffff16148015612bf357505063ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031615919050565b60008263ffffffff168263ffffffff161115612ef3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b63ffffffff8116600090815260096020526040812060010154600160401b90046001600160401b0316151580612449575061244982613170565b60075460009061343d9063ffffffff908116906001906131fb16565b63ffffffff168263ffffffff16149050919050565b61346f61346a63ffffffff8084169060019061338416565b6138a7565b6007805463ffffffff191663ffffffff831617905561348c6140b7565b5060408051600060a0820181815260c083018452825260045463ffffffff600160801b82048116602080860191909152600160a01b8304821685870152600160e01b8304821660608601526001600160801b03909216608085015285168252600a8152929020815180519293849361350792849201906140e5565b5060208281015160019283018054604080870151606088015160809098015163ffffffff1990931663ffffffff9586161767ffffffff000000001916600160201b91861691909102176bffffffff00000000000000001916600160401b97851697909702969096176fffffffffffffffffffffffffffffffff60601b1916600160601b6001600160801b03909216919091021790558516600081815260098352849020909201805467ffffffffffffffff1916426001600160401b039081169190911791829055845191168152925133937f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac6027192908290030190a35050565b63ffffffff9081166000908152600a602052604090206001015416151590565b60008151600010613676576040805162461bcd60e51b81526020600482015260166024820152756c697374206d757374206e6f7420626520656d70747960501b604482015290519081900360640190fd5b815160028104600182166136b55760008061369b866000600187036001870387613969565b90925090506136aa8282613a47565b945050505050611796565b6136c58460006001850384613ab5565b92505050611796565b60008282016001600160801b038085169082161015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b60008261373157506000612449565b8282028284828161373e57fe5b0414612bf35760405162461bcd60e51b815260040180806020018281038252602181526020018061418c6021913960400191505060405180910390fd5b6001600160a01b031660009081526008602052604090205463ffffffff600160a01b90910481161490565b60075460009063ffffffff1680158015906137e857506001600160a01b03831660009081526008602052604090205463ffffffff828116600160a01b90920416145b156137f4579050611796565b612bf363ffffffff808316906001906131fb16565b6001600160a01b03821660009081526008602052604081205460045463ffffffff600160e01b909204821691600160c01b9091048116820190841611806131f35750159392505050565b60008282016001600160401b038085169082161015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b6138b081613170565b6138b9576124e0565b60006138d063ffffffff8084169060019061338416565b63ffffffff8181166000908152600960209081526040808320805488861685528285209081556001918201549101805463ffffffff60801b1916600160801b928390049096169091029490941767ffffffffffffffff60401b1916600160401b426001600160401b03160217909355600a90529081209192506139538282614099565b5060010180546001600160e01b03191690555050565b60008082841061397857600080fd5b8386111580156139885750848411155b61399157600080fd5b8286111580156139a15750848311155b6139aa57600080fd5b600786860310156139cb576139c28787878787613b46565b91509150613a3d565b60006139d8888888613f19565b90508084116139e957809550613a37565b848110156139fc57806001019650613a37565b808511158015613a0b57508381105b613a1157fe5b613a1d88888388613ab5565b9250613a2e88826001018887613ab5565b9150613a3d9050565b506139aa565b9550959350505050565b60008083128015613a585750600082135b80613a6e5750600083138015613a6e5750600082125b15613a8e576002613a7f8484613ff6565b81613a8657fe5b059050612449565b60006002808507818507010590506131f3613aaf6002860560028605613ff6565b82613ff6565b600081841115613ac457600080fd5b82821115613ad157600080fd5b82841015613b285760078484031015613afd576000613af38686868687613b46565b5091506131f39050565b6000613b0a868686613f19565b9050808311613b1b57809350613b22565b8060010194505b50613ad1565b848481518110613b3457fe5b60200260200101519050949350505050565b600080600086866001010390506000888860000181518110613b6457fe5b60200260200101519050600082600110613b85576001600160ff1b03613b9d565b898960010181518110613b9457fe5b60200260200101515b9050600083600210613bb6576001600160ff1b03613bce565b8a8a60020181518110613bc557fe5b60200260200101515b9050600084600310613be7576001600160ff1b03613bff565b8b8b60030181518110613bf657fe5b60200260200101515b9050600085600410613c18576001600160ff1b03613c30565b8c8c60040181518110613c2757fe5b60200260200101515b9050600086600510613c49576001600160ff1b03613c61565b8d8d60050181518110613c5857fe5b60200260200101515b9050600087600610613c7a576001600160ff1b03613c92565b8e8e60060181518110613c8957fe5b60200260200101515b905085871315613ca0579495945b83851315613cac579293925b81831315613cb8579091905b84871315613cc4579395935b83861315613cd0579294925b80831315613cda57915b84861315613ce6579394935b80821315613cf057905b82871315613cfc579195915b81861315613d08579094905b80851315613d1257935b82861315613d1e579194915b80841315613d2857925b82851315613d34579193915b81841315613d40579092905b82841315613d4c579192915b8d8c0380613d5c57879a50613e02565b8060011415613d6d57869a50613e02565b8060021415613d7e57859a50613e02565b8060031415613d8f57849a50613e02565b8060041415613da057839a50613e02565b8060051415613db157829a50613e02565b8060061415613dc257819a50613e02565b6040805162461bcd60e51b815260206004820152601060248201526f6b31206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b8e8c038d8d1415613e2057508a9950613a3d98505050505050505050565b80613e375750969850613a3d975050505050505050565b8060011415613e525750959850613a3d975050505050505050565b8060021415613e6d5750949850613a3d975050505050505050565b8060031415613e885750939850613a3d975050505050505050565b8060041415613ea35750929850613a3d975050505050505050565b8060051415613ebe5750919850613a3d975050505050505050565b8060061415613ed95750909850613a3d975050505050505050565b6040805162461bcd60e51b815260206004820152601060248201526f6b32206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b6000808460028585010481518110613f2d57fe5b602002602001015190506001840393506001830192505b60018401935080858581518110613f5757fe5b602002602001015112613f44575b60018303925080858481518110613f7857fe5b602002602001015113613f655782841015613fe857848381518110613f9957fe5b6020026020010151858581518110613fad57fe5b6020026020010151868681518110613fc157fe5b60200260200101878681518110613fd457fe5b602090810291909101019190915252613ff1565b82915050612bf3565b613f44565b600082820181831280159061400b5750838112155b80614020575060008312801561402057508381125b612bf35760405162461bcd60e51b815260040180806020018281038252602181526020018061414b6021913960400191505060405180910390fd5b604080518082019091526000808252602082015290565b60408051608081018252600080825260208201819052918101829052606081019190915290565b50805460008255906000526020600020908101906124e09190614130565b6040805160a08101825260608082526000602083018190529282018390528101829052608081019190915290565b828054828255906000526020600020908101928215614120579160200282015b82811115614120578251825591602001919060010190614105565b5061412c929150614130565b5090565b61151391905b8082111561412c576000815560010161413656fe5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f77536166654d6174683a206164646974696f6e206f766572666c6f770000000000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f6e6c792063616c6c61626c65206279206f776e657200000000000000000000a26469706673582212205752ce9095ae9e6129196eea73dac92cb2a25f52fb262c93f35ce9dcb1b3f25764736f6c63430006050033536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77"; +export const FluxAggregatorABI = [ + { + inputs: [ + { + internalType: "address", + name: "_link", + type: "address", + }, + { + internalType: "uint128", + name: "_paymentAmount", + type: "uint128", + }, + { + internalType: "uint32", + name: "_timeout", + type: "uint32", + }, + { + internalType: "address", + name: "_validator", + type: "address", + }, + { + internalType: "int256", + name: "_minSubmissionValue", + type: "int256", + }, + { + internalType: "int256", + name: "_maxSubmissionValue", + type: "int256", + }, + { + internalType: "uint8", + name: "_decimals", + type: "uint8", + }, + { + internalType: "string", + name: "_description", + type: "string", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "int256", + name: "current", + type: "int256", + }, + { + indexed: true, + internalType: "uint256", + name: "roundId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + ], + name: "AnswerUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "AvailableFundsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "roundId", + type: "uint256", + }, + { + indexed: true, + internalType: "address", + name: "startedBy", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + ], + name: "NewRound", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "admin", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address", + }, + ], + name: "OracleAdminUpdateRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newAdmin", + type: "address", + }, + ], + name: "OracleAdminUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + { + indexed: true, + internalType: "bool", + name: "whitelisted", + type: "bool", + }, + ], + name: "OraclePermissionsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "requester", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "authorized", + type: "bool", + }, + { + indexed: false, + internalType: "uint32", + name: "delay", + type: "uint32", + }, + ], + name: "RequesterPermissionsSet", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint128", + name: "paymentAmount", + type: "uint128", + }, + { + indexed: true, + internalType: "uint32", + name: "minSubmissionCount", + type: "uint32", + }, + { + indexed: true, + internalType: "uint32", + name: "maxSubmissionCount", + type: "uint32", + }, + { + indexed: false, + internalType: "uint32", + name: "restartDelay", + type: "uint32", + }, + { + indexed: false, + internalType: "uint32", + name: "timeout", + type: "uint32", + }, + ], + name: "RoundDetailsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "int256", + name: "submission", + type: "int256", + }, + { + indexed: true, + internalType: "uint32", + name: "round", + type: "uint32", + }, + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + ], + name: "SubmissionReceived", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previous", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "current", + type: "address", + }, + ], + name: "ValidatorUpdated", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + ], + name: "acceptAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "acceptOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "allocatedFunds", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "availableFunds", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "_removed", + type: "address[]", + }, + { + internalType: "address[]", + name: "_added", + type: "address[]", + }, + { + internalType: "address[]", + name: "_addedAdmins", + type: "address[]", + }, + { + internalType: "uint32", + name: "_minSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_maxSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_restartDelay", + type: "uint32", + }, + ], + name: "changeOracles", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "description", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + ], + name: "getAdmin", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + ], + name: "getAnswer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getOracles", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + ], + name: "getRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + ], + name: "getTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestAnswer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRound", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "linkToken", + outputs: [ + { + internalType: "contract LinkTokenInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxSubmissionCount", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxSubmissionValue", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minSubmissionCount", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minSubmissionValue", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "onTokenTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "oracleCount", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "uint32", + name: "_queriedRoundId", + type: "uint32", + }, + ], + name: "oracleRoundState", + outputs: [ + { + internalType: "bool", + name: "_eligibleToSubmit", + type: "bool", + }, + { + internalType: "uint32", + name: "_roundId", + type: "uint32", + }, + { + internalType: "int256", + name: "_latestSubmission", + type: "int256", + }, + { + internalType: "uint64", + name: "_startedAt", + type: "uint64", + }, + { + internalType: "uint64", + name: "_timeout", + type: "uint64", + }, + { + internalType: "uint128", + name: "_availableFunds", + type: "uint128", + }, + { + internalType: "uint8", + name: "_oracleCount", + type: "uint8", + }, + { + internalType: "uint128", + name: "_paymentAmount", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "paymentAmount", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "requestNewRound", + outputs: [ + { + internalType: "uint80", + name: "", + type: "uint80", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "restartDelay", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_requester", + type: "address", + }, + { + internalType: "bool", + name: "_authorized", + type: "bool", + }, + { + internalType: "uint32", + name: "_delay", + type: "uint32", + }, + ], + name: "setRequesterPermissions", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_newValidator", + type: "address", + }, + ], + name: "setValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + { + internalType: "int256", + name: "_submission", + type: "int256", + }, + ], + name: "submit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "timeout", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "address", + name: "_newAdmin", + type: "address", + }, + ], + name: "transferAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_to", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "updateAvailableFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint128", + name: "_paymentAmount", + type: "uint128", + }, + { + internalType: "uint32", + name: "_minSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_maxSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_restartDelay", + type: "uint32", + }, + { + internalType: "uint32", + name: "_timeout", + type: "uint32", + }, + ], + name: "updateFutureRounds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "validator", + outputs: [ + { + internalType: "contract AggregatorValidatorInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_recipient", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "withdrawFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "address", + name: "_recipient", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "withdrawPayment", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + ], + name: "withdrawablePayment", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +export const AccessControlledAggregatorByteCode = + "0x60c06040523480156200001157600080fd5b50604051620053523803806200535283398181016040526101008110156200003857600080fd5b815160208301516040808501516060860151608087015160a088015160c089015160e08a0180519651989a9799959894979396929591949391820192846401000000008211156200008857600080fd5b9083019060208201858111156200009e57600080fd5b8251640100000000811182820188101715620000b957600080fd5b82525081516020918201929091019080838360005b83811015620000e8578181015183820152602001620000ce565b50505050905090810190601f168015620001165780820380516001836020036101000a031916815260200191505b50604052505060008054336001600160a01b0319918216178255600280549091166001600160a01b038c1617905589915088908890889088908890889088906200016590889080808a62000244565b62000179856001600160e01b036200062216565b608084905260a08390526005805460ff191660ff84161790558051620001a790600690602084019062000806565b50620001c88663ffffffff1642620006ec60201b620034db1790919060201c565b6000805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6c80546001600160401b03929092166801000000000000000002600160401b600160801b03199092169190911790555050600e805460ff1916600117905550620008a89c50505050505050505050505050565b6000546001600160a01b03163314620002a4576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6000620002b96001600160e01b036200074f16565b60ff1690508463ffffffff168463ffffffff16101562000320576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff16101562000382576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff81161580620003a157508263ffffffff168163ffffffff16115b620003f3576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b620004106001600160801b0387166001600160e01b036200075616565b600d546001600160801b0316101562000470576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b6000620004856001600160e01b036200074f16565b60ff161115620004eb5760008563ffffffff1611620004eb576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b0316331462000682576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6003546001600160a01b039081169082168114620006e857600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b60008282111562000744576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600c545b90565b60006200074960026200078d620007756001600160e01b036200074f16565b60ff1685620007a160201b62003f6a1790919060201c565b620007a160201b62003f6a1790919060201c565b600082620007b25750600062000749565b82820282848281620007c057fe5b0414620007ff5760405162461bcd60e51b8152600401808060200182810382526021815260200180620053316021913960400191505060405180910390fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200084957805160ff191683800117855562000879565b8280016001018555821562000879579182015b82811115620008795782518255916020019190600101906200085c565b50620008879291506200088b565b5090565b6200075391905b8082111562000887576000815560010162000892565b60805160a051614a5b620008d660003980610c805280610f04525080610c0b5280611c045250614a5b6000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c806370dea79a11610167578063a4c0ed36116100ce578063d4cc54e411610087578063d4cc54e414610a25578063dc7f012414610a2d578063e2e4031714610a35578063e9ee6eeb14610a5b578063f2fde38b14610a89578063feaf968c14610aaf57610295565b8063a4c0ed361461092c578063b5ab58dc146109af578063b633620c146109cc578063c1075329146109e9578063c35905c614610a15578063c937450014610a1d57610295565b80638823da6c116101205780638823da6c146107b757806388aa80e7146107dd5780638da5cb5b1461086f57806398e5b12a146108775780639a6fc8f51461089e578063a118f2491461090657610295565b806370dea79a146107125780637284e4161461071a57806379ba5097146107975780637c2b0b211461079f5780638038e4a1146107a75780638205bf6a146107af57610295565b806340884c521161020b57806358609e44116101c457806358609e44146105e6578063613d8fcc146105ee578063628806ef146105f657806364efb22b1461061c578063668a0f02146106425780636b14daf81461064a57610295565b806340884c521461054a57806346fcff4c146105a25780634f8fc3b5146105c657806350d25bcd146105ce57806354fd4d50146105d657806357970e93146105de57610295565b8063313ce5671161025d578063313ce56714610341578063357ebb021461035f57806338aa4c72146103805780633969c20f146103ca5780633a5381b5146104f05780633d3d77141461051457610295565b80630a7569831461029a5780631327d3d8146102a4578063202ee0ed146102ca57806320ed0275146102ed57806323ca290314610327575b600080fd5b6102a2610ab7565b005b6102a2600480360360208110156102ba57600080fd5b50356001600160a01b0316610b45565b6102a2600480360360408110156102e057600080fd5b5080359060200135610bfb565b6102a26004803603606081101561030357600080fd5b5080356001600160a01b03169060208101351515906040013563ffffffff16610dcd565b61032f610f02565b60408051918252519081900360200190f35b610349610f26565b6040805160ff9092168252519081900360200190f35b610367610f2f565b6040805163ffffffff9092168252519081900360200190f35b6102a2600480360360a081101561039657600080fd5b506001600160801b038135169063ffffffff6020820135811691604081013582169160608201358116916080013516610f42565b6102a2600480360360c08110156103e057600080fd5b810190602081018135600160201b8111156103fa57600080fd5b82018360208201111561040c57600080fd5b803590602001918460208302840111600160201b8311171561042d57600080fd5b919390929091602081019035600160201b81111561044a57600080fd5b82018360208201111561045c57600080fd5b803590602001918460208302840111600160201b8311171561047d57600080fd5b919390929091602081019035600160201b81111561049a57600080fd5b8201836020820111156104ac57600080fd5b803590602001918460208302840111600160201b831117156104cd57600080fd5b919350915063ffffffff81358116916020810135821691604090910135166112e5565b6104f86114ad565b604080516001600160a01b039092168252519081900360200190f35b6102a26004803603606081101561052a57600080fd5b506001600160a01b038135811691602081013590911690604001356114bc565b6105526116af565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561058e578181015183820152602001610576565b505050509050019250505060405180910390f35b6105aa611712565b604080516001600160801b039092168252519081900360200190f35b6102a2611721565b61032f611838565b61032f6118c5565b6104f86118ca565b6103676118d9565b6103496118ec565b6102a26004803603602081101561060c57600080fd5b50356001600160a01b03166118f2565b6104f86004803603602081101561063257600080fd5b50356001600160a01b03166119d8565b61032f611a02565b6106fe6004803603604081101561066057600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460018302840111600160201b831117156106bd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611a8a945050505050565b604080519115158252519081900360200190f35b610367611ab2565b610722611ac5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561075c578181015183820152602001610744565b50505050905090810190601f1680156107895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102a2611b53565b61032f611c02565b6102a2611c26565b61032f611cb5565b6102a2600480360360208110156107cd57600080fd5b50356001600160a01b0316611d3d565b61080f600480360360408110156107f357600080fd5b5080356001600160a01b0316906020013563ffffffff16611e04565b60408051981515895263ffffffff9097166020890152878701959095526001600160401b0393841660608801529190921660808601526001600160801b0391821660a086015260ff1660c08501521660e083015251908190036101000190f35b6104f8611f64565b61087f611f73565b6040805169ffffffffffffffffffff9092168252519081900360200190f35b6108c7600480360360208110156108b457600080fd5b503569ffffffffffffffffffff16612092565b6040805169ffffffffffffffffffff96871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b6102a26004803603602081101561091c57600080fd5b50356001600160a01b0316612133565b6102a26004803603606081101561094257600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561097157600080fd5b82018360208201111561098357600080fd5b803590602001918460018302840111600160201b831117156109a457600080fd5b5090925090506121fb565b61032f600480360360208110156109c557600080fd5b503561225c565b61032f600480360360208110156109e257600080fd5b50356122e5565b6102a2600480360360408110156109ff57600080fd5b506001600160a01b03813516906020013561236e565b6105aa612510565b61036761251f565b6105aa612532565b6106fe612548565b61032f60048036036020811015610a4b57600080fd5b50356001600160a01b0316612551565b6102a260048036036040811015610a7157600080fd5b506001600160a01b0381358116916020013516612575565b6102a260048036036020811015610a9f57600080fd5b50356001600160a01b0316612658565b6108c76126f6565b6000546001600160a01b03163314610b04576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600e5460ff1615610b4357600e805460ff191690556040517f3be8a977a014527b50ae38adda80b56911c267328965c98ddc385d248f53963890600090a15b565b6000546001600160a01b03163314610b92576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6003546001600160a01b039081169082168114610bf757600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b6060610c073384612795565b90507f0000000000000000000000000000000000000000000000000000000000000000821215610c7e576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652062656c6f77206d696e5375626d697373696f6e56616c75650000604482015290519081900360640190fd5b7f0000000000000000000000000000000000000000000000000000000000000000821315610cf3576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652061626f7665206d61785375626d697373696f6e56616c75650000604482015290519081900360640190fd5b8051819015610d805760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d45578181015183820152602001610d2d565b50505050905090810190601f168015610d725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50610d8a83612a37565b610d948284612acc565b600080610da085612ba5565b91509150610dad85612cfd565b610db685612e40565b8115610dc657610dc68582612e9f565b5050505050565b6000546001600160a01b03163314610e1a576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6001600160a01b0383166000908152600b602052604090205460ff1615158215151415610e4657610efd565b8115610e89576001600160a01b0383166000908152600b60205260409020805460ff19168315151764ffffffff00191661010063ffffffff841602179055610eb2565b6001600160a01b0383166000908152600b60205260409020805468ffffffffffffffffff191690555b60408051831515815263ffffffff8316602082015281516001600160a01b038616927fc3df5a754e002718f2e10804b99e6605e7c701d95cec9552c7680ca2b6f2820a928290030190a25b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60055460ff1681565b600454600160c01b900463ffffffff1681565b6000546001600160a01b03163314610f8f576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6000610f996118ec565b60ff1690508463ffffffff168463ffffffff161015610fff576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff161015611060576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff8116158061107e57508263ffffffff168163ffffffff16115b6110cf576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b6110e1866001600160801b0316612f98565b600d546001600160801b03161015611140576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b600061114a6118ec565b60ff1611156111ae5760008563ffffffff16116111ae576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b03163314611332576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b60005b88811015611369576113618a8a8381811061134c57fe5b905060200201356001600160a01b0316612fc6565b600101611335565b508584146113be576040805162461bcd60e51b815260206004820181905260248201527f6e6565642073616d65206f7261636c6520616e642061646d696e20636f756e74604482015290519081900360640190fd5b604d6113db876113cc6118ec565b60ff169063ffffffff61319416565b1115611424576040805162461bcd60e51b81526020600482015260136024820152721b585e081bdc9858db195cc8185b1b1bddd959606a1b604482015290519081900360640190fd5b60005b868110156114775761146f88888381811061143e57fe5b905060200201356001600160a01b031687878481811061145a57fe5b905060200201356001600160a01b03166131dc565b600101611427565b506004546114a2906001600160801b03811690859085908590600160e01b900463ffffffff16610f42565b505050505050505050565b6003546001600160a01b031681565b6001600160a01b0383811660009081526008602052604090206002015462010000900416331461152c576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b03831660009081526008602052604090205481906001600160801b039081169082168110156115a9576040805162461bcd60e51b815260206004820152601f60248201527f696e73756666696369656e7420776974686472617761626c652066756e647300604482015290519081900360640190fd5b6115c26001600160801b0382168363ffffffff61346c16565b6001600160a01b038616600090815260086020526040902080546001600160801b0319166001600160801b03928316179055600d5461160a91600160801b909104168361346c565b600d80546001600160801b03928316600160801b029083161790556002546040805163a9059cbb60e01b81526001600160a01b03888116600483015293861660248201529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561167d57600080fd5b505af1158015611691573d6000803e3d6000fd5b505050506040513d60208110156116a757600080fd5b5051610dc657fe5b6060600c80548060200260200160405190810160405280929190818152602001828054801561170757602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116116e9575b505050505090505b90565b600d546001600160801b031690565b6117296148b4565b50604080518082018252600d546001600160801b038082168352600160801b90910416602080830182905260025484516370a0823160e01b8152306004820152945193946000946117da94936001600160a01b03909316926370a082319260248082019391829003018186803b1580156117a257600080fd5b505afa1580156117b6573d6000803e3d6000fd5b505050506040513d60208110156117cc57600080fd5b50519063ffffffff6134db16565b82519091506001600160801b03168114610bf757600d80546001600160801b0319166001600160801b03831617905560405181907ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f90600090a25050565b600061187b336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b6118b8576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6118c0613532565b905090565b600381565b6002546001600160a01b031681565b600454600160801b900463ffffffff1681565b600c5490565b6001600160a01b03818116600090815260086020526040902060030154163314611963576040805162461bcd60e51b815260206004820152601e60248201527f6f6e6c792063616c6c61626c652062792070656e64696e672061646d696e0000604482015290519081900360640190fd5b6001600160a01b0381166000818152600860205260408082206003810180546001600160a01b0319169055600201805462010000600160b01b031916336201000081029190911790915590519092917f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90491a350565b6001600160a01b03808216600090815260086020526040902060020154620100009004165b919050565b6000611a45336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b611a82576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6118c0613554565b6000611a968383613567565b80611aa957506001600160a01b03831632145b90505b92915050565b600454600160e01b900463ffffffff1681565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015611b4b5780601f10611b2057610100808354040283529160200191611b4b565b820191906000526020600020905b815481529060010190602001808311611b2e57829003601f168201915b505050505081565b6001546001600160a01b03163314611bab576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b03163314611c73576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600e5460ff16610b4357600e805460ff191660011790556040517faebf329500988c6488a0074e5a0a9ff304561fc5c6fc877aeb1d59c8282c348090600090a1565b6000611cf8336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b611d35576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6118c0613597565b6000546001600160a01b03163314611d8a576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152600f602052604090205460ff1615611e01576001600160a01b0381166000818152600f6020908152604091829020805460ff19169055815192835290517f3d68a6fce901d20453d1a7aa06bf3950302a735948037deb182a8db66df2a0d19281900390910190a15b50565b600080808080808080333214611e5a576040805162461bcd60e51b81526020600482015260166024820152756f66662d636861696e2072656164696e67206f6e6c7960501b604482015290519081900360640190fd5b63ffffffff891615611f3d5763ffffffff89166000908152600960209081526040808320600a909252909120611e908c8c6135cc565b6001600160a01b038d1660009081526008602052604090206001908101548482015491840154600d548f936001600160401b031691600160401b900463ffffffff16906001600160801b0316611ee46118ec565b60018901546001600160401b0316611f07576004546001600160801b0316611f1d565b6001880154600160601b90046001600160801b03165b8363ffffffff169350995099509950995099509950995099505050611f57565b611f468a613621565b975097509750975097509750975097505b9295985092959890939650565b6000546001600160a01b031681565b336000908152600b602052604081205460ff16611fd7576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617574686f72697a6564207265717565737465720000000000000000604482015290519081900360640190fd5b60075463ffffffff16600081815260096020526040902060010154600160401b90046001600160401b03161515806120135750612013816137ec565b612064576040805162461bcd60e51b815260206004820152601f60248201527f7072657620726f756e64206d75737420626520737570657273656461626c6500604482015290519081900360640190fd5b600061207b63ffffffff8084169060019061387716565b9050612086816138c8565b63ffffffff1691505090565b60008060008060006120db336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b612118576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61212186613996565b939a9299509097509550909350915050565b6000546001600160a01b03163314612180576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152600f602052604090205460ff16611e01576001600160a01b0381166000818152600f6020908152604091829020805460ff19166001179055815192835290517f87286ad1f399c8e82bf0c4ef4fcdc570ea2e1e92176e5c848b6413545b885db49281900390910190a150565b801561224e576040805162461bcd60e51b815260206004820181905260248201527f7472616e7366657220646f65736e2774206163636570742063616c6c64617461604482015290519081900360640190fd5b612256611721565b50505050565b600061229f336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b6122dc576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b611aac82613ad0565b6000612328336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b612365576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b611aac82613b04565b6000546001600160a01b031633146123bb576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600d546004546001600160801b039182169183916123ea916123dd9116612f98565b839063ffffffff6134db16565b101561243d576040805162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420726573657276652066756e6473000000000000604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561249357600080fd5b505af11580156124a7573d6000803e3d6000fd5b505050506040513d60208110156124bd57600080fd5b5051612508576040805162461bcd60e51b81526020600482015260156024820152741d1bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604482015290519081900360640190fd5b610efd611721565b6004546001600160801b031681565b600454600160a01b900463ffffffff1681565b600d54600160801b90046001600160801b031690565b600e5460ff1681565b6001600160a01b03166000908152600860205260409020546001600160801b031690565b6001600160a01b038281166000908152600860205260409020600201546201000090041633146125e5576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b0382811660008181526008602090815260409182902060030180546001600160a01b0319169486169485179055815133815290810193909352805191927fb79bf2e89c2d70dde91d2991fb1ea69b7e478061ad7c04ed5b02b96bc52b8104929081900390910190a25050565b6000546001600160a01b031633146126a5576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080600080600061273f336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b61277c576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b612784613b43565b945094509450945094509091929394565b6001600160a01b03821660009081526008602052604090205460075460609163ffffffff600160801b90910481169116816127fe57604051806040016040528060128152602001716e6f7420656e61626c6564206f7261636c6560701b81525092505050611aac565b8363ffffffff168263ffffffff16111561284a57604051806040016040528060168152602001756e6f742079657420656e61626c6564206f7261636c6560501b81525092505050611aac565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160a01b9092041610156128b9576040518060400160405280601881526020017f6e6f206c6f6e67657220616c6c6f776564206f7261636c65000000000000000081525092505050611aac565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160c01b9092041610612927576040518060400160405280602081526020017f63616e6e6f74207265706f7274206f6e2070726576696f757320726f756e647381525092505050611aac565b8063ffffffff168463ffffffff1614158015612963575061295363ffffffff8083169060019061387716565b63ffffffff168463ffffffff1614155b801561297657506129748482613b6c565b155b156129ba576040518060400160405280601781526020017f696e76616c696420726f756e6420746f207265706f727400000000000000000081525092505050611aac565b8363ffffffff166001141580156129eb57506129e96129e463ffffffff80871690600190613bcc16565b613c2f565b155b15612a2f576040518060400160405280601f81526020017f70726576696f757320726f756e64206e6f7420737570657273656461626c650081525092505050611aac565b505092915050565b612a4081613c69565b612a4957611e01565b3360009081526008602052604090205460045463ffffffff600160e01b909204821691600160c01b9091048116820190831611801590612a8857508015155b15612a935750611e01565b612a9c82613c9a565b50336000908152600860205260409020805463ffffffff8316600160e01b026001600160e01b0390911617905550565b612ad581613e4d565b612b26576040805162461bcd60e51b815260206004820152601f60248201527f726f756e64206e6f7420616363657074696e67207375626d697373696f6e7300604482015290519081900360640190fd5b63ffffffff81166000818152600a6020908152604080832080546001808201835591855283852001879055338085526008909352818420805463ffffffff60c01b1916600160c01b8702178155018690555190929185917f92e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68c9190a45050565b63ffffffff8082166000908152600a602052604081206001810154905491928392600160201b909204161115612be057506000905080612cf8565b63ffffffff83166000908152600a602090815260408083208054825181850281018501909352808352612c4693830182828015612c3c57602002820191906000526020600020905b815481526020019060010190808311612c28575b5050505050613e6d565b63ffffffff8516600081815260096020908152604091829020848155600101805467ffffffffffffffff60401b1916600160401b426001600160401b038116919091029190911763ffffffff60801b1916600160801b8602179091556007805467ffffffff000000001916600160201b860217905582519081529151939450919284927f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f928290030190a36001925090505b915091565b63ffffffff81166000908152600a6020526040902060010154600160601b90046001600160801b0316612d2e6148b4565b5060408051808201909152600d546001600160801b03808216808452600160801b909204166020830152612d68908363ffffffff61346c16565b6001600160801b0390811682526020820151612d8b91168363ffffffff613f1616565b6001600160801b0390811660208084018290528351600d8054600160801b9094029185166001600160801b03199094169390931784161790915533600090815260089091526040902054612de691168363ffffffff613f1616565b3360009081526008602052604080822080546001600160801b0319166001600160801b03948516179055835190519216917ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f9190a2505050565b63ffffffff8082166000908152600a602052604090206001810154905491161115612e6a57611e01565b63ffffffff81166000908152600a6020526040812090612e8a82826148cb565b5060010180546001600160e01b031916905550565b6003546001600160a01b031680612eb65750610bf7565b6000612ecd63ffffffff80861690600190613bcc16565b63ffffffff808216600090815260096020908152604080832060018101549054825163beed9b5160e01b8152600160801b90920486166004830181905260248301829052958b166044830152606482018a90529151959650939490936001600160a01b0388169363beed9b5193620186a093608480850194929391928390030190829088803b158015612f5f57600080fd5b5087f193505050508015612f8557506040513d6020811015612f8057600080fd5b505160015b612f8e57612f90565b505b505050505050565b6000611aac6002612fba612faa6118ec565b859060ff1663ffffffff613f6a16565b9063ffffffff613f6a16565b612fcf81613fc3565b613015576040805162461bcd60e51b81526020600482015260126024820152711bdc9858db19481b9bdd08195b98589b195960721b604482015290519081900360640190fd5b60075461302e9063ffffffff9081169060019061387716565b6001600160a01b0382166000908152600860205260408120805463ffffffff93909316600160a01b0263ffffffff60a01b1990931692909217909155600c61308860016130796118ec565b60ff169063ffffffff6134db16565b8154811061309257fe5b6000918252602080832091909101546001600160a01b0385811680855260089093526040808520600290810180549390941680875291862001805461ffff90931661ffff199384168117909155939094528154169055600c80549293509091839190839081106130fe57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600c80548061313757fe5b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038516907f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e908390a3505050565b600082820183811015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b6131e582613fc3565b15613230576040805162461bcd60e51b81526020600482015260166024820152751bdc9858db1948185b1c9958591e48195b98589b195960521b604482015290519081900360640190fd5b6001600160a01b038116613283576040805162461bcd60e51b8152602060048201526015602482015274063616e6e6f74207365742061646d696e20746f203605c1b604482015290519081900360640190fd5b6001600160a01b038281166000908152600860205260409020600201546201000090041615806132d857506001600160a01b038281166000908152600860205260409020600201546201000090048116908216145b613329576040805162461bcd60e51b815260206004820152601c60248201527f6f776e65722063616e6e6f74206f76657277726974652061646d696e00000000604482015290519081900360640190fd5b61333282613fee565b6001600160a01b03808416600081815260086020526040808220805463ffffffff60a01b1963ffffffff97909716600160801b0263ffffffff60801b19909116179590951663ffffffff60a01b178555600c80546002909601805461ffff90971661ffff19909716969096178655805460018181019092557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b031916851790558383528554948716620100000262010000600160b01b0319909516949094179094559251919290917f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e9190a3806001600160a01b0316826001600160a01b03167f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90460405160405180910390a35050565b6000826001600160801b0316826001600160801b031611156134d5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828211156134d5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b600754600160201b900463ffffffff1660009081526009602052604090205490565b600754600160201b900463ffffffff1690565b6001600160a01b0382166000908152600f602052604081205460ff1680611aa9575050600e5460ff161592915050565b600754600160201b900463ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031690565b63ffffffff81166000908152600960205260408120600101546001600160401b031615613617576135fc82613e4d565b8015613610575061360d8383612795565b51155b9050611aac565b6135fc8383614058565b6001600160a01b0381166000908152600860205260408120600754815483928392839283928392839283927fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b929091849163ffffffff908116600160c01b90920416148061369e575060075461369c9063ffffffff16613e4d565b155b6007549091506136b39063ffffffff16613c2f565b80156136bc5750805b15613715576007546136da9063ffffffff9081169060019061387716565b63ffffffff81166000908152600960205260409020600454919b506001600160801b039091169450925061370e8c8b614058565b9a5061375f565b60075463ffffffff166000818152600960209081526040808320600a90925290912060010154919b50600160601b9091046001600160801b03169450925061375c8a613e4d565b9a505b6137698c8b612795565b51156137745760009a505b6001808301548482015463ffffffff808e166000908152600a6020526040902090930154600d548f948f94936001600160401b031692600160401b900416906001600160801b03166137c46118ec565b8a8363ffffffff1693509a509a509a509a509a509a509a509a50505050919395975091939597565b63ffffffff8082166000908152600960209081526040808320600190810154600a909352908320015491926001600160401b0390911691600160401b9004168115801590613840575060008163ffffffff16115b801561386f5750426138646001600160401b03841663ffffffff808516906140a216565b6001600160401b0316105b949350505050565b600082820163ffffffff8085169082161015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b6138d181613c69565b6138da57611e01565b336000908152600b602052604090205463ffffffff6501000000000082048116916101009004811682019083161180613911575080155b613958576040805162461bcd60e51b81526020600482015260136024820152726d7573742064656c617920726571756573747360681b604482015290519081900360640190fd5b61396182613c9a565b50336000908152600b60205260409020805463ffffffff8316650100000000000268ffffffff00000000001990911617905550565b60008060008060006139a66148e9565b5063ffffffff8087166000908152600960209081526040918290208251608081018452815481526001909101546001600160401b0380821693830193909352600160401b810490921692810192909252600160801b90049091166060820181905215801590613a255750613a258769ffffffffffffffffffff166140f6565b6040518060400160405280600f81526020016e139bc819185d18481c1c995cd95b9d608a1b81525090613a995760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d45578181015183820152602001610d2d565b50805160208201516040830151606090930151989991986001600160401b0391821698509216955063ffffffff9091169350915050565b6000613adb826140f6565b15613afc575063ffffffff81166000908152600960205260409020546119fd565b506000919050565b6000613b0f826140f6565b15613afc575063ffffffff8116600090815260096020526040902060010154600160401b90046001600160401b03166119fd565b6000806000806000612784600760049054906101000a900463ffffffff1663ffffffff16612092565b60008163ffffffff16613b8f60018563ffffffff1661387790919063ffffffff16565b63ffffffff16148015611aa957505063ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031615919050565b60008263ffffffff168263ffffffff1611156134d5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b63ffffffff8116600090815260096020526040812060010154600160401b90046001600160401b0316151580611aac5750611aac826137ec565b600754600090613c859063ffffffff9081169060019061387716565b63ffffffff168263ffffffff16149050919050565b613cb7613cb263ffffffff80841690600190613bcc16565b614100565b6007805463ffffffff191663ffffffff8316179055613cd4614910565b5060408051600060a0820181815260c083018452825260045463ffffffff600160801b82048116602080860191909152600160a01b8304821685870152600160e01b8304821660608601526001600160801b03909216608085015285168252600a81529290208151805192938493613d4f928492019061493e565b5060208281015160019283018054604080870151606088015160809098015163ffffffff1990931663ffffffff9586161767ffffffff000000001916600160201b91861691909102176bffffffff00000000000000001916600160401b97851697909702969096176fffffffffffffffffffffffffffffffff60601b1916600160601b6001600160801b03909216919091021790558516600081815260098352849020909201805467ffffffffffffffff1916426001600160401b039081169190911791829055845191168152925133937f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac6027192908290030190a35050565b63ffffffff9081166000908152600a602052604090206001015416151590565b60008151600010613ebe576040805162461bcd60e51b81526020600482015260166024820152756c697374206d757374206e6f7420626520656d70747960501b604482015290519081900360640190fd5b81516002810460018216613efd57600080613ee38660006001870360018703876141c2565b9092509050613ef282826142a0565b9450505050506119fd565b613f0d846000600185038461430e565b925050506119fd565b60008282016001600160801b038085169082161015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b600082613f7957506000611aac565b82820282848281613f8657fe5b0414611aa95760405162461bcd60e51b81526004018080602001828103825260218152602001806149e56021913960400191505060405180910390fd5b6001600160a01b031660009081526008602052604090205463ffffffff600160a01b90910481161490565b60075460009063ffffffff16801580159061403057506001600160a01b03831660009081526008602052604090205463ffffffff828116600160a01b90920416145b1561403c5790506119fd565b61405163ffffffff8083169060019061387716565b9392505050565b6001600160a01b03821660009081526008602052604081205460045463ffffffff600160e01b909204821691600160c01b90910481168201908416118061386f5750159392505050565b60008282016001600160401b038085169082161015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b63ffffffff101590565b614109816137ec565b61411257611e01565b600061412963ffffffff80841690600190613bcc16565b63ffffffff8181166000908152600960209081526040808320805488861685528285209081556001918201549101805463ffffffff60801b1916600160801b928390049096169091029490941767ffffffffffffffff60401b1916600160401b426001600160401b03160217909355600a90529081209192506141ac82826148cb565b5060010180546001600160e01b03191690555050565b6000808284106141d157600080fd5b8386111580156141e15750848411155b6141ea57600080fd5b8286111580156141fa5750848311155b61420357600080fd5b600786860310156142245761421b878787878761439f565b91509150614296565b6000614231888888614772565b905080841161424257809550614290565b8481101561425557806001019650614290565b80851115801561426457508381105b61426a57fe5b6142768888838861430e565b92506142878882600101888761430e565b91506142969050565b50614203565b9550959350505050565b600080831280156142b15750600082135b806142c757506000831380156142c75750600082125b156142e75760026142d8848461484f565b816142df57fe5b059050611aac565b600060028085078185070105905061386f614308600286056002860561484f565b8261484f565b60008184111561431d57600080fd5b8282111561432a57600080fd5b82841015614381576007848403101561435657600061434c868686868761439f565b50915061386f9050565b6000614363868686614772565b90508083116143745780935061437b565b8060010194505b5061432a565b84848151811061438d57fe5b60200260200101519050949350505050565b6000806000868660010103905060008888600001815181106143bd57fe5b602002602001015190506000826001106143de576001600160ff1b036143f6565b8989600101815181106143ed57fe5b60200260200101515b905060008360021061440f576001600160ff1b03614427565b8a8a6002018151811061441e57fe5b60200260200101515b9050600084600310614440576001600160ff1b03614458565b8b8b6003018151811061444f57fe5b60200260200101515b9050600085600410614471576001600160ff1b03614489565b8c8c6004018151811061448057fe5b60200260200101515b90506000866005106144a2576001600160ff1b036144ba565b8d8d600501815181106144b157fe5b60200260200101515b90506000876006106144d3576001600160ff1b036144eb565b8e8e600601815181106144e257fe5b60200260200101515b9050858713156144f9579495945b83851315614505579293925b81831315614511579091905b8487131561451d579395935b83861315614529579294925b8083131561453357915b8486131561453f579394935b8082131561454957905b82871315614555579195915b81861315614561579094905b8085131561456b57935b82861315614577579194915b8084131561458157925b8285131561458d579193915b81841315614599579092905b828413156145a5579192915b8d8c03806145b557879a5061465b565b80600114156145c657869a5061465b565b80600214156145d757859a5061465b565b80600314156145e857849a5061465b565b80600414156145f957839a5061465b565b806005141561460a57829a5061465b565b806006141561461b57819a5061465b565b6040805162461bcd60e51b815260206004820152601060248201526f6b31206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b8e8c038d8d141561467957508a995061429698505050505050505050565b806146905750969850614296975050505050505050565b80600114156146ab5750959850614296975050505050505050565b80600214156146c65750949850614296975050505050505050565b80600314156146e15750939850614296975050505050505050565b80600414156146fc5750929850614296975050505050505050565b80600514156147175750919850614296975050505050505050565b80600614156147325750909850614296975050505050505050565b6040805162461bcd60e51b815260206004820152601060248201526f6b32206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b600080846002858501048151811061478657fe5b602002602001015190506001840393506001830192505b600184019350808585815181106147b057fe5b60200260200101511261479d575b600183039250808584815181106147d157fe5b6020026020010151136147be5782841015614841578483815181106147f257fe5b602002602001015185858151811061480657fe5b602002602001015186868151811061481a57fe5b6020026020010187868151811061482d57fe5b60209081029190910101919091525261484a565b82915050614051565b61479d565b60008282018183128015906148645750838112155b80614879575060008312801561487957508381125b611aa95760405162461bcd60e51b81526004018080602001828103825260218152602001806149a46021913960400191505060405180910390fd5b604080518082019091526000808252602082015290565b5080546000825590600052602060002090810190611e019190614989565b60408051608081018252600080825260208201819052918101829052606081019190915290565b6040805160a08101825260608082526000602083018190529282018390528101829052608081019190915290565b828054828255906000526020600020908101928215614979579160200282015b8281111561497957825182559160200191906001019061495e565b50614985929150614989565b5090565b61170f91905b80821115614985576000815560010161498f56fe5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f77536166654d6174683a206164646974696f6e206f766572666c6f770000000000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f6e6c792063616c6c61626c65206279206f776e657200000000000000000000a2646970667358221220adbe637a18154d5b9bb2754ed3c4577d8d26d4f0111ea8aa5549703dec6e796e64736f6c63430006050033536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77"; +export const AccessControlledAggregatorABI = [ + { + inputs: [ + { + internalType: "address", + name: "_link", + type: "address", + }, + { + internalType: "uint128", + name: "_paymentAmount", + type: "uint128", + }, + { + internalType: "uint32", + name: "_timeout", + type: "uint32", + }, + { + internalType: "address", + name: "_validator", + type: "address", + }, + { + internalType: "int256", + name: "_minSubmissionValue", + type: "int256", + }, + { + internalType: "int256", + name: "_maxSubmissionValue", + type: "int256", + }, + { + internalType: "uint8", + name: "_decimals", + type: "uint8", + }, + { + internalType: "string", + name: "_description", + type: "string", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + ], + name: "AddedAccess", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "int256", + name: "current", + type: "int256", + }, + { + indexed: true, + internalType: "uint256", + name: "roundId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + ], + name: "AnswerUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "AvailableFundsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "CheckAccessDisabled", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "CheckAccessEnabled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "roundId", + type: "uint256", + }, + { + indexed: true, + internalType: "address", + name: "startedBy", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + ], + name: "NewRound", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "admin", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address", + }, + ], + name: "OracleAdminUpdateRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newAdmin", + type: "address", + }, + ], + name: "OracleAdminUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + { + indexed: true, + internalType: "bool", + name: "whitelisted", + type: "bool", + }, + ], + name: "OraclePermissionsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + ], + name: "RemovedAccess", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "requester", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "authorized", + type: "bool", + }, + { + indexed: false, + internalType: "uint32", + name: "delay", + type: "uint32", + }, + ], + name: "RequesterPermissionsSet", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint128", + name: "paymentAmount", + type: "uint128", + }, + { + indexed: true, + internalType: "uint32", + name: "minSubmissionCount", + type: "uint32", + }, + { + indexed: true, + internalType: "uint32", + name: "maxSubmissionCount", + type: "uint32", + }, + { + indexed: false, + internalType: "uint32", + name: "restartDelay", + type: "uint32", + }, + { + indexed: false, + internalType: "uint32", + name: "timeout", + type: "uint32", + }, + ], + name: "RoundDetailsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "int256", + name: "submission", + type: "int256", + }, + { + indexed: true, + internalType: "uint32", + name: "round", + type: "uint32", + }, + { + indexed: true, + internalType: "address", + name: "oracle", + type: "address", + }, + ], + name: "SubmissionReceived", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previous", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "current", + type: "address", + }, + ], + name: "ValidatorUpdated", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + ], + name: "acceptAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "acceptOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address", + }, + ], + name: "addAccess", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "allocatedFunds", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "availableFunds", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "_removed", + type: "address[]", + }, + { + internalType: "address[]", + name: "_added", + type: "address[]", + }, + { + internalType: "address[]", + name: "_addedAdmins", + type: "address[]", + }, + { + internalType: "uint32", + name: "_minSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_maxSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_restartDelay", + type: "uint32", + }, + ], + name: "changeOracles", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "checkEnabled", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "description", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "disableAccessCheck", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "enableAccessCheck", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + ], + name: "getAdmin", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + ], + name: "getAnswer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getOracles", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + ], + name: "getRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + ], + name: "getTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address", + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes", + }, + ], + name: "hasAccess", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestAnswer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRound", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "linkToken", + outputs: [ + { + internalType: "contract LinkTokenInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxSubmissionCount", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxSubmissionValue", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minSubmissionCount", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minSubmissionValue", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "onTokenTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "oracleCount", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "uint32", + name: "_queriedRoundId", + type: "uint32", + }, + ], + name: "oracleRoundState", + outputs: [ + { + internalType: "bool", + name: "_eligibleToSubmit", + type: "bool", + }, + { + internalType: "uint32", + name: "_roundId", + type: "uint32", + }, + { + internalType: "int256", + name: "_latestSubmission", + type: "int256", + }, + { + internalType: "uint64", + name: "_startedAt", + type: "uint64", + }, + { + internalType: "uint64", + name: "_timeout", + type: "uint64", + }, + { + internalType: "uint128", + name: "_availableFunds", + type: "uint128", + }, + { + internalType: "uint8", + name: "_oracleCount", + type: "uint8", + }, + { + internalType: "uint128", + name: "_paymentAmount", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "paymentAmount", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address", + }, + ], + name: "removeAccess", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "requestNewRound", + outputs: [ + { + internalType: "uint80", + name: "", + type: "uint80", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "restartDelay", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_requester", + type: "address", + }, + { + internalType: "bool", + name: "_authorized", + type: "bool", + }, + { + internalType: "uint32", + name: "_delay", + type: "uint32", + }, + ], + name: "setRequesterPermissions", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_newValidator", + type: "address", + }, + ], + name: "setValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + { + internalType: "int256", + name: "_submission", + type: "int256", + }, + ], + name: "submit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "timeout", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "address", + name: "_newAdmin", + type: "address", + }, + ], + name: "transferAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_to", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "updateAvailableFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint128", + name: "_paymentAmount", + type: "uint128", + }, + { + internalType: "uint32", + name: "_minSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_maxSubmissions", + type: "uint32", + }, + { + internalType: "uint32", + name: "_restartDelay", + type: "uint32", + }, + { + internalType: "uint32", + name: "_timeout", + type: "uint32", + }, + ], + name: "updateFutureRounds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "validator", + outputs: [ + { + internalType: "contract AggregatorValidatorInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_recipient", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "withdrawFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "address", + name: "_recipient", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "withdrawPayment", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + ], + name: "withdrawablePayment", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +export const EACAggregatorProxyByteCode = + "0x608060405234801561001057600080fd5b5060405162001d0638038062001d068339818101604052604081101561003557600080fd5b508051602090910151600080546001600160a01b0319163317905581610063816001600160e01b0361007d16565b50610076816001600160e01b036100ec16565b505061016d565b60028054604080518082018252600161ffff80851691909101168082526001600160a01b0395909516602091820181905261ffff19909316851762010000600160b01b0319166201000084021790935560009384526004909252912080546001600160a01b0319169091179055565b6000546001600160a01b0316331461014b576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611b89806200017d6000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80638f6b4d91116100c3578063bc43cbaf1161007c578063bc43cbaf1461038a578063c159730414610392578063e8c4be30146103b3578063f2fde38b146103bb578063f8a2abd3146103e1578063feaf968c146104075761014d565b80638f6b4d91146102d657806392eefe9b146102de5780639a6fc8f514610304578063a928c0961461032a578063b5ab58dc14610350578063b633620c1461036d5761014d565b80636001ac53116101155780636001ac53146101d5578063668a0f02146102375780637284e4161461023f57806379ba5097146102bc5780638205bf6a146102c65780638da5cb5b146102ce5761014d565b8063245a7bfc14610152578063313ce5671461017657806350d25bcd1461019457806354fd4d50146101ae57806358303b10146101b6575b600080fd5b61015a61040f565b604080516001600160a01b039092168252519081900360200190f35b61017e610424565b6040805160ff9092168252519081900360200190f35b61019c6104a8565b60408051918252519081900360200190f35b61019c6105b0565b6101be610603565b6040805161ffff9092168252519081900360200190f35b6101fb600480360360208110156101eb57600080fd5b50356001600160501b031661060d565b604080516001600160501b0396871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b61019c610776565b610247610878565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610281578181015183820152602001610269565b50505050905090810190601f1680156102ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c46109bd565b005b61019c610a6c565b61015a610b6e565b6101fb610b7d565b6102c4600480360360208110156102f457600080fd5b50356001600160a01b0316610ce4565b6101fb6004803603602081101561031a57600080fd5b50356001600160501b0316610d5e565b6102c46004803603602081101561034057600080fd5b50356001600160a01b0316610e69565b61019c6004803603602081101561036657600080fd5b5035610f3f565b61019c6004803603602081101561038357600080fd5b5035611049565b61015a61114c565b61015a600480360360208110156103a857600080fd5b503561ffff1661115b565b61015a611176565b6102c4600480360360208110156103d157600080fd5b50356001600160a01b0316611185565b6102c4600480360360208110156103f757600080fd5b50356001600160a01b031661122e565b6101fb6112a8565b6002546201000090046001600160a01b031690565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b505afa15801561048b573d6000803e3d6000fd5b505050506040513d60208110156104a157600080fd5b5051905090565b6005546000906001600160a01b0316801580610565575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561053857600080fd5b505afa15801561054c573d6000803e3d6000fd5b505050506040513d602081101561056257600080fd5b50515b6105a2576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105aa6113b2565b91505090565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b60025461ffff1690565b60055460009081908190819081906001600160a01b03168015806106d2575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b1580156106a557600080fd5b505afa1580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b50515b61070f576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6003546001600160a01b031661075a576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b61076387611405565b939b929a50909850965090945092505050565b6005546000906001600160a01b0316801580610833575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561080657600080fd5b505afa15801561081a573d6000803e3d6000fd5b505050506040513d602081101561083057600080fd5b50515b610870576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105aa611502565b6060600260000160029054906101000a90046001600160a01b03166001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b1580156108cb57600080fd5b505afa1580156108df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561090857600080fd5b810190808051604051939291908464010000000082111561092857600080fd5b90830190602082018581111561093d57600080fd5b825164010000000081118282018810171561095757600080fd5b82525081516020918201929091019080838360005b8381101561098457818101518382015260200161096c565b50505050905090810190601f1680156109b15780820380516001836020036101000a031916815260200191505b50604052505050905090565b6001546001600160a01b03163314610a15576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6005546000906001600160a01b0316801580610b29575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610afc57600080fd5b505afa158015610b10573d6000803e3d6000fd5b505050506040513d6020811015610b2657600080fd5b50515b610b66576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105aa6115b0565b6000546001600160a01b031681565b60055460009081908190819081906001600160a01b0316801580610c42575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610c1557600080fd5b505afa158015610c29573d6000803e3d6000fd5b505050506040513d6020811015610c3f57600080fd5b50515b610c7f576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6003546001600160a01b0316610cca576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b610cd2611603565b95509550955095509550509091929394565b6000546001600160a01b03163314610d3c576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60055460009081908190819081906001600160a01b0316801580610e23575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610df657600080fd5b505afa158015610e0a573d6000803e3d6000fd5b505050506040513d6020811015610e2057600080fd5b50515b610e60576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610763876116f9565b6000546001600160a01b03163314610ec1576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6003546001600160a01b03828116911614610f23576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c69642070726f706f7365642061676772656761746f720000000000604482015290519081900360640190fd5b600380546001600160a01b0319169055610f3c816117f5565b50565b6005546000906001600160a01b0316801580610ffc575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610fcf57600080fd5b505afa158015610fe3573d6000803e3d6000fd5b505050506040513d6020811015610ff957600080fd5b50515b611039576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61104283611864565b9392505050565b6005546000906001600160a01b0316801580611106575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b1580156110d957600080fd5b505afa1580156110ed573d6000803e3d6000fd5b505050506040513d602081101561110357600080fd5b50515b611143576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61104283611941565b6005546001600160a01b031681565b6004602052600090815260409020546001600160a01b031681565b6003546001600160a01b031681565b6000546001600160a01b031633146111dd576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6000546001600160a01b03163314611286576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60055460009081908190819081906001600160a01b031680158061136d575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561134057600080fd5b505afa158015611354573d6000803e3d6000fd5b505050506040513d602081101561136a57600080fd5b50515b6113aa576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610cd26119e7565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b60035460009081908190819081906001600160a01b031661145b576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b60035460408051639a6fc8f560e01b81526001600160501b038916600482015290516001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b1580156114af57600080fd5b505afa1580156114c3573d6000803e3d6000fd5b505050506040513d60a08110156114d957600080fd5b508051602082015160408301516060840151608090940151929a91995097509195509350915050565b600061150c611b1c565b5060408051808201825260025461ffff8116808352620100009091046001600160a01b031660208084018290528451633345078160e11b8152945193946115a19463668a0f0292600480840193919291829003018186803b15801561157057600080fd5b505afa158015611584573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b5051611abe565b6001600160501b031691505090565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b0316638205bf6a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b60035460009081908190819081906001600160a01b0316611659576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156116a757600080fd5b505afa1580156116bb573d6000803e3d6000fd5b505050506040513d60a08110156116d157600080fd5b5080516020820151604083015160608401516080909401519299919850965091945092509050565b6000806000806000806000611716886001600160501b0316611ade565b61ffff8216600090815260046020819052604091829020548251639a6fc8f560e01b815267ffffffffffffffff85169281019290925291519395509193506001600160a01b031691639a6fc8f59160248082019260a092909190829003018186803b15801561178457600080fd5b505afa158015611798573d6000803e3d6000fd5b505050506040513d60a08110156117ae57600080fd5b508051602082015160408301516060840151608090940151929a50909850965090945092506117e1878787878787611ae6565b939c929b5090995097509095509350505050565b60028054604080518082018252600161ffff80851691909101168082526001600160a01b0395909516602091820181905261ffff19909316851762010000600160b01b0319166201000084021790935560009384526004909252912080546001600160a01b0319169091179055565b60006001600160501b0382111561187d5750600061193c565b60008061188984611ade565b61ffff821660009081526004602052604090205491935091506001600160a01b0316806118bc576000935050505061193c565b806001600160a01b031663b5ab58dc836040518263ffffffff1660e01b8152600401808267ffffffffffffffff16815260200191505060206040518083038186803b15801561190a57600080fd5b505afa15801561191e573d6000803e3d6000fd5b505050506040513d602081101561193457600080fd5b505193505050505b919050565b60006001600160501b0382111561195a5750600061193c565b60008061196684611ade565b61ffff821660009081526004602052604090205491935091506001600160a01b031680611999576000935050505061193c565b806001600160a01b031663b633620c836040518263ffffffff1660e01b8152600401808267ffffffffffffffff16815260200191505060206040518083038186803b15801561190a57600080fd5b60008060008060006119f7611b1c565b5060408051808201825260025461ffff811682526201000090046001600160a01b0316602082018190528251633fabe5a360e21b815292519192909163feaf968c9160048082019260a092909190829003018186803b158015611a5957600080fd5b505afa158015611a6d573d6000803e3d6000fd5b505050506040513d60a0811015611a8357600080fd5b5080516020820151604083015160608401516080909401518551939a509198509650919450909250610cd29087908790879087908790611ae6565b67ffffffffffffffff1660409190911b69ffff0000000000000000161790565b604081901c91565b6000806000806000611af8868c611abe565b8a8a8a611b058a8c611abe565b939f929e50909c509a509098509650505050505050565b60408051808201909152600080825260208201529056fe4e6f2070726f706f7365642061676772656761746f722070726573656e740000a2646970667358221220660c1d21c40a09a3e59afd423b6352da87c5862bdce313c2da1d582fcd2655fa64736f6c63430006050033"; +export const EACAggregatorProxyABI = [ + { + inputs: [ + { + internalType: "address", + name: "_aggregator", + type: "address", + }, + { + internalType: "address", + name: "_accessController", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "int256", + name: "current", + type: "int256", + }, + { + indexed: true, + internalType: "uint256", + name: "roundId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + ], + name: "AnswerUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "roundId", + type: "uint256", + }, + { + indexed: true, + internalType: "address", + name: "startedBy", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + ], + name: "NewRound", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "acceptOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "accessController", + outputs: [ + { + internalType: "contract AccessControllerInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "aggregator", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_aggregator", + type: "address", + }, + ], + name: "confirmAggregator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "description", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + ], + name: "getAnswer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + ], + name: "getRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + ], + name: "getTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestAnswer", + outputs: [ + { + internalType: "int256", + name: "", + type: "int256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRound", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "latestTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint16", + name: "", + type: "uint16", + }, + ], + name: "phaseAggregators", + outputs: [ + { + internalType: "contract AggregatorV2V3Interface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "phaseId", + outputs: [ + { + internalType: "uint16", + name: "", + type: "uint16", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_aggregator", + type: "address", + }, + ], + name: "proposeAggregator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "proposedAggregator", + outputs: [ + { + internalType: "contract AggregatorV2V3Interface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint80", + name: "_roundId", + type: "uint80", + }, + ], + name: "proposedGetRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "proposedLatestRoundData", + outputs: [ + { + internalType: "uint80", + name: "roundId", + type: "uint80", + }, + { + internalType: "int256", + name: "answer", + type: "int256", + }, + { + internalType: "uint256", + name: "startedAt", + type: "uint256", + }, + { + internalType: "uint256", + name: "updatedAt", + type: "uint256", + }, + { + internalType: "uint80", + name: "answeredInRound", + type: "uint80", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_accessController", + type: "address", + }, + ], + name: "setController", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_to", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +export const WriteAccessControllerByteCode = + "0x608060405234801561001057600080fd5b50600080546001600160a01b031916331790556001805460ff60a01b1916600160a01b1790556106ee806100456000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638823da6c116100665780638823da6c1461017c5780638da5cb5b146101a2578063a118f249146101c6578063dc7f0124146101ec578063f2fde38b146101f457610093565b80630a756983146100985780636b14daf8146100a257806379ba50971461016c5780638038e4a114610174575b600080fd5b6100a061021a565b005b610158600480360360408110156100b857600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100e357600080fd5b8201836020820111156100f557600080fd5b8035906020019184600183028401116401000000008311171561011757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102bd945050505050565b604080519115158252519081900360200190f35b6100a06102f5565b6100a06103a4565b6100a06004803603602081101561019257600080fd5b50356001600160a01b031661044b565b6101aa61051d565b604080516001600160a01b039092168252519081900360200190f35b6100a0600480360360208110156101dc57600080fd5b50356001600160a01b031661052c565b6101586105ff565b6100a06004803603602081101561020a57600080fd5b50356001600160a01b031661060f565b6000546001600160a01b03163314610272576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600154600160a01b900460ff16156102bb576001805460ff60a01b191690556040517f3be8a977a014527b50ae38adda80b56911c267328965c98ddc385d248f53963890600090a15b565b6001600160a01b03821660009081526002602052604081205460ff16806102ee5750600154600160a01b900460ff16155b9392505050565b6001546001600160a01b0316331461034d576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6000546001600160a01b031633146103fc576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600154600160a01b900460ff166102bb576001805460ff60a01b1916600160a01b1790556040517faebf329500988c6488a0074e5a0a9ff304561fc5c6fc877aeb1d59c8282c348090600090a1565b6000546001600160a01b031633146104a3576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161561051a576001600160a01b038116600081815260026020908152604091829020805460ff19169055815192835290517f3d68a6fce901d20453d1a7aa06bf3950302a735948037deb182a8db66df2a0d19281900390910190a15b50565b6000546001600160a01b031681565b6000546001600160a01b03163314610584576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff1661051a576001600160a01b038116600081815260026020908152604091829020805460ff19166001179055815192835290517f87286ad1f399c8e82bf0c4ef4fcdc570ea2e1e92176e5c848b6413545b885db49281900390910190a150565b600154600160a01b900460ff1681565b6000546001600160a01b03163314610667576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a35056fea264697066735822122059998b07b9fd02348799dd40e9f8ee7cb93de830b92715d68b41e1993b35698664736f6c63430006050033"; +export const WriteAccessControllerABI = [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + ], + name: "AddedAccess", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "CheckAccessDisabled", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "CheckAccessEnabled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + ], + name: "RemovedAccess", + type: "event", + }, + { + inputs: [], + name: "acceptOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_user", type: "address" }], + name: "addAccess", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "checkEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "disableAccessCheck", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "enableAccessCheck", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_user", type: "address" }, + { internalType: "bytes", name: "", type: "bytes" }, + ], + name: "hasAccess", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_user", type: "address" }], + name: "removeAccess", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_to", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; + +export const FlagsByteCode = + "0x608060405234801561001057600080fd5b506040516110833803806110838339818101604052602081101561003357600080fd5b5051600080546001600160a01b031916331790556001805460ff60a01b1916600160a01b17905561006c816001600160e01b0361007216565b5061013a565b6000546001600160a01b031633146100d1576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6003546001600160a01b03908116908216811461013657600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fbaf9ea078655a4fffefd08f9435677bbc91e457a6d015fe7de1d0e68b8802cac90600090a35b5050565b610f3a806101496000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80637d723cac11610097578063a118f24911610066578063a118f2491461041f578063d74af26314610445578063dc7f01241461046b578063f2fde38b1461047357610100565b80637d723cac1461032b5780638038e4a1146103e95780638823da6c146103f15780638da5cb5b1461041757610100565b8063517e89fe116100d3578063517e89fe146101db5780636b14daf814610201578063760bc82d146102b557806379ba50971461032357610100565b80630a75698314610105578063282865961461010f5780632e1d859c1461017d578063357e47fe146101a1575b600080fd5b61010d610499565b005b61010d6004803603602081101561012557600080fd5b810190602081018135600160201b81111561013f57600080fd5b82018360208201111561015157600080fd5b803590602001918460208302840111600160201b8311171561017257600080fd5b509092509050610531565b61018561061b565b604080516001600160a01b039092168252519081900360200190f35b6101c7600480360360208110156101b757600080fd5b50356001600160a01b031661062a565b604080519115158252519081900360200190f35b61010d600480360360208110156101f157600080fd5b50356001600160a01b03166106c9565b6101c76004803603604081101561021757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561024157600080fd5b82018360208201111561025357600080fd5b803590602001918460018302840111600160201b8311171561027457600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061077f945050505050565b61010d600480360360208110156102cb57600080fd5b810190602081018135600160201b8111156102e557600080fd5b8201836020820111156102f757600080fd5b803590602001918460208302840111600160201b8311171561031857600080fd5b5090925090506107a5565b61010d610835565b6103996004803603602081101561034157600080fd5b810190602081018135600160201b81111561035b57600080fd5b82018360208201111561036d57600080fd5b803590602001918460208302840111600160201b8311171561038e57600080fd5b5090925090506108e4565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103d55781810151838201526020016103bd565b505050509050019250505060405180910390f35b61010d610a2f565b61010d6004803603602081101561040757600080fd5b50356001600160a01b0316610acb565b610185610b92565b61010d6004803603602081101561043557600080fd5b50356001600160a01b0316610ba1565b61010d6004803603602081101561045b57600080fd5b50356001600160a01b0316610c69565b6101c7610ccb565b61010d6004803603602081101561048957600080fd5b50356001600160a01b0316610cdb565b6000546001600160a01b031633146104e6576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b600154600160a01b900460ff161561052f576001805460ff60a01b191690556040517f3be8a977a014527b50ae38adda80b56911c267328965c98ddc385d248f53963890600090a15b565b6000546001600160a01b0316331461057e576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b60005b8181101561061657600083838381811061059757fe5b602090810292909201356001600160a01b0316600081815260049093526040909220549192505060ff161561060d576001600160a01b038116600081815260046020526040808220805460ff19169055517fd86728e2e5cbaa28c1d357b5fbccc9c1ab0add09950eb7cac42df9acb24c4bc89190a25b50600101610581565b505050565b6003546001600160a01b031681565b600061066d336000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061077f92505050565b6106aa576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b506001600160a01b031660009081526004602052604090205460ff1690565b6000546001600160a01b03163314610716576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b6003546001600160a01b03908116908216811461077b57600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fbaf9ea078655a4fffefd08f9435677bbc91e457a6d015fe7de1d0e68b8802cac90600090a35b5050565b600061078b8383610d79565b8061079e57506001600160a01b03831632145b9392505050565b6107ad610db0565b6107fe576040805162461bcd60e51b815260206004820152601a60248201527f4e6f7420616c6c6f77656420746f20726169736520666c616773000000000000604482015290519081900360640190fd5b60005b818110156106165761082d83838381811061081857fe5b905060200201356001600160a01b0316610e78565b600101610801565b6001546001600160a01b0316331461088d576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6060610927336000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061077f92505050565b610964576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b60608267ffffffffffffffff8111801561097d57600080fd5b506040519080825280602002602001820160405280156109a7578160200160208202803683370190505b50905060005b83811015610a2757600460008686848181106109c557fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff16828281518110610a0f57fe5b911515602092830291909101909101526001016109ad565b509392505050565b6000546001600160a01b03163314610a7c576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b600154600160a01b900460ff1661052f576001805460ff60a01b1916600160a01b1790556040517faebf329500988c6488a0074e5a0a9ff304561fc5c6fc877aeb1d59c8282c348090600090a1565b6000546001600160a01b03163314610b18576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff1615610b8f576001600160a01b038116600081815260026020908152604091829020805460ff19169055815192835290517f3d68a6fce901d20453d1a7aa06bf3950302a735948037deb182a8db66df2a0d19281900390910190a15b50565b6000546001600160a01b031681565b6000546001600160a01b03163314610bee576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16610b8f576001600160a01b038116600081815260026020908152604091829020805460ff19166001179055815192835290517f87286ad1f399c8e82bf0c4ef4fcdc570ea2e1e92176e5c848b6413545b885db49281900390910190a150565b610c71610db0565b610cc2576040805162461bcd60e51b815260206004820152601a60248201527f4e6f7420616c6c6f77656420746f20726169736520666c616773000000000000604482015290519081900360640190fd5b610b8f81610e78565b600154600160a01b900460ff1681565b6000546001600160a01b03163314610d28576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6001600160a01b03821660009081526002602052604081205460ff168061079e575050600154600160a01b900460ff161592915050565b600080546001600160a01b0316331480610e73575060035460408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b0390951694636b14daf894929360009391929190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610e4657600080fd5b505afa158015610e5a573d6000803e3d6000fd5b505050506040513d6020811015610e7057600080fd5b50515b905090565b6001600160a01b03811660009081526004602052604090205460ff16610b8f576001600160a01b038116600081815260046020526040808220805460ff19166001179055517f881febd4cd194dd4ace637642862aef1fb59a65c7e5551a5d9208f268d11c0069190a25056fe4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000a2646970667358221220c8c9690e43178ab9f5c0b8787595506fa81d810eae23e7476ac23fa3e268d98e64736f6c63430006050033"; +export const FlagsABI = [ + { + inputs: [{ internalType: "address", name: "racAddress", type: "address" }], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + ], + name: "AddedAccess", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "CheckAccessDisabled", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "CheckAccessEnabled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "subject", + type: "address", + }, + ], + name: "FlagLowered", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "subject", + type: "address", + }, + ], + name: "FlagRaised", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previous", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "current", + type: "address", + }, + ], + name: "RaisingAccessControllerUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + ], + name: "RemovedAccess", + type: "event", + }, + { + inputs: [], + name: "acceptOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_user", type: "address" }], + name: "addAccess", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "checkEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "disableAccessCheck", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "enableAccessCheck", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "subject", type: "address" }], + name: "getFlag", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "subjects", type: "address[]" }, + ], + name: "getFlags", + outputs: [{ internalType: "bool[]", name: "", type: "bool[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_user", type: "address" }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes", + }, + ], + name: "hasAccess", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "subjects", type: "address[]" }, + ], + name: "lowerFlags", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "subject", type: "address" }], + name: "raiseFlag", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "subjects", type: "address[]" }, + ], + name: "raiseFlags", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "raisingAccessController", + outputs: [ + { + internalType: "contract AccessControllerInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_user", type: "address" }], + name: "removeAccess", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "racAddress", type: "address" }], + name: "setRaisingAccessController", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_to", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; + +export const DeviationFlaggingValidatorByteCode = + "0x608060405234801561001057600080fd5b506040516109be3803806109be8339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b03191633179055610060826001600160e01b0361007916565b610072816001600160e01b0361014116565b5050610215565b6000546001600160a01b031633146100d8576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6002546001600160a01b03908116908216811461013d57600280546001600160a01b0319166001600160a01b0384811691821790925560405190918316907f900aa01828592ab069e4d44e7a36c70ebd476e35f567c7db6a691e503b8029d890600090a35b5050565b6000546001600160a01b031633146101a0576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b600154600160a01b900463ffffffff81169062ffffff83811691161461013d576001805463ffffffff60a01b191662ffffff848116600160a01b81029290921790925560405190918316907f985b87e809fd5992ec257eac36f25777ce308055dd9249a0182123d7b5d6633a90600090a35050565b61079a806102246000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063eed8a1de11610066578063eed8a1de1461013d578063f19876951461015f578063f2c0ea9214610185578063f2fde38b1461018d578063ffd93670146101b35761009e565b80630910ce4a146100a357806364cc4aa5146100c457806379ba5097146100e85780638da5cb5b146100f2578063beed9b51146100fa575b600080fd5b6100ab6101e2565b6040805163ffffffff9092168252519081900360200190f35b6100cc6101f5565b604080516001600160a01b039092168252519081900360200190f35b6100f0610204565b005b6100cc6102b3565b6101296004803603608081101561011057600080fd5b50803590602081013590604081013590606001356102c2565b604080519115158252519081900360200190f35b6100f06004803603602081101561015357600080fd5b503562ffffff1661034d565b6100f06004803603602081101561017557600080fd5b50356001600160a01b031661041b565b6100ab6104db565b6100f0600480360360208110156101a357600080fd5b50356001600160a01b03166104e2565b610129600480360360808110156101c957600080fd5b508035906020810135906040810135906060013561058b565b600154600160a01b900463ffffffff1681565b6002546001600160a01b031681565b6001546001600160a01b0316331461025c576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6000546001600160a01b031681565b60006102d08585858561058b565b610341576002546040805163d74af26360e01b815233600482015290516001600160a01b039092169163d74af2639160248082019260009290919082900301818387803b15801561032057600080fd5b505af1158015610334573d6000803e3d6000fd5b5050505060009050610345565b5060015b949350505050565b6000546001600160a01b031633146103a5576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600154600160a01b900463ffffffff81169062ffffff838116911614610417576001805463ffffffff60a01b191662ffffff848116600160a01b81029290921790925560405190918316907f985b87e809fd5992ec257eac36f25777ce308055dd9249a0182123d7b5d6633a90600090a35b5050565b6000546001600160a01b03163314610473576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6002546001600160a01b03908116908216811461041757600280546001600160a01b0319166001600160a01b0384811691821790925560405190918316907f900aa01828592ab069e4d44e7a36c70ebd476e35f567c7db6a691e503b8029d890600090a35050565b620186a081565b6000546001600160a01b0316331461053a576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60008361059a57506001610345565b6000806105ad868563ffffffff61063616565b90925090506000806105c284620186a0610681565b90925090506000806105da848b63ffffffff6106d916565b915091506000806105ea84610728565b915091508680156105f85750845b80156106015750825b801561060a5750805b80156106255750600154600160a01b900463ffffffff168211155b9d9c50505050505050505050505050565b600080828403818412801561064b5750848113155b8061066157506000841215801561066157508481135b1561067357506000915081905061067a565b9150600190505b9250929050565b60008083610695575060009050600161067a565b836000191480156106a95750600160ff1b83145b156106b95750600090508061067a565b838302838582816106c657fe5b051461067357506000915081905061067a565b600080826106ec5750600090508061067a565b826000191480156107005750600160ff1b84145b156107105750600090508061067a565b600083858161071b57fe5b0595600195509350505050565b6000806000831261073e5750819050600161075f565b600160ff1b8314156107555750600090508061075f565b5050600081900360015b91509156fea2646970667358221220638e67a73b124d57864726f9c892db65957043b890b8cc7b1ec604abde16d29064736f6c63430006050033"; +export const DeviationFlaggingValidatorABI = [ + { + inputs: [ + { + internalType: "address", + name: "_flags", + type: "address", + }, + { + internalType: "uint24", + name: "_flaggingThreshold", + type: "uint24", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint24", + name: "previous", + type: "uint24", + }, + { + indexed: true, + internalType: "uint24", + name: "current", + type: "uint24", + }, + ], + name: "FlaggingThresholdUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previous", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "current", + type: "address", + }, + ], + name: "FlagsAddressUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "THRESHOLD_MULTIPLIER", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "acceptOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "flaggingThreshold", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "flags", + outputs: [ + { + internalType: "contract FlagsInterface", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "int256", + name: "_previousAnswer", + type: "int256", + }, + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "int256", + name: "_answer", + type: "int256", + }, + ], + name: "isValid", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint24", + name: "_flaggingThreshold", + type: "uint24", + }, + ], + name: "setFlaggingThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_flags", + type: "address", + }, + ], + name: "setFlagsAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_to", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_previousRoundId", + type: "uint256", + }, + { + internalType: "int256", + name: "_previousAnswer", + type: "int256", + }, + { + internalType: "uint256", + name: "_roundId", + type: "uint256", + }, + { + internalType: "int256", + name: "_answer", + type: "int256", + }, + ], + name: "validate", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +]; + +export const PriceQueryBytecode = + "0x6080604052600160045534801561001557600080fd5b50604051610f83380380610f838339818101604052606081101561003857600080fd5b508051602082015160409092015190919061005b836001600160e01b0361007816565b61006d826001600160e01b0361009a16565b600655506100bc9050565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b610eb8806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80635591a6081161005b5780635591a608146100f05780638dc654a2146101385780639d1b464a14610140578063e8d5359d1461015a5761007d565b8063042f2b651461008257806339a287d6146100a757806350f65a30146100d3575b600080fd5b6100a56004803603604081101561009857600080fd5b5080359060200135610186565b005b6100a5600480360360408110156100bd57600080fd5b50803590602001356001600160a01b0316610254565b6100a5600480360360208110156100e957600080fd5b503561035d565b6100a5600480360360a081101561010657600080fd5b506001600160a01b03813516906020810135906040810135906001600160e01b0319606082013516906080013561036a565b6100a56103f3565b61014861053d565b60408051918252519081900360200190f35b6100a56004803603604081101561017057600080fd5b506001600160a01b038135169060200135610543565b60008281526005602052604090205482906001600160a01b031633146101dd5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e5b6028913960400191505060405180910390fd5b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a2604051829084907f0c2366233f634048c0f0458060d1228fab36d00f7c0ecf6bdf2d9c458503631190600090a35060075550565b61025c610da8565b600654610271908363042f2b6560e01b610551565b90506102b96040518060400160405280600381526020016219d95d60ea1b815250604051806060016040528060408152602001610e1b6040913983919063ffffffff61057c16565b604080516001808252818301909252606091816020015b60608152602001906001900390816102d0579050509050604051806040016040528060038152602001621554d160ea1b8152508160008151811061031057fe5b602002602001018190525061034c604051806040016040528060048152602001630e0c2e8d60e31b81525082846105ab9092919063ffffffff16565b6103568285610619565b5050505050565b6103678130610254565b50565b60408051636ee4d55360e01b815260048101869052602481018590526001600160e01b03198416604482015260648101839052905186916001600160a01b03831691636ee4d5539160848082019260009290919082900301818387803b1580156103d357600080fd5b505af11580156103e7573d6000803e3d6000fd5b50505050505050505050565b60006103fd61063c565b604080516370a0823160e01b815230600482015290519192506001600160a01b0383169163a9059cbb91339184916370a08231916024808301926020929190829003018186803b15801561045057600080fd5b505afa158015610464573d6000803e3d6000fd5b505050506040513d602081101561047a57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b1580156104cb57600080fd5b505af11580156104df573d6000803e3d6000fd5b505050506040513d60208110156104f557600080fd5b5051610367576040805162461bcd60e51b81526020600482015260126024820152712ab730b13632903a37903a3930b739b332b960711b604482015290519081900360640190fd5b60075481565b61054d828261064b565b5050565b610559610da8565b610561610da8565b6105738186868663ffffffff6106e616565b95945050505050565b6080830151610591908363ffffffff61072316565b60808301516105a6908263ffffffff61072316565b505050565b60808301516105c0908363ffffffff61072316565b6105cd8360800151610740565b60005b815181101561060b576106038282815181106105e857fe5b6020026020010151856080015161072390919063ffffffff16565b6001016105d0565b506105a6836080015161074b565b600354600090610633906001600160a01b03168484610756565b90505b92915050565b6002546001600160a01b031690565b60008181526005602052604090205481906001600160a01b0316156106b7576040805162461bcd60e51b815260206004820152601a60248201527f5265717565737420697320616c72656164792070656e64696e67000000000000604482015290519081900360640190fd5b50600090815260056020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6106ee610da8565b6106fe856080015161010061092d565b50509183526001600160a01b031660208301526001600160e01b031916604082015290565b6107308260038351610967565b6105a6828263ffffffff610a7716565b610367816004610a91565b610367816007610a91565b6004546040805130606090811b60208084019190915260348084018690528451808503909101815260549093018452825192810192909220908601939093526000838152600590915281812080546001600160a01b0319166001600160a01b038816179055905182917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af991a26002546001600160a01b0316634000aea085846107fe87610aac565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610868578181015183820152602001610850565b50505050905090810190601f1680156108955780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156108b657600080fd5b505af11580156108ca573d6000803e3d6000fd5b505050506040513d60208110156108e057600080fd5b505161091d5760405162461bcd60e51b8152600401808060200182810382526023815260200180610df86023913960400191505060405180910390fd5b6004805460010190559392505050565b610935610ddd565b602082061561094a5760208206602003820191505b506020828101829052604080518085526000815290920101905290565b6017811161098e576109888360e0600585901b16831763ffffffff610bec16565b506105a6565b60ff81116109c4576109b1836018611fe0600586901b161763ffffffff610bec16565b506109888382600163ffffffff610c0416565b61ffff81116109fb576109e8836019611fe0600586901b161763ffffffff610bec16565b506109888382600263ffffffff610c0416565b63ffffffff8111610a3457610a2183601a611fe0600586901b161763ffffffff610bec16565b506109888382600463ffffffff610c0416565b67ffffffffffffffff81116105a657610a5e83601b611fe0600586901b161763ffffffff610bec16565b50610a718382600863ffffffff610c0416565b50505050565b610a7f610ddd565b61063383846000015151848551610c25565b6105a682601f611fe0600585901b161763ffffffff610bec16565b6060634042994660e01b6000808460000151856020015186604001518760600151600189608001516000015160405160240180896001600160a01b03166001600160a01b03168152602001888152602001878152602001866001600160a01b03166001600160a01b03168152602001856001600160e01b0319166001600160e01b031916815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610b7a578181015183820152602001610b62565b50505050905090810190601f168015610ba75780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909d169c909c17909b5250989950505050505050505050919050565b610bf4610ddd565b6106338384600001515184610cd1565b610c0c610ddd565b610c1d848560000151518585610d1c565b949350505050565b610c2d610ddd565b8251821115610c3b57600080fd5b84602001518285011115610c6557610c6585610c5d8760200151878601610d7a565b600202610d91565b600080865180518760208301019350808887011115610c845787860182525b505050602084015b60208410610cab5780518252601f199093019260209182019101610c8c565b51815160001960208690036101000a019081169019919091161790525083949350505050565b610cd9610ddd565b83602001518310610cf557610cf5848560200151600202610d91565b835180516020858301018481535080851415610d12576001810182525b5093949350505050565b610d24610ddd565b84602001518483011115610d4157610d4185858401600202610d91565b60006001836101000a039050855183868201018583198251161781525080518487011115610d6f5783860181525b509495945050505050565b600081831115610d8b575081610636565b50919050565b8151610d9d838361092d565b50610a718382610a77565b6040805160a081018252600080825260208201819052918101829052606081019190915260808101610dd8610ddd565b905290565b60405180604001604052806060815260200160008152509056fe756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261636c6568747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d444f434b267473796d733d555344536f75726365206d75737420626520746865206f7261636c65206f66207468652072657175657374a2646970667358221220ce8ae44d9a449cd38a5357ce261afb19ea4dbfc887cc655dd667b0f4b276871464736f6c63430006050033"; +export const PriceQueryABI = [ + { + inputs: [ + { + internalType: "address", + name: "_link", + type: "address", + }, + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "bytes32", + name: "_specId", + type: "bytes32", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "id", + type: "bytes32", + }, + ], + name: "ChainlinkCancelled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "id", + type: "bytes32", + }, + ], + name: "ChainlinkFulfilled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "id", + type: "bytes32", + }, + ], + name: "ChainlinkRequested", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "requestId", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "price", + type: "bytes32", + }, + ], + name: "RequestFulfilled", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "bytes32", + name: "_requestId", + type: "bytes32", + }, + ], + name: "addExternalRequest", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_oracle", + type: "address", + }, + { + internalType: "bytes32", + name: "_requestId", + type: "bytes32", + }, + { + internalType: "uint256", + name: "_payment", + type: "uint256", + }, + { + internalType: "bytes4", + name: "_callbackFunctionId", + type: "bytes4", + }, + { + internalType: "uint256", + name: "_expiration", + type: "uint256", + }, + ], + name: "cancelRequest", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "currentPrice", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_requestId", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "_price", + type: "bytes32", + }, + ], + name: "fulfill", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_payment", + type: "uint256", + }, + { + internalType: "address", + name: "_callback", + type: "address", + }, + ], + name: "requestDockUSDByCallback", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_payment", + type: "uint256", + }, + ], + name: "requestDockUSDPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "withdrawLink", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/packages/dock-blockchain-api/scripts/eth/chainlink/deviation-flag-validator.js b/packages/dock-blockchain-api/scripts/eth/chainlink/deviation-flag-validator.js new file mode 100644 index 000000000..b4312a3c7 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/deviation-flag-validator.js @@ -0,0 +1,62 @@ +import { + deployContract, + getTestEVMAccountsFromWeb3, + getWeb3, + sendEVMTxn, +} from "../helpers"; +import { + WriteAccessControllerByteCode, + WriteAccessControllerABI, + FlagsByteCode, + DeviationFlaggingValidatorByteCode, +} from "./bytecodes-and-abis"; + +async function main() { + const web3 = getWeb3(); + + const [alice] = getTestEVMAccountsFromWeb3(web3); + + console.log( + "Deploying WriteAccessController contract to track who can raise flags" + ); + const wacAddr = await deployContract( + web3, + alice, + WriteAccessControllerByteCode + ); + const wacContract = new web3.eth.Contract(WriteAccessControllerABI, wacAddr); + + console.log( + "Deploying Flags contract which will allow validator to raise flags" + ); + const flagsInitBytecode = + FlagsByteCode + + web3.eth.abi.encodeParameters(["address"], [wacAddr]).slice(2); + const flagsAddr = await deployContract(web3, alice, flagsInitBytecode); + + console.log( + "Deploying DeviationFlaggingValidator contract to raise a flag on deviation above threshold" + ); + // Setting the value of 100,000 is equivalent to tolerating a 100% change compared to the previous price. + const flaggingThreshold = 10000; // 10% + const validatorInitBytecode = + DeviationFlaggingValidatorByteCode + + web3.eth.abi + .encodeParameters(["address", "uint24"], [flagsAddr, flaggingThreshold]) + .slice(2); + const validatorAddr = await deployContract( + web3, + alice, + validatorInitBytecode + ); + await sendEVMTxn( + web3, + alice, + wacAddr, + wacContract.methods.addAccess(validatorAddr).encodeABI() + ); +} + +main().catch((err) => { + console.log("Error", err); +}); diff --git a/packages/dock-blockchain-api/scripts/eth/chainlink/flux-aggegator.js b/packages/dock-blockchain-api/scripts/eth/chainlink/flux-aggegator.js new file mode 100644 index 000000000..c1f32d422 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/flux-aggegator.js @@ -0,0 +1,121 @@ +// Script used by Chainlink to deploy its FluxAggregator contract. + +import { + FluxAggregatorABI, + FluxAggregatorByteCode, +} from "./bytecodes-and-abis"; + +import { + deployContract, + endowEVMAddressWithDefault, + getTestEVMAccountsFromWeb3, + getWeb3, + sendEVMTxn, +} from "../helpers"; +import { addOracles, fund } from "./helpers"; + +async function deploy( + web3, + signer, + linkTokenAddr, + paymentAmount, + timeout, + validator, + minSubmissionValue, + maxSubmissionValue, + decimals, + description +) { + console.log("Deploying FluxAggregator"); + const argsABI = web3.eth.abi.encodeParameters( + [ + "address", + "uint128", + "uint32", + "address", + "int256", + "int256", + "uint8", + "string", + ], + [ + linkTokenAddr, + paymentAmount, + timeout, + validator, + minSubmissionValue, + maxSubmissionValue, + decimals, + description, + ] + ); + const contractBytecode = FluxAggregatorByteCode + argsABI.slice(2); + + return deployContract(web3, signer, contractBytecode); +} + +async function main() { + const web3 = getWeb3(); + + const [alice, bob, carol] = getTestEVMAccountsFromWeb3(web3); + await endowEVMAddressWithDefault(alice.address); + await endowEVMAddressWithDefault(bob.address); + await endowEVMAddressWithDefault(carol.address); + + // Link token contract address + const linkTokenAddr = "0x8cB6497CDB9D44E168C076B414e4a675ebCC8683"; + const paymentAmount = 10; + const timeout = 2100; + const validator = "0x0000000000000000000000000000000000000000"; + const minSubmissionValue = 0; + const maxSubmissionValue = 1000; + const decimals = 3; + const description = "FluxAggregator for Dock USD price feed"; + + const contractAddr = await deploy( + web3, + alice, + linkTokenAddr, + paymentAmount, + timeout, + validator, + minSubmissionValue, + maxSubmissionValue, + decimals, + description + ); + + const contract = new web3.eth.Contract(FluxAggregatorABI, contractAddr); + console.log(`Oracles: ${await contract.methods.getOracles().call()}`); + + // Fund the aggregator + await fund(web3, alice, linkTokenAddr, contractAddr, contract); + + // Add 2 oracles + await addOracles(web3, alice, contractAddr, contract, bob, carol); + + console.log("Latest round data"); + console.log(await contract.methods.latestRoundData().call()); + + console.log("Round state for Bob"); + console.log(await contract.methods.oracleRoundState(bob.address, 0).call()); + + // Oracle's round state above should decide the round number + const submitCall1 = contract.methods.submit(1, 40).encodeABI(); + await sendEVMTxn(web3, bob, contractAddr, submitCall1); + + console.log("Round state for Carol"); + console.log(await contract.methods.oracleRoundState(carol.address, 0).call()); + + // Oracle's round state above should decide the round number + const submitCall2 = contract.methods.submit(1, 90).encodeABI(); + await sendEVMTxn(web3, carol, contractAddr, submitCall2); + + console.log("Latest round data"); + console.log(await contract.methods.latestRoundData().call()); + process.exit(0); +} + +main().catch((err) => { + console.log("Error", err); +}); diff --git a/packages/dock-blockchain-api/scripts/eth/chainlink/helpers.js b/packages/dock-blockchain-api/scripts/eth/chainlink/helpers.js new file mode 100644 index 000000000..3437791aa --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/helpers.js @@ -0,0 +1,64 @@ +import { getTokenBalance, sendEVMTxn, sendTokens } from "../helpers"; +import { LinkTokenABI } from "./bytecodes-and-abis"; + +export async function fund( + web3, + signer, + linkTokenAddr, + contractAddr, + contract +) { + // Send Link to Aggregator + console.log( + `Aggregator's token balance: ${await getTokenBalance( + web3, + linkTokenAddr, + LinkTokenABI, + contractAddr + )}` + ); + await sendTokens( + web3, + signer, + linkTokenAddr, + LinkTokenABI, + contractAddr, + web3.utils.toBN(1000000) + ); + console.log( + `Aggregator's token balance: ${await getTokenBalance( + web3, + linkTokenAddr, + LinkTokenABI, + contractAddr + )}` + ); + + // Let Aggregator update its state to reflect the transferred ether + const updateFundsCode = contract.methods.updateAvailableFunds().encodeABI(); + await sendEVMTxn(web3, signer, contractAddr, updateFundsCode); +} + +export async function addOracles( + web3, + signer, + contractAddr, + contract, + oracle1, + oracle2 +) { + // Add oracles + // Keeping the admin same as oracle node as its an example + + const addOracle1Code = contract.methods + .changeOracles([], [oracle1.address], [oracle1.address], 1, 1, 0) + .encodeABI(); + await sendEVMTxn(web3, signer, contractAddr, addOracle1Code); + console.log(`Oracles: ${await contract.methods.getOracles().call()}`); + + const addOracle2Code = contract.methods + .changeOracles([], [oracle2.address], [oracle2.address], 1, 2, 0) + .encodeABI(); + await sendEVMTxn(web3, signer, contractAddr, addOracle2Code); + console.log(`Oracles: ${await contract.methods.getOracles().call()}`); +} diff --git a/packages/dock-blockchain-api/scripts/eth/chainlink/link-token.js b/packages/dock-blockchain-api/scripts/eth/chainlink/link-token.js new file mode 100644 index 000000000..fb48cf1b5 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/link-token.js @@ -0,0 +1,85 @@ +import { LinkTokenABI, LinkTokenByteCode } from "./bytecodes-and-abis"; + +import { + deployContract, + endowEVMAddressWithDefault, + getTestEVMAccountsFromWeb3, + getTokenBalance, + getWeb3, + sendTokens, +} from "../helpers"; + +async function main() { + const web3 = getWeb3(); + + const [alice, bob] = getTestEVMAccountsFromWeb3(web3); + await endowEVMAddressWithDefault(alice.address); + await endowEVMAddressWithDefault(bob.address); + + console.log(`Generated accounts ${alice.address}, ${bob.address}`); + + const decimals = web3.utils.toBN(18); + const amount = web3.utils.toBN(100); + const value = amount.mul(web3.utils.toBN(10).pow(decimals)); + + console.log( + `Alice's balance using web3 ${await web3.eth.getBalance(alice.address)}` + ); + + const contractAddr = await deployContract(web3, alice, LinkTokenByteCode); + + console.log( + `Alice's balance using web3 ${await web3.eth.getBalance(alice.address)}` + ); + console.log( + `Alice's ERC-20 token balance ${await getTokenBalance( + web3, + contractAddr, + LinkTokenABI, + alice.address + )}` + ); + console.log( + `Bob's ERC-20 token balance ${await getTokenBalance( + web3, + contractAddr, + LinkTokenABI, + bob.address + )}` + ); + + const receipt = await sendTokens( + web3, + alice, + contractAddr, + LinkTokenABI, + bob.address, + value + ); + console.log(receipt); + + console.log( + `Alice's balance using web3 ${await web3.eth.getBalance(alice.address)}` + ); + console.log( + `Alice's ERC-20 token balance ${await getTokenBalance( + web3, + contractAddr, + LinkTokenABI, + alice.address + )}` + ); + console.log( + `Bob's ERC-20 token balance ${await getTokenBalance( + web3, + contractAddr, + LinkTokenABI, + bob.address + )}` + ); + process.exit(0); +} + +main().catch((err) => { + console.log("Error", err); +}); diff --git a/scripts/eth/chainlink/oracle.js b/packages/dock-blockchain-api/scripts/eth/chainlink/oracle.js similarity index 58% rename from scripts/eth/chainlink/oracle.js rename to packages/dock-blockchain-api/scripts/eth/chainlink/oracle.js index cd33c63b3..f6e884941 100644 --- a/scripts/eth/chainlink/oracle.js +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/oracle.js @@ -1,8 +1,12 @@ // Script used by an Oracle to deploy its contract. -import { OracleABI, OracleByteCode } from './bytecodes-and-abis'; +import { OracleABI, OracleByteCode } from "./bytecodes-and-abis"; -import { deployContract, getTestEVMAccountsFromWeb3, getWeb3 } from '../helpers'; +import { + deployContract, + getTestEVMAccountsFromWeb3, + getWeb3, +} from "../helpers"; async function main() { const web3 = getWeb3(); @@ -10,18 +14,18 @@ async function main() { const [, bob] = getTestEVMAccountsFromWeb3(web3); // Assumes Link token is deployed and address is known. - const linkTokenAddr = '0x8cB6497CDB9D44E168C076B414e4a675ebCC8683'; + const linkTokenAddr = "0x8cB6497CDB9D44E168C076B414e4a675ebCC8683"; // Oracle contract takes Link token address as constructor argument. - const argsABI = web3.eth.abi.encodeParameters(['address'], [linkTokenAddr]); + const argsABI = web3.eth.abi.encodeParameters(["address"], [linkTokenAddr]); const contractBytecode = OracleByteCode + argsABI.slice(2); const contractAddr = await deployContract(web3, bob, contractBytecode); const contract = new web3.eth.Contract(OracleABI, contractAddr); - console.log((await contract.methods.getChainlinkToken().call())); + console.log(await contract.methods.getChainlinkToken().call()); } main().catch((err) => { - console.log('Error', err); + console.log("Error", err); }); diff --git a/scripts/eth/chainlink/price-request.test.js b/packages/dock-blockchain-api/scripts/eth/chainlink/price-request.test.js similarity index 66% rename from scripts/eth/chainlink/price-request.test.js rename to packages/dock-blockchain-api/scripts/eth/chainlink/price-request.test.js index 0bb0316e9..6c89557a6 100644 --- a/scripts/eth/chainlink/price-request.test.js +++ b/packages/dock-blockchain-api/scripts/eth/chainlink/price-request.test.js @@ -1,18 +1,18 @@ -import Web3 from 'web3'; -import { LinkTokenABI, PriceQueryABI } from './bytecodes-and-abis'; -import { getTestEVMAccountsFromWeb3, getTokenBalance } from '../helpers'; +import Web3 from "web3"; +import { LinkTokenABI, PriceQueryABI } from "./bytecodes-and-abis"; +import { getTestEVMAccountsFromWeb3, getTokenBalance } from "../helpers"; -const getRevertReason = require('eth-revert-reason'); +const getRevertReason = require("eth-revert-reason"); const { FullNodeEndpoint } = process.env; -const web3 = new Web3('http://127.0.0.1:9933'); +const web3 = new Web3("http://127.0.0.1:9933"); async function main() { const [alice, bob] = getTestEVMAccountsFromWeb3(web3); - const tokenAddr = '0x8cB6497CDB9D44E168C076B414e4a675ebCC8683'; - const oracleAddr = '0x69e5C78dAa79E5BbBe4dF6B269d77AfBC351aC90'; + const tokenAddr = "0x8cB6497CDB9D44E168C076B414e4a675ebCC8683"; + const oracleAddr = "0x69e5C78dAa79E5BbBe4dF6B269d77AfBC351aC90"; /* const argsABI = web3.eth.abi.encodeParameters(['address', 'address', 'bytes32'], [tokenAddr, oracleAddr, '0x11111111111111111111111111111111']); const createTransaction = await alice.signTransaction( @@ -31,30 +31,35 @@ async function main() { const contractAddr = createReceipt.contractAddress; */ // const contractAddr = '0xBeDC65895cB3B5D3B4A3263b01d21FB4f6EdE5d1'; - const contractAddr = '0x51De21C1F5d17CE544529a31850981e1278EDfba'; + const contractAddr = "0x51De21C1F5d17CE544529a31850981e1278EDfba"; const contract = new web3.eth.Contract(PriceQueryABI, contractAddr); - console.log((await contract.methods.currentPrice().call())); + console.log(await contract.methods.currentPrice().call()); // await sendTokens(web3, bob, tokenAddr, LinkTokenABI, contractAddr, web3.utils.toBN(100)); // let oracleContract = new web3.eth.Contract(OracleABI, oracleAddr); // console.log((await oracleContract.methods.getChainlinkToken().call())); - console.log(`Bob's balance ${(await getTokenBalance(web3, tokenAddr, LinkTokenABI, bob.address))}`); - const payment = web3.utils.toWei('.00000000000000001', 'ether'); + console.log( + `Bob's balance ${await getTokenBalance( + web3, + tokenAddr, + LinkTokenABI, + bob.address + )}` + ); + const payment = web3.utils.toWei(".00000000000000001", "ether"); console.log(payment); const encoded = contract.methods.requestDockUSDPrice(payment).encodeABI(); - const txn = await bob.signTransaction( - { - to: contractAddr, - data: encoded, - value: '0x00', - gasPrice: '0x01', - gas: '0x1000000', - }, - ); + const txn = await bob.signTransaction({ + to: contractAddr, + data: encoded, + value: "0x00", + gasPrice: "0x01", + gas: "0x1000000", + }); const txnReceipt = await web3.eth.sendSignedTransaction(txn.rawTransaction); console.log(`Txn executed (H: ${txnReceipt.transactionHash})`); @@ -68,5 +73,5 @@ async function main() { } main().catch((err) => { - console.log('Error', err); + console.log("Error", err); }); diff --git a/scripts/eth/dao/ACL.sol b/packages/dock-blockchain-api/scripts/eth/dao/ACL.sol similarity index 100% rename from scripts/eth/dao/ACL.sol rename to packages/dock-blockchain-api/scripts/eth/dao/ACL.sol diff --git a/scripts/eth/dao/Counter.sol b/packages/dock-blockchain-api/scripts/eth/dao/Counter.sol similarity index 100% rename from scripts/eth/dao/Counter.sol rename to packages/dock-blockchain-api/scripts/eth/dao/Counter.sol diff --git a/scripts/eth/dao/DAOFactory.sol b/packages/dock-blockchain-api/scripts/eth/dao/DAOFactory.sol similarity index 100% rename from scripts/eth/dao/DAOFactory.sol rename to packages/dock-blockchain-api/scripts/eth/dao/DAOFactory.sol diff --git a/scripts/eth/dao/EVMScriptRegistryFactory.sol b/packages/dock-blockchain-api/scripts/eth/dao/EVMScriptRegistryFactory.sol similarity index 100% rename from scripts/eth/dao/EVMScriptRegistryFactory.sol rename to packages/dock-blockchain-api/scripts/eth/dao/EVMScriptRegistryFactory.sol diff --git a/scripts/eth/dao/Kernel.sol b/packages/dock-blockchain-api/scripts/eth/dao/Kernel.sol similarity index 100% rename from scripts/eth/dao/Kernel.sol rename to packages/dock-blockchain-api/scripts/eth/dao/Kernel.sol diff --git a/scripts/eth/dao/VotingAppAragon.sol b/packages/dock-blockchain-api/scripts/eth/dao/VotingAppAragon.sol similarity index 100% rename from scripts/eth/dao/VotingAppAragon.sol rename to packages/dock-blockchain-api/scripts/eth/dao/VotingAppAragon.sol diff --git a/packages/dock-blockchain-api/scripts/eth/dao/bytecodes-and-abis.js b/packages/dock-blockchain-api/scripts/eth/dao/bytecodes-and-abis.js new file mode 100644 index 000000000..872273659 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/dao/bytecodes-and-abis.js @@ -0,0 +1,2268 @@ +export const MiniMeTokenBytecode = + "0x60c0604052600760808190527f4d4d545f302e310000000000000000000000000000000000000000000000000060a090815262000040916004919062000147565b503480156200004e57600080fd5b5060405162001b1b38038062001b1b8339810160409081528151602080840151928401516060850151608086015160a087015160c088015160008054600160a060020a03191633179055600b8054600160a060020a0389166101000261010060a860020a031990911617905592880180519698949690959294919091019291620000de9160019187019062000147565b506002805460ff191660ff851617905581516200010390600390602085019062000147565b5060058054600160a060020a031916600160a060020a039790971696909617909555505050600655600b805460ff19169115159190911790555043600755620001ec565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018a57805160ff1916838001178555620001ba565b82800160010185558215620001ba579182015b82811115620001ba5782518255916020019190600101906200019d565b50620001c8929150620001cc565b5090565b620001e991905b80821115620001c85760008155600101620001d3565b90565b61191f80620001fc6000396000f30060806040526004361061012f5763ffffffff60e060020a60003504166306fdde0381146101f2578063095ea7b31461027c57806317634514146102b457806318160ddd146102db57806323b872dd146102f0578063313ce5671461031a5780633cebb823146103455780634ee2cd7e1461036657806354fd4d501461038a5780636638c0871461039f57806370a082311461046257806380a5400114610483578063827f32c01461049857806395d89b41146104bc578063981b24d0146104d1578063a9059cbb146104e9578063bef97c871461050d578063c5bcc4f114610522578063cae9ca5114610537578063d3ce77fe146105a0578063dd62ed3e146105c4578063df8de3e7146105eb578063e77772fe1461060c578063f41e60c514610621578063f77c47911461063b575b60005461014490600160a060020a0316610650565b151561014f57600080fd5b600054604080517ff48c30540000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a039092169163f48c3054913491602480830192602092919082900301818588803b1580156101b557600080fd5b505af11580156101c9573d6000803e3d6000fd5b50505050506040513d60208110156101e057600080fd5b505115156001146101f057600080fd5b005b3480156101fe57600080fd5b5061020761067d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610241578181015183820152602001610229565b50505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028857600080fd5b506102a0600160a060020a036004351660243561070a565b604080519115158252519081900360200190f35b3480156102c057600080fd5b506102c961088b565b60408051918252519081900360200190f35b3480156102e757600080fd5b506102c9610891565b3480156102fc57600080fd5b506102a0600160a060020a03600435811690602435166044356108a2565b34801561032657600080fd5b5061032f610939565b6040805160ff9092168252519081900360200190f35b34801561035157600080fd5b506101f0600160a060020a0360043516610942565b34801561037257600080fd5b506102c9600160a060020a0360043516602435610988565b34801561039657600080fd5b50610207610ad5565b3480156103ab57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261044694369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b60ff8b35169b909a909994019750919550918201935091508190840183828082843750949750508435955050505050602001351515610b30565b60408051600160a060020a039092168252519081900360200190f35b34801561046e57600080fd5b506102c9600160a060020a0360043516610d96565b34801561048f57600080fd5b50610446610daa565b3480156104a457600080fd5b506102a0600160a060020a0360043516602435610db9565b3480156104c857600080fd5b50610207610e85565b3480156104dd57600080fd5b506102c9600435610ee0565b3480156104f557600080fd5b506102a0600160a060020a0360043516602435610fd4565b34801561051957600080fd5b506102a0610ff3565b34801561052e57600080fd5b506102c9610ffc565b34801561054357600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102a0948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506110029650505050505050565b3480156105ac57600080fd5b506102a0600160a060020a036004351660243561111d565b3480156105d057600080fd5b506102c9600160a060020a03600435811690602435166111e5565b3480156105f757600080fd5b506101f0600160a060020a0360043516611210565b34801561061857600080fd5b506104466113f7565b34801561062d57600080fd5b506101f0600435151561140b565b34801561064757600080fd5b50610446611435565b600080600160a060020a038316151561066c5760009150610677565b823b90506000811191505b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107025780601f106106d757610100808354040283529160200191610702565b820191906000526020600020905b8154815290600101906020018083116106e557829003601f168201915b505050505081565b600b5460009060ff16151561071e57600080fd5b81158061074c5750336000908152600960209081526040808320600160a060020a0387168452909152902054155b151561075757600080fd5b60005461076c90600160a060020a0316610650565b156108235760008054604080517fda682aeb000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038781166024830152604482018790529151919092169263da682aeb92606480820193602093909283900390910190829087803b1580156107e957600080fd5b505af11580156107fd573d6000803e3d6000fd5b505050506040513d602081101561081357600080fd5b5051151560011461082357600080fd5b336000818152600960209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60075481565b600061089c43610ee0565b90505b90565b60008054600160a060020a0316331461092457600b5460ff1615156108c657600080fd5b600160a060020a03841660009081526009602090815260408083203384529091529020548211156108f957506000610932565b600160a060020a03841660009081526009602090815260408083203384529091529020805483900390555b61092f848484611444565b90505b9392505050565b60025460ff1681565b600054600160a060020a0316331461095957600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03821660009081526008602052604081205415806109e45750600160a060020a0383166000908152600860205260408120805484929081106109cd57fe5b6000918252602090912001546001608060020a0316115b15610aac57600554600160a060020a031615610aa457600554600654600160a060020a0390911690634ee2cd7e908590610a1f908690611639565b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610a7157600080fd5b505af1158015610a85573d6000803e3d6000fd5b505050506040513d6020811015610a9b57600080fd5b50519050610885565b506000610885565b600160a060020a0383166000908152600860205260409020610ace908361164f565b9050610885565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107025780601f106106d757610100808354040283529160200191610702565b600080808415610b405784610b45565b600143035b600b546040517f5b7b72c100000000000000000000000000000000000000000000000000000000815230600482018181526024830185905260ff8c16606484015288151560a484015260c0604484019081528d5160c48501528d51959750610100909404600160a060020a031694635b7b72c194929388938f938f938f938e9391608482019160e40190602089019080838360005b83811015610bf2578181015183820152602001610bda565b50505050905090810190601f168015610c1f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610c52578181015183820152602001610c3a565b50505050905090810190601f168015610c7f5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b158015610ca457600080fd5b505af1158015610cb8573d6000803e3d6000fd5b505050506040513d6020811015610cce57600080fd5b5051604080517f3cebb8230000000000000000000000000000000000000000000000000000000081523360048201529051919250600160a060020a03831691633cebb8239160248082019260009290919082900301818387803b158015610d3457600080fd5b505af1158015610d48573d6000803e3d6000fd5b5050604080518581529051600160a060020a03851693507f086c875b377f900b07ce03575813022f05dd10ed7640b5282cf6d3c3fc352ade92509081900360200190a2979650505050505050565b6000610da28243610988565b90505b919050565b600554600160a060020a031681565b6000805481908190600160a060020a03163314610dd557600080fd5b610ddd610891565b9150838201821115610dee57600080fd5b610df785610d96565b9050838101811115610e0857600080fd5b610e15600a8584016117ae565b600160a060020a0385166000908152600860205260409020610e39908286016117ae565b604080518581529051600160a060020a038716916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001949350505050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107025780601f106106d757610100808354040283529160200191610702565b600a546000901580610f15575081600a6000815481101515610efe57fe5b6000918252602090912001546001608060020a0316115b15610fc257600554600160a060020a031615610fba57600554600654600160a060020a039091169063981b24d090610f4e908590611639565b6040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015610f8757600080fd5b505af1158015610f9b573d6000803e3d6000fd5b505050506040513d6020811015610fb157600080fd5b50519050610da5565b506000610da5565b610fcd600a8361164f565b9050610da5565b600b5460009060ff161515610fe857600080fd5b610932338484611444565b600b5460ff1681565b60065481565b600061100e848461070a565b151561101957600080fd5b6040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b838110156110ac578181015183820152602001611094565b50505050905090810190601f1680156110d95780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156110fb57600080fd5b505af115801561110f573d6000803e3d6000fd5b506001979650505050505050565b6000805481908190600160a060020a0316331461113957600080fd5b611141610891565b91508382101561115057600080fd5b61115985610d96565b90508381101561116857600080fd5b611175600a8584036117ae565b600160a060020a0385166000908152600860205260409020611199908583036117ae565b604080518581529051600091600160a060020a038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001949350505050565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b600080548190600160a060020a0316331461122a57600080fd5b600160a060020a038316151561127b5760008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015611275573d6000803e3d6000fd5b506113f2565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b1580156112df57600080fd5b505af11580156112f3573d6000803e3d6000fd5b505050506040513d602081101561130957600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519394509085169263a9059cbb92604480840193602093929083900390910190829087803b15801561137f57600080fd5b505af1158015611393573d6000803e3d6000fd5b505050506040513d60208110156113a957600080fd5b5050600054604080518381529051600160a060020a03928316928616917ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c919081900360200190a35b505050565b600b546101009004600160a060020a031681565b600054600160a060020a0316331461142257600080fd5b600b805460ff1916911515919091179055565b600054600160a060020a031681565b600080808315156114585760019250611630565b600654431161146657600080fd5b600160a060020a038516158015906114875750600160a060020a0385163014155b151561149257600080fd5b61149c8643610988565b9150838210156114af5760009250611630565b6000546114c490600160a060020a0316610650565b1561157d5760008054604080517f4a393149000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015289811660248301526044820189905291519190921692634a39314992606480820193602093909283900390910190829087803b15801561154357600080fd5b505af1158015611557573d6000803e3d6000fd5b505050506040513d602081101561156d57600080fd5b5051151560011461157d57600080fd5b600160a060020a03861660009081526008602052604090206115a1908584036117ae565b6115ab8543610988565b90508381018111156115bc57600080fd5b600160a060020a03851660009081526008602052604090206115e0908286016117ae565b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600192505b50509392505050565b60008183106116485781610932565b5090919050565b60008060008085805490506000141561166b57600093506117a5565b85548690600019810190811061167d57fe5b6000918252602090912001546001608060020a031685106116da578554869060001981019081106116aa57fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a031693506117a5565b8560008154811015156116e957fe5b6000918252602090912001546001608060020a031685101561170e57600093506117a5565b8554600093506000190191505b8282111561176b57600260018385010104905084868281548110151561173d57fe5b6000918252602090912001546001608060020a03161161175f57809250611766565b6001810391505b61171b565b858381548110151561177957fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a031693505b50505092915050565b6000806001608060020a038311156117c557600080fd5b835415806117f9575083544390859060001981019081106117e257fe5b6000918252602090912001546001608060020a0316105b1561186b578354849061180f82600183016118b6565b8154811061181957fe5b600091825260209091200180546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff19909316929092171617815591506118b0565b83548490600019810190811061187d57fe5b600091825260209091200180546001608060020a0380861670010000000000000000000000000000000002911617815590505b50505050565b8154818355818111156113f2576000838152602090206113f291810190830161089f91905b808211156118ef57600081556001016118db565b50905600a165627a7a72305820023a7e1d47802836a2437cc2852cc6c8edcfbe38ca35a34f9551d81b48884f5f0029"; +export const MiniMeTokenABI = [ + { + constant: true, + inputs: [], + name: "name", + outputs: [ + { + name: "", + type: "string", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_spender", + type: "address", + }, + { + name: "_amount", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + name: "success", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "creationBlock", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "totalSupply", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_from", + type: "address", + }, + { + name: "_to", + type: "address", + }, + { + name: "_amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + name: "success", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "decimals", + outputs: [ + { + name: "", + type: "uint8", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_newController", + type: "address", + }, + ], + name: "changeController", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_owner", + type: "address", + }, + { + name: "_blockNumber", + type: "uint256", + }, + ], + name: "balanceOfAt", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "version", + outputs: [ + { + name: "", + type: "string", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_cloneTokenName", + type: "string", + }, + { + name: "_cloneDecimalUnits", + type: "uint8", + }, + { + name: "_cloneTokenSymbol", + type: "string", + }, + { + name: "_snapshotBlock", + type: "uint256", + }, + { + name: "_transfersEnabled", + type: "bool", + }, + ], + name: "createCloneToken", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_owner", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + name: "balance", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "parentToken", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_owner", + type: "address", + }, + { + name: "_amount", + type: "uint256", + }, + ], + name: "generateTokens", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "symbol", + outputs: [ + { + name: "", + type: "string", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_blockNumber", + type: "uint256", + }, + ], + name: "totalSupplyAt", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_to", + type: "address", + }, + { + name: "_amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + name: "success", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "transfersEnabled", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "parentSnapShotBlock", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_spender", + type: "address", + }, + { + name: "_amount", + type: "uint256", + }, + { + name: "_extraData", + type: "bytes", + }, + ], + name: "approveAndCall", + outputs: [ + { + name: "success", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_owner", + type: "address", + }, + { + name: "_amount", + type: "uint256", + }, + ], + name: "destroyTokens", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_owner", + type: "address", + }, + { + name: "_spender", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + name: "remaining", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_token", + type: "address", + }, + ], + name: "claimTokens", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "tokenFactory", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_transfersEnabled", + type: "bool", + }, + ], + name: "enableTransfers", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "controller", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + name: "_tokenFactory", + type: "address", + }, + { + name: "_parentToken", + type: "address", + }, + { + name: "_parentSnapShotBlock", + type: "uint256", + }, + { + name: "_tokenName", + type: "string", + }, + { + name: "_decimalUnits", + type: "uint8", + }, + { + name: "_tokenSymbol", + type: "string", + }, + { + name: "_transfersEnabled", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + payable: true, + stateMutability: "payable", + type: "fallback", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "_token", + type: "address", + }, + { + indexed: true, + name: "_controller", + type: "address", + }, + { + indexed: false, + name: "_amount", + type: "uint256", + }, + ], + name: "ClaimedTokens", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "_from", + type: "address", + }, + { + indexed: true, + name: "_to", + type: "address", + }, + { + indexed: false, + name: "_amount", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "_cloneToken", + type: "address", + }, + { + indexed: false, + name: "_snapshotBlock", + type: "uint256", + }, + ], + name: "NewCloneToken", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "_owner", + type: "address", + }, + { + indexed: true, + name: "_spender", + type: "address", + }, + { + indexed: false, + name: "_amount", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, +]; + +export const VotingDAOBytecode = + "0x6080604052620000176401000000006200001d810204565b6200023b565b6200003064010000000062000125810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a45440000000000000000602082015290156200010c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620000d0578181015183820152602001620000b6565b50505050905090810190601f168015620000fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506200012360001964010000000062000154810204565b565b60006200014f6000805160206200386983398151915264010000000062001fd16200023382021704565b905090565b6200016764010000000062000125810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152901562000206576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252838181518152602001915080519060200190808383600083811015620000d0578181015183820152602001620000b6565b5062000230600080516020620038698339815191528264010000000062002db36200023782021704565b50565b5490565b9055565b61361e806200024b6000396000f3006080604052600436106101925763ffffffff60e060020a6000350416630803fac081146101975780632914b9bd146101c057806332f0a3b5146102355780633c624c751461024a5780634b12311c146102715780635a55c1f0146102b95780635eb24332146103e057806362de7e5a146104045780637c1d0b87146104195780637e7db6e11461043b57806380afdea81461045c5780638b3dd749146104715780639d4941d814610486578063a1658fad146104a7578063a479e5081461050e578063bcf93dd614610523578063be2c64d414610555578063c0774df31461056a578063cc63604a146105d1578063cdb2867b146105e9578063d4aae0c41461060d578063d5db2c8014610622578063d948d4681461064e578063dc474b1a146106a7578063de4796ed146106bc578063de4f6347146106d1578063df133bca146106e6578063df3d330514610708578063f4b0051314610742578063f98a4eca14610778578063fad167ab14610790578063fc0c546a146107a5578063fc157cb4146107ba578063fd64eccb146107cf575b600080fd5b3480156101a357600080fd5b506101ac6107e4565b604080519115158252519081900360200190f35b3480156101cc57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261021994369492936024939284019190819084018382808284375094975061080e9650505050505050565b60408051600160a060020a039092168252519081900360200190f35b34801561024157600080fd5b506102196108f4565b34801561025657600080fd5b5061025f61096d565b60408051918252519081900360200190f35b34801561027d57600080fd5b50610295600435600160a060020a03602435166109a2565b604051808260028111156102a557fe5b60ff16815260200191505060405180910390f35b3480156102c557600080fd5b506102d1600435610a8e565b604051808b1515151581526020018a1515151581526020018967ffffffffffffffff1667ffffffffffffffff1681526020018867ffffffffffffffff1667ffffffffffffffff1681526020018767ffffffffffffffff1667ffffffffffffffff1681526020018667ffffffffffffffff1667ffffffffffffffff16815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561039c578181015183820152602001610384565b50505050905090810190601f1680156103c95780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390f35b3480156103ec57600080fd5b5061040267ffffffffffffffff60043516610c7b565b005b34801561041057600080fd5b5061025f610e3f565b34801561042557600080fd5b5061040267ffffffffffffffff60043516610e74565b34801561044757600080fd5b506101ac600160a060020a03600435166110ed565b34801561046857600080fd5b5061025f6110f3565b34801561047d57600080fd5b5061025f611123565b34801561049257600080fd5b50610402600160a060020a036004351661114e565b3480156104b357600080fd5b5060408051602060046044358181013583810280860185019096528085526101ac958335600160a060020a03169560248035963696956064959394920192918291850190849080828437509497506113dd9650505050505050565b34801561051a57600080fd5b5061021961152d565b34801561052f57600080fd5b506105386115e2565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561056157600080fd5b5061025f6115fe565b34801561057657600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101ac958335600160a060020a03169536956044949193909101919081908401838280828437509497506116219650505050505050565b3480156105dd57600080fd5b506101ac60043561165f565b3480156105f557600080fd5b506101ac600435600160a060020a03602435166116ee565b34801561061957600080fd5b5061021961177d565b34801561062e57600080fd5b5061025f60246004803582810192908201359181359182019101356117a8565b34801561065a57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104029436949293602493928401919081908401838280828437509497506118d09650505050505050565b3480156106b357600080fd5b50610538611982565b3480156106c857600080fd5b506101ac611992565b3480156106dd57600080fd5b5061025f6119a5565b3480156106f257600080fd5b50610402600435602435151560443515156119ab565b34801561071457600080fd5b50610402600160a060020a036004351667ffffffffffffffff60243581169060443581169060643516611ac7565b34801561074e57600080fd5b5061025f602460048035828101929082013591813591820191013560443515156064351515611d2b565b34801561078457600080fd5b50610402600435611e52565b34801561079c57600080fd5b50610538611ed4565b3480156107b157600080fd5b50610219611eeb565b3480156107c657600080fd5b50610538611efa565b3480156107db57600080fd5b506101ac611f06565b6000806107ef611123565b90508015801590610807575080610804611f0b565b10155b91505b5090565b600061081861152d565b600160a060020a03166304bf2a7f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561087657818101518382015260200161085e565b50505050905090810190601f1680156108a35780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156108c257600080fd5b505af11580156108d6573d6000803e3d6000fd5b505050506040513d60208110156108ec57600080fd5b505192915050565b60006108fe61177d565b600160a060020a03166332f0a3b56040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561093b57600080fd5b505af115801561094f573d6000803e3d6000fd5b505050506040513d602081101561096557600080fd5b505190505b90565b604080517f4d4f444946595f51554f52554d5f524f4c4500000000000000000000000000008152905190819003601201902081565b60035460408051808201909152600e81526000805160206135b383398151915260208201526000918491908210610a5a5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a1f578181015183820152602001610a07565b50505050905090810190601f168015610a4c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000848152600260209081526040808320600160a060020a038716845260060190915290205460ff1691505b5092915050565b6000806000806000806000806000606060008b60035481106040805190810160405280600e81526020016000805160206135b3833981519152815250901515610b1c5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060008d81526002602052604090209150610b3682611f0f565b9b508160000160009054906101000a900460ff169a508160000160019054906101000a900467ffffffffffffffff1699508160000160099054906101000a900467ffffffffffffffff1698508160000160119054906101000a900467ffffffffffffffff1697508160010160009054906101000a900467ffffffffffffffff169650816002015495508160030154945081600401549350816005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c655780601f10610c3a57610100808354040283529160200191610c65565b820191906000526020600020905b815481529060010190602001808311610c4857829003601f168201915b5050505050925050509193959799509193959799565b604080517f4d4f444946595f51554f52554d5f524f4c45000000000000000000000000000081529051908190036012019020600154610cc79067ffffffffffffffff8085169116611f76565b610cd23383836113dd565b60408051808201909152600f81526000805160206135938339815191526020820152901515610d465760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060005460408051808201909152601981527f564f54494e475f4348414e47455f51554f52554d5f504354530000000000000060208201529067ffffffffffffffff60a060020a90910481169085161115610de65760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506001805467ffffffffffffffff851667ffffffffffffffff19909116811790915560408051918252517f3172f2e9273c729c2a47cc8bf7e7f18506e3e3035126d562602bd2155bc78a509181900360200190a1505050565b604080517f4d4f444946595f535550504f52545f524f4c45000000000000000000000000008152905190819003601301902081565b604080517f4d4f444946595f535550504f52545f524f4c450000000000000000000000000081529051908190036013019020600054610ec79067ffffffffffffffff8085169160a060020a900416611f76565b610ed23383836113dd565b60408051808201909152600f81526000805160206135938339815191526020820152901515610f465760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060015460408051808201909152601a81527f564f54494e475f4348414e47455f535550504f52545f5043545300000000000060208201529067ffffffffffffffff80861691161115610fde5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060408051808201909152601a81527f564f54494e475f4348414e47455f535550505f544f4f5f4249470000000000006020820152670de0b6b3a764000067ffffffffffffffff8516106110775760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506000805467ffffffffffffffff851660a060020a81027bffffffffffffffff0000000000000000000000000000000000000000199092169190911790915560408051918252517f903b617f7f36eb047a29b89d1bf7885fdae31d250c3320fccf11d045c11b396e9181900360200190a1505050565b50600190565b600061111e7fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b611fd1565b905090565b600061111e7febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e611fd1565b600080600061115c846110ed565b60408051808201909152601281527f5245434f5645525f444953414c4c4f574544000000000000000000000000000060208201529015156111e25760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506111eb6108f4565b92506111f683611fd9565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e5452414354000000000000602082015290151561127c5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50600160a060020a03841615156112cd5760405130319250600160a060020a0384169083156108fc029084906000818181858888f193505050501580156112c7573d6000803e3d6000fd5b5061138c565b50826112e8600160a060020a0382163063ffffffff611fff16565b9150611304600160a060020a038216848463ffffffff6120ff16565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c4544000000602082015290151561138a5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b6000806113e86107e4565b15156113f75760009150611525565b6113ff61177d565b9050600160a060020a038116151561141a5760009150611525565b80600160a060020a031663fdef910686308761143588612175565b60405160e060020a63ffffffff8716028152600160a060020a03808616600483019081529085166024830152604482018490526080606483019081528351608484015283519192909160a490910190602085019080838360005b838110156114a757818101518382015260200161148f565b50505050905090810190601f1680156114d45780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156114f657600080fd5b505af115801561150a573d6000803e3d6000fd5b505050506040513d602081101561152057600080fd5b505191505b509392505050565b60008061153861177d565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527fd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb60048201527fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd6160248201529051600160a060020a03929092169163be00bbd8916044808201926020929091908290030181600087803b1580156108c257600080fd5b60015468010000000000000000900467ffffffffffffffff1681565b604080516000805160206135d38339815191528152905190819003601101902081565b60006116588360405180806000805160206135d38339815191528152506011019050604051809103902061165361217f565b6113dd565b9392505050565b60035460408051808201909152600e81526000805160206135b3833981519152602082015260009183919082106116db5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506116e583612191565b91505b50919050565b60035460408051808201909152600e81526000805160206135b38339815191526020820152600091849190821061176a5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061177584846122aa565b949350505050565b600061111e7f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b611fd1565b604080516000805160206135d383398151915281528151908190036011018120600080835260208301909352906117e59033908390855b506113dd565b60408051808201909152600f815260008051602061359383398151915260208201529015156118595760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506118c686868080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f8c018190048102820181019092528a815294508a93508992508291508401838280828437820191505050505050600180612384565b9695505050505050565b6118da3382611621565b60408051808201909152601681527f564f54494e475f43414e5f4e4f545f464f52574152440000000000000000000060208201529015156119605760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061197e816020604051908101604052806000815250600180612384565b5050565b60015467ffffffffffffffff1681565b600060001961199f611123565b14905090565b60035481565b60035460408051808201909152600e81526000805160206135b3833981519152602082015284918210611a235760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611a2e84336122aa565b60408051808201909152601381527f564f54494e475f43414e5f4e4f545f564f5445000000000000000000000000006020820152901515611ab45760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611ac18484338561267a565b50505050565b611acf611123565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529015611b545760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611b5d6128b6565b60408051808201909152601081527f564f54494e475f494e49545f5043545300000000000000000000000000000000602082015267ffffffffffffffff8085169084161115611bf15760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060408051808201909152601b81527f564f54494e475f494e49545f535550504f52545f544f4f5f42494700000000006020820152670de0b6b3a764000067ffffffffffffffff851610611c8a5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0395909516949094177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a67ffffffffffffffff94851602179093556001805467ffffffffffffffff1916918316919091176fffffffffffffffff00000000000000001916680100000000000000009390921692909202179055565b604080516000805160206135d38339815191528152815190819003601101812060008083526020830190935290611d669033908390856117df565b60408051808201909152600f81526000805160206135938339815191526020820152901515611dda5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611e4688888080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f8e018190048102820181019092528c815294508c93508b925082915084018382808284378201915050505050508686612384565b98975050505050505050565b60035460408051808201909152600e81526000805160206135b3833981519152602082015282918210611eca5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061197e8261297e565b60005460a060020a900467ffffffffffffffff1681565b600054600160a060020a031681565b670de0b6b3a764000081565b600190565b4390565b6001548154600091611f4591610100900467ffffffffffffffff908116916801000000000000000090041663ffffffff612a1a16565b67ffffffffffffffff16611f57612ab5565b67ffffffffffffffff16108015611f705750815460ff16155b92915050565b604080516002808252606080830184529260208301908038833901905050905082816000815181101515611fa657fe5b602090810290910101528051829082906001908110611fc157fe5b6020908102909101015292915050565b5490565b5490565b600080600160a060020a0383161515611ff557600091506116e8565b50506000903b1190565b60408051600160a060020a038316602480830191909152825180830390910181526044909101909152602081018051600160e060020a03167f70a0823100000000000000000000000000000000000000000000000000000000179052600090818061206a8684612ac7565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f524556455254454400000000602082015291935091508215156120f55760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5095945050505050565b60408051600160a060020a03841660248201526044808201849052825180830390910181526064909101909152602081018051600160e060020a03167fa9059cbb0000000000000000000000000000000000000000000000000000000017905260009061216c8582612af8565b95945050505050565b8051602002815290565b60408051600081526020810190915290565b60008181526002602052604081208054829060ff16156121b457600092506122a3565b6002820154600483015483546121ea92919071010000000000000000000000000000000000900467ffffffffffffffff16612b46565b156121f857600192506122a3565b61220182611f0f565b1561220f57600092506122a3565b600382015460028301546122289163ffffffff612b8816565b6002830154835491925061225c91839071010000000000000000000000000000000000900467ffffffffffffffff16612b46565b151561226b57600092506122a3565b60028201546004830154600184015461228f92919067ffffffffffffffff16612b46565b151561229e57600092506122a3565b600192505b5050919050565b60008281526002602052604081206122c181611f0f565b80156117755750600080548254604080517f4ee2cd7e000000000000000000000000000000000000000000000000000000008152600160a060020a038881166004830152690100000000000000000090930467ffffffffffffffff16602482015290519190921691634ee2cd7e91604480830192602092919082900301818787803b15801561234f57600080fd5b505af1158015612363573d6000803e3d6000fd5b505050506040513d602081101561237957600080fd5b505111949350505050565b6000806000806001612394612c16565b60008054604080517f981b24d00000000000000000000000000000000000000000000000000000000081529490930367ffffffffffffffff811660048601529251929650600160a060020a03169263981b24d09260248083019360209383900390910190829087803b15801561240957600080fd5b505af115801561241d573d6000803e3d6000fd5b505050506040513d602081101561243357600080fd5b505160408051808201909152601681527f564f54494e475f4e4f5f564f54494e475f504f574552000000000000000000006020820152909250600083116124bf5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5050600380546001810190915560008181526002602052604090209093506124e5612ab5565b815468ffffffffffffffff00191661010067ffffffffffffffff928316021770ffffffffffffffff00000000000000000019166901000000000000000000858316021780835560005478ffffffffffffffff00000000000000000000000000000000001990911660a060020a909104821671010000000000000000000000000000000000021782556001805490830180549190921667ffffffffffffffff199091161790556004810182905587516125a690600583019060208b0190613504565b5033600160a060020a0316847f4d72fe0577a3a3f7da968d7b892779dde102519c25527b29cf7054f245c791b9896040518080602001828103825283818151815260200191508051906020019080838360005b838110156126115781810151838201526020016125f9565b50505050905090810190601f16801561263e5780820380516001836020036101000a031916815260200191505b509250505060405180910390a385801561265d575061265d84336122aa565b1561266f5761266f846001338861267a565b505050949350505050565b60008481526002602090815260408083208354815483517f4ee2cd7e000000000000000000000000000000000000000000000000000000008152600160a060020a038981166004830152690100000000000000000090920467ffffffffffffffff166024820152935192959485949190921692634ee2cd7e9260448084019391929182900301818787803b15801561271157600080fd5b505af1158015612725573d6000803e3d6000fd5b505050506040513d602081101561273b57600080fd5b5051600160a060020a038616600090815260068501602052604090205490925060ff169050600181600281111561276e57fe5b1415612793576002830154612789908363ffffffff612c2316565b60028401556127c2565b60028160028111156127a157fe5b14156127c25760038301546127bc908363ffffffff612c2316565b60038401555b85156127e75760028301546127dd908363ffffffff612b8816565b6002840155612802565b60038301546127fc908363ffffffff612b8816565b60038401555b8561280e576002612811565b60015b600160a060020a03861660009081526006850160205260409020805460ff1916600183600281111561283f57fe5b0217905550604080518715158152602081018490528151600160a060020a038816928a927fb34ee265e3d4f5ec4e8b52d59b2a9be8fceca2f274ebc080d8fba797fea9391f929081900390910190a383801561289f575061289f87612191565b156128ad576128ad87612cb7565b50505050505050565b6128be611123565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a45440000000000000000602082015290156129435760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061297c61294f611f0b565b7febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e9063ffffffff612db316565b565b61298781612191565b60408051808201909152601681527f564f54494e475f43414e5f4e4f545f45584543555445000000000000000000006020820152901515612a0d5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50612a1781612cb7565b50565b60408051808201909152601381527f4d41544836345f4144445f4f564552464c4f570000000000000000000000000060208201526000908383019067ffffffffffffffff80861690831610156115255760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b600061111e612ac2612db7565b612dbb565b6000806000806040516020818751602089018a5afa92506000831115612aec57805191505b50909590945092505050565b6000806040516020818551602087016000895af16000811115612b3c573d8015612b295760208114612b3257612b3a565b60019350612b3a565b600183511493505b505b5090949350505050565b600080831515612b595760009150611525565b83612b7286670de0b6b3a764000063ffffffff612e5416565b811515612b7b57fe5b0492909211949350505050565b60408051808201909152601181527f4d4154485f4144445f4f564552464c4f57000000000000000000000000000000602082015260009083830190848210156115255760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b600061111e612ac2611f0b565b60408051808201909152601281527f4d4154485f5355425f554e444552464c4f5700000000000000000000000000006020820152600090819084841115612caf5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b505050900390565b6000818152600260208181526040808420805460ff191660019081178255825195865260058201805491821615610100026000190190911694909404601f81018490048402860183018352928501838152909493612d82939192909190850182828015612d655780601f10612d3a57610100808354040283529160200191612d65565b820191906000526020600020905b815481529060010190602001808311612d4857829003601f168201915b50506040805160008152602081019091528693509150612eff9050565b5060405183907fbf8e2b108bb7c980e08903a8a46527699d5e84905a082d56dacb4150725c8cab90600090a2505050565b9055565b4290565b60408051808201909152601581527f55494e5436345f4e554d4245525f544f4f5f4249470000000000000000000000602082015260009067ffffffffffffffff831115612e4d5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5090919050565b600080831515612e675760009150610a87565b50828202828482811515612e7757fe5b60408051808201909152601181527f4d4154485f4d554c5f4f564552464c4f57000000000000000000000000000000602082015292919004146115255760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b6060600080606080612f0f6107e4565b60408051808201909152601481527f494e49545f4e4f545f494e495449414c495a45440000000000000000000000006020820152901515612f955760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50600080612fa161177d565b9150612fab6110f3565b9050612fb68a61080e565b60408051808201909152601b81527f45564d52554e5f4558454355544f525f554e415641494c41424c4500000000006020820152909650600160a060020a03871615156130485760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506040516060602482019081528b5160848301528b517f279cea3500000000000000000000000000000000000000000000000000000000975087928d928d928d9282916044820191606481019160a490910190602089019080838360005b838110156130be5781810151838201526020016130a6565b50505050905090810190601f1680156130eb5780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b8381101561311e578181015183820152602001613106565b50505050905090810190601f16801561314b5780820380516001836020036101000a031916815260200191505b508481038252855181528551602091820191808801910280838360005b83811015613180578181015183820152602001613168565b50505050905001965050505050505060405160208183030381529060405290600160e060020a031916602082018051600160e060020a0383818316178352505050509350600080855160208701895af4604051935080801561324457603f3d1180156131f95760203d03806020883e860160405261323e565b60e560020a62461bcd02865260206004870152601e60248701527f45564d52554e5f4558454355544f525f494e56414c49445f52455455524e00006044870152606486fd5b5061324d565b3d6000863e3d85fd5b505085600160a060020a03167f5229a5dba83a54ae8cb5b51bdd6de9474cacbe9dd332f5185f3a4f4f2e3f4ad98b8b8660405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156132c25781810151838201526020016132aa565b50505050905090810190601f1680156132ef5780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b8381101561332257818101518382015260200161330a565b50505050905090810190601f16801561334f5780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b8381101561338257818101518382015260200161336a565b50505050905090810190601f1680156133af5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a282965081600160a060020a03166133d561177d565b600160a060020a0316146040805190810160405280601f81526020017f45564d52554e5f50524f5445435445445f53544154455f4d4f444946494544008152509015156134675760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50806134716110f3565b60408051808201909152601f81527f45564d52554e5f50524f5445435445445f53544154455f4d4f44494649454400602082015291146134f65760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b505050505050509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061354557805160ff1916838001178555613572565b82800160010185558215613572579182015b82811115613572578251825591602001919060010190613557565b5061080a9261096a9250905b8082111561080a576000815560010161357e56004150505f415554485f4641494c45440000000000000000000000000000000000564f54494e475f4e4f5f564f54450000000000000000000000000000000000004352454154455f564f5445535f524f4c45000000000000000000000000000000a165627a7a72305820e6a06a964692f26a22a2e85cfd6610dcd8fe0cf5277b551cf6d61484be71e7b90029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e"; +export const VotingDAOABI = [ + { + constant: true, + inputs: [], + name: "hasInitialized", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_script", + type: "bytes", + }, + ], + name: "getEVMScriptExecutor", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getRecoveryVault", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "MODIFY_QUORUM_ROLE", + outputs: [ + { + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_voteId", + type: "uint256", + }, + { + name: "_voter", + type: "address", + }, + ], + name: "getVoterState", + outputs: [ + { + name: "", + type: "uint8", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_voteId", + type: "uint256", + }, + ], + name: "getVote", + outputs: [ + { + name: "open", + type: "bool", + }, + { + name: "executed", + type: "bool", + }, + { + name: "startDate", + type: "uint64", + }, + { + name: "snapshotBlock", + type: "uint64", + }, + { + name: "supportRequired", + type: "uint64", + }, + { + name: "minAcceptQuorum", + type: "uint64", + }, + { + name: "yea", + type: "uint256", + }, + { + name: "nay", + type: "uint256", + }, + { + name: "votingPower", + type: "uint256", + }, + { + name: "script", + type: "bytes", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_minAcceptQuorumPct", + type: "uint64", + }, + ], + name: "changeMinAcceptQuorumPct", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "MODIFY_SUPPORT_ROLE", + outputs: [ + { + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_supportRequiredPct", + type: "uint64", + }, + ], + name: "changeSupportRequiredPct", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "token", + type: "address", + }, + ], + name: "allowRecoverability", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "appId", + outputs: [ + { + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getInitializationBlock", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_token", + type: "address", + }, + ], + name: "transferToVault", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_sender", + type: "address", + }, + { + name: "_role", + type: "bytes32", + }, + { + name: "_params", + type: "uint256[]", + }, + ], + name: "canPerform", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getEVMScriptRegistry", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "voteTime", + outputs: [ + { + name: "", + type: "uint64", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "CREATE_VOTES_ROLE", + outputs: [ + { + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_sender", + type: "address", + }, + { + name: "", + type: "bytes", + }, + ], + name: "canForward", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_voteId", + type: "uint256", + }, + ], + name: "canExecute", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + name: "_voteId", + type: "uint256", + }, + { + name: "_voter", + type: "address", + }, + ], + name: "canVote", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "kernel", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_executionScript", + type: "bytes", + }, + { + name: "_metadata", + type: "string", + }, + ], + name: "newVote", + outputs: [ + { + name: "voteId", + type: "uint256", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_evmScript", + type: "bytes", + }, + ], + name: "forward", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "minAcceptQuorumPct", + outputs: [ + { + name: "", + type: "uint64", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "isPetrified", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "votesLength", + outputs: [ + { + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_voteId", + type: "uint256", + }, + { + name: "_supports", + type: "bool", + }, + { + name: "_executesIfDecided", + type: "bool", + }, + ], + name: "vote", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_token", + type: "address", + }, + { + name: "_supportRequiredPct", + type: "uint64", + }, + { + name: "_minAcceptQuorumPct", + type: "uint64", + }, + { + name: "_voteTime", + type: "uint64", + }, + ], + name: "initialize", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_executionScript", + type: "bytes", + }, + { + name: "_metadata", + type: "string", + }, + { + name: "_castVote", + type: "bool", + }, + { + name: "_executesIfDecided", + type: "bool", + }, + ], + name: "newVote", + outputs: [ + { + name: "voteId", + type: "uint256", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + name: "_voteId", + type: "uint256", + }, + ], + name: "executeVote", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "supportRequiredPct", + outputs: [ + { + name: "", + type: "uint64", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "token", + outputs: [ + { + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "PCT_BASE", + outputs: [ + { + name: "", + type: "uint64", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "isForwarder", + outputs: [ + { + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "voteId", + type: "uint256", + }, + { + indexed: true, + name: "creator", + type: "address", + }, + { + indexed: false, + name: "metadata", + type: "string", + }, + ], + name: "StartVote", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "voteId", + type: "uint256", + }, + { + indexed: true, + name: "voter", + type: "address", + }, + { + indexed: false, + name: "supports", + type: "bool", + }, + { + indexed: false, + name: "stake", + type: "uint256", + }, + ], + name: "CastVote", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "voteId", + type: "uint256", + }, + ], + name: "ExecuteVote", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + name: "supportRequiredPct", + type: "uint64", + }, + ], + name: "ChangeSupportRequired", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + name: "minAcceptQuorumPct", + type: "uint64", + }, + ], + name: "ChangeMinQuorum", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "executor", + type: "address", + }, + { + indexed: false, + name: "script", + type: "bytes", + }, + { + indexed: false, + name: "input", + type: "bytes", + }, + { + indexed: false, + name: "returnData", + type: "bytes", + }, + ], + name: "ScriptResult", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: "vault", + type: "address", + }, + { + indexed: true, + name: "token", + type: "address", + }, + { + indexed: false, + name: "amount", + type: "uint256", + }, + ], + name: "RecoverToVault", + type: "event", + }, +]; + +export const InitializableBytecode = + "0x608060405234801561001057600080fd5b5061011d806100206000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630803fac08114604d5780638b3dd749146073575b600080fd5b348015605857600080fd5b50605f6097565b604080519115158252519081900360200190f35b348015607e57600080fd5b50608560bb565b60408051918252519081900360200190f35b60008060a060bb565b9050801580159060b557508060b260e9565b10155b91505090565b600060e47febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e60ed565b905090565b4390565b54905600a165627a7a723058201206f9a7b03e1a2b5d8568cd87c86c45b564552e04d8f731b4451cbe4310384e0029"; +export const InitializableABI = [ + { + constant: true, + inputs: [], + name: "hasInitialized", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getInitializationBlock", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, +]; + +export const KernelBytecode = + "0x60806040523480156200001157600080fd5b5060405160208062002cc7833981016040525180156200003e576200003e64010000000062000045810204565b5062000263565b620000586401000000006200014d810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152901562000134576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620000f8578181015183820152602001620000de565b50505050905090810190601f168015620001265780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506200014b6000196401000000006200017c810204565b565b60006200017760008051602062002ca7833981519152640100000000620018a56200025b82021704565b905090565b6200018f6401000000006200014d810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a45440000000000000000602082015290156200022e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252838181518152602001915080519060200190808383600083811015620000f8578181015183820152602001620000de565b506200025860008051602062002ca78339815191528264010000000062001ad36200025f82021704565b50565b5490565b9055565b612a3480620002736000396000f300608060405260043610620001865763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630803fac081146200018b5780631113ed0d14620001b7578063178e607914620001e157806332f0a3b514620001f9578063397edd41146200022d5780634558850c146200029d578063485cc95514620002bb578063756f604914620002e75780637e7db6e114620002ff57806380cd5ac3146200032357806386070cfe146200034a5780638b3dd74914620003625780638c61757d146200037a5780638ea8dc9d1462000395578063958fde8214620003ad5780639d4941d814620003d4578063ae5b254014620003f8578063be00bbd81462000422578063c050a7a61462000440578063d162f8b014620004b0578063db8a61d4146200051c578063de2873591462000534578063de4796ed146200054c578063e156a8f31462000564578063e8187ff0146200058b578063ede658b014620005a3578063fdef9106146200060f578063ff289fc51462000681575b600080fd5b3480156200019857600080fd5b50620001a3620006a8565b604080519115158252519081900360200190f35b348015620001c457600080fd5b50620001cf620006d6565b60408051918252519081900360200190f35b348015620001ee57600080fd5b50620001cf620006fa565b3480156200020657600080fd5b50620002116200070d565b60408051600160a060020a039092168252519081900360200190f35b3480156200023a57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452620002119482359460248035600160a060020a0316953695946064949201919081908401838280828437509497505050509135151592506200074a915050565b348015620002aa57600080fd5b50620002116004356024356200089d565b348015620002c857600080fd5b50620002e5600160a060020a0360043581169060243516620008c0565b005b348015620002f457600080fd5b50620001cf62000a8c565b3480156200030c57600080fd5b50620001a3600160a060020a036004351662000ab0565b3480156200033057600080fd5b5062000211600435600160a060020a036024351662000ab6565b3480156200035757600080fd5b50620001cf62000b96565b3480156200036f57600080fd5b50620001cf62000b9c565b3480156200038757600080fd5b50620002e560043562000bce565b348015620003a257600080fd5b50620001cf62000c8b565b348015620003ba57600080fd5b5062000211600435600160a060020a036024351662000c9e565b348015620003e157600080fd5b50620002e5600160a060020a036004351662000d75565b3480156200040557600080fd5b50620002e5600435602435600160a060020a03604435166200101a565b3480156200042f57600080fd5b5062000211600435602435620010d5565b3480156200044d57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452620002119482359460248035600160a060020a031695369594606494920191908190840183828082843750949750505050913515159250620010f9915050565b348015620004bd57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845262000211948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750620011d59650505050505050565b3480156200052957600080fd5b50620001cf620012e0565b3480156200054157600080fd5b5062000211620012f3565b3480156200055957600080fd5b50620001a36200131f565b3480156200057157600080fd5b5062000211600160a060020a036004351660243562001334565b3480156200059857600080fd5b50620001cf6200135a565b348015620005b057600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845262000211948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506200136d9650505050505050565b3480156200061c57600080fd5b50604080516020601f606435600481810135928301849004840285018401909552818452620001a394600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750620014789650505050505050565b3480156200068e57600080fd5b5062000211600160a060020a0360043516602435620015bb565b600080620006b562000b9c565b90508015801590620006d0575080620006cd620015da565b10155b91505090565b7f3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c90565b600080516020620029e983398151915290565b60015460009081527f9e3eae70920eeef6013879bf9155b985893698c145361c31365929723678b2576020526040902054600160a060020a031690565b600060008051602062002969833981519152620007776000805160206200298983398151915287620015de565b6200078f3330846200078985620015ec565b62001478565b6040805180820190915260128152600080516020620029c98339815191526020820152901515620008445760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562000808578181015183820152602001620007ee565b50505050905090810190601f168015620008365780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5062000861600080516020620029898339815191528888620015f6565b6200086e3088876200136d565b92508315620008935762000893600080516020620029e983398151915288856200101a565b5050949350505050565b6000602081815292815260408082209093529081522054600160a060020a031681565b6000620008cc62000b9c565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529015620009545760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506200095f620016c5565b6200098a60008051602062002989833981519152600080516020620029a98339815191528562001796565b620009a530600080516020620029a983398151915262001334565b905080600160a060020a031663c4d66de8836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15801562000a1c57600080fd5b505af115801562000a31573d6000803e3d6000fd5b5062000a639250600080516020620029e98339815191529150600080516020620029a983398151915290508362001796565b50507f7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d160015550565b7fc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f890565b50600190565b60006000805160206200296983398151915262000ae36000805160206200298983398151915285620015de565b62000af53330846200078985620015ec565b6040805180820190915260128152600080516020620029c9833981519152602082015290151562000b6d5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506040805160008082526020820190925262000b8d91879187916200074a565b95945050505050565b60015481565b600062000bc97febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e620018a5565b905090565b6000805160206200296983398151915262000bf9600080516020620029e983398151915283620015de565b62000c0b3330846200078985620015ec565b6040805180820190915260128152600080516020620029c9833981519152602082015290151562000c835760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b505050600155565b6000805160206200296983398151915281565b60006000805160206200296983398151915262000ccb6000805160206200298983398151915285620015de565b62000cdd3330846200078985620015ec565b6040805180820190915260128152600080516020620029c9833981519152602082015290151562000d555760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506040805160008082526020820190925262000b8d9187918791620010f9565b600080600062000d858462000ab0565b60408051808201909152601281527f5245434f5645525f444953414c4c4f5745440000000000000000000000000000602082015290151562000e0e5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b5062000e196200070d565b925062000e2683620018a9565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e5452414354000000000000602082015290151562000eaf5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50600160a060020a038416151562000f035760405130319250600160a060020a0384169083156108fc029084906000818181858888f1935050505015801562000efc573d6000803e3d6000fd5b5062000fc9565b508262000f20600160a060020a0382163063ffffffff620018d816565b915062000f3e600160a060020a038216848463ffffffff620019f216565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c4544000000602082015290151562000fc75760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b60008051602062002969833981519152620010368484620015de565b620010483330846200078985620015ec565b6040805180820190915260128152600080516020620029c98339815191526020820152901515620010c05760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50620010ce85858562001796565b5050505050565b600091825260208281526040808420928452919052902054600160a060020a031690565b600060008051602062002969833981519152620011266000805160206200298983398151915287620015de565b620011383330846200078985620015ec565b6040805180820190915260128152600080516020620029c98339815191526020820152901515620011b05760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50620011cd600080516020620029898339815191528888620015f6565b6200086e3088875b600080848484620011e562001b5c565b600160a060020a038416815260208082018490526060604083018181528451918401919091528351909160808401919085019080838360005b83811015620012385781810151838201526020016200121e565b50505050905090810190601f168015620012665780820380516001836020036101000a031916815260200191505b50945050505050604051809103906000f0801580156200128a573d6000803e3d6000fd5b5060408051600160a060020a03831681526000602082015280820187905290519192507fd880e726dced8808d727f02dd0e6fdd3a945b24bfee77e13367bcbe61ddbaf47919081900360600190a1949350505050565b6000805160206200298983398151915290565b600062000bc9600080516020620029e9833981519152600080516020620029a9833981519152620010d5565b60006000196200132e62000b9c565b14905090565b604080516000808252602082019092526200135390849084906200136d565b9392505050565b600080516020620029a983398151915290565b6000808484846200137d62001b6d565b600160a060020a038416815260208082018490526060604083018181528451918401919091528351909160808401919085019080838360005b83811015620013d0578181015183820152602001620013b6565b50505050905090810190601f168015620013fe5780820380516001836020036101000a031916815260200191505b50945050505050604051809103906000f08015801562001422573d6000803e3d6000fd5b5060408051600160a060020a03831681526001602082015280820187905290519192507fd880e726dced8808d727f02dd0e6fdd3a945b24bfee77e13367bcbe61ddbaf47919081900360600190a1949350505050565b60008062001485620012f3565b9050600160a060020a03811615801590620015b157506040517ffdef9106000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483019081528782166024840152604483018790526080606484019081528651608485015286519285169363fdef9106938b938b938b938b9360a490910190602085019080838360005b838110156200153157818101518382015260200162001517565b50505050905090810190601f1680156200155f5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156200158257600080fd5b505af115801562001597573d6000803e3d6000fd5b505050506040513d6020811015620015ae57600080fd5b50515b9695505050505050565b60408051600080825260208201909252620013539084908490620011d5565b4390565b606062001353838362001a76565b8051602002815290565b6000620016048484620010d5565b9050600160a060020a03811615620016b25760408051808201909152601981527f4b45524e454c5f494e56414c49445f4150505f4348414e4745000000000000006020820152600160a060020a0382811690841614620016ab5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50620016bf565b620016bf84848462001796565b50505050565b620016cf62000b9c565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529015620017575760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506200179462001766620015da565b7febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e9063ffffffff62001ad316565b565b620017a181620018a9565b60408051808201909152601781527f4b45524e454c5f4150505f4e4f545f434f4e545241435400000000000000000060208201529015156200182a5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50600083815260208181526040808320858452825291829020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03851690811790915582519081529151849286927f2ec1ae0a449b7ae354b9dacfb3ade6b6332ba26b7fcbb935835fa39dd7263b2392918290030190a3505050565b5490565b600080600160a060020a0383161515620018c75760009150620018d2565b823b90506000811191505b50919050565b60408051600160a060020a0383166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a082310000000000000000000000000000000000000000000000000000000017905260009081806200195a868462001ad7565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f52455645525445440000000060208201529193509150821515620019e85760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b5095945050505050565b60408051600160a060020a038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905260009062000b8d858262001b09565b60408051600280825260608083018452926020830190803883390190505090508281600081518110151562001aa757fe5b60209081029091010152805182908290600190811062001ac357fe5b6020908102909101015292915050565b9055565b6000806000806040516020818751602089018a5afa9250600083111562001afd57805191505b50909590945092505050565b6000806040516020818551602087016000895af1600081111562001b52573d801562001b3e576020811462001b485762001b50565b6001935062001b50565b600183511493505b505b5090949350505050565b6040516106fd8062001b7f83390190565b6040516106ed806200227c833901905600608060405234801561001057600080fd5b506040516106fd3803806106fd8339810160409081528151602083015191830151909201828282600061004b8464010000000061017a810204565b61005d836401000000006101a2810204565b61006f836401000000006101d9810204565b90506000825111156101185761008d816401000000006102a9810204565b151561009857600080fd5b80600160a060020a03168260405180828051906020019080838360005b838110156100cd5781810151838201526020016100b5565b50505050905090810190601f1680156100fa5780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af4915050151561011857600080fd5b50505050610145610137836101d9640100000000026401000000009004565b6401000000006102d6810204565b6101676101596401000000006102fb810204565b6401000000006102a9810204565b151561017257600080fd5b505050610354565b61019f6000805160206106bd8339815191528264010000000061032661032682021704565b50565b61019f7fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b8264010000000061032661032682021704565b60006101ec64010000000061032a810204565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527ff1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f6004820152602481018590529051600160a060020a03929092169163be00bbd8916044808201926020929091908290030181600087803b15801561027757600080fd5b505af115801561028b573d6000803e3d6000fd5b505050506040513d60208110156102a157600080fd5b505192915050565b600080600160a060020a03831615156102c557600091506102d0565b823b90506000811191505b50919050565b61019f6000805160206106dd8339815191528264010000000061032661032682021704565b60006103216000805160206106dd83398151915264010000000061031e61035082021704565b905090565b9055565b60006103216000805160206106bd83398151915264010000000061031e61035082021704565b5490565b61035a806103636000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634555d5c9811461012b57806348a0c8dd146101525780635c60da1b1461017b57806380afdea8146101b9578063d4aae0c4146101ce575b6127107f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea6000825a10156100e15760003411361583541616156100dc576040513381523460208201527f15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1604082a1005b600080fd5b6100e96101e3565b9050610126816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506101f2945050505050565b505050005b34801561013757600080fd5b50610140610233565b60408051918252519081900360200190f35b34801561015e57600080fd5b50610167610238565b604080519115158252519081900360200190f35b34801561018757600080fd5b506101906101e3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101c557600080fd5b50610140610263565b3480156101da57600080fd5b5061019061028e565b60006101ed6102b9565b905090565b60006101fd836102e4565b151561020857600080fd5b612710905060008083516020850186855a03f43d604051816000823e82801561022f578282f35b8282fd5b600190565b60006101ed7f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea61031e565b60006101ed7fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b61031e565b60006101ed7f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b61031e565b60006101ed7fdee64df20d65e53d7f51cb6ab6d921a0a6a638a91e942e1d8d02df28e31c038e61031e565b60008073ffffffffffffffffffffffffffffffffffffffff8316151561030d5760009150610318565b823b90506000811191505b50919050565b5490565b5490565b9055565b90555600a165627a7a723058200a44fcb163e95c6029f007b585c5b1f4a19791176e8b69350961b028fadd9b8800294172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137bdee64df20d65e53d7f51cb6ab6d921a0a6a638a91e942e1d8d02df28e31c038e608060405234801561001057600080fd5b506040516106ed3803806106ed8339810160409081528151602083015191830151909201828282600061004b84640100000000610124810204565b61005d8364010000000061014c810204565b61006f83640100000000610183810204565b90506000825111156101185761008d81640100000000610253810204565b151561009857600080fd5b80600160a060020a03168260405180828051906020019080838360005b838110156100cd5781810151838201526020016100b5565b50505050905090810190601f1680156100fa5780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af4915050151561011857600080fd5b505050505050506102b3565b6101496000805160206106cd833981519152826401000000006103d761028082021704565b50565b6101497fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b826401000000006103d761028082021704565b6000610196640100000000610284810204565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527ff1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f6004820152602481018590529051600160a060020a03929092169163be00bbd8916044808201926020929091908290030181600087803b15801561022157600080fd5b505af1158015610235573d6000803e3d6000fd5b505050506040513d602081101561024b57600080fd5b505192915050565b600080600160a060020a038316151561026f576000915061027a565b823b90506000811191505b50919050565b9055565b60006102aa6000805160206106cd8339815191526401000000006103cf6102af82021704565b905090565b5490565b61040b806102c26000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634555d5c9811461012b57806348a0c8dd146101525780635c60da1b1461017b57806380afdea8146101b9578063d4aae0c4146101ce575b6127107f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea6000825a10156100e15760003411361583541616156100dc576040513381523460208201527f15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1604082a1005b600080fd5b6100e96101e3565b9050610126816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506101fa945050505050565b505050005b34801561013757600080fd5b5061014061023b565b60408051918252519081900360200190f35b34801561015e57600080fd5b50610167610240565b604080519115158252519081900360200190f35b34801561018757600080fd5b506101906101e3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101c557600080fd5b5061014061026b565b3480156101da57600080fd5b50610190610296565b60006101f56101f061026b565b6102c1565b905090565b600061020583610395565b151561021057600080fd5b612710905060008083516020850186855a03f43d604051816000823e828015610237578282f35b8282fd5b600290565b60006101f57f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea6103cf565b60006101f57fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b6103cf565b60006101f57f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b6103cf565b60006102cb610296565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527ff1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f600482015260248101859052905173ffffffffffffffffffffffffffffffffffffffff929092169163be00bbd8916044808201926020929091908290030181600087803b15801561036357600080fd5b505af1158015610377573d6000803e3d6000fd5b505050506040513d602081101561038d57600080fd5b505192915050565b60008073ffffffffffffffffffffffffffffffffffffffff831615156103be57600091506103c9565b823b90506000811191505b50919050565b5490565b5490565b9055565b90555600a165627a7a723058207342d5b39040c05b6485068ac1f0654ea21ac187a3954631eeb55545f938aed100294172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137bb6d92708f3d4817afc106147d969e229ced5c46e65e0a5002a0d391287762bd0f1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0fe3262375f45a6e2026b7e7b18c2b807434f2508fe1a2a3dfb493c7df8f4aad6a4b45524e454c5f415554485f4641494c45440000000000000000000000000000d6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fba165627a7a72305820c3d67a3fbc23ba7a388714030f1747db37b527f814bfe115c1938a4b5ecf1e840029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e"; +export const KernelABI = [ + { + constant: true, + inputs: [], + name: "hasInitialized", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "KERNEL_APP_ID", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "pure", + type: "function", + }, + { + constant: true, + inputs: [], + name: "APP_ADDR_NAMESPACE", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "pure", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getRecoveryVault", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_appId", type: "bytes32" }, + { name: "_appBase", type: "address" }, + { name: "_initializePayload", type: "bytes" }, + { name: "_setDefault", type: "bool" }, + ], + name: "newAppInstance", + outputs: [{ name: "appProxy", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "", type: "bytes32" }, + { name: "", type: "bytes32" }, + ], + name: "apps", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_baseAcl", type: "address" }, + { name: "_permissionsCreator", type: "address" }, + ], + name: "initialize", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "CORE_NAMESPACE", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "pure", + type: "function", + }, + { + constant: true, + inputs: [{ name: "token", type: "address" }], + name: "allowRecoverability", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_appId", type: "bytes32" }, + { name: "_appBase", type: "address" }, + ], + name: "newAppInstance", + outputs: [{ name: "appProxy", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "recoveryVaultAppId", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getInitializationBlock", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [{ name: "_recoveryVaultAppId", type: "bytes32" }], + name: "setRecoveryVaultAppId", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "APP_MANAGER_ROLE", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_appId", type: "bytes32" }, + { name: "_appBase", type: "address" }, + ], + name: "newPinnedAppInstance", + outputs: [{ name: "appProxy", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [{ name: "_token", type: "address" }], + name: "transferToVault", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_namespace", type: "bytes32" }, + { name: "_appId", type: "bytes32" }, + { name: "_app", type: "address" }, + ], + name: "setApp", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_namespace", type: "bytes32" }, + { name: "_appId", type: "bytes32" }, + ], + name: "getApp", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_appId", type: "bytes32" }, + { name: "_appBase", type: "address" }, + { name: "_initializePayload", type: "bytes" }, + { name: "_setDefault", type: "bool" }, + ], + name: "newPinnedAppInstance", + outputs: [{ name: "appProxy", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_kernel", type: "address" }, + { name: "_appId", type: "bytes32" }, + { name: "_initializePayload", type: "bytes" }, + ], + name: "newAppProxyPinned", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "APP_BASES_NAMESPACE", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "pure", + type: "function", + }, + { + constant: true, + inputs: [], + name: "acl", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "isPetrified", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_kernel", type: "address" }, + { name: "_appId", type: "bytes32" }, + ], + name: "newAppProxy", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "DEFAULT_ACL_APP_ID", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "pure", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_kernel", type: "address" }, + { name: "_appId", type: "bytes32" }, + { name: "_initializePayload", type: "bytes" }, + ], + name: "newAppProxy", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_who", type: "address" }, + { name: "_where", type: "address" }, + { name: "_what", type: "bytes32" }, + { name: "_how", type: "bytes" }, + ], + name: "hasPermission", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_kernel", type: "address" }, + { name: "_appId", type: "bytes32" }, + ], + name: "newAppProxyPinned", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ name: "_shouldPetrify", type: "bool" }], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: false, name: "proxy", type: "address" }, + { indexed: false, name: "isUpgradeable", type: "bool" }, + { indexed: false, name: "appId", type: "bytes32" }, + ], + name: "NewAppProxy", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "vault", type: "address" }, + { indexed: true, name: "token", type: "address" }, + { indexed: false, name: "amount", type: "uint256" }, + ], + name: "RecoverToVault", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "namespace", type: "bytes32" }, + { indexed: true, name: "appId", type: "bytes32" }, + { indexed: false, name: "app", type: "address" }, + ], + name: "SetApp", + type: "event", + }, +]; + +export const ACLBytecode = + "0x6080604052620000176401000000006200001d810204565b6200024a565b6200003064010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200010d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016020808201828103835283518152835183929182019185019080838360005b83811015620000d1578181015183820152602001620000b7565b50505050905090810190601f168015620000ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50620001246000196401000000006200015b810204565b565b6000620001568119600160008051602062002df38339815191520216640100000000620021fa6200024282021704565b905090565b6200016e64010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160208082018281038352835181528351839291820191850190808383600083811015620000d1578181015183820152602001620000b7565b506200023f600019600160008051602062002df383398151915202168264010000000062002ac36200024682021704565b50565b5490565b9055565b612b99806200025a6000396000f3006080604052600436106101875763ffffffff60e060020a60003504166301ffc9a7811461018c5780630803fac0146101c55780630808343e146101da57806309699ff5146102075780630a8ed3db1461023257806315949ed7146102685780631b5e75be146102b15780631d63ff2b146103365780632914b9bd1461036657806332f0a3b5146103f05780633d6ab68f146104055780636815c9921461041a5780636d6712d8146104955780637e7db6e1146104cb57806380afdea8146104ec5780638b3dd749146105015780639d0effdb146105165780639d4941d81461054c578063a03c58321461056d578063a1658fad146105ea578063a479e5081461065e578063a5ed8bf814610673578063a885508a14610688578063afd925df146106b3578063b1905727146106e9578063be03847814610714578063c4d66de814610750578063c513f66e14610771578063d4aae0c414610786578063de4796ed1461079b578063f516bc0e146107b0578063f520b58d146107c5578063fdef910614610840575b600080fd5b34801561019857600080fd5b506101ae600160e060020a0319600435166108c2565b604080519115151515825251602090910181900390f35b3480156101d157600080fd5b506101ae6108fb565b3480156101e657600080fd5b5061020560048035600160a060020a0316906020013560001916610926565b005b34801561021357600080fd5b5061020560048035600160a060020a0316906020013560001916610ae8565b34801561023e57600080fd5b50610205600160a060020a0360048035821691602091820180359091169160001991013516610b8e565b34801561027457600080fd5b5061029e600160a060020a0360048035821691602091820180359091169160001991013516610bca565b6040805191825251602090910181900390f35b3480156102bd57600080fd5b5060408051602060048181018083018084018085018035850180358088028089018a01909a528089526101ae99600019883581169a600160a060020a03983589169a973590981698953516963686900386019694850194909381019291829185019084908082843750949750610c199650505050505050565b34801561034257600080fd5b5061034b610c5f565b60408051600019928316909216825251602090910181900390f35b34801561037257600080fd5b506103c8600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949750610c679650505050505050565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b3480156103fc57600080fd5b506103c8610d4d565b34801561041157600080fd5b5061034b610dc5565b34801561042657600080fd5b5060408051600460208181018082018083018035850180358086028087018901909952808852610205988735600160a060020a0390811699963516979435600019169636869003860196948101949381019291829185019084908082843750949750610dda9650505050505050565b3480156104a157600080fd5b506101ae600160a060020a0360048035821691602091820180359091169160001991013516610eb0565b3480156104d757600080fd5b506101ae600160a060020a0360043516610ef9565b3480156104f857600080fd5b5061034b610eff565b34801561050d57600080fd5b5061029e610f36565b34801561052257600080fd5b50610205600160a060020a0360048035821691602091820180359091169160001991013516610f68565b34801561055857600080fd5b50610205600160a060020a036004351661100c565b34801561057957600080fd5b506105a860048035600160a060020a0390811691602090810180359092169181018035600019169101356112a9565b604051808460ff1660ff1681526020018360ff1660ff16815260200182600160f060020a0316600160f060020a03168152602001935050505060405180910390f35b3480156105f657600080fd5b50604080516004602081810180820180358401803580850280860188019098528087526101ae978635600160a060020a0316979435600019169636819003810196909594810194938101929182918501908490808284375094975061133c9650505050505050565b34801561066a57600080fd5b506103c86114b0565b34801561067f57600080fd5b506103c8611561565b34801561069457600080fd5b5061020560048035600160a060020a0316906020013560001916611567565b3480156106bf57600080fd5b50610205600160a060020a0360048035821691602091820180359091169160001991013516611607565b3480156106f557600080fd5b506103c860048035600160a060020a03169060200135600019166116a6565b34801561072057600080fd5b5061020560048035600160a060020a039081169160209081018035831692908201803560001916920135166116e8565b34801561075c57600080fd5b50610205600160a060020a0360043516611866565b34801561077d57600080fd5b5061034b6119bf565b34801561079257600080fd5b506103c86119d4565b3480156107a757600080fd5b506101ae611a06565b3480156107bc57600080fd5b506103c8611a19565b3480156107d157600080fd5b50604080516004602081810180820180830180358501803580860280870189019099528088526101ae988735600160a060020a0390811699963516979435600019169636869003860196948101949381019291829185019084908082843750949750611a1e9650505050505050565b34801561084c57600080fd5b50604080516020601f60048281018084018085018035840180359586018790048702870188019098528487526101ae97600160a060020a0385358116989435169660001993359390931695368690038601959492840193918201918190840183828082843750949750611ae89650505050505050565b60006108cd82611afe565b806108f557506354053e6c60e060020a02600160e060020a03191682600160e060020a031916145b92915050565b600080610906610f36565b90508060001415801561092057508061091d611b1b565b10155b91505090565b600080516020612b2e83398151915260010261096e33826000604051908082528060200260200182016040528015610968578160200160208202803883390190505b5061133c565b60408051808201909152600f81527f4150505f415554485f4641494c454400000000000000000000000000000000006020820152901515610a2d5760405160e560020a62461bcd0281526004016020808201828103835283518152835183929182019185019080838360005b838110156109f25781810151838201526020016109da565b50505050905090810190601f168015610a1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082826000600160a060020a0316610a4583836116a6565b600160a060020a0316146040805190810160405280601481526020017f41434c5f4558495354454e545f4d414e41474552000000000000000000000000815250901515610ad45760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ae160018686611b1f565b5050505050565b8181610af482826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e833981519152815250901515610b7b5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610b8860018585611b1f565b50505050565b610bc58383836000604051908082528060200260200182016040528015610bbf578160200160208202803883390190505b50610dda565b505050565b600060016000806000610bde888888611bb2565b6000191660001916815260200190815260200160002054600019166000191681526020019081526020016000208054905090505b9392505050565b6000600080516020612b0e8339815191526001026000191686600019161415610c4457506001610c56565b610c5386600087878787611cba565b90505b95945050505050565b600060010281565b6000610c716114b0565b600160a060020a03166304bf2a7f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ccf578181015183820152602001610cb7565b50505050905090810190601f168015610cfc5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b505050506040513d6020811015610d4557600080fd5b505192915050565b6000610d576119d4565b600160a060020a03166332f0a3b56040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610d9457600080fd5b505af1158015610da8573d6000803e3d6000fd5b505050506040513d6020811015610dbe57600080fd5b5051905090565b600080516020612b2e83398151915260010281565b60008383610de882826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e833981519152815250901515610e6f5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506000845111610e9057600080516020612b0e833981519152600102610e99565b610e9984611f07565b9250610ea7878787866120d5565b50505050505050565b600060606000604051908082528060200260200182016040528015610edf578160200160208202803883390190505b509050610eee85858584611a1e565b91505b509392505050565b50600190565b6000610f317fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b600102600019166121fa565b905090565b6000610f317febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e600102600019166121fa565b8181610f7482826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e833981519152815250901515610ffb5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ae185858560006001026120d5565b600080600061101a84610ef9565b60408051808201909152601281527f5245434f5645525f444953414c4c4f5745440000000000000000000000000000602082015290151561109d5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506110a6610d4d565b92506110b183612202565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e545241435400000000000060208201529015156111345760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506000600160a060020a031684600160a060020a0316141561119c5730600160a060020a031631915082600160a060020a03166108fc839081150290604051600060405180830381858888f19350505050158015611196573d6000803e3d6000fd5b50611258565b50826111b7600160a060020a0382163063ffffffff61223a16565b91506111d3600160a060020a038216848463ffffffff61232516565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c454400000060208201529015156112565760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b600080600080600160008060006112c18c8c8c611bb2565b600019166000191681526020019081526020016000205460001916600019168152602001908152602001600020858154811015156112fb57fe5b6000918252602082200181015461010091820a810460ff9081169b6001840a83049091169a50600290920a9004600160f060020a0316975095505050505050565b6000806113476108fb565b15156113565760009150610ef1565b61135e6119d4565b90506000600160a060020a031681600160a060020a031614156113845760009150610ef1565b80600160a060020a031663fdef910686308761139f88612382565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561142c578181015183820152602001611414565b50505050905090810190601f1680156114595780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561147b57600080fd5b505af115801561148f573d6000803e3d6000fd5b505050506040513d60208110156114a557600080fd5b505195945050505050565b6000806114bb6119d4565b600160a060020a031663be00bbd87fd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb6001027fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd616001026040518363ffffffff1660e060020a028152600401808360001916600019168152602001826000191660001916815260200192505050602060405180830381600087803b158015610d1b57600080fd5b60001981565b818161157382826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e8339815191528152509015156115fa5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610b8860008585611b1f565b818161161382826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e83398151915281525090151561169a5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ae1858585611b1f565b6000600260006116b6858561238c565b6000191660001916815260200190815260200160002060009054906101000a9004600160a060020a0316905092915050565b600080516020612b2e83398151915260010261172f33826000604051908082528060200260200182016040528015610968578160200160208202803883390190505061133c565b60408051808201909152600f81527f4150505f415554485f4641494c4544000000000000000000000000000000000060208201529015156117b25760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5083836000600160a060020a03166117ca83836116a6565b600160a060020a0316146040805190810160405280601481526020017f41434c5f4558495354454e545f4d414e414745520000000000000000000000008152509015156118595760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ea78787878761246a565b61186e610f36565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156118f45760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506118fd612492565b6119056119d4565b600160a060020a031633600160a060020a0316146040805190810160405280601481526020017f41434c5f415554485f494e49545f4b45524e454c00000000000000000000000081525090151561199e5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506119bc8130600080516020612b2e8339815191526001028461246a565b50565b600080516020612b0e83398151915260010281565b6000610f317f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b600102600019166121fa565b6000600019611a13610f36565b14905090565b600181565b6000806000806000611a31898989611bb2565b60001916600019168152602001908152602001600020549150600060010260001916826000191614158015611a6e5750611a6e8288888888610c19565b15611a7c5760019250611ade565b600080611a8c6000198989611bb2565b60001916600019168152602001908152602001600020549050600060010260001916816000191614158015611acb5750611acb81600019888888610c19565b15611ad95760019250611ade565b600092505b5050949350505050565b6000610c56858585611af986612562565b611a1e565b6301ffc9a760e060020a02600160e060020a031990811691161490565b4390565b8260026000611b2e858561238c565b6000191660001916815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a0316021790555082600160a060020a0316816000191683600160a060020a03167ff3addc8b8e25ee11528a61b0e65092cae0666ef0ec0c64cb303993c88d689b4d60405160405180910390a4505050565b600083838360405160200180807f5045524d495353494f4e00000000000000000000000000000000000000000000815250600a0184600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140183600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401826000191660001916815260200193505050506040516020818303038152906040526040518082805190602001908083835b602083101515611c855780518252602092839003929182019101611c66565b51815160016020949094036101000a939093039283169219169190911790526040519201829003909120979650505050505050565b6000611cc4612adc565b60008019808a161681526001602080830191825201812054819063ffffffff8a16101515611cf55760009350611efa565b600160008b600019166000191681526020019081526020016000208963ffffffff16815481101515611d2357fe5b600091825260208083206040805160608101909152920183015460ff61010085810a830482168216821685526001810a8304821682168216858501908152600160f060020a03600290920a9093048116811616919092015291810151909450811660cc9091161415611da457611d9d838b8a8a8a8a612609565b9350611efa565b8260400151600160f060020a0316905060cb60ff16836000015160ff161415611df457611dd88360400151898989896127e8565b611de3576000611de6565b60015b60ff16915060019050611e9e565b60c860ff16836000015160ff161415611e1657611e0f611b1b565b9150611e9e565b60c960ff16836000015160ff161415611e3157611e0f61292b565b60cd60ff16836000015160ff161415611e59578260400151600160f060020a03169150611e9e565b8451836000015160ff16101515611e735760009350611efa565b84836000015160ff16815181101515611e8857fe5b90602001906020020151600160f060020a031691505b6007600c811115611eab57fe5b836020015160ff16600c811115611ebe57fe5b600c811115611ec957fe5b1415611eda57600082119350611efa565b611ef782846020015160ff16600c811115611ef157fe5b8361292f565b93505b5050509695505050505050565b6000806000806000611f17612adc565b8660405160200180828051906020019060200280838360005b83811015611f48578181015183820152602001611f30565b505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083101515611f905780518252602092839003929182019101611f71565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020945060016000866000191660001916815260200190815260200160002093508380549050600014156120ca57600092505b86518310156120ca57868381518110151561200557fe5b90602001906020020151915060606040519081016040528061202684612a2e565b60ff16815260200161203784612a38565b60ff9081168252600160f060020a0380861660209384015287546001908101808a5560008a8152858120818801519284900301810180549688015160408901518616600261010090810a918202919097021991881686880a908102908902199589169490970a93840293909702199097169190911791909116929092179390931691909117905593909301929050611fee565b509295945050505050565b600080826000806120e7898989611bb2565b60001916600019168152602001908152602001600020816000191690555060006001026000191683600019161415915081801561213d5750600080516020612b0e83398151915260010260001916836000191614155b9050836000191685600160a060020a031687600160a060020a03167f759b9a74d5354b5801710a0c1b283cc9f0d32b607ac8ced10c83ac8e75c77d5285604051808215151515815260200191505060405180910390a480156121f257836000191685600160a060020a031687600160a060020a03167f8dfee25d92d73b8c9b868f9fa3e215cc1981033f426e53803e3da4f09a2cfc308660405180826000191660001916815260200191505060405180910390a45b505050505050565b5490565b5490565b6000806000600160a060020a031683600160a060020a031614156122295760009150612234565b823b90506000811191505b50919050565b60408051600160a060020a0383811616602490910190815281516020918201818103839003825290925281018051600160e060020a03908116901960e060020a6370a08231021617905260009081806122938684612a42565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f5245564552544544000000006020820152919350915082151561231b5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5095945050505050565b60408051600160a060020a0380851616602490910190815260209081018381528251908201818103839003825290925281018051600160e060020a03908116901960e060020a63a9059cbb0216179052600090610eee8582612a73565b8051602002815290565b6000828260405160200180807f524f4c450000000000000000000000000000000000000000000000000000000081525060040183600160a060020a0316600160a060020a03166c010000000000000000000000000281526014018260001916600019168152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831015156124365780518252602092839003929182019101612417565b51815160016020949094036101000a9390930392831692191691909117905260405192018290039091209695505050505050565b612487848484600080516020612b0e8339815191526001026120d5565b610b88818484611b1f565b61249a610f36565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156125205760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5061256061252c611b1b565b60001960017febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e02169063ffffffff612ac316565b565b606060006020835181151561257357fe5b049050806020028351146040805190810160405280601a81526020017f434f4e56455253494f4e5f494d50524f5045525f4c454e4754480000000000008152509015156126025760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5082525090565b6000806000806000806000806000600c8081111561262357fe5b8f6020015160ff16600c81111561263657fe5b600c81111561264157fe5b14156126955761265d8f60400151600160f060020a0316612ac7565b919950975095506126728e898f8f8f8f611cba565b945061268e8e866126835787612685565b885b8f8f8f8f611cba565b98506127d6565b6126ab8f60400151600160f060020a0316612ac7565b5090945092506126bf8e858f8f8f8f611cba565b91506008600c8111156126ce57fe5b8f6020015160ff16600c8111156126e157fe5b600c8111156126ec57fe5b14156126fb57811598506127d6565b8180156127305750600a600c81111561271057fe5b8f6020015160ff16600c81111561272357fe5b600c81111561272e57fe5b145b1561273e57600198506127d6565b8115801561277457506009600c81111561275457fe5b8f6020015160ff16600c81111561276757fe5b600c81111561277257fe5b145b1561278257600098506127d6565b6127908e848f8f8f8f611cba565b9050600b600c81111561279f57fe5b8f6020015160ff16600c8111156127b257fe5b600c8111156127bd57fe5b14156127d257801515821515141598506127d6565b8098505b50505050505050509695505050505050565b600080606060008060008a600160a060020a0316632a151090905060e060020a029450848a8a8a8a6040516024018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015612891578181015183820152602001612879565b505050509050019550505050505060405160208183030381529060405290600160e060020a031916602082018051600160e060020a03838183161783525050505093506000808551602087018e5afa92508215156128f2576000955061291d565b3d9150816020141515612908576000955061291d565b604051826000823e8051915060008152508095505b505050505095945050505050565b4290565b60006001600c81111561293e57fe5b83600c81111561294a57fe5b14156129595750828114610c12565b6002600c81111561296657fe5b83600c81111561297257fe5b1415612982575082811415610c12565b6003600c81111561298f57fe5b83600c81111561299b57fe5b14156129aa5750808311610c12565b6004600c8111156129b757fe5b83600c8111156129c357fe5b14156129d25750808310610c12565b6005600c8111156129df57fe5b83600c8111156129eb57fe5b14156129fb575080831015610c12565b6006600c811115612a0857fe5b83600c811115612a1457fe5b1415612a24575080831115610c12565b5060009392505050565b60f860020a900490565b60f060020a900490565b6000806000806040516020818751602089018a5afa92506000831115612a6757805191505b50909590945092505050565b6000806040516020818551602087016000895af16000811115612ab9573d60008114612aa65760208114612aaf57612ab7565b60019350612ab7565b600183511493505b505b5090949350505050565b9055565b906020600290810a830491604090910a830490565b606060405190810160405280600060ff168152602001600060ff1681526020016000600160f060020a0316815250905600290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630b719b33c83b8e5d300c521cb8b54ae9bd933996a14bef8c2f4e0285d2d2400a41434c5f415554485f4e4f5f4d414e4147455200000000000000000000000000a165627a7a72305820ea4b7195f16bf7d48dfc10281c5f524cb5ebad276e463c345659b85b24e26df90029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e"; +export const ACLABI = [ + { + constant: true, + inputs: [{ name: "_interfaceId", type: "bytes4" }], + name: "supportsInterface", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "pure", + type: "function", + }, + { + constant: true, + inputs: [], + name: "hasInitialized", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "createBurnedPermission", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "burnPermissionManager", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_entity", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "grantPermission", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_entity", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "getPermissionParamsLength", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_paramsHash", type: "bytes32" }, + { name: "_who", type: "address" }, + { name: "_where", type: "address" }, + { name: "_what", type: "bytes32" }, + { name: "_how", type: "uint256[]" }, + ], + name: "evalParams", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "NO_PERMISSION", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [{ name: "_script", type: "bytes" }], + name: "getEVMScriptExecutor", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getRecoveryVault", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "CREATE_PERMISSIONS_ROLE", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_entity", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + { name: "_params", type: "uint256[]" }, + ], + name: "grantPermissionP", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_who", type: "address" }, + { name: "_where", type: "address" }, + { name: "_what", type: "bytes32" }, + ], + name: "hasPermission", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [{ name: "token", type: "address" }], + name: "allowRecoverability", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "appId", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getInitializationBlock", + outputs: [{ name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_entity", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "revokePermission", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [{ name: "_token", type: "address" }], + name: "transferToVault", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_entity", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + { name: "_index", type: "uint256" }, + ], + name: "getPermissionParam", + outputs: [ + { name: "", type: "uint8" }, + { name: "", type: "uint8" }, + { name: "", type: "uint240" }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_sender", type: "address" }, + { name: "_role", type: "bytes32" }, + { name: "_params", type: "uint256[]" }, + ], + name: "canPerform", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "getEVMScriptRegistry", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "ANY_ENTITY", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "removePermissionManager", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_newManager", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "setPermissionManager", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + ], + name: "getPermissionManager", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { name: "_entity", type: "address" }, + { name: "_app", type: "address" }, + { name: "_role", type: "bytes32" }, + { name: "_manager", type: "address" }, + ], + name: "createPermission", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [{ name: "_permissionsCreator", type: "address" }], + name: "initialize", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "EMPTY_PARAM_HASH", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "kernel", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "isPetrified", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "BURN_ENTITY", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_who", type: "address" }, + { name: "_where", type: "address" }, + { name: "_what", type: "bytes32" }, + { name: "_how", type: "uint256[]" }, + ], + name: "hasPermission", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { name: "_who", type: "address" }, + { name: "_where", type: "address" }, + { name: "_what", type: "bytes32" }, + { name: "_how", type: "bytes" }, + ], + name: "hasPermission", + outputs: [{ name: "", type: "bool" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "entity", type: "address" }, + { indexed: true, name: "app", type: "address" }, + { indexed: true, name: "role", type: "bytes32" }, + { indexed: false, name: "allowed", type: "bool" }, + ], + name: "SetPermission", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "entity", type: "address" }, + { indexed: true, name: "app", type: "address" }, + { indexed: true, name: "role", type: "bytes32" }, + { indexed: false, name: "paramsHash", type: "bytes32" }, + ], + name: "SetPermissionParams", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "app", type: "address" }, + { indexed: true, name: "role", type: "bytes32" }, + { indexed: true, name: "manager", type: "address" }, + ], + name: "ChangePermissionManager", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "executor", type: "address" }, + { indexed: false, name: "script", type: "bytes" }, + { indexed: false, name: "input", type: "bytes" }, + { indexed: false, name: "returnData", type: "bytes" }, + ], + name: "ScriptResult", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "vault", type: "address" }, + { indexed: true, name: "token", type: "address" }, + { indexed: false, name: "amount", type: "uint256" }, + ], + name: "RecoverToVault", + type: "event", + }, +]; + +export const EVMScriptRegistryFactoryBytecode = + "0x608060405234801561001057600080fd5b506100196100ab565b604051809103906000f080158015610035573d6000803e3d6000fd5b506000806101000a815481600160a060020a030219169083600160a060020a031602179055506100636100bb565b604051809103906000f08015801561007f573d6000803e3d6000fd5b50600160006101000a815481600160a060020a030219169083600160a060020a031602179055506100cb565b604051611a31806107b083390190565b604051610a60806121e183390190565b6106d6806100da6000396000f30060806040526004361061003d5763ffffffff60e060020a600035041663127d679c8114610042578063334041431461007f5780634de50a3a146100a0575b600080fd5b34801561004e57600080fd5b506100576100b5565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b34801561008b57600080fd5b50610057600160a060020a03600435166100cd565b3480156100ac57600080fd5b50610057610693565b6000809054906101000a9004600160a060020a031681565b60006060600082600160a060020a0316638129fc1c905060e060020a02604051602401604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050915083600160a060020a031663c050a7a67fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd616001026000809054906101000a9004600160a060020a03168560016040518563ffffffff1660e060020a02815260040180856000191660001916815260200184600160a060020a0316600160a060020a031681526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610219578181015183820152602001610201565b50505050905090810190601f1680156102465780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561026857600080fd5b505af115801561027c573d6000803e3d6000fd5b505050506040513d602081101561029257600080fd5b50516040805163de28735963ffffffff811660e060020a0282529151929550600160a060020a0387169260049091019060209080830381600087803b1580156102da57600080fd5b505af11580156102ee573d6000803e3d6000fd5b505050506040513d602081101561030457600080fd5b8101908080519060200190929190505050905080600160a060020a031663be038478308586600160a060020a03166319f3d10f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561036657600080fd5b505af115801561037a573d6000803e3d6000fd5b505050506040513d602081101561039057600080fd5b50516040805160e060020a63ffffffff8716028152600160a060020a03948516851660049091019081529284168416602093840190815260008019938416909316908401908152308516909416938301938452519290910191808303818387803b1580156103fd57600080fd5b505af1158015610411573d6000803e3d6000fd5b5050505082600160a060020a03166387a16f12600160009054906101000a9004600160a060020a03166040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561048557600080fd5b505af1158015610499573d6000803e3d6000fd5b505050506040513d60208110156104af57600080fd5b5050604080516319f3d10f63ffffffff811660e060020a0282529151600160a060020a0384811693639d0effdb9330938993841692916004019060209080830381600087803b15801561050157600080fd5b505af1158015610515573d6000803e3d6000fd5b505050506040513d602081101561052b57600080fd5b50516040805160e060020a63ffffffff8716028152600160a060020a039485168516600490910190815292841690931660209283019081526000801992831690921690830190815292519290910191808303818387803b15801561058e57600080fd5b505af11580156105a2573d6000803e3d6000fd5b5050505080600160a060020a031663a885508a8485600160a060020a03166319f3d10f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b505050506040513d602081101561061e57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a0393841690931660049093019283526000801992831690921660209384019081529051920191808303818387803b15801561067457600080fd5b505af1158015610688573d6000803e3d6000fd5b505050505050919050565b60015460006101000a9004600160a060020a0316815600a165627a7a72305820c23f76b24685d8f2399b5dc4dc464c727fbad20be073d9d432147925f1a02f3f00296080604052620000176401000000006200001d810204565b6200024a565b6200003064010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200010d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016020808201828103835283518152835183929182019185019080838360005b83811015620000d1578181015183820152602001620000b7565b50505050905090810190601f168015620000ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50620001246000196401000000006200015b810204565b565b6000620001568119600160008051602062001a118339815191520216640100000000620014546200024282021704565b905090565b6200016e64010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160208082018281038352835181528351839291820191850190808383600083811015620000d1578181015183820152602001620000b7565b506200023f600019600160008051602062001a11833981519152021682640100000000620016fe6200024682021704565b50565b5490565b9055565b6117b7806200025a6000396000f3006080604052600436106100f85763ffffffff60e060020a60003504166301ffc9a781146100fd57806304bf2a7f146101365780630803fac0146101c057806319f3d10f146101d55780632914b9bd1461020557806332f0a3b5146102675780635ca4d4bb1461027c5780637e7db6e11461029657806380afdea8146102b75780638129fc1c146102cc57806387a16f12146102e15780638b3dd749146103155780639d4941d81461032a578063a1658fad1461034b578063a479e508146103bf578063bd8fde1c146103d4578063cff606a0146103e9578063d4aae0c414610401578063de4796ed14610416578063f97a05df1461042b575b600080fd5b34801561010957600080fd5b5061011f600160e060020a031960043516610476565b604080519115151515825251602090910181900390f35b34801561014257600080fd5b50610198600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509497506104af9650505050505050565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b3480156101cc57600080fd5b5061011f6105e0565b3480156101e157600080fd5b506101ea61060b565b60408051600019928316909216825251602090910181900390f35b34801561021157600080fd5b50610198600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509497506106329650505050505050565b34801561027357600080fd5b50610198610718565b34801561028857600080fd5b50610294600435610790565b005b3480156102a257600080fd5b5061011f600160a060020a036004351661096c565b3480156102c357600080fd5b506101ea610972565b3480156102d857600080fd5b506102946109a9565b3480156102ed57600080fd5b50610302600160a060020a0360043516610a47565b6040805191825251602090910181900390f35b34801561032157600080fd5b50610302610bd3565b34801561033657600080fd5b50610294600160a060020a0360043516610c05565b34801561035757600080fd5b506040805160046020818101808201803584018035808502808601880190985280875261011f978635600160a060020a03169794356000191696368190038101969095948101949381019291829185019084908082843750949750610ea29650505050505050565b3480156103cb57600080fd5b50610198611018565b3480156103e057600080fd5b506101ea6110c9565b3480156103f557600080fd5b506102946004356110f0565b34801561040d57600080fd5b50610198611364565b34801561042257600080fd5b5061011f611396565b34801561043757600080fd5b506104436004356113a9565b6040518083600160a060020a0316600160a060020a03168152602001821515151581526020019250505060405180910390f35b6000610481826113d8565b806104a957506354053e6c60e060020a02600160e060020a03191682600160e060020a031916145b92915050565b60008060006004845110156040805190810160405280601e81526020017f45564d5245475f5343524950545f4c454e4754485f544f4f5f53484f5254000081525090151561057b5760405160e560020a62461bcd0281526004016020808201828103835283518152835183929182019185019080838360005b83811015610540578181015183820152602001610528565b50505050905090810190601f16801561056d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50610585846113f5565b63ffffffff1691506001600083815260200190815260200160002090508060000160149054906101000a900460ff166105bf5760006105d8565b8060000160009054906101000a9004600160a060020a03165b949350505050565b6000806105eb610bd3565b905080600014158015610605575080610602611402565b10155b91505090565b7fc4e90f38eea8c4212a009ca7b8947943ba4d4a58d19b683417f65291d1cd9ed260010281565b600061063c611018565b600160a060020a03166304bf2a7f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561069a578181015183820152602001610682565b50505050905090810190601f1680156106c75780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156106e657600080fd5b505af11580156106fa573d6000803e3d6000fd5b505050506040513d602081101561071057600080fd5b505192915050565b6000610722611364565b600160a060020a03166332f0a3b56040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561075f57600080fd5b505af1158015610773573d6000803e3d6000fd5b505050506040513d602081101561078957600080fd5b5051905090565b60007ff7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa36001026107bf83611406565b6107ca338383610ea2565b60408051808201909152600f81527f4150505f415554485f4641494c45440000000000000000000000000000000000602082015290151561084d5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506001600085815260200190815260200160002092508260000160149054906101000a900460ff166040805190810160405280601881526020017f45564d5245475f4558454355544f525f44495341424c454400000000000000008152509015156108fa5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b5060008360000160146101000a81548160ff0219169083151502179055508260000160009054906101000a9004600160a060020a0316600160a060020a0316847fc13cd9238f8ab1e5ab1f95cde77e89288fe5c328d04739adffd57b144b408fd160405160405180910390a350505050565b50600190565b60006109a47fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b60010260001916611454565b905090565b6109b1610bd3565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152906000141515610a375760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b50610a40611458565b6001600055565b6000807fc4e90f38eea8c4212a009ca7b8947943ba4d4a58d19b683417f65291d1cd9ed2600102610aa433826000604051908082528060200260200182016040528015610a9e578160200160208202803883390190505b50610ea2565b60408051808201909152600f81527f4150505f415554485f4641494c454400000000000000000000000000000000006020820152901515610b275760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506000805460018082018355604080518082018252600160a060020a03808a16808352841515602080850191825287895280890196875295909501872092870151928701805495511515601461010090810a91820260ff9092021995851699900a98890298909302199095169690961791909116179091555190935083907f7697fa3288629310075a63816e294207c84f3cfc18ccf8e18eb917ec0bb566999080800390a35092915050565b60006109a47febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e60010260001916611454565b6000806000610c138461096c565b60408051808201909152601281527f5245434f5645525f444953414c4c4f57454400000000000000000000000000006020820152901515610c965760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b50610c9f610718565b9250610caa8361152c565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e54524143540000000000006020820152901515610d2d5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506000600160a060020a031684600160a060020a03161415610d955730600160a060020a031631915082600160a060020a03166108fc839081150290604051600060405180830381858888f19350505050158015610d8f573d6000803e3d6000fd5b50610e51565b5082610db0600160a060020a0382163063ffffffff61156416565b9150610dcc600160a060020a038216848463ffffffff61164f16565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c45440000006020820152901515610e4f5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b600080610ead6105e0565b1515610ebc5760009150611010565b610ec4611364565b90506000600160a060020a031681600160a060020a03161415610eea5760009150611010565b80600160a060020a031663fdef9106863087610f05886116b5565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610f92578181015183820152602001610f7a565b50505050905090810190601f168015610fbf5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b505050506040513d602081101561100b57600080fd5b505191505b509392505050565b600080611023611364565b600160a060020a031663be00bbd87fd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb6001027fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd616001026040518363ffffffff1660e060020a028152600401808360001916600019168152602001826000191660001916815260200192505050602060405180830381600087803b1580156106e657600080fd5b7ff7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa360010281565b60007ff7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa360010261111f83611406565b61112a338383610ea2565b60408051808201909152600f81527f4150505f415554485f4641494c4544000000000000000000000000000000000060208201529015156111ad5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b50836000811180156111c0575060005481105b60408051808201909152601a81527f45564d5245475f494e4558495354454e545f4558454355544f5200000000000060208201529015156112435760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506001600086815260200190815260200160002093508360000160149054906101000a900460ff16156040805190810160405280601781526020017f45564d5245475f4558454355544f525f454e41424c45440000000000000000008152509015156112f15760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b5060018460000160146101000a81548160ff0219169083151502179055508360000160009054906101000a9004600160a060020a0316600160a060020a0316857f7697fa3288629310075a63816e294207c84f3cfc18ccf8e18eb917ec0bb5669960405160405180910390a35050505050565b60006109a47f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b60010260001916611454565b60006000196113a3610bd3565b14905090565b600160205260009081526040812081015461010091820a8104600160a060020a0316916014900a900460ff1682565b6301ffc9a760e060020a02600160e060020a031990811691161490565b60006104a98260006116bf565b4390565b60606001604051908082528060200260200182016040528015611433578160200160208202803883390190505b5090508181600081518110151561144657fe5b602090810291010152919050565b5490565b611460610bd3565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156114e65760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506115266114f2611402565b60001960017febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e02169063ffffffff6116fe16565b565b5490565b6000806000600160a060020a031683600160a060020a03161415611553576000915061155e565b823b90506000811191505b50919050565b60408051600160a060020a0383811616602490910190815281516020918201818103839003825290925281018051600160e060020a03908116901960e060020a6370a08231021617905260009081806115bd8684611702565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f524556455254454400000000602082015291935091508215156116455760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b5095945050505050565b60408051600160a060020a0380851616602490910190815260209081018381528251908201818103839003825290925281018051600160e060020a03908116901960e060020a63a9059cbb02161790526000906116ac8582611733565b95945050505050565b8051602002815290565b6000806116cc8484611783565b60e060020a7fffffffff0000000000000000000000000000000000000000000000000000000090911604949350505050565b9055565b6000806000806040516020818751602089018a5afa9250600083111561172757805191505b50909590945092505050565b6000806040516020818551602087016000895af16000811115611779573d60008114611766576020811461176f57611777565b60019350611777565b600183511493505b505b5090949350505050565b6020010151905600a165627a7a72305820b03bf6da24af4735020436b780c3cfa6fab0f186d8b2a4a1d675e5a5bda0cf7e0029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e608060405261001564010000000061001a810204565b610232565b61002b64010000000061011b810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152906000141515610104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016020808201828103835283518152835183929182019185019080838360005b838110156100c95781810151838201526020016100b1565b50505050905090810190601f1680156100f65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5061011960001964010000000061014c810204565b565b600061014781196001600080516020610a4083398151915202166401000000006107c361022a82021704565b905090565b61015d64010000000061011b810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156101fa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401602080820182810383528351815283518392918201918501908083836000838110156100c95781810151838201526020016100b1565b506102276000196001600080516020610a408339815191520216826401000000006107cf61022e82021704565b50565b5490565b9055565b6107ff806102416000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630803fac08114610071578063279cea351461009d5780638333d9b2146101505780638b3dd74914610180578063de4796ed146101a8575b600080fd5b34801561007d57600080fd5b506100866101bd565b604080519115151515825251602090910181900390f35b3480156100a957600080fd5b506100db60048035810160208181019291359181810180358201808401939035929181013590910190810190356101e8565b6040516020808201828103835283518152835183929182019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101656106ba565b60408051600019928316909216825251602090910181900390f35b34801561018c57600080fd5b506101956106e1565b6040805191825251602090910181900390f35b3480156101b457600080fd5b50610086610718565b6000806101c86106e1565b9050806000141580156101e25750806101df61072b565b10155b91505090565b606060008060008060008060006101fd6101bd565b60408051808201909152601481527f494e49545f4e4f545f494e495449414c495a454400000000000000000000000060208201529015156102bc5760405160e560020a62461bcd0281526004016020808201828103835283518152835183929182019185019080838360005b83811015610281578181015183820152602001610269565b50505050905090810190601f1680156102ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600496505b8c8710156106a95760408051808201909152601781527f45564d43414c4c535f494e56414c49445f4c454e47544800000000000000000060208201526018888f03101515156103535760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610281578181015183820152602001610269565b50610397878f8f8080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff61072f1692505050565b9550600094505b888510156104915789898681811015156103b457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156040805190810160405280601981526020017f45564d43414c4c535f424c41434b4c49535445445f43414c4c000000000000008152509015156104855760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610281578181015183820152602001610269565b5060019094019361039e565b8573ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f9dcff9d94fbfdb4622d11edb383005f95e78efb446c72d92f8e615c6025c470360405160405180910390a4610548876014018f8f8080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6107641692505050565b63ffffffff16935086601401600401925061059c838f8f8080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6107bc1692505050565b60408051808201909152601781527f45564d43414c4c535f494e56414c49445f4c454e475448000000000000000000602082015284860198509092508d881115151561062a5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610281578181015183820152602001610269565b50600080858460008a6113885a03f190508060008114610649576106a3565b6040513d6000811461065e573d6000833e3d82fd5b60e560020a62461bcd02825260206004830152601660248301527f45564d43414c4c535f43414c4c5f5245564552544544000000000000000000006044830152606482fd5b506102c2565b505050505050509695505050505050565b60017f2dc858a00f3e417be1394b87c07158e989ec681ce8cc68a9093680ac1a8703020290565b60006107137febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e600102600019166107c3565b905090565b60006000196107256106e1565b14905090565b4390565b60008061073c84846107c7565b6c010000000000000000000000006bffffffffffffffffffffffff1990911604949350505050565b60008061077184846107c7565b7c01000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000090911604949350505050565b6020010190565b5490565b602001015190565b90555600a165627a7a7230582036ed5b0abc077894d617a4f7b362ad245a2bd5c0ab23014001effae373a3c01d0029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e"; +export const EVMScriptRegistryFactoryABI = [ + { + constant: true, + inputs: [], + name: "baseReg", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [{ name: "_dao", type: "address" }], + name: "newEVMScriptRegistry", + outputs: [{ name: "reg", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "baseCallScript", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + inputs: [], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, +]; + +export const DAOFactoryBytecode = + "0x608060405234801561001057600080fd5b506040516060806110d2833981016040528051602091820180519201519091906000600160a060020a0390811690821614151561006f5780600260006101000a815481600160a060020a030219169083600160a060020a031602179055505b5060008054600160a060020a0393841661010083900a908102858202199283161790925560018054939094169091029116179055611020806100b26000396000f3006080604052600436106100485763ffffffff60e060020a600035041663086b339e811461004d578063216874441461008a578063656362b5146100ab578063b16dd130146100c0575b600080fd5b34801561005957600080fd5b506100626100d5565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b34801561009657600080fd5b50610062600160a060020a03600435166100ec565b3480156100b757600080fd5b50610062610a57565b3480156100cc57600080fd5b50610062610a6e565b60015460006101000a9004600160a060020a031681565b6000806000806000806000809054906101000a9004600160a060020a0316610112610a86565b8082600160a060020a0316600160a060020a03168152602001915050604051809103906000f08015801561014a573d6000803e3d6000fd5b5094506000600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a031614156102245784600160a060020a031663485cc955600160009054906101000a9004600160a060020a0316896040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182600160a060020a0316600160a060020a0316815260200192505050600060405180830381600087803b15801561020757600080fd5b505af115801561021b573d6000803e3d6000fd5b50505050610a0e565b84600160a060020a031663485cc955600160009054906101000a9004600160a060020a0316306040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182600160a060020a0316600160a060020a0316815260200192505050600060405180830381600087803b1580156102ae57600080fd5b505af11580156102c2573d6000803e3d6000fd5b5050505084600160a060020a031663de2873596040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d602081101561032e57600080fd5b505160408051633d6ab68f63ffffffff811660e060020a0282529151929650600160a060020a0387169260049091019060209080830381600087803b15801561037657600080fd5b505af115801561038a573d6000803e3d6000fd5b505050506040513d60208110156103a057600080fd5b505160408051638ea8dc9d63ffffffff811660e060020a0282529151929550600160a060020a0388169260049091019060209080830381600087803b1580156103e857600080fd5b505af11580156103fc573d6000803e3d6000fd5b505050506040513d602081101561041257600080fd5b505160025460408051630a8ed3db63ffffffff811660e060020a028252600160a060020a03600061010081900a9095048116811681166004909301928352898116908116602093840190815285198a8116169084019081529351959750949093929091019190808303818387803b15801561048c57600080fd5b505af11580156104a0573d6000803e3d6000fd5b5050505083600160a060020a031663be038478600260009054906101000a9004600160a060020a03168785306040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200182600160a060020a0316600160a060020a03168152602001945050505050600060405180830381600087803b15801561055857600080fd5b505af115801561056c573d6000803e3d6000fd5b50505050600260009054906101000a9004600160a060020a0316600160a060020a03166333404143866040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156105e057600080fd5b505af11580156105f4573d6000803e3d6000fd5b505050506040513d602081101561060a57600080fd5b505160408051600160a060020a0380841616815290519192507f1a40224412580c1ae5a2fbe8029a565f49a3a029608a8fd9320b32477f31457991602090910181900390a183600160a060020a0316639d0effdb600260009054906101000a9004600160a060020a031687856040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b5050505083600160a060020a031663a885508a86846040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a03168152602001826000191660001916815260200192505050600060405180830381600087803b15801561076c57600080fd5b505af1158015610780573d6000803e3d6000fd5b5050505083600160a060020a0316639d0effdb600260009054906101000a9004600160a060020a031686866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b15801561081e57600080fd5b505af1158015610832573d6000803e3d6000fd5b5050505083600160a060020a0316639d0effdb3086866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b1580156108bb57600080fd5b505af11580156108cf573d6000803e3d6000fd5b5050505083600160a060020a0316630a8ed3db8886866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b5050505083600160a060020a031663afd925df8886866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b1580156109f557600080fd5b505af1158015610a09573d6000803e3d6000fd5b505050505b60408051600160a060020a0380881616815290517f3a7eb042a769adf51e9be78b68ed7af0ad7b379246536efc376ed2ca012382829160200181900390a1509295945050505050565b60025460006101000a9004600160a060020a031681565b6000809054906101000a9004600160a060020a031681565b60405161055e80610a97833901905600608060405234801561001057600080fd5b5060405160208061055e833981016040525161003481640100000000610112810204565b151561003f57600080fd5b7fc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8600190810260008019918216808316825260208083018381528082018085207f3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c9097028616958616855295905293822080546101009390930a600160a060020a038181021990941687851691820217909155604080519190931681529151929390927f2ec1ae0a449b7ae354b9dacfb3ade6b6332ba26b7fcbb935835fa39dd7263b239290910181900390a35061014a565b6000806000600160a060020a031683600160a060020a031614156101395760009150610144565b823b90506000811191505b50919050565b610405806101596000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634555d5c9811461012e5780634558850c1461015657806348a0c8dd146101bd5780635c60da1b146101e957806386070cfe146101fe575b61271060017f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea026000825a10156100e45760003411361583541616156100df576040513381523460208201527f15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1604082a1005b600080fd5b6100ec61022e565b9050610129816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506102bc945050505050565b505050005b34801561013a57600080fd5b506101436102ff565b6040805191825251602090910181900390f35b34801561016257600080fd5b5061017b60048035600019908116916020013516610304565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c957600080fd5b506101d2610346565b604080519115151515825251602090910181900390f35b3480156101f557600080fd5b5061017b61022e565b34801561020a57600080fd5b5061021361037d565b60408051600019928316909216825251602090910181900390f35b6000801960017fc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8810282168216835260208084018481529081018085207f3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c909302841690931684525281205473ffffffffffffffffffffffffffffffffffffffff6101009290920a90041690565b60006102c783610383565b15156102d257600080fd5b612710905060008083516020850186855a03f43d604051816000823e82600081146102fb578282f35b8282fd5b600290565b60006020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006103787f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea600102600019166103d5565b905090565b60015481565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156103c457600091506103cf565b823b90506000811191505b50919050565b54905600a165627a7a72305820d129f069f5a8553498f3d265660cfd38890ff302b163515c6a5a3d03a47c2bed0029a165627a7a72305820508849b0e7b1436712b9423c4995cf7c0ffbb64243c1f3255a6d4584f31b726d0029"; +export const DAOFactoryABI = [ + { + constant: true, + inputs: [], + name: "baseACL", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [{ name: "_root", type: "address" }], + name: "newDAO", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "regFactory", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "baseKernel", + outputs: [{ name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { name: "_baseKernel", type: "address" }, + { name: "_baseACL", type: "address" }, + { name: "_regFactory", type: "address" }, + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [{ indexed: false, name: "dao", type: "address" }], + name: "DeployDAO", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, name: "reg", type: "address" }], + name: "DeployEVMScriptRegistry", + type: "event", + }, +]; + +export const CounterBytecode = + "0x60806040526000805534801561001457600080fd5b50610143806100246000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632baeceb71461005c57806361bc221a14610087578063d09de08a146100b2575b600080fd5b34801561006857600080fd5b506100716100dd565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b5061009c6100f7565b6040518082815260200191505060405180910390f35b3480156100be57600080fd5b506100c76100fd565b6040518082815260200191505060405180910390f35b600060016000808282540392505081905550600054905090565b60005481565b6000600160008082825401925050819055506000549050905600a165627a7a7230582065e2500e33bce3cfc5a98c35e4780aabaf2a2b8176c14afe5371ffe8d6dfab540029"; +export const CounterABI = [ + { + constant: false, + inputs: [], + name: "decrement", + outputs: [{ name: "", type: "int256" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "counter", + outputs: [{ name: "", type: "int256" }], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [], + name: "increment", + outputs: [{ name: "", type: "int256" }], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/packages/dock-blockchain-api/scripts/eth/dao/voting-dao-test.js b/packages/dock-blockchain-api/scripts/eth/dao/voting-dao-test.js new file mode 100644 index 000000000..4bd21f5c3 --- /dev/null +++ b/packages/dock-blockchain-api/scripts/eth/dao/voting-dao-test.js @@ -0,0 +1,366 @@ +import { + KernelBytecode, + KernelABI, + ACLBytecode, + ACLABI, + EVMScriptRegistryFactoryBytecode, + DAOFactoryBytecode, + DAOFactoryABI, + VotingDAOABI, + VotingDAOBytecode, + MiniMeTokenABI, + MiniMeTokenBytecode, + CounterABI, + CounterBytecode, +} from "./bytecodes-and-abis"; + +import { + getTestEVMAccountsFromWeb3, + endowEVMAddressWithDefault, + sendEVMTxn, + deployContract, + getWeb3, +} from "../helpers"; + +require("dotenv").config(); + +async function createDaoFactory(web3, signer) { + const kernelContractAddr = await deployContract( + web3, + signer, + KernelBytecode + web3.eth.abi.encodeParameters(["bool"], [true]).slice(2) + ); + const aclContractAddr = await deployContract(web3, signer, ACLBytecode); + const evmRegContractAddr = await deployContract( + web3, + signer, + EVMScriptRegistryFactoryBytecode + ); + const daoFactContractAddr = await deployContract( + web3, + signer, + DAOFactoryBytecode + + web3.eth.abi + .encodeParameters( + ["address", "address", "address"], + [kernelContractAddr, aclContractAddr, evmRegContractAddr] + ) + .slice(2) + ); + console.log( + `Creating Kernel ${kernelContractAddr}, ACL ${aclContractAddr}, EVM Script registry ${evmRegContractAddr} and DAO factory ${daoFactContractAddr}` + ); + return [ + kernelContractAddr, + aclContractAddr, + evmRegContractAddr, + daoFactContractAddr, + ]; +} + +async function createNewDao(web3, signer, root, daoFactAddr) { + const daoFactContract = new web3.eth.Contract(DAOFactoryABI, daoFactAddr); + const receipt = await sendEVMTxn( + web3, + signer, + daoFactAddr, + daoFactContract.methods.newDAO(root).encodeABI() + ); + // The last log contains the address of the DAO + const decoded = web3.eth.abi.decodeLog( + [{ type: "address", name: "dao" }], + receipt.logs[receipt.logs.length - 1].data + ); + console.log(`Created new DAO ${decoded.dao} from factory`); + return decoded.dao; +} + +async function setupAcl(web3, signer, root, daoAddr) { + console.log(`Setting ${root} as the manager of the kernel`); + const dao = new web3.eth.Contract(KernelABI, daoAddr); + const aclAddr = await dao.methods.acl().call(); + const acl = new web3.eth.Contract(ACLABI, aclAddr); + const managerRole = await dao.methods.APP_MANAGER_ROLE().call(); + await sendEVMTxn( + web3, + signer, + acl.options.address, + acl.methods + .createPermission(root, dao.options.address, managerRole, root) + .encodeABI() + ); + console.log(`Kernel ACL is ${aclAddr}`); + return aclAddr; +} + +async function setupVotingApp(web3, signer, root, appId, daoAddr, aclAddr) { + console.log("Install voting app and permit anyone with tokens to vote"); + const dao = new web3.eth.Contract(KernelABI, daoAddr); + const acl = new web3.eth.Contract(ACLABI, aclAddr); + + // Pattern to keep the contract upgradable. + const votingBaseAddress = await deployContract( + web3, + signer, + VotingDAOBytecode + ); + const votingBase = new web3.eth.Contract(VotingDAOABI, votingBaseAddress); + const receipt = await sendEVMTxn( + web3, + signer, + dao.options.address, + dao.methods.newAppInstance(appId, votingBaseAddress).encodeABI() + ); + // The last log contains the address of the voting app + const decoded = web3.eth.abi.decodeLog( + [{ type: "address", name: "proxy" }], + receipt.logs[receipt.logs.length - 1].data + ); + const votingAppAddress = decoded.proxy; + console.log(`Installed voting app at ${votingAppAddress}`); + + const anyOne = "0xffffffffffffffffffffffffffffffffffffffff"; // Granting permission to this special address means everyone has this permission + await sendEVMTxn( + web3, + signer, + acl.options.address, + acl.methods + .createPermission( + anyOne, + votingAppAddress, + await votingBase.methods.CREATE_VOTES_ROLE().call(), + root + ) + .encodeABI() + ); + return votingAppAddress; +} + +async function deployToken(web3, signer, voters) { + const zeroAddress = `0x${"0".repeat(40)}`; // 0x0000...0000 + console.log( + "Deploying MiniMeToken token and giving tokens to holders to vote with" + ); + const tokenArgsABI = web3.eth.abi.encodeParameters( + ["address", "address", "uint", "string", "uint8", "string", "bool"], + [zeroAddress, zeroAddress, 0, "MiniMeToken", 0, "mm", true] + ); + const tokenContractBytecode = MiniMeTokenBytecode + tokenArgsABI.slice(2); + const tokenContractAddr = await deployContract( + web3, + signer, + tokenContractBytecode + ); + const tokenContract = new web3.eth.Contract( + MiniMeTokenABI, + tokenContractAddr + ); + + /* eslint-disable no-await-in-loop */ + for (let i = 0; i < voters.length; i++) { + const [address, amount] = voters[i]; + await sendEVMTxn( + web3, + signer, + tokenContractAddr, + tokenContract.methods.generateTokens(address, amount).encodeABI() + ); + } + + console.log(`Token deployed at ${tokenContractAddr}`); + return tokenContractAddr; +} + +async function initializeVotingApp( + web3, + signer, + votingAppAddress, + tokenContractAddr +) { + console.log("Initializing voting app with token"); + + const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); + const ten16 = web3.utils.toBN(10).pow(web3.utils.toBN(16)); // 10^16 + + // Acceptance requires >50% and participation of >20% and voting lasts for 30 seconds. These values are just an example. + const supportRequiredPct = web3.utils.toBN(50).mul(ten16); + const minAcceptQuorumPct = web3.utils.toBN(20).mul(ten16); + const votingDuration = 30; + + await sendEVMTxn( + web3, + signer, + votingAppAddress, + votingApp.methods + .initialize( + tokenContractAddr, + supportRequiredPct, + minAcceptQuorumPct, + votingDuration + ) + .encodeABI() + ); +} + +async function setupVotingExecutor(web3, signer) { + console.log( + "Setting up Counter contract whose methods will be called through voting" + ); + + const counterAddr = await deployContract(web3, signer, CounterBytecode); + const counterContract = new web3.eth.Contract(CounterABI, counterAddr); + + const incrementCall = counterContract.methods + .increment() + .encodeABI() + .slice(2); + const decrementCall = counterContract.methods + .decrement() + .encodeABI() + .slice(2); + + // Aragon specific encoding of the `increment` and `decrement` methods of the Counter. + // [1 byte identifier] + [ 20 bytes (address) ] + [ 4 bytes (uint32: calldata length) ] + [ calldataLength bytes (payload) ] + function encode(calldata) { + return `0x00000001${ + web3.eth.abi.encodeParameter("address", counterAddr).slice(26) // Remove leading 0x and 12 more bytes + }${ + web3.eth.abi.encodeParameter("uint256", calldata.length / 2).slice(58) // Remove leading 0x and 28 more bytes + }${calldata}`; + } + + // Encoded actions that will be executed on successful voting + const incrementScript = encode(incrementCall); + const decrementScript = encode(decrementCall); + + console.log( + `Counter deployed at ${counterAddr}, incrementer script is ${incrementScript}, decrementer script is ${decrementScript}` + ); + + return [counterAddr, incrementScript, decrementScript]; +} + +async function createNewVote(web3, signer, votingAppAddress, execScript) { + const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); + // vote + const receipt = await sendEVMTxn( + web3, + signer, + votingAppAddress, + votingApp.methods.newVote(execScript, "").encodeABI() + ); + + // Extract `voteId` from the first log + const decodedLog = web3.eth.abi.decodeLog( + [ + { type: "uint256", name: "voteId", indexed: true }, + { type: "address", name: "creator", indexed: true }, + { type: "string", name: "metadata" }, + ], + receipt.logs[0].data, + [receipt.logs[0].topics[1], receipt.logs[0].topics[2]] + ); + console.log(`Created a new vote with id: ${decodedLog.voteId}`); + return decodedLog.voteId; +} + +async function getCounter(web3, counterAddr) { + const counterContract = new web3.eth.Contract(CounterABI, counterAddr); + return counterContract.methods.counter().call(); +} + +async function main() { + const web3 = getWeb3(); + + // Create some test accounts. Alice will be the manager of the DAO while Bob, Carol and Dave will be voters. + const [alice, bob, carol, dave] = getTestEVMAccountsFromWeb3(web3); + + // Endow accounts with tokens so they can pay fees for transactions + await endowEVMAddressWithDefault(alice.address); + await endowEVMAddressWithDefault(bob.address); + await endowEVMAddressWithDefault(carol.address); + await endowEVMAddressWithDefault(dave.address); + + // Create a contract factory to create new DAO instance. + const [, , , daoFactContractAddr] = await createDaoFactory(web3, alice); + + // Create a new DAO instance + const daoAddr = await createNewDao( + web3, + alice, + alice.address, + daoFactContractAddr + ); + + // Set access control and set Alice as DAO's manager + const aclAddr = await setupAcl(web3, alice, alice.address, daoAddr); + + // Some unique app id + const appId = + "0x0000000000000000000000000000000000000000000000000000000000000100"; + + // Create a voting contract, install it as an app in the DAO and allow any token holder to vote + const votingAppAddress = await setupVotingApp( + web3, + alice, + alice.address, + appId, + daoAddr, + aclAddr + ); + const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); + + // Deploy a token contract where Bob, Carol and Dave will have 51%, 29% and 20% tokens as thus proportional voting power. + const tokenContractAddr = await deployToken(web3, alice, [ + [bob.address, 51], + [carol.address, 29], + [dave.address, 20], + ]); + + // Initialize the voting by supplying the token contract and thresholds for voting. + await initializeVotingApp(web3, alice, votingAppAddress, tokenContractAddr); + + // A Counter contract as an example executor. In practice, the executor methods will only allow calls by the voting contract. + const [counterAddr, incrementScript] = await setupVotingExecutor(web3, alice); + + // Bob alone can increment the Counter as he has 51% tokens + console.log( + `Counter before increment from Bob ${await getCounter(web3, counterAddr)}` + ); + await sendEVMTxn( + web3, + bob, + votingAppAddress, + votingApp.methods.newVote(incrementScript, "").encodeABI() + ); + console.log( + `Counter after increment from Bob ${await getCounter(web3, counterAddr)}` + ); + + // Carol creates a new vote + const voteId = await createNewVote( + web3, + carol, + votingAppAddress, + incrementScript + ); + // Dave seconds Carol's vote + await sendEVMTxn( + web3, + dave, + votingAppAddress, + votingApp.methods.vote(voteId, true, true).encodeABI() + ); + console.log( + "Counter after attempted increment from Carol and Dave. Counter will not change as Bob and Carol don't have enough voting power" + ); + + process.exit(0); +} + +main() + .then(() => process.exit(0)) + .catch((e) => { + console.error(e); + process.exit(1); + }); diff --git a/scripts/eth/helpers.js b/packages/dock-blockchain-api/scripts/eth/helpers.js similarity index 51% rename from scripts/eth/helpers.js rename to packages/dock-blockchain-api/scripts/eth/helpers.js index 968ebf9c1..5800e0649 100644 --- a/scripts/eth/helpers.js +++ b/packages/dock-blockchain-api/scripts/eth/helpers.js @@ -1,39 +1,58 @@ -import { ethers } from 'ethers'; -import Web3 from 'web3'; -import { DockAPI } from '../../src/index'; -import { endowEVMAddress } from '../../src/utils/evm-utils'; +import { ethers } from "ethers"; +import Web3 from "web3"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { endowEVMAddress } from "../../src/utils/evm-utils"; -require('dotenv').config(); +require("dotenv").config(); const { - FullNodeEndpoint, EndowedSecretURI, MinGasPrice, MaxGas, FullNodeTCPEndpoint, + FullNodeEndpoint, + EndowedSecretURI, + MinGasPrice, + MaxGas, + FullNodeTCPEndpoint, } = process.env; export function getTestPrivKeysForEVMAccounts() { - const alice = '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709'; - const bob = '0xd7325de5c2c1cf0009fac77d3d04a9c004b038883446b065871bc3e831dcd098'; - const carol = '0xcc505ee6067fba3f6fc2050643379e190e087aeffe5d958ab9f2f3ed3800fa4e'; - const dave = '0x348ce564067fba3f6fc2050643379e190e087aeffe5d958ab9f2f3ed31dcd098'; + const alice = + "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709"; + const bob = + "0xd7325de5c2c1cf0009fac77d3d04a9c004b038883446b065871bc3e831dcd098"; + const carol = + "0xcc505ee6067fba3f6fc2050643379e190e087aeffe5d958ab9f2f3ed3800fa4e"; + const dave = + "0x348ce564067fba3f6fc2050643379e190e087aeffe5d958ab9f2f3ed31dcd098"; return [alice, bob, carol, dave]; } // Returns some test EVM accounts export function getTestEVMAccountsFromWeb3(web3) { - return getTestPrivKeysForEVMAccounts().map((k) => web3.eth.accounts.privateKeyToAccount(k)); + return getTestPrivKeysForEVMAccounts().map((k) => + web3.eth.accounts.privateKeyToAccount(k) + ); } export function getTestEVMAccountsFromEthers(provider) { - return getTestPrivKeysForEVMAccounts().map((k) => new ethers.Wallet(k, provider)); + return getTestPrivKeysForEVMAccounts().map( + (k) => new ethers.Wallet(k, provider) + ); } // Give `amount` of Dock tokens to EVM address. `amount` defaults to the number of tokens required to pay of maximum gas. // Uses the node endpoint and endowed account seed from environment variable. -export async function endowEVMAddressWithDefault(evmAddr, amount, nodeEndpoint, accountUri) { +export async function endowEVMAddressWithDefault( + evmAddr, + amount, + nodeEndpoint, + accountUri +) { const dock = new DockAPI(); await dock.init({ address: nodeEndpoint !== undefined ? nodeEndpoint : FullNodeEndpoint, }); - const keypair = dock.keyring.addFromUri(accountUri !== undefined ? accountUri : EndowedSecretURI); + const keypair = dock.keyring.addFromUri( + accountUri !== undefined ? accountUri : EndowedSecretURI + ); dock.setAccount(keypair); const res = await endowEVMAddress(dock, evmAddr, amount); @@ -54,35 +73,57 @@ export function getEthers(endpoint) { } // Deploy a contract and return the address -export async function deployContract(web3, signer, bytecode, value, gasPrice, gas) { +export async function deployContract( + web3, + signer, + bytecode, + value, + gasPrice, + gas +) { const createTransaction = await signer.signTransaction({ data: bytecode, value: value !== undefined ? value : web3.utils.toBN(0), gasPrice: gasPrice !== undefined ? gasPrice : web3.utils.toBN(MinGasPrice), gas: gas !== undefined ? gas : web3.utils.toBN(MaxGas), }); - const createReceipt = await web3.eth.sendSignedTransaction(createTransaction.rawTransaction); + const createReceipt = await web3.eth.sendSignedTransaction( + createTransaction.rawTransaction + ); console.log(`Contract deployed at address ${createReceipt.contractAddress}`); return createReceipt.contractAddress; } -export async function sendEVMTxn(web3, signer, to, bytecode, value, gasPrice, gas) { - const txn = await signer.signTransaction( - { - to, - data: bytecode, - value: value !== undefined ? value : web3.utils.toBN(0), - gasPrice: gasPrice !== undefined ? gasPrice : web3.utils.toBN(MinGasPrice), - gas: gas !== undefined ? gas : web3.utils.toBN(MaxGas), - }, - ); +export async function sendEVMTxn( + web3, + signer, + to, + bytecode, + value, + gasPrice, + gas +) { + const txn = await signer.signTransaction({ + to, + data: bytecode, + value: value !== undefined ? value : web3.utils.toBN(0), + gasPrice: gasPrice !== undefined ? gasPrice : web3.utils.toBN(MinGasPrice), + gas: gas !== undefined ? gas : web3.utils.toBN(MaxGas), + }); const txnReceipt = await web3.eth.sendSignedTransaction(txn.rawTransaction); console.log(`Txn executed (H: ${txnReceipt.transactionHash})`); return txnReceipt; } // Send Dock tokens, i.e. base currency of chain to EVM address. -export async function sendTokensToEVMAddress(web3, signer, to, amount, gasPrice, gas) { +export async function sendTokensToEVMAddress( + web3, + signer, + to, + amount, + gasPrice, + gas +) { // A transfer is an EVM transaction with no data. return sendEVMTxn(web3, signer, to, 0, amount, gasPrice, gas); } @@ -94,22 +135,33 @@ export async function getTokenBalance(web3, contractAddress, abi, address) { } // Send ERC-20 tokens -export async function sendTokens(web3, signer, contractAddress, abi, to, amount, gasPrice, gas) { +export async function sendTokens( + web3, + signer, + contractAddress, + abi, + to, + amount, + gasPrice, + gas +) { const contract = new web3.eth.Contract(abi, contractAddress); const encoded = contract.methods.transfer(to, amount).encodeABI(); - const transferTransaction = await signer.signTransaction( - { - to: contractAddress, - data: encoded, - value: web3.utils.toBN(0), - gasPrice: gasPrice !== undefined ? gasPrice : web3.utils.toBN(MinGasPrice), - gas: gas !== undefined ? gas : web3.utils.toBN(MaxGas), - }, - ); + const transferTransaction = await signer.signTransaction({ + to: contractAddress, + data: encoded, + value: web3.utils.toBN(0), + gasPrice: gasPrice !== undefined ? gasPrice : web3.utils.toBN(MinGasPrice), + gas: gas !== undefined ? gas : web3.utils.toBN(MaxGas), + }); - const transferReceipt = await web3.eth.sendSignedTransaction(transferTransaction.rawTransaction); - console.log(`Transfer executed to ${transferReceipt.to} (H: ${transferReceipt.transactionHash})`); + const transferReceipt = await web3.eth.sendSignedTransaction( + transferTransaction.rawTransaction + ); + console.log( + `Transfer executed to ${transferReceipt.to} (H: ${transferReceipt.transactionHash})` + ); return transferReceipt; } diff --git a/packages/dock-blockchain-api/scripts/fetch-block.js b/packages/dock-blockchain-api/scripts/fetch-block.js new file mode 100644 index 000000000..dc339eeaf --- /dev/null +++ b/packages/dock-blockchain-api/scripts/fetch-block.js @@ -0,0 +1,15 @@ +import { firstValueFrom } from "rxjs"; +import { blockByNumber, withDockAPI } from "./helpers"; + +const { FullNodeEndpoint, BlockNumber } = process.env; + +async function main(dock, number) { + const block = await firstValueFrom(blockByNumber(dock, number)); + + console.log("Human:", JSON.stringify(block.toHuman(), void 0, 2), "\n"); + console.log("JSON:", JSON.stringify(block.toJSON(), void 0, 2)); +} + +withDockAPI({ address: FullNodeEndpoint })(main)(BlockNumber).catch( + console.error +); diff --git a/scripts/get_did_doc.js b/packages/dock-blockchain-api/scripts/get_did_doc.js similarity index 51% rename from scripts/get_did_doc.js rename to packages/dock-blockchain-api/scripts/get_did_doc.js index 901176e2e..243a9d76e 100644 --- a/scripts/get_did_doc.js +++ b/packages/dock-blockchain-api/scripts/get_did_doc.js @@ -1,30 +1,31 @@ // Import Dock API -import dock from '../src/index'; +import dock from "../src/index"; -require('dotenv').config(); +require("dotenv").config(); // The following can be tweaked depending on where the node is running and what // account is to be used for sending the transaction. const { FullNodeEndpoint } = process.env; async function getDIDDoc(dockDID) { - console.log('Getting DID now.'); + console.log("Getting DID now."); // Check if DID exists - const result = await dock.did.getDocument(dockDID); - console.log('DID Document:', JSON.stringify(result, null, 2)); + const result = await dock.modules.did.getDocument(dockDID); + console.log("DID Document:", JSON.stringify(result.toJSON(), null, 2)); process.exit(0); } if (process.argv.length !== 3) { - console.error('Need one and only one argument as the DID', process.argv); + console.error("Need one and only one argument as the DID", process.argv); process.exit(2); } -dock.init({ - address: FullNodeEndpoint, -}) +dock + .init({ + address: FullNodeEndpoint, + }) .then(() => getDIDDoc(process.argv[2])) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/get_session_keys.js b/packages/dock-blockchain-api/scripts/get_session_keys.js similarity index 64% rename from scripts/get_session_keys.js rename to packages/dock-blockchain-api/scripts/get_session_keys.js index fa3848940..06b3a40c5 100644 --- a/scripts/get_session_keys.js +++ b/packages/dock-blockchain-api/scripts/get_session_keys.js @@ -1,10 +1,10 @@ // Script to print session keys of the current validators -import { u8aToString, bnToU8a, u8aToHex } from '@polkadot/util'; -import { asDockAddress } from '../src/utils/codec'; -import dock from '../src/index'; +import { u8aToString, bnToU8a, u8aToHex } from "@polkadot/util"; +import { asDockAddress } from "@docknetwork/credential-sdk/utils"; +import dock from "../src/index"; -require('dotenv').config(); +require("dotenv").config(); const { FullNodeEndpoint, Network } = process.env; @@ -18,7 +18,9 @@ async function printSessionKeys() { addresses[addr] = {}; } /* eslint no-underscore-dangle: ["error", { "allow": ["_args"] }] */ - addresses[addr][u8aToString(bnToU8a(keyOwner[0]._args[0][0]))] = u8aToHex(keyOwner[0]._args[0][1]); + addresses[addr][u8aToString(bnToU8a(keyOwner[0]._args[0][0]))] = u8aToHex( + keyOwner[0]._args[0][1] + ); }); console.log(`Found ${Object.keys(addresses).length} addreses`); @@ -30,17 +32,25 @@ async function printSessionKeys() { console.log(`Grandpa key is ${addresses[addr].gran}`); console.log(`Authority Discovery key is ${addresses[addr].audi}`); console.log(`Imonline key is ${addresses[addr].imon}`); - console.log(`Session key is ${addresses[addr].babe + addresses[addr].gran.substring(2) + addresses[addr].audi.substring(2) + addresses[addr].imon.substring(2)}`); - console.log(''); + console.log( + `Session key is ${ + addresses[addr].babe + + addresses[addr].gran.substring(2) + + addresses[addr].audi.substring(2) + + addresses[addr].imon.substring(2) + }` + ); + console.log(""); }); process.exit(0); } -dock.init({ - address: FullNodeEndpoint, -}) +dock + .init({ + address: FullNodeEndpoint, + }) .then(printSessionKeys) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/get_summary.js b/packages/dock-blockchain-api/scripts/get_summary.js similarity index 72% rename from scripts/get_summary.js rename to packages/dock-blockchain-api/scripts/get_summary.js index f7d77045f..e758f4b67 100644 --- a/scripts/get_summary.js +++ b/packages/dock-blockchain-api/scripts/get_summary.js @@ -1,7 +1,7 @@ // Get summary from for PoA like current epoch, when will it end, active validators, queued validators, etc -import dock from '../src/index'; +import dock from "../src/index"; -require('dotenv').config(); +require("dotenv").config(); const { FullNodeEndpoint } = process.env; @@ -15,9 +15,10 @@ const { FullNodeEndpoint } = process.env; async function multiQuery(handle, queries) { return new Promise((resolve, reject) => { try { - handle.api.queryMulti(queries, (resp) => { - resolve(resp); - }) + handle.api + .queryMulti(queries, (resp) => { + resolve(resp); + }) .catch((error) => { reject(error); }); @@ -28,15 +29,14 @@ async function multiQuery(handle, queries) { } async function getSummary(handle) { - const [ - emissionStatus, - emissionSupply, - totalIssuance, - ] = await multiQuery(handle, [ - handle.api.query.stakingRewards.stakingEmissionStatus, - handle.api.query.stakingRewards.stakingEmissionSupply, - handle.api.query.balances.totalIssuance, - ]); + const [emissionStatus, emissionSupply, totalIssuance] = await multiQuery( + handle, + [ + handle.api.query.stakingRewards.stakingEmissionStatus, + handle.api.query.stakingRewards.stakingEmissionSupply, + handle.api.query.balances.totalIssuance, + ] + ); // const accounts = await dock.api.query.system.account.entries(); // const totalBal = bnToBn(0); @@ -61,13 +61,14 @@ async function printSummary() { process.exit(0); } -dock.init({ - address: FullNodeEndpoint, -}) +dock + .init({ + address: FullNodeEndpoint, + }) .then(() => { printSummary(); }) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/helpers.js b/packages/dock-blockchain-api/scripts/helpers.js similarity index 76% rename from scripts/helpers.js rename to packages/dock-blockchain-api/scripts/helpers.js index 8f247f375..520d6a8e3 100644 --- a/scripts/helpers.js +++ b/packages/dock-blockchain-api/scripts/helpers.js @@ -1,9 +1,9 @@ // Helpers for scripts -import { Keyring } from '@polkadot/api'; -import { cryptoWaitReady } from '@polkadot/util-crypto'; -import { formatBalance } from '@polkadot/util'; -import { bufferCount, map as mapRx } from 'rxjs/operators'; +import { Keyring } from "@polkadot/api"; +import { cryptoWaitReady } from "@polkadot/util-crypto"; +import { formatBalance } from "@polkadot/util"; +import { bufferCount, map as mapRx } from "rxjs/operators"; import { always, ifElse, @@ -20,9 +20,9 @@ import { __, unless, fromPairs, -} from 'ramda'; -import { of, concatMap, from } from 'rxjs'; -import { DockAPI } from '../src'; +} from "ramda"; +import { of, concatMap, from } from "rxjs"; +import { DockAPI } from "../src"; /** * Retrieves a block associated with the given number. @@ -31,10 +31,12 @@ import { DockAPI } from '../src'; * @param {number} number * @returns {Observable<*>} */ -export const blockByNumber = curry((dock, number) => of(number).pipe( - concatMap((number) => from(dock.api.rpc.chain.getBlockHash(number))), - concatMap((hash) => from(dock.api.derive.chain.getBlock(hash))), -)); +export const blockByNumber = curry((dock, number) => + of(number).pipe( + concatMap((number) => from(dock.api.rpc.chain.getBlockHash(number))), + concatMap((hash) => from(dock.api.derive.chain.getBlock(hash))) + ) +); /** * Send the give transaction with the given account URI (secret) and return the block hash @@ -47,7 +49,7 @@ export async function sendTxnWithAccount( dock, senderAccountUri, txn, - waitForFinalization = true, + waitForFinalization = true ) { const account = dock.keyring.addFromUri(senderAccountUri); dock.setAccount(account); @@ -67,9 +69,9 @@ export async function sendTxnWithAccount( export async function validatorChange(dock, argv, func, senderAccountUri) { let shortCircuit; if (argv.length === 4) { - if (argv[3].toLowerCase() === 'true') { + if (argv[3].toLowerCase() === "true") { shortCircuit = true; - } else if (argv[3].toLowerCase() === 'false') { + } else if (argv[3].toLowerCase() === "false") { shortCircuit = false; } else { throw new Error(`Should be true or false but was ${argv[3]}`); @@ -95,12 +97,12 @@ export async function sendBatch( dock, txs, senderAddress, - waitForFinalization = false, + waitForFinalization = false ) { const txBatch = dock.api.tx.utility.batch(txs); console.log(`Batch size is ${txBatch.encodedLength}`); console.info( - `Payment info of batch is ${await txBatch.paymentInfo(senderAddress)}`, + `Payment info of batch is ${await txBatch.paymentInfo(senderAddress)}` ); const bal1 = await getBalance(dock.api, senderAddress); @@ -127,7 +129,7 @@ export async function sendBatch( */ export async function keypair(seed) { await cryptoWaitReady(); - const keyring = new Keyring({ type: 'sr25519' }); + const keyring = new Keyring({ type: "sr25519" }); return keyring.addFromUri(seed); } @@ -154,8 +156,8 @@ export function median(numbers) { numbers.sort(); if ( - numsLen % 2 - === 0 // is even + numsLen % 2 === + 0 // is even ) { // average of two middle numbers mid = (numbers[numsLen / 2 - 1] + numbers[numsLen / 2]) / 2; @@ -195,7 +197,7 @@ export const finiteNumber = o( unless(isFinite, (value) => { throw new Error(`Invalid number provided: ${value}`); }), - Number, + Number ); /** @@ -245,10 +247,14 @@ export const envObj = mapObjIndexed(parseEnv); * @param {Observable} extrs$ * @returns {Observable} */ -export const batchExtrinsics = curry((api, limit, extrs$) => extrs$.pipe( - bufferCount(limit), - mapRx((batch) => (batch.length === 1 ? batch[0] : api.tx.utility.batch(batch))), -)); +export const batchExtrinsics = curry((api, limit, extrs$) => + extrs$.pipe( + bufferCount(limit), + mapRx((batch) => + batch.length === 1 ? batch[0] : api.tx.utility.batch(batch) + ) + ) +); /** * Creates a promise that will be rejected after the given time. @@ -256,7 +262,10 @@ export const batchExtrinsics = curry((api, limit, extrs$) => extrs$.pipe( * @param {number} time * @returns {Promise} */ -export const rejectTimeout = (time) => new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout is exceeded')), time)); +export const rejectTimeout = (time) => + new Promise((_, reject) => + setTimeout(() => reject(new Error("Timeout is exceeded")), time) + ); /** * Creates a promise that will be either resolved before the specified @@ -267,7 +276,9 @@ export const rejectTimeout = (time) => new Promise((_, reject) => setTimeout(() * @param {Promise} promise * @returns {Promise} */ -export const timeout = curry((time, promise) => Promise.race([rejectTimeout(time), promise])); +export const timeout = curry((time, promise) => + Promise.race([rejectTimeout(time), promise]) +); /** * Formats given value as DOCK token amount. @@ -276,12 +287,13 @@ export const timeout = curry((time, promise) => Promise.race([rejectTimeout(time * @param {?object} config * @returns {string} */ -export const formatDock = (value, config = {}) => formatBalance(value, { - decimals: 6, - withSi: true, - ...config, - withUnit: 'DCK', -}); +export const formatDock = (value, config = {}) => + formatBalance(value, { + decimals: 6, + withSi: true, + ...config, + withUnit: "DCK", + }); /** * Enhances supplied function by providing access to the initialized global dock API. @@ -294,33 +306,36 @@ export const formatDock = (value, config = {}) => formatBalance(value, { * @param {function(dock: DockAPI, ...args: any[]): Promise} * @returns {function(...args: any[]): Promise} */ -export const withDockAPI = curry(({ senderAccountURI, ...params }, fn) => async (...args) => { - console.log('Connecting...'); - let err; let - res; - const dockAPI = new DockAPI(); - - try { - await dockAPI.init(params); - if (senderAccountURI) { - const account = dockAPI.keyring.addFromUri(senderAccountURI); - dockAPI.setAccount(account); - } - - res = await fn(dockAPI, ...args); - } catch (e) { - err = e; - } finally { - console.log('Disconnecting...'); - await dockAPI.disconnect(); +export const withDockAPI = curry( + ({ senderAccountURI, ...params }, fn) => + async (...args) => { + console.log("Connecting..."); + let err; + let res; + const dockAPI = new DockAPI(); + + try { + await dockAPI.init(params); + if (senderAccountURI) { + const account = dockAPI.keyring.addFromUri(senderAccountURI); + dockAPI.setAccount(account); + } - if (err) { - throw err; - } else { - return res; + res = await fn(dockAPI, ...args); + } catch (e) { + err = e; + } finally { + console.log("Disconnecting..."); + await dockAPI.disconnect(); + + if (err) { + throw err; + } else { + return res; + } + } } - } -}); +); /** * Converts "true" and non-zero to `true`, other values to `false`. @@ -328,7 +343,7 @@ export const withDockAPI = curry(({ senderAccountURI, ...params }, fn) => async * @param {*} value * @returns {bool} */ -export const parseBool = either(equals('true'), o(Boolean, Number)); +export const parseBool = either(equals("true"), o(Boolean, Number)); /** * Queries validator identity. @@ -338,16 +353,16 @@ export const parseBool = either(equals('true'), o(Boolean, Number)); */ export const accountIdentity = curry(async (api, accountId) => { const val = api.createType( - 'Option', - await api.query.identity.identityOf(api.createType('AccountId', accountId)), + "Option", + await api.query.identity.identityOf(api.createType("AccountId", accountId)) ); if (val.isSome) { const { info } = val.unwrap(); return `\`${api.createType( - 'String', - info.toHuman().display.Raw, + "String", + info.toHuman().display.Raw )} (${accountId.toString()})\``; } else { return `\`${accountId.toString()}\``; @@ -360,15 +375,18 @@ export const accountIdentity = curry(async (api, accountId) => { * @param {*} date * @returns */ -export const formatAsISO = (date) => date.toISOString().replace(/T/, ' ').replace(/\..+/, ''); +export const formatAsISO = (date) => + date.toISOString().replace(/T/, " ").replace(/\..+/, ""); /** * Enhances logger by adding a prefix built by the supplied function on each call. */ -export const addLoggerPrefix = curry((buildPrefix, logger) => o( - fromPairs, - map((key) => [key, (...args) => logger[key](buildPrefix(...args), ...args)]), -)(['error', 'log', 'info', 'warn'])); +export const addLoggerPrefix = curry((buildPrefix, logger) => + o( + fromPairs, + map((key) => [key, (...args) => logger[key](buildPrefix(...args), ...args)]) + )(["error", "log", "info", "warn"]) +); /** * Returns hash and number of the first block satisfying the provided predicate. @@ -383,10 +401,8 @@ export const addLoggerPrefix = curry((buildPrefix, logger) => o( export const binarySearchFirstSatisfyingBlock = curry( async ( api, - { - startBlockNumber, endBlockNumber, targetValue, fetchValue, checkBlock, - }, - { maxBlocksPerUnit = null, debug = false } = {}, + { startBlockNumber, endBlockNumber, targetValue, fetchValue, checkBlock }, + { maxBlocksPerUnit = null, debug = false } = {} ) => { for ( // Number of iterations performed during binary search. @@ -400,16 +416,16 @@ export const binarySearchFirstSatisfyingBlock = curry( if (debug) { timestampLogger.log( - 'target value:', + "target value:", targetValue, - 'current value:', + "current value:", midValue, - 'start block:', + "start block:", startBlockNumber, - 'end block:', + "end block:", endBlockNumber, - 'jumps:', - jumps, + "jumps:", + jumps ); } @@ -418,7 +434,7 @@ export const binarySearchFirstSatisfyingBlock = curry( if (maxBlocksPerUnit != null) { endBlockNumber = Math.min( midBlockNumber + maxBlocksPerUnit * (1 + targetValue - midValue), - endBlockNumber, + endBlockNumber ); } } else if (midValue > targetValue) { @@ -426,7 +442,7 @@ export const binarySearchFirstSatisfyingBlock = curry( if (maxBlocksPerUnit != null) { startBlockNumber = Math.max( midBlockNumber - maxBlocksPerUnit * (1 + midValue - targetValue), - startBlockNumber, + startBlockNumber ); } } else { @@ -434,7 +450,7 @@ export const binarySearchFirstSatisfyingBlock = curry( if (maxBlocksPerUnit != null) { startBlockNumber = Math.max( midBlockNumber - maxBlocksPerUnit, - startBlockNumber, + startBlockNumber ); } @@ -445,7 +461,7 @@ export const binarySearchFirstSatisfyingBlock = curry( if (debug) { timestampLogger.log( `First block that satisfied value \`${targetValue}\` found - \`${midBlockNumber}\` (${jumps} jumps)`, - found, + found ); } @@ -454,8 +470,8 @@ export const binarySearchFirstSatisfyingBlock = curry( } } - throw new Error('No block found'); - }, + throw new Error("No block found"); + } ); /** @@ -468,5 +484,5 @@ export const binarySearchFirstSatisfyingBlock = curry( */ export const timestampLogger = addLoggerPrefix( () => `[${formatAsISO(new Date())}]`, - console, + console ); diff --git a/scripts/hit_1.js b/packages/dock-blockchain-api/scripts/hit_1.js similarity index 81% rename from scripts/hit_1.js rename to packages/dock-blockchain-api/scripts/hit_1.js index a6afa2ff4..b81696ade 100644 --- a/scripts/hit_1.js +++ b/packages/dock-blockchain-api/scripts/hit_1.js @@ -1,11 +1,11 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import dock from '../src/index'; -import { DockDid, DidKeypair } from '../src/did'; -import { getPublicKeyFromKeyringPair } from '../src/utils/misc'; -import { sendBatch } from './helpers'; -import { DidKey, VerificationRelationship } from '../src/public-keys'; +import { randomAsHex } from "@polkadot/util-crypto"; +import dock from "../src/index"; +import { DockDid, DidKeypair } from "../src/did"; +import { getPublicKeyFromKeyringPair } from "../src/utils/misc"; +import { sendBatch } from "./helpers"; +import { DidKey, VerificationRelationship } from "../src/public-keys"; -require('dotenv').config(); +require("dotenv").config(); const { FullNodeEndpoint, SudoSecretURI, EndowedSecretURI } = process.env; @@ -40,12 +40,12 @@ async function sendOnChainDIDTxns(count, waitForFinalization = true) { while (txs.length < count) { const did = DockDid.random(); const seed = randomAsHex(32); - const pair = dock.keyring.addFromUri(seed, null, 'sr25519'); + const pair = dock.keyring.addFromUri(seed, null, "sr25519"); const publicKey = getPublicKeyFromKeyringPair(pair); const didKey = new DidKey(publicKey, new VerificationRelationship()); - const tx = dock.did.createNewOnchainTx(did, [didKey], []); + const tx = dock.modules.did.createNewOnchainTx(did, [didKey], []); txs.push(tx); - didPairs.push([did, new DidKeypair(pair, 1)]); + didPairs.push(new DidKeypair([did, 1], pair)); } await sendBatch(dock, txs, account.address, waitForFinalization); @@ -69,13 +69,17 @@ async function sendAddKeyTxns(count, didPairs) { const txs = []; let j = 0; while (txs.length < count) { - const did = didPairs[j][0]; - const currentPair = didPairs[j][1]; + const did = didPairs[j].did; + const currentPair = didPairs[j]; const seed = randomAsHex(32); - const newPair = dock.keyring.addFromUri(seed, null, 'sr25519'); + const newPair = dock.keyring.addFromUri(seed, null, "sr25519"); const publicKey = getPublicKeyFromKeyringPair(newPair); const didKey = new DidKey(publicKey, new VerificationRelationship()); - const tx = await dock.did.createAddKeysTx([didKey], did, did, currentPair); + const tx = await dock.modules.did.createAddKeysTx( + [didKey], + did, + currentPair + ); txs.push(tx); j++; } @@ -101,13 +105,12 @@ async function sendAddControllerTxns(count, didPairs) { const txs = []; let j = 0; while (txs.length < count) { - const did = didPairs[j][0]; - const currentPair = didPairs[j][1]; - const tx = await dock.did.createAddControllersTx( + const did = didPairs[j].did; + const currentPair = didPairs[j]; + const tx = await dock.modules.did.createAddControllersTx( [DockDid.random()], did, - did, - currentPair, + currentPair ); txs.push(tx); j++; @@ -136,7 +139,7 @@ async function sendRemoveTxns(count, didPairs, waitForFinalization = true) { while (txs.length < count) { const did = didPairs[j][0]; const currentPair = didPairs[j][1]; - const tx = await dock.did.createRemoveTx(did, did, currentPair); + const tx = await dock.modules.did.createRemoveTx(did, did, currentPair); txs.push(tx); j++; } @@ -170,7 +173,7 @@ async function sendBlobTxns(count, didPairs) { blob: randomAsHex(995), }; const tx = await dock.blob.createNewTx(blob, did, pair, { - didModule: dock.did, + didModule: dock.modules.did, }); txs.push(tx); blobIds.push(blobId); @@ -214,13 +217,13 @@ async function sendAnchorTxns(count) { async function runOnce() { const count = 1000; let didPairs = await sendOnChainDIDTxns(count); - console.log(''); + console.log(""); didPairs = await sendAddKeyTxns(count, didPairs); - console.log(''); + console.log(""); await sendAddControllerTxns(count, didPairs); - console.log(''); + console.log(""); await sendBlobTxns(800, didPairs); - console.log(''); + console.log(""); await sendRemoveTxns(count, didPairs); } @@ -228,27 +231,27 @@ async function runInLoop(limit) { if (limit) { console.info(`Will do ${limit} iterations`); } - console.time('loop'); + console.time("loop"); let count = 0; while (true) { - console.time('iteration'); - console.time('WriteDID'); + console.time("iteration"); + console.time("WriteDID"); const didPairs = await sendOnChainDIDTxns(1950, false); - console.timeEnd('WriteDID'); - console.log('Added 1950 DIDs in a batch'); - console.log(''); - console.time('RemoveDID'); + console.timeEnd("WriteDID"); + console.log("Added 1950 DIDs in a batch"); + console.log(""); + console.time("RemoveDID"); await sendRemoveTxns(1950, didPairs, false); - console.timeEnd('RemoveDID'); - console.log('Remove 1950 DIDs in a batch'); + console.timeEnd("RemoveDID"); + console.log("Remove 1950 DIDs in a batch"); count++; console.info(`Iteration ${count} done`); if (limit && count >= limit) { break; } - console.timeEnd('iteration'); + console.timeEnd("iteration"); } - console.timeEnd('loop'); + console.timeEnd("loop"); } async function main() { @@ -270,7 +273,7 @@ async function main() { await sendAnchorTxns(7000); break; default: - console.error('Argument should be 0, 1 or 2'); + console.error("Argument should be 0, 1 or 2"); process.exit(1); } process.exit(0); @@ -282,6 +285,6 @@ dock }) .then(main) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/insert_session_key_with_seed.js b/packages/dock-blockchain-api/scripts/insert_session_key_with_seed.js similarity index 56% rename from scripts/insert_session_key_with_seed.js rename to packages/dock-blockchain-api/scripts/insert_session_key_with_seed.js index 9bf808651..d80c775c7 100644 --- a/scripts/insert_session_key_with_seed.js +++ b/packages/dock-blockchain-api/scripts/insert_session_key_with_seed.js @@ -2,17 +2,17 @@ // using the same seed and insert them in the keystore. This is useful when an entity needs to run several nodes as validators // by all nodes having the same session key in their keystore but only one of them running as a validator (with flag `--validator`) -import { cryptoWaitReady } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; -import dock from '../src/index'; +import { cryptoWaitReady } from "@polkadot/util-crypto"; +import { u8aToHex } from "@polkadot/util"; +import dock from "../src/index"; -require('dotenv').config(); +require("dotenv").config(); // This is the endpoint of the node whose keystore will be updated with the keys const { FullNodeEndpoint } = process.env; if (process.argv.length !== 3) { - console.error('Need only one argument as the seed'); + console.error("Need only one argument as the seed"); process.exit(1); } @@ -23,37 +23,41 @@ if (process.argv.length !== 3) { */ async function insertKeys(seed) { await cryptoWaitReady(); - const pairBabe = dock.keyring.addFromUri(seed, null, 'sr25519'); + const pairBabe = dock.keyring.addFromUri(seed, null, "sr25519"); const pkBabe = u8aToHex(pairBabe.publicKey); - const pairGran = dock.keyring.addFromUri(seed, null, 'ed25519'); + const pairGran = dock.keyring.addFromUri(seed, null, "ed25519"); const pkGran = u8aToHex(pairGran.publicKey); - const pairAudi = dock.keyring.addFromUri(seed, null, 'sr25519'); + const pairAudi = dock.keyring.addFromUri(seed, null, "sr25519"); const pkAudi = u8aToHex(pairAudi.publicKey); - const pairImon = dock.keyring.addFromUri(seed, null, 'sr25519'); + const pairImon = dock.keyring.addFromUri(seed, null, "sr25519"); const pkImon = u8aToHex(pairImon.publicKey); // Prepare session key by concatenating Aura and Grandpa keys - const sessKey = pkBabe + pkGran.substring(2) + pkAudi.substring(2) + pkImon.substring(2); // Remove `0x` from other key + const sessKey = + pkBabe + pkGran.substring(2) + pkAudi.substring(2) + pkImon.substring(2); // Remove `0x` from other key // Insert keys through RPC - await dock.api.rpc.author.insertKey('babe', seed, pkBabe); - await dock.api.rpc.author.insertKey('gran', seed, pkGran); - await dock.api.rpc.author.insertKey('audi', seed, pkAudi); - await dock.api.rpc.author.insertKey('imon', seed, pkImon); + await dock.api.rpc.author.insertKey("babe", seed, pkBabe); + await dock.api.rpc.author.insertKey("gran", seed, pkGran); + await dock.api.rpc.author.insertKey("audi", seed, pkAudi); + await dock.api.rpc.author.insertKey("imon", seed, pkImon); const hasKey = await dock.api.rpc.author.hasSessionKeys(sessKey); if (!hasKey) { - throw new Error('Inserted session key not found in keystore. This is a bug and should be reported'); + throw new Error( + "Inserted session key not found in keystore. This is a bug and should be reported" + ); } console.log(`The generated session key is ${sessKey}`); process.exit(0); } -dock.init({ - address: FullNodeEndpoint, -}) +dock + .init({ + address: FullNodeEndpoint, + }) .then(() => insertKeys(process.argv[2])) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/latency_checker.js b/packages/dock-blockchain-api/scripts/latency_checker.js similarity index 70% rename from scripts/latency_checker.js rename to packages/dock-blockchain-api/scripts/latency_checker.js index 4d35ba1e0..225a504ed 100644 --- a/scripts/latency_checker.js +++ b/packages/dock-blockchain-api/scripts/latency_checker.js @@ -1,10 +1,11 @@ -import dock from '../src/index'; -import { DockDid } from '../src/did'; -import { getPublicKeyFromKeyringPair } from '../src/utils/misc'; -import { median } from './helpers'; -import { DidKey, VerificationRelationship } from '../src/public-keys'; +import dock from "../src/index"; +import { DockDid } from "../src/did"; +import { getPublicKeyFromKeyringPair } from "../src/utils/misc"; +import { median } from "./helpers"; +import { DidKey, VerificationRelationship } from "../src/public-keys"; +import { Ed25519Keypair } from "@docknetwork/credential-sdk/keypairs"; -require('dotenv').config(); +require("dotenv").config(); const { FullNodeEndpoint, EndowedSecretURI } = process.env; @@ -14,11 +15,11 @@ async function sendTxn(baseSeed, seedPath) { // DID will be generated randomly const dockDID = DockDid.random(); const seed = `${baseSeed}/${seedPath}`; - const pair = dock.keyring.addFromUri(seed, null, 'sr25519'); - const publicKey = getPublicKeyFromKeyringPair(pair); + const pair = new Ed25519Keypair(seed); + const publicKey = pair.publicKey(); const didKey = new DidKey(publicKey, new VerificationRelationship()); const start = new Date().getTime(); - await dock.did.new(dockDID, [didKey], [], false); + await dock.modules.did.new(dockDID, [didKey], [], false); return new Date().getTime() - start; } @@ -29,7 +30,8 @@ async function main(countReqs) { const account = dock.keyring.addFromUri(EndowedSecretURI); dock.setAccount(account); - const baseSeed = '0x3f7b9516b38f6bb8c3241e58eaa37d318c03d4facdf03c9ce61507b9bc1c34ea'; + const baseSeed = + "0x3f7b9516b38f6bb8c3241e58eaa37d318c03d4facdf03c9ce61507b9bc1c34ea"; // Send `count` requests and calculate for each request const durations = []; let counter = 0; @@ -46,7 +48,7 @@ async function main(countReqs) { const mean = Math.round(total / durations.length); const med = median(durations); console.log( - `After sending ${durations.length} requests, mean latency is ${mean}ms and median is ${med}ms`, + `After sending ${durations.length} requests, mean latency is ${mean}ms and median is ${med}ms` ); process.exit(1); } @@ -65,6 +67,6 @@ dock return main(count); }) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/master_voting/example_proposal.json b/packages/dock-blockchain-api/scripts/master_voting/example_proposal.json similarity index 100% rename from scripts/master_voting/example_proposal.json rename to packages/dock-blockchain-api/scripts/master_voting/example_proposal.json diff --git a/scripts/master_voting/example_votes.json b/packages/dock-blockchain-api/scripts/master_voting/example_votes.json similarity index 100% rename from scripts/master_voting/example_votes.json rename to packages/dock-blockchain-api/scripts/master_voting/example_votes.json diff --git a/scripts/master_voting/submit.js b/packages/dock-blockchain-api/scripts/master_voting/submit.js similarity index 72% rename from scripts/master_voting/submit.js rename to packages/dock-blockchain-api/scripts/master_voting/submit.js index 72aa980a4..81722c40d 100644 --- a/scripts/master_voting/submit.js +++ b/packages/dock-blockchain-api/scripts/master_voting/submit.js @@ -2,15 +2,15 @@ // Master::execute() transaction. // Assumes all signature are Sr25519. -import { sr25519Verify } from '@polkadot/util-crypto/sr25519'; -import { u8aToHex, assert } from '@polkadot/util'; -import { keypair, connect } from '../helpers'; -import { createDidSig } from '../../src/did'; -import { getStateChange } from '../../src/utils/misc'; +import { sr25519Verify } from "@polkadot/util-crypto/sr25519"; +import { u8aToHex, assert } from "@polkadot/util"; +import { keypair, connect } from "../helpers"; +import { createDidSig } from "../../src/did"; +import { getStateChange } from "../../src/utils/misc"; -const { promises: fs } = require('fs'); +const { promises: fs } = require("fs"); -require('dotenv').config(); +require("dotenv").config(); const USAGE = `\ npx babel-node ./scripts/master_votes_submit.js @@ -25,20 +25,22 @@ env vars: Note: This script only supports sr25519 keys. `; -main().catch((e) => { - console.error(e); - process.exit(1); -}).then((_) => { - process.exit(0); -}); +main() + .catch((e) => { + console.error(e); + process.exit(1); + }) + .then((_) => { + process.exit(0); + }); async function main() { - const { - FullNodeEndpoint, - PayerSecret, - } = process.env; - assert(FullNodeEndpoint !== undefined, 'env var FullNodeEndpoint must be defined'); - assert(PayerSecret !== undefined, 'env var PayerSecret must be defined'); + const { FullNodeEndpoint, PayerSecret } = process.env; + assert( + FullNodeEndpoint !== undefined, + "env var FullNodeEndpoint must be defined" + ); + assert(PayerSecret !== undefined, "env var PayerSecret must be defined"); if (process.argv.length !== 4) { throw USAGE; @@ -54,7 +56,7 @@ async function main() { votes, }); - console.log('Proposal and votes successfully submitted.'); + console.log("Proposal and votes successfully submitted."); } /** @@ -67,16 +69,11 @@ async function main() { * @param votes - list of [did, signature] pairs. values should be formated as 0x-prefixed hex. * @returns {Promise<()>} */ -async function submit({ - nodeWsUrl, - payerKey, - proposal, - votes, -}) { +async function submit({ nodeWsUrl, payerKey, proposal, votes }) { const nc = await connect(nodeWsUrl); // encode proposal as call - const call = nc.api.createType('Call', proposal); + const call = nc.api.createType("Call", proposal); // parse votes const mpauth = toAuth(votes); @@ -98,7 +95,10 @@ async function submit({ * @returns {Array} */ function toAuth(votes) { - return votes.map((did, keyId, signature, nonce) => [createDidSig(did, keyId, signature), nonce]); + return votes.map((did, keyId, signature, nonce) => [ + createDidSig(did, keyId, signature), + nonce, + ]); } /** @@ -125,21 +125,30 @@ async function assertValidAuth(nodeClient, proposal, mpauth) { } const srpk = pk.asSr25519.value; const srsig = sig.asSr25519.value; - const encoded_state_change = asEncodedStateChange(nodeClient, roundNo, proposal, nonce); + const encoded_state_change = asEncodedStateChange( + nodeClient, + roundNo, + proposal, + nonce + ); const ver = sr25519Verify(encoded_state_change, srsig, srpk); if (!ver) { - throw 'Signature invalid:\n' - + ` payload: ${u8aToHex(encoded_state_change)}\n` - + ` did: ${did}\n` - + ` public: ${srpk}\n` - + ` sig: ${srsig}`; + throw ( + "Signature invalid:\n" + + ` payload: ${u8aToHex(encoded_state_change)}\n` + + ` did: ${did}\n` + + ` public: ${srpk}\n` + + ` sig: ${srsig}` + ); } } // * - all dids are members of master const membership = await nodeClient.api.query.master.members(); for (const [did, _sig] of mpauth) { - const is_member = [...membership.members].some((member) => u8aToHex(member) === u8aToHex(did)); + const is_member = [...membership.members].some( + (member) => u8aToHex(member) === u8aToHex(did) + ); if (!is_member) { throw `${did} is not a member of master`; } @@ -162,9 +171,9 @@ async function assertValidAuth(nodeClient, proposal, mpauth) { * @returns */ function asEncodedStateChange(nodeClient, roundNo, call, nonce) { - const encodedProposal = [...nodeClient.api.createType('Call', call).toU8a()]; + const encodedProposal = [...nodeClient.api.createType("Call", call).toU8a()]; const vote = { nonce, proposal: encodedProposal, round_no: roundNo }; - return getStateChange(nodeClient.api, 'MasterVote', vote); + return getStateChange(nodeClient.api, "MasterVote", vote); } /** @@ -178,15 +187,16 @@ async function signSendTx(extrinsic, kp) { const promise = new Promise((resolve, reject) => { try { let unsubFunc = null; - return extrinsic.send(({ events = [], status }) => { - if (status.isFinalized) { - unsubFunc(); - resolve({ - events, - status, - }); - } - }) + return extrinsic + .send(({ events = [], status }) => { + if (status.isFinalized) { + unsubFunc(); + resolve({ + events, + status, + }); + } + }) .catch((error) => { reject(error); }) diff --git a/scripts/master_voting/vote.js b/packages/dock-blockchain-api/scripts/master_voting/vote.js similarity index 77% rename from scripts/master_voting/vote.js rename to packages/dock-blockchain-api/scripts/master_voting/vote.js index 1dbed8307..777112e83 100644 --- a/scripts/master_voting/vote.js +++ b/packages/dock-blockchain-api/scripts/master_voting/vote.js @@ -1,13 +1,13 @@ // Signs a master proposal using sr25519, prints the signature as hex. -import { u8aToHex } from '@polkadot/util'; -import { connect, keypair } from '../helpers'; -import { DockDidOrDidMethodKey } from '../../src/did'; -import { getStateChange } from '../../src/utils/misc'; +import { u8aToHex } from "@polkadot/util"; +import { connect, keypair } from "../helpers"; +import { DockDidOrDidMethodKey } from "../../src/did"; +import { getStateChange } from "../../src/utils/misc"; -require('dotenv').config(); +require("dotenv").config(); -const fsp = require('fs').promises; +const fsp = require("fs").promises; const USAGE = ` Use: @@ -54,7 +54,7 @@ async function main() { let do_vote_yes = false; if (process.argv.length === 5) { - if (process.argv[4] !== 'yes') { + if (process.argv[4] !== "yes") { throw 'final argument must be either omitted or "yes"'; } do_vote_yes = true; @@ -64,7 +64,7 @@ async function main() { try { proposal = JSON.parse(proposal_unparsed); } catch (e) { - console.error('Proposal is not valid json.'); + console.error("Proposal is not valid json."); throw e; } @@ -73,24 +73,24 @@ async function main() { const actual_round_no = (await nc.api.query.master.round()).toJSON(); if (actual_round_no !== round_no) { throw ( - 'Round number passed as argument is not equal to round number reported by node.\n' - + `Passed as argument: ${round_no}\n` - + `Reported by node: ${actual_round_no}` + "Round number passed as argument is not equal to round number reported by node.\n" + + `Passed as argument: ${round_no}\n` + + `Reported by node: ${actual_round_no}` ); } // encode proposal as call - const call = nc.api.createType('Call', proposal); + const call = nc.api.createType("Call", proposal); - console.log(''); + console.log(""); console.log(`This proposal calls "${call._meta.name}" with arguments:`); console.dir(JSON.parse(JSON.stringify(call.args)), { depth: null }); - console.log(''); + console.log(""); - const encodedProposal = [...nc.api.createType('Call', proposal).toU8a()]; + const encodedProposal = [...nc.api.createType("Call", proposal).toU8a()]; const nonce = await nc.didModule.getNextNonceForDid(did); const vote = { nonce, proposal: encodedProposal, round_no: actual_round_no }; - const encodedStateChange = getStateChange(nc.api, 'MasterVote', vote); + const encodedStateChange = getStateChange(nc.api, "MasterVote", vote); if (do_vote_yes) { // sign and print signature diff --git a/scripts/queries.js b/packages/dock-blockchain-api/scripts/queries.js similarity index 59% rename from scripts/queries.js rename to packages/dock-blockchain-api/scripts/queries.js index 66d3a2e2d..aa6aeb73f 100644 --- a/scripts/queries.js +++ b/packages/dock-blockchain-api/scripts/queries.js @@ -1,6 +1,6 @@ -import { DockAPI } from '../src/index'; +import { DockAPI } from "../src/index"; -require('dotenv').config(); +require("dotenv").config(); async function getHandle(endpoint) { const handle = new DockAPI(); @@ -19,7 +19,7 @@ async function getHandles(count, endpoint) { // Get balance of an account. async function getBalance(handle, address) { - return parseInt((await getBalance(handle.api, address))); + return parseInt(await getBalance(handle.api, address)); } // Get balance of given list of accounts. @@ -38,39 +38,52 @@ async function getBalancesRepeatedly(count, handle, addresses) { async function getBalanceWithAllHandles(handles, address) { return Promise.all(handles.map((h) => getBalance(h, address))).then(() => { - console.log('done getting balance'); + console.log("done getting balance"); }); } async function getBalancesWithAllHandles(handles, addresses) { return Promise.all(handles.map((h) => getBalances(h, addresses))).then(() => { - console.log('done getting balances'); + console.log("done getting balances"); }); } async function getBalancesWithAllHandlesRepeat(handles, addresses, count) { - return Promise.all(handles.map((h) => getBalancesRepeatedly(count, h, addresses))).then(() => { - console.log('done getting balances'); + return Promise.all( + handles.map((h) => getBalancesRepeatedly(count, h, addresses)) + ).then(() => { + console.log("done getting balances"); }); } async function main() { // Websocket server at localhost:9000 - const endpoint = 'ws://127.0.0.1:9900'; + const endpoint = "ws://127.0.0.1:9900"; - const alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; - const bob = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; - const charlie = '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y'; - const dave = '5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy'; - const eve = '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw'; - const ferdie = '5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL'; + const alice = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; + const bob = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"; + const charlie = "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y"; + const dave = "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy"; + const eve = "5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw"; + const ferdie = "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL"; const count = 10; const handles = await getHandles(count, endpoint); await getBalanceWithAllHandles(handles, alice); - await getBalancesWithAllHandles(handles, [alice, bob, charlie, dave, eve, ferdie]); - await getBalancesWithAllHandlesRepeat(handles, [alice, bob, charlie, dave, eve, ferdie], 100); + await getBalancesWithAllHandles(handles, [ + alice, + bob, + charlie, + dave, + eve, + ferdie, + ]); + await getBalancesWithAllHandlesRepeat( + handles, + [alice, bob, charlie, dave, eve, ferdie], + 100 + ); } main() @@ -78,6 +91,6 @@ main() process.exit(0); }) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/runtime_upgrade_with_sudo.js b/packages/dock-blockchain-api/scripts/runtime_upgrade_with_sudo.js similarity index 55% rename from scripts/runtime_upgrade_with_sudo.js rename to packages/dock-blockchain-api/scripts/runtime_upgrade_with_sudo.js index ff42439d4..60fa18890 100644 --- a/scripts/runtime_upgrade_with_sudo.js +++ b/packages/dock-blockchain-api/scripts/runtime_upgrade_with_sudo.js @@ -1,16 +1,16 @@ // Script to send runtime upgrade using sudo account -import dock from '../src/index'; -import { sendTxnWithAccount } from './helpers'; +import dock from "../src/index"; +import { sendTxnWithAccount } from "./helpers"; -require('dotenv').config(); +require("dotenv").config(); -const fs = require('fs'); +const fs = require("fs"); const { FullNodeEndpoint, SudoSecretURI } = process.env; if (process.argv.length !== 3) { - console.error('Need only 1 argument which is the path of wasm file'); + console.error("Need only 1 argument which is the path of wasm file"); process.exit(2); } @@ -20,16 +20,21 @@ if (process.argv.length !== 3) { */ async function getRuntimeVersion(dock) { const ver = await dock.api.rpc.state.getRuntimeVersion(); - return [ver.authoringVersion.toNumber(), ver.specVersion.toNumber(), ver.implVersion.toNumber(), ver.transactionVersion.toNumber()]; + return [ + ver.authoringVersion.toNumber(), + ver.specVersion.toNumber(), + ver.implVersion.toNumber(), + ver.transactionVersion.toNumber(), + ]; } async function doRuntimeUpgrade() { console.log(`Upgrading runtime using endpoint: ${FullNodeEndpoint}`); const code = fs.readFileSync(process.argv[2]); - const codeAsHex = code.toString('hex'); + const codeAsHex = code.toString("hex"); - fs.writeFileSync('wasm_code.hex', codeAsHex); - console.log('WASM code written in hex in file wasm_code.hex'); + fs.writeFileSync("wasm_code.hex", codeAsHex); + console.log("WASM code written in hex in file wasm_code.hex"); // Prepare to send the code const proposal = dock.api.tx.system.setCode(`0x${codeAsHex}`); @@ -42,29 +47,43 @@ async function doRuntimeUpgrade() { const txn = dock.api.tx.sudo.sudoUncheckedWeight(proposal, code.length); const runtimeVerBeforeUpgrade = await getRuntimeVersion(dock); - console.log('Before upgrade'); - console.log(`Authoring version, Spec version, Impl version, Transaction version -> (${[...runtimeVerBeforeUpgrade]})`); + console.log("Before upgrade"); + console.log( + `Authoring version, Spec version, Impl version, Transaction version -> (${[ + ...runtimeVerBeforeUpgrade, + ]})` + ); - console.log('Going to send node upgrade transaction'); + console.log("Going to send node upgrade transaction"); const blockHash = await sendTxnWithAccount(dock, SudoSecretURI, txn); console.log(`Code upgrade extrinsic finalized in block ${blockHash}`); const runtimeVerAfterUpgrade = await getRuntimeVersion(dock); - console.log('After upgrade'); - console.log(`Authoring version, Spec version, Impl version, Transaction version -> (${[...runtimeVerAfterUpgrade]})`); + console.log("After upgrade"); + console.log( + `Authoring version, Spec version, Impl version, Transaction version -> (${[ + ...runtimeVerAfterUpgrade, + ]})` + ); // Runtime version should change. - if (JSON.stringify(runtimeVerBeforeUpgrade) === JSON.stringify(runtimeVerAfterUpgrade)) { - throw new Error('Runtime version did not change post upgrade. Update did not happen, maybe the node was already running the version'); + if ( + JSON.stringify(runtimeVerBeforeUpgrade) === + JSON.stringify(runtimeVerAfterUpgrade) + ) { + throw new Error( + "Runtime version did not change post upgrade. Update did not happen, maybe the node was already running the version" + ); } process.exit(0); } -dock.init({ - address: FullNodeEndpoint, -}) +dock + .init({ + address: FullNodeEndpoint, + }) .then(doRuntimeUpgrade) .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); + console.error("Error occurred somewhere, it was caught!", error); process.exit(1); }); diff --git a/scripts/set-storage.js b/packages/dock-blockchain-api/scripts/set-storage.js similarity index 65% rename from scripts/set-storage.js rename to packages/dock-blockchain-api/scripts/set-storage.js index 51611d76b..70b6845da 100644 --- a/scripts/set-storage.js +++ b/packages/dock-blockchain-api/scripts/set-storage.js @@ -1,15 +1,17 @@ -import { toPairs } from 'ramda'; -import fs from 'fs'; -import { withDockAPI } from './helpers'; +import { toPairs } from "ramda"; +import fs from "fs"; +import { withDockAPI } from "./helpers"; const { FullNodeEndpoint, SudoSecretURI } = process.env; const [_, __, filePath] = process.argv; async function main(dock, filePath) { const keyValuePairs = JSON.parse(fs.readFileSync(filePath)); - console.log('Setting', JSON.stringify(keyValuePairs, null, 2)); + console.log("Setting", JSON.stringify(keyValuePairs, null, 2)); const setStorageTx = dock.api.tx.system.setStorage(toPairs(keyValuePairs)); return dock.signAndSend(dock.api.tx.sudo.sudo(setStorageTx)); } -withDockAPI({ senderAccountURI: SudoSecretURI, address: FullNodeEndpoint })(main)(filePath).catch(console.error); +withDockAPI({ senderAccountURI: SudoSecretURI, address: FullNodeEndpoint })( + main +)(filePath).catch(console.error); diff --git a/scripts/set_export_paths.js b/packages/dock-blockchain-api/scripts/set_export_paths.js similarity index 76% rename from scripts/set_export_paths.js rename to packages/dock-blockchain-api/scripts/set_export_paths.js index 2d5cf4102..d254aba44 100644 --- a/scripts/set_export_paths.js +++ b/packages/dock-blockchain-api/scripts/set_export_paths.js @@ -1,8 +1,8 @@ -const distDir = 'dist'; -const distPackage = 'package.json'; +const distDir = "dist"; +const distPackage = "package.json"; -const { resolve, relative } = require('path'); -const { readdir, readFile, writeFile } = require('fs').promises; +const { resolve, relative } = require("path"); +const { readdir, readFile, writeFile } = require("fs").promises; async function* getFiles(dir) { const dirents = await readdir(dir, { withFileTypes: true }); @@ -20,17 +20,17 @@ async function* getFiles(dir) { (async () => { const exports = { - '.': { - require: './index.cjs', - default: './index.js', + ".": { + require: "./index.cjs", + default: "./index.js", }, }; for await (const f of getFiles(distDir)) { - if (f.indexOf('.cjs') > -1) { + if (f.indexOf(".cjs") > -1) { continue; } - if (f.indexOf('.js') > -1) { + if (f.indexOf(".js") > -1) { exports[`./${f.substring(0, f.length - 3)}`] = { require: `./${f.substring(0, f.length - 3)}.cjs`, default: `./${f}`, @@ -46,9 +46,9 @@ async function* getFiles(dir) { // Read package.json and modify it const packagePath = resolve(distDir, distPackage); - const distPackageTxt = (await readFile(packagePath)).toString('UTF-8'); + const distPackageTxt = (await readFile(packagePath)).toString("UTF-8"); const distPackageJSON = JSON.parse(distPackageTxt); distPackageJSON.exports = exports; - distPackageJSON.type = 'module'; + distPackageJSON.type = "module"; await writeFile(packagePath, JSON.stringify(distPackageJSON, null, 2)); })(); diff --git a/scripts/show-revoked-status-list-indices.js b/packages/dock-blockchain-api/scripts/show-revoked-status-list-indices.js similarity index 58% rename from scripts/show-revoked-status-list-indices.js rename to packages/dock-blockchain-api/scripts/show-revoked-status-list-indices.js index 5861a28e8..3940496e8 100644 --- a/scripts/show-revoked-status-list-indices.js +++ b/packages/dock-blockchain-api/scripts/show-revoked-status-list-indices.js @@ -1,17 +1,20 @@ -import { StatusList2021Credential } from '../src'; -import { DockDidOrDidMethodKey } from '../src/did'; -import { withDockAPI } from './helpers'; +import { + DockDidOrDidMethodKey, + StatusList2021Credential, +} from "@docknetwork/credential-sdk/types"; +import { withDockAPI } from "./helpers"; const { FullNodeEndpoint, ShowEmpty, ShowDeprecated } = process.env; async function main(dock) { - console.log('Revoked:'); + console.log("Revoked:"); - const statusListCreds = await dock.api.query.statusListCredential.statusListCredentials.entries(); + const statusListCreds = + await dock.api.query.statusListCredential.statusListCredentials.entries(); for (const [id, unparsedCredential] of statusListCreds) { const credential = StatusList2021Credential.fromBytes( unparsedCredential.unwrap().statusListCredential - .asStatusList2021Credential, + .asStatusList2021Credential ); const owners = [ ...(await unparsedCredential.unwrap().policy.asOneOf.values()), @@ -20,7 +23,7 @@ async function main(dock) { .map(String); const decoded = await credential.decodedStatusList(); const revoked = await credential.revokedBatch( - Array.from({ length: decoded.length }, (_, idx) => idx), + Array.from({ length: decoded.length }, (_, idx) => idx) ); const toShow = revoked @@ -30,30 +33,30 @@ async function main(dock) { if (toShow.length || ShowEmpty) { decoded.bitstring.leftToRightIndexing = false; const revoked = await credential.revokedBatch( - Array.from({ length: decoded.length }, (_, idx) => idx), + Array.from({ length: decoded.length }, (_, idx) => idx) ); const toShowBigEndian = revoked .map((revoked, idx) => (revoked ? idx : null)) .filter((v) => v != null); if (ShowDeprecated) { - console.log(id.toHuman()[0], ':'); + console.log(id.toHuman()[0], ":"); console.log( - ' - revoked indices with left to right indexing (correct):', - toShow.join(', ') || '-', + " - revoked indices with left to right indexing (correct):", + toShow.join(", ") || "-" ); console.log( - ' - revoked indices with right to left indexing (deprecated):', - toShowBigEndian.join(', ') || '-', + " - revoked indices with right to left indexing (deprecated):", + toShowBigEndian.join(", ") || "-" ); - console.log(' - owners:', owners.join(',')); + console.log(" - owners:", owners.join(",")); } else { console.log( id.toHuman()[0], - ':', - toShow.join(', ') || '-', - '; owners:', - owners.join(','), + ":", + toShow.join(", ") || "-", + "; owners:", + owners.join(",") ); } } diff --git a/scripts/slack.js b/packages/dock-blockchain-api/scripts/slack.js similarity index 66% rename from scripts/slack.js rename to packages/dock-blockchain-api/scripts/slack.js index 94d0b8989..d247b62a6 100644 --- a/scripts/slack.js +++ b/packages/dock-blockchain-api/scripts/slack.js @@ -1,15 +1,15 @@ -import { curry } from 'ramda'; -import fetch from 'node-fetch'; -import { envObj, notNilAnd } from './helpers'; +import { curry } from "ramda"; +import fetch from "node-fetch"; +import { envObj, notNilAnd } from "./helpers"; const { SlackNotificationWebhookUrl } = envObj({ SlackNotificationWebhookUrl: notNilAnd(String), }); export const TYPES = { - WARNING: 'warning', - DANGER: 'danger', - SUCCESS: 'success', + WARNING: "warning", + DANGER: "danger", + SUCCESS: "success", }; /** @@ -26,16 +26,16 @@ export const postMessage = curry(async (type, header, fields) => { ts: new Date().getTime() / 1e3, }, ], - }), + }) ); const headers = { - 'Content-Type': 'application/json', - 'Content-Length': body.byteLength, + "Content-Type": "application/json", + "Content-Length": body.byteLength, }; return await fetch(SlackNotificationWebhookUrl, { headers, - method: 'POST', + method: "POST", body, }); }); diff --git a/scripts/staking_payouts.js b/packages/dock-blockchain-api/scripts/staking_payouts.js similarity index 74% rename from scripts/staking_payouts.js rename to packages/dock-blockchain-api/scripts/staking_payouts.js index 5206215dd..c760f020e 100644 --- a/scripts/staking_payouts.js +++ b/packages/dock-blockchain-api/scripts/staking_payouts.js @@ -1,7 +1,5 @@ -import BN from 'bn.js'; -import { - from, lastValueFrom, timer, EMPTY, defer, -} from 'rxjs'; +import BN from "bn.js"; +import { from, lastValueFrom, timer, EMPTY, defer } from "rxjs"; import { tap, map as mapRx, @@ -12,7 +10,7 @@ import { toArray, concatMapTo, catchError, -} from 'rxjs/operators'; +} from "rxjs/operators"; import { prop, indexBy, @@ -35,10 +33,10 @@ import { split, reduceBy, either, -} from 'ramda'; +} from "ramda"; -import dotenv from 'dotenv'; -import { sendAlarmEmailText } from './email_utils'; +import dotenv from "dotenv"; +import { sendAlarmEmailText } from "./email_utils"; import { batchExtrinsics, envObj, @@ -48,7 +46,7 @@ import { formatDock, parseBool, withDockAPI, -} from './helpers'; +} from "./helpers"; dotenv.config(); @@ -71,7 +69,7 @@ const { // Address of the node RPC. FullNodeEndpoint: notNilAnd(String), // List of email addresses separated by comma to send alarm email to. - StakingPayoutsAlarmEmailTo: notNilAnd(split(',')), + StakingPayoutsAlarmEmailTo: notNilAnd(split(",")), // Account to send transactions from. InitiatorAccountURI: notNilAnd(String), // Max batch size. @@ -83,7 +81,7 @@ const { // Timeout to wait before retry transaction. In ms. RetryTimeout: o(finiteNumber, defaultTo(5e3)), // Max commission allowed to be set for validators. Default is 5%. Used as a criteria if `TargetAllValidatorsMatchingCriteria` is enabled. - MaxCommission: o((val) => new BN(val), defaultTo('50000000')), + MaxCommission: o((val) => new BN(val), defaultTo("50000000")), // Min account balance to ring the alarm. AlarmBalance: notNilAnd((val) => new BN(val)), // Time to wait for transaction to be finalized. In ms. @@ -93,14 +91,14 @@ const { // Finalize the transaction or just wait for it to be included in the block. FinalizeTx: parseBool, // List of validator stashes to make payouts to independently of matching criteria or not. - TargetStashIds: pipe(defaultTo(''), split(','), reject(isEmpty)), + TargetStashIds: pipe(defaultTo(""), split(","), reject(isEmpty)), // Target all validators matching criteria along with targeting supplied stash id list. TargetAllValidatorsMatchingCriteria: parseBool, }); if (!TargetAllValidatorsMatchingCriteria && TargetStashIds.length === 0) { throw new Error( - 'No target validators were found. You can provide list of validator stash ids by specifying `TargetStashIds` or force all validators to be checked by setting `TargetAllValidatorsMatchingCriteria` to `true`', + "No target validators were found. You can provide list of validator stash ids by specifying `TargetStashIds` or force all validators to be checked by setting `TargetAllValidatorsMatchingCriteria` to `true`" ); } @@ -111,24 +109,24 @@ const main = withDockAPI( async (dock) => { const initiator = dock.keyring.addFromUri(InitiatorAccountURI); - console.log('Pre-work balance check.'); + console.log("Pre-work balance check."); const balanceIsOk = await checkBalance( dock.api, StakingPayoutsAlarmEmailTo, initiator.address, - AlarmBalance, + AlarmBalance ); - console.log('Fetching eras info...'); + console.log("Fetching eras info..."); const erasInfo = await fetchErasInfo(dock.api); - console.log('Calculating and sending payouts:'); + console.log("Calculating and sending payouts:"); let needToRecheck; try { needToRecheck = await timeout( IterationTimeout, - sendStakingPayouts(dock, erasInfo, initiator, BatchSize), + sendStakingPayouts(dock, erasInfo, initiator, BatchSize) ); } catch (err) { needToRecheck = true; @@ -138,25 +136,25 @@ const main = withDockAPI( if (needToRecheck) { // Check payouts again with a batch size of 1 // This is needed to execute valid transactions packed in invalid batches - console.log('Checking payouts again:'); + console.log("Checking payouts again:"); await timeout( IterationTimeout, - sendStakingPayouts(dock, erasInfo, initiator, 1), + sendStakingPayouts(dock, erasInfo, initiator, 1) ); } if (balanceIsOk) { - console.log('Post-work balance check.'); + console.log("Post-work balance check."); await checkBalance( dock.api, StakingPayoutsAlarmEmailTo, initiator.address, - AlarmBalance, + AlarmBalance ); } - console.log('Done!'); - }, + console.log("Done!"); + } ); /** @@ -174,7 +172,8 @@ const main = withDockAPI( * @returns {bool} */ const ensureCommissionLessOrEqualTo = curry( - (maxCommission, stashId, { prefs }) => prefs.validators[stashId]?.commission?.toBn().lte(maxCommission), + (maxCommission, stashId, { prefs }) => + prefs.validators[stashId]?.commission?.toBn().lte(maxCommission) ); /** @@ -194,60 +193,60 @@ async function sendStakingPayouts(dock, erasInfo, initiator, batchSize) { console.log( `- Payouts will be made to target validator stashes ${JSON.stringify([ ...targetValidatorStashIds, - ])} and all validators matching criteria`, + ])} and all validators matching criteria` ); validatorStashIds = pipe( values, - pluck('validators'), + pluck("validators"), chain(keys), - (valitors) => new Set(valitors), + (valitors) => new Set(valitors) )(erasInfo.pointsByEra); } else { console.log( `- Payouts will be made only to target validator stashes ${JSON.stringify( - [...targetValidatorStashIds], - )}`, + [...targetValidatorStashIds] + )}` ); validatorStashIds = targetValidatorStashIds; } if (!validatorStashIds.size) { - console.log('- Validator set is empty.'); + console.log("- Validator set is empty."); return false; } - console.log('- Retrieving validator eras...'); + console.log("- Retrieving validator eras..."); const erasToBePaid = await lastValueFrom( from(validatorStashIds).pipe( getUnclaimedStashesEras(dock.api, erasInfo), - toArray(), - ), + toArray() + ) ); // Payout validator if it's either in a target list or satisfies criteria. const checkValidator = either( (validatorStashId) => targetValidatorStashIds.has(validatorStashId), - ensureCommissionLessOrEqualTo(MaxCommission), + ensureCommissionLessOrEqualTo(MaxCommission) ); const rewards = pipe(buildValidatorRewards, toPairs)( checkValidator, erasInfo, - erasToBePaid, + erasToBePaid ); if (isEmpty(rewards)) { - console.log('- No unpaid validator rewards found for recent eras.'); + console.log("- No unpaid validator rewards found for recent eras."); return false; } - console.log('- Payouts need to be made:'); + console.log("- Payouts need to be made:"); for (const [stashId, eras] of rewards) { const total = eras.reduce( (total, { reward }) => (total != null ? total.add(reward) : reward), - null, + null ); console.log(` * To \`${stashId}\`: ${formatDock(total)}`); @@ -257,9 +256,9 @@ async function sendStakingPayouts(dock, erasInfo, initiator, batchSize) { // There's a much better way to check this... const isBatch = tx.method.args?.[0]?.[0] instanceof Map; - let msg = ' * '; - if (isBatch) msg += 'Batch transaction'; - else msg += 'Transaction'; + let msg = " * "; + if (isBatch) msg += "Batch transaction"; + else msg += "Transaction"; if (FinalizeTx) { msg += ` finalized at block \`${result.status.asFinalized}\`: `; @@ -268,11 +267,12 @@ async function sendStakingPayouts(dock, erasInfo, initiator, batchSize) { } const payoutsSummary = (isBatch ? tx.method.args[0] : [tx.method]) - .map((payout) => payout.get('args')) + .map((payout) => payout.get("args")) .map( - ({ validator_stash, era }) => `\`${validator_stash}\` rewarded for era ${era}`, + ({ validator_stash, era }) => + `\`${validator_stash}\` rewarded for era ${era}` ) - .join(isBatch ? ',\n ' : ','); + .join(isBatch ? ",\n " : ","); msg += isBatch ? `[\n ${payoutsSummary}\n ]` : payoutsSummary; @@ -280,17 +280,21 @@ async function sendStakingPayouts(dock, erasInfo, initiator, batchSize) { }; const payoutTxs$ = from(rewards).pipe( - concatMap(([stashId, eras]) => from(eras.map(assoc('stashId', stashId)))), - mapRx(({ stashId, era }) => dock.api.tx.staking.payoutStakers(stashId, era)), + concatMap(([stashId, eras]) => from(eras.map(assoc("stashId", stashId)))), + mapRx(({ stashId, era }) => + dock.api.tx.staking.payoutStakers(stashId, era) + ), batchExtrinsics(dock.api, batchSize), signAndSendExtrinsics(dock, initiator), - tap(logResult), + tap(logResult) ); - await new Promise((resolve, reject) => payoutTxs$.subscribe({ - error: reject, - complete: resolve, - })); + await new Promise((resolve, reject) => + payoutTxs$.subscribe({ + error: reject, + complete: resolve, + }) + ); return true; } @@ -312,16 +316,16 @@ async function checkBalance(api, emailAddr, accountAddress, min) { if (balance.lt(min)) { console.error( `Balance of the \`${accountAddress}\` - ${formatDock( - balance, - )} is less than ${formatDock(min)}.`, + balance + )} is less than ${formatDock(min)}.` ); await sendAlarmEmailText( emailAddr, - 'Low balance of the staking payouts sender', + "Low balance of the staking payouts sender", `Balance of the \`${accountAddress}\` - ${formatDock( - balance, - )} is less than ${formatDock(min)}.`, + balance + )} is less than ${formatDock(min)}.` ); return false; @@ -346,7 +350,7 @@ async function checkBalance(api, emailAddr, accountAddress, min) { */ const fetchErasInfo = async (api) => { const eras = await api.derive.staking.erasHistoric(); - const indexByEra = indexBy(o((era) => era.toString(), prop('era'))); + const indexByEra = indexBy(o((era) => era.toString(), prop("era"))); const [pointsByEra, rewardsByEra, prefsByEra] = await Promise.all([ api.derive.staking._erasPoints(eras), @@ -403,14 +407,16 @@ const getUnclaimedStashesEras = curry((api, { eras }, stashIds$) => // Concurrently get unclaimed eras for each of stashes stashIds$.pipe( mergeMap( - (stashId) => from(getUnclaimedStashEras(api, eras, stashId)).pipe( - // Filter out stashes with no unclaimed eras - filterRx(complement(isEmpty)), - mapRx(assoc('eras', __, { stashId })), - ), - ConcurrentRequestsLimit, - ), - )); + (stashId) => + from(getUnclaimedStashEras(api, eras, stashId)).pipe( + // Filter out stashes with no unclaimed eras + filterRx(complement(isEmpty)), + mapRx(assoc("eras", __, { stashId })) + ), + ConcurrentRequestsLimit + ) + ) +); /** * Signs and sends extrinsics produced by the given observable. @@ -426,37 +432,39 @@ const signAndSendExtrinsics = curry((dock, initiator, txs$) => // To send several extrinsics simultaneously, we need to emulate increasing nonce from(dock.api.rpc.system.accountNextIndex(initiator.address)).pipe( switchMap((nonce) => { - const sendExtrinsic = (tx) => defer(() => { - dock.setAccount(initiator); - const sentTx = dock.signAndSend(tx, FinalizeTx, { nonce }); - // Increase nonce by hand - nonce = nonce.add(new BN(1)); - - return from(timeout(TxFinalizationTimeout, sentTx)); - }).pipe( - mapRx((result) => ({ tx, result })), - catchError((error, caught) => { - console.error(` * Transaction failed: ${error}`); - const stringified = error.toString().toLowerCase(); - - // Filter out errors related to balance, election and double-claim - if ( - stringified.includes('balance') - || stringified.includes('alreadyclaimed') - || stringified.includes('invalid transaction') - || stringified.includes('election') - ) { - return EMPTY; - } else { - // Retry an observable after the given timeout - return timer(RetryTimeout).pipe(concatMapTo(caught)); - } - }), - ); + const sendExtrinsic = (tx) => + defer(() => { + dock.setAccount(initiator); + const sentTx = dock.signAndSend(tx, FinalizeTx, { nonce }); + // Increase nonce by hand + nonce = nonce.add(new BN(1)); + + return from(timeout(TxFinalizationTimeout, sentTx)); + }).pipe( + mapRx((result) => ({ tx, result })), + catchError((error, caught) => { + console.error(` * Transaction failed:\n${error}`); + const stringified = error.toString().toLowerCase(); + + // Filter out errors related to balance, election and double-claim + if ( + stringified.includes("balance") || + stringified.includes("alreadyclaimed") || + stringified.includes("invalid transaction") || + stringified.includes("election") + ) { + return EMPTY; + } else { + // Retry an observable after the given timeout + return timer(RetryTimeout).pipe(concatMapTo(caught)); + } + }) + ); return txs$.pipe(mergeMap(sendExtrinsic, ConcurrentTxLimit)); - }), - )); + }) + ) +); /** * Groups eras having some reward to be paid by validator stash accounts. @@ -471,7 +479,7 @@ const buildValidatorRewards = curry( ( checkValidatorInEra, { pointsByEra, rewardsByEra, prefsByEra }, - validatorEras, + validatorEras ) => { const stashErasReducer = (acc, { eras, stashId }) => { const eraReducer = (acc, era) => { @@ -487,14 +495,14 @@ const buildValidatorRewards = curry( if ( // Points must be greater than 0 - eraPoints?.eraPoints.gt(new BN(0)) + eraPoints?.eraPoints.gt(new BN(0)) && // We must have a stash as a validator in the given era - && eraPoints?.validators[stashId] + eraPoints?.validators[stashId] && // Era rewards and prefs should be defined - && eraRewards - && eraPrefs + eraRewards && + eraPrefs && // Validator configuration in the era should be acceptable - && checkValidatorInEra(stashId, eraInfo) + checkValidatorInEra(stashId, eraInfo) ) { const reward = eraPoints.validators[stashId] .mul(eraRewards.eraReward) @@ -518,19 +526,19 @@ const buildValidatorRewards = curry( // Filter out stashes with no rewards reject(isEmpty), // Reduce given stash eras by the stash id - reduceBy(stashErasReducer, [], prop('stashId')), + reduceBy(stashErasReducer, [], prop("stashId")) )(validatorEras); - }, + } ); export const handler = async () => { await timeout(IterationTimeout * 2.5, main()); - return 'Done'; + return "Done"; }; if (require.main === module) { - console.log('Executing the script...'); + console.log("Executing the script..."); handler() .catch((error) => { diff --git a/scripts/state-restore.js b/packages/dock-blockchain-api/scripts/state-restore.js similarity index 65% rename from scripts/state-restore.js rename to packages/dock-blockchain-api/scripts/state-restore.js index 9b5b1fa46..a0122f42f 100644 --- a/scripts/state-restore.js +++ b/packages/dock-blockchain-api/scripts/state-restore.js @@ -1,17 +1,17 @@ // Read key-value pairs downloaded from chain and write them back. Used when restoring testnet. -import fs from 'fs'; +import fs from "fs"; -import { DockAPI } from '../src/index'; +import { DockAPI } from "../src/index"; -require('dotenv').config(); +require("dotenv").config(); const { FullNodeEndpoint, SudoSecretURI } = process.env; // Filesystem paths of JSON file containing state dump of few modules -const anchorsPath = ''; // To be filled -const blobsPath = ''; // To be filled -const didsPath = ''; // To be filled -const revokPath = ''; // To be filled +const anchorsPath = ""; // To be filled +const blobsPath = ""; // To be filled +const didsPath = ""; // To be filled +const revokPath = ""; // To be filled async function sendSetStorageTxn(dock, keyValue) { const storageTxn = dock.api.tx.system.setStorage(keyValue); @@ -22,7 +22,7 @@ async function sendSetStorageTxn(dock, keyValue) { async function loadFromFileAndSet(dock, filePath) { const file = fs.readFileSync(filePath); - const kv = (JSON.parse(file)).result; + const kv = JSON.parse(file).result; return sendSetStorageTxn(dock, kv); } @@ -34,11 +34,13 @@ async function main() { const account = dock.keyring.addFromUri(SudoSecretURI); dock.setAccount(account); - console.log(`Written in block ${(await loadFromFileAndSet(dock, anchorsPath))}`); + console.log( + `Written in block ${await loadFromFileAndSet(dock, anchorsPath)}` + ); - console.log(`Written in block ${(await loadFromFileAndSet(dock, blobsPath))}`); + console.log(`Written in block ${await loadFromFileAndSet(dock, blobsPath)}`); - console.log(`Written in block ${(await loadFromFileAndSet(dock, didsPath))}`); + console.log(`Written in block ${await loadFromFileAndSet(dock, didsPath)}`); console.log(`Written in block ${await loadFromFileAndSet(dock, revokPath)}`); } diff --git a/scripts/validator_stash_payouts.js b/packages/dock-blockchain-api/scripts/validator_stash_payouts.js similarity index 69% rename from scripts/validator_stash_payouts.js rename to packages/dock-blockchain-api/scripts/validator_stash_payouts.js index 84847de8d..b92cb0663 100644 --- a/scripts/validator_stash_payouts.js +++ b/packages/dock-blockchain-api/scripts/validator_stash_payouts.js @@ -1,11 +1,7 @@ -import { - o, defaultTo, unless, either, curry, __, sum, -} from 'ramda'; -import BN from 'bn.js'; -import { - toArray, from, mergeMap, lastValueFrom, -} from 'rxjs'; -import { validateAddress } from '../src/utils/chain-ops'; +import { o, defaultTo, unless, either, curry, __, sum } from "ramda"; +import BN from "bn.js"; +import { toArray, from, mergeMap, lastValueFrom } from "rxjs"; +import { validateAddress } from "../src/utils/chain-ops"; import { withDockAPI, formatDock, @@ -14,13 +10,13 @@ import { finiteNumber, parseBool, binarySearchFirstSatisfyingBlock, -} from './helpers'; +} from "./helpers"; const greaterThanZero = unless( (value) => value > 0, () => { - throw new Error('Must be greater than zero'); - }, + throw new Error("Must be greater than zero"); + } ); const { @@ -40,14 +36,14 @@ const { Stash: o( unless( either( - (addr) => validateAddress(addr, 'test'), - (addr) => validateAddress(addr, 'main'), + (addr) => validateAddress(addr, "test"), + (addr) => validateAddress(addr, "main") ), (addr) => { throw new Error(`Invalid stash address: ${addr}`); - }, + } ), - notNilAnd(String), + notNilAnd(String) ), // Start era to summarise payouts from. StartEra: o(greaterThanZero, notNilAnd(finiteNumber)), @@ -76,18 +72,18 @@ const main = withDockAPI( if (activeEraIndex < StartEra + ErasCount) { throw new Error( - `\`StartEra\` + \`ErasCount\` must be less or equal to ${activeEraIndex}`, + `\`StartEra\` + \`ErasCount\` must be less or equal to ${activeEraIndex}` ); } if (BlocksPerEra % SessionsPerEra) { throw new Error( - 'Failed to calculate blocks per session, `BlocksPerEra` should be divisible by `SessionsPerEra` with zero remainder', + "Failed to calculate blocks per session, `BlocksPerEra` should be divisible by `SessionsPerEra` with zero remainder" ); } const eraIndices = Array.from( { length: ErasCount }, - (_, idx) => StartEra + idx, + (_, idx) => StartEra + idx ); const lastBlock = (await dock.api.query.system.number()).toNumber(); @@ -96,14 +92,14 @@ const main = withDockAPI( o(from, async (eraIndex) => { const startBlock = Math.max( lastBlock - BlocksPerEra * (activeEraIndex - eraIndex), - 0, + 0 ); const { hash: eraPaidBlockHash, number } = await findEraPaidBlock( dock, startBlock, lastBlock, - eraIndex, + eraIndex ); const eraPaidApi = await dock.api.at(eraPaidBlockHash); @@ -115,7 +111,7 @@ const main = withDockAPI( const eraValidatorInfo = await fetchValidatorStashEraInfo( eraPaidApi, new BN(eraIndex), - Stash, + Stash ); let validatorPoints = new BN(0); @@ -127,46 +123,42 @@ const main = withDockAPI( const eraValidatorPayout = validatorPoints.isZero() ? { - total: new BN(0), - staking: new BN(0), - commission: new BN(0), - } + total: new BN(0), + staking: new BN(0), + commission: new BN(0), + } : validatorStashPayout( - eraValidatorInfo.prefs, - validatorPoints, - eraValidatorInfo.exposure, - eraValidatorInfo.points.total, - eraValidatorInfo.rewards, - ); + eraValidatorInfo.prefs, + validatorPoints, + eraValidatorInfo.exposure, + eraValidatorInfo.points.total, + eraValidatorInfo.rewards + ); return [ eraIndex, { ...eraValidatorPayout, blocks, prefs: eraValidatorInfo.prefs }, ]; }), - ConcurrentErasLimit, - ), + ConcurrentErasLimit + ) ); const validatorEraResults = await lastValueFrom( - validatorEraResults$.pipe(toArray()), + validatorEraResults$.pipe(toArray()) ); - const { - total, staking, commission, blocks, - } = validatorEraResults + const { total, staking, commission, blocks } = validatorEraResults .sort(([i1], [i2]) => i1 - i2) .reduce( - (acc, [index, { - total, staking, commission, blocks, prefs, - }]) => { + (acc, [index, { total, staking, commission, blocks, prefs }]) => { console.log( `Era ${index}: paid = \`${formatDock( - total, + total )}\` (staking = ${formatDock(staking)}, commission = ${formatDock( - commission, + commission )}), commission = ${prefs.commission.toNumber() / 1e7}%${ - blocks != null ? `, blocks produced = ${blocks.join('/')}` : '' - }`, + blocks != null ? `, blocks produced = ${blocks.join("/")}` : "" + }` ); return { @@ -181,25 +173,25 @@ const main = withDockAPI( staking: new BN(0), commission: new BN(0), blocks: 0, - }, + } ); console.log( `Summarised stash payout for ${Stash} in ${StartEra}-${ StartEra + ErasCount - 1 } eras - total = \`${formatDock(total, { - forceUnit: 'DCK', + forceUnit: "DCK", })}\`: staking = \`${formatDock(staking, { - forceUnit: 'DCK', - })}\`, commission = \`${formatDock(commission, { forceUnit: 'DCK' })}\`${ + forceUnit: "DCK", + })}\`, commission = \`${formatDock(commission, { forceUnit: "DCK" })}\`${ blocks != null ? `, average blocks per session = ${ - blocks / eraIndices.length / SessionsPerEra - }` - : '' - }`, + blocks / eraIndices.length / SessionsPerEra + }` + : "" + }` ); - }, + } ); const fetchProducedBlockCounts = async (dock, number) => { @@ -207,17 +199,19 @@ const fetchProducedBlockCounts = async (dock, number) => { const lastSessionIndex = await api.query.session.currentIndex(); const sessionEnds = await Promise.all( - Array.from({ length: SessionsPerEra - 1 }, (_, idx) => findNewSession( - dock, - (number - (BlocksPerEra * (idx + 1)) / SessionsPerEra) | 0, - number, - lastSessionIndex.toNumber() - idx - 1, - )).reverse(), + Array.from({ length: SessionsPerEra - 1 }, (_, idx) => + findNewSession( + dock, + (number - (BlocksPerEra * (idx + 1)) / SessionsPerEra) | 0, + number, + lastSessionIndex.toNumber() - idx - 1 + ) + ).reverse() ); const sessionAPIs = [ ...(await Promise.all( - sessionEnds.map(({ number }) => apiAtBlock(dock, number - 1)), + sessionEnds.map(({ number }) => apiAtBlock(dock, number - 1)) )), api, ]; @@ -231,7 +225,8 @@ const fetchProducedBlockCounts = async (dock, number) => { * @param {number} number * @returns {Promise} */ -const apiAtBlock = async (dock, number) => await dock.api.at(await dock.api.rpc.chain.getBlockHash(number)); +const apiAtBlock = async (dock, number) => + await dock.api.at(await dock.api.rpc.chain.getBlockHash(number)); /** * Returns the amount of blocks produced by the supplied stash during the current session. @@ -243,7 +238,7 @@ const countStashSessionBlocks = curry(async (api, stash) => { const sessionIndex = await api.query.session.currentIndex(); const authoredBlocks = await api.query.imOnline.authoredBlocks( sessionIndex, - stash, + stash ); return authoredBlocks.toNumber(); @@ -262,27 +257,30 @@ const findEraPaidBlock = async ( dock, startBlockNumber, endBlockNumber, - targetEra, -) => binarySearchFirstSatisfyingBlock( - dock.api, - { - startBlockNumber, - endBlockNumber, - fetchValue: async (blockHash) => { - const activeEra = await dock.api.query.staking.activeEra.at(blockHash); - - return activeEra.unwrap().index.toNumber(); + targetEra +) => + binarySearchFirstSatisfyingBlock( + dock.api, + { + startBlockNumber, + endBlockNumber, + fetchValue: async (blockHash) => { + const activeEra = await dock.api.query.staking.activeEra.at(blockHash); + + return activeEra.unwrap().index.toNumber(); + }, + targetValue: targetEra + 1, + checkBlock: (block) => + block.events + .toHuman() + .find( + ({ event: { method, section } }) => + section === "staking" && + (method === "EraPayout" || method === "EraPaid") + ), }, - targetValue: targetEra + 1, - checkBlock: (block) => block.events - .toHuman() - .find( - ({ event: { method, section } }) => section === 'staking' - && (method === 'EraPayout' || method === 'EraPaid'), - ), - }, - { maxBlocksPerUnit: BlocksPerEra, debug: Debug }, -); + { maxBlocksPerUnit: BlocksPerEra, debug: Debug } + ); /** * Returns hash of the block when `NewSession` was emitted for the `targetSession`. @@ -297,28 +295,31 @@ const findNewSession = async ( dock, startBlockNumber, endBlockNumber, - targetSession, -) => binarySearchFirstSatisfyingBlock( - dock.api, - { - startBlockNumber, - endBlockNumber, - fetchValue: async (blockHash) => { - const sessionIndex = await dock.api.query.session.currentIndex.at( - blockHash, - ); - - return sessionIndex.toNumber(); + targetSession +) => + binarySearchFirstSatisfyingBlock( + dock.api, + { + startBlockNumber, + endBlockNumber, + fetchValue: async (blockHash) => { + const sessionIndex = await dock.api.query.session.currentIndex.at( + blockHash + ); + + return sessionIndex.toNumber(); + }, + targetValue: targetSession + 1, + checkBlock: (block) => + block.events + .toHuman() + .find( + ({ event: { method, section } }) => + section === "session" && method === "NewSession" + ), }, - targetValue: targetSession + 1, - checkBlock: (block) => block.events - .toHuman() - .find( - ({ event: { method, section } }) => section === 'session' && method === 'NewSession', - ), - }, - { maxBlocksPerUnit: BlocksPerEra / SessionsPerEra, debug: Debug }, -); + { maxBlocksPerUnit: BlocksPerEra / SessionsPerEra, debug: Debug } + ); /** * Fetches information about the era for the supplied validator. * @@ -357,7 +358,7 @@ const validatorStashPayout = ( validatorRewardPoints, validatorExposure, eraRewardPoints, - eraPayout, + eraPayout ) => { // This is how much validator + nominators are entitled to. const validatorTotalPayout = eraPayout @@ -366,11 +367,11 @@ const validatorStashPayout = ( // Validator first gets a cut off the top. const validatorCommissionPayout = new BN( - validatorTotalPayout.toNumber() - * (validatorPref.commission.toNumber() / 1e9), + validatorTotalPayout.toNumber() * + (validatorPref.commission.toNumber() / 1e9) ); const validatorLeftOverPart = validatorTotalPayout.sub( - validatorCommissionPayout, + validatorCommissionPayout ); // Now let's calculate how this is split to the validator. diff --git a/scripts/watch-essential-events.js b/packages/dock-blockchain-api/scripts/watch-essential-events.js similarity index 63% rename from scripts/watch-essential-events.js rename to packages/dock-blockchain-api/scripts/watch-essential-events.js index 255e142ef..f8e9f996d 100644 --- a/scripts/watch-essential-events.js +++ b/packages/dock-blockchain-api/scripts/watch-essential-events.js @@ -42,7 +42,7 @@ import { min, max, anyPass, -} from 'ramda'; +} from "ramda"; import { timeout, from, @@ -71,7 +71,7 @@ import { throwError, retry, Subject, -} from 'rxjs'; +} from "rxjs"; import { envObj, formatDock, @@ -79,10 +79,10 @@ import { finiteNumber, timestampLogger, blockByNumber, -} from './helpers'; -import dock from '../src'; -import { sendAlarmEmailText } from './email_utils'; -import { TYPES, postMessage } from './slack'; +} from "./helpers"; +import dock from "../src"; +import { sendAlarmEmailText } from "./email_utils"; +import { TYPES, postMessage } from "./slack"; const { TxWatcherAlarmEmailTo, @@ -98,24 +98,24 @@ const { RetryAttempts, } = envObj({ // Email to send alarm emails to. - TxWatcherAlarmEmailTo: notNilAnd(split(',')), + TxWatcherAlarmEmailTo: notNilAnd(split(",")), // Address of the node RPC. FullNodeEndpoint: notNilAnd(String), // Level of logs to be used for profiling: `debug` or null. LogLevel: unless( isNil, - unless(includes(__, ['debug']), () => { + unless(includes(__, ["debug"]), () => { throw new Error('Allowed options: ["debug"]'); - }), + }) ), // Amount of time used to accumulate notifications into a single email. BatchNoficationTimeout: o(finiteNumber, defaultTo(3e3)), // Block number to start from. StartBlock: unless(isNil, finiteNumber), // Base explorer url to construct block address. - BaseBlockExplorerUrl: defaultTo('https://dock.subscan.io/block'), + BaseBlockExplorerUrl: defaultTo("https://dock.subscan.io/block"), // Base explorer url to construct extrinsic address. - BaseExtrinsicExplorerUrl: defaultTo('https://dock.subscan.io/extrinsic'), + BaseExtrinsicExplorerUrl: defaultTo("https://dock.subscan.io/extrinsic"), // Max amount of blocks to be requested concurrently when syncing. ConcurrentBlocksSyncLimit: o(finiteNumber, defaultTo(100)), // Maximum time allowed for the block processing. The workflow will be launched if no block is processed within this time. @@ -131,35 +131,38 @@ const main = async (dock, startBlock) => { // The minimum number of the unprocessed block. let minUnprocessed = startBlock; - return defer(() => from(dock.disconnect()).pipe( - switchMap(() => from(dock.init({ address: FullNodeEndpoint }))), - switchMap(() => { - const updates$ = processBlocks(dock, minUnprocessed); - - return updates$.pipe( - tap((number) => { - minUnprocessed = number; - }), - timeout({ - each: BlockProcessingTimeOut, - with: () => { - timestampLogger.log('Timeout exceeded'); - - return throwError(() => 'Timeout exceeded'); - }, - }), - ); - }), - )) + return defer(() => + from(dock.disconnect()).pipe( + switchMap(() => from(dock.init({ address: FullNodeEndpoint }))), + switchMap(() => { + const updates$ = processBlocks(dock, minUnprocessed); + + return updates$.pipe( + tap((number) => { + minUnprocessed = number; + }), + timeout({ + each: BlockProcessingTimeOut, + with: () => { + timestampLogger.log("Timeout exceeded"); + + return throwError(() => "Timeout exceeded"); + }, + }) + ); + }) + ) + ) .pipe( retry({ delay: RetryDelay, count: RetryAttempts }), catchError( - (error) => void timestampLogger.error(error) - || sendMessage( - 'Mainnet watcher was restarted', - `Due to either connection or node API problems, the dock blockchain essential notifications watcher was restarted with the last unprocessed block ${minUnprocessed}.`, - ), - ), + (error) => + void timestampLogger.error(error) || + sendMessage( + "Mainnet watcher was restarted", + `Due to either connection or node API problems, the dock blockchain essential notifications watcher was restarted with the last unprocessed block ${minUnprocessed}.` + ) + ) ) .subscribe({ complete: () => resolve(null), error: reject }); }); @@ -187,10 +190,10 @@ const trackSeqProcessed = curry((startBlock, missedBlocksSink, blocks$) => { if (skipped.delete(received)) { timestampLogger.info( - 'Received skipped block - ', + "Received skipped block - ", received, - 'maxReceived - ', - maxReceived, + "maxReceived - ", + maxReceived ); } @@ -204,7 +207,7 @@ const trackSeqProcessed = curry((startBlock, missedBlocksSink, blocks$) => { const maxSeqProcessed = reduce(min, maxReceived, [...skipped]); return { maxReceived, maxSeqProcessed, block }; - }), + }) ); }); @@ -229,7 +232,7 @@ const processBlocks = (dock, startBlock) => { const missedBlocksSink = new Subject(); const missedBlocks$ = missedBlocksSink.pipe( - mergeMap(blockByNumber(dock), ConcurrentBlocksSyncLimit), + mergeMap(blockByNumber(dock), ConcurrentBlocksSyncLimit) ); return merge(subscribeBlocks(dock, startBlock), missedBlocks$).pipe( @@ -237,31 +240,35 @@ const processBlocks = (dock, startBlock) => { mergeMap(({ block, maxSeqProcessed }) => { // Flattens extrinsics returning transaction along with produced events const txs$ = from( - block.extrinsics.flatMap(({ extrinsic, events }) => (ExtrinsicFailed.is(last(events)) - ? [] - : mergeEventsWithExtrs(events, extrinsic, { - rootTx: extrinsic, - config: 0, - }).extrinsics)), + block.extrinsics.flatMap(({ extrinsic, events }) => + ExtrinsicFailed.is(last(events)) + ? [] + : mergeEventsWithExtrs(events, extrinsic, { + rootTx: extrinsic, + config: 0, + }).extrinsics + ) ) - .pipe(mapRx(assoc('block', block))) + .pipe(mapRx(assoc("block", block))) .pipe(share()); // Each event repeats its transaction const events$ = txs$.pipe( - concatMap(({ events, ...rest }) => from(events).pipe(mapRx((event) => ({ event, events, ...rest })))), + concatMap(({ events, ...rest }) => + from(events).pipe(mapRx((event) => ({ event, events, ...rest }))) + ) ); const handleBlock$ = merge( txs$.pipe( - tap(LogLevel === 'debug' ? logTx : identity), - applyFilters(txFilters), + tap(LogLevel === "debug" ? logTx : identity), + applyFilters(txFilters) ), - events$.pipe(applyFilters(eventFilters)), + events$.pipe(applyFilters(eventFilters)) ).pipe( batchNotifications(BatchNoficationTimeout), - tap((email) => timestampLogger.log('Sending email: ', email)), - mergeMap(o(from, sendMessage('Mainnet alarm notification'))), + tap((email) => timestampLogger.log("Sending email: ", email)), + mergeMap(o(from, sendMessage("Mainnet alarm notification"))) ); const number = block.block.header.number.toNumber(); @@ -269,13 +276,13 @@ const processBlocks = (dock, startBlock) => { return concat( of({ maxSeqProcessed, number, state: 0 }), handleBlock$.pipe(tap(timestampLogger.log), filterRx(F)), - of({ number, state: 1 }), + of({ number, state: 1 }) ); }), scan( ( { minUnprocessed, maxReceived, processing }, - { maxSeqProcessed = minUnprocessed, number, state }, + { maxSeqProcessed = minUnprocessed, number, state } ) => { if (!state) processing.add(number); else processing.delete(number); @@ -290,9 +297,9 @@ const processBlocks = (dock, startBlock) => { minUnprocessed: startBlock, maxReceived: startBlock, processing: new Set(), - }, + } ), - mapRx(prop('minUnprocessed')), + mapRx(prop("minUnprocessed")) ); }; @@ -313,41 +320,45 @@ export const subscribeBlocks = curry((dock, startBlock) => { }).pipe(shareReplay(1)); // Emits blocks starting from the specified number - const previousBlocks$ = startBlock != null - ? defer(() => syncPrevousBlocks(dock, startBlock, currentBlocks$)) - : EMPTY; + const previousBlocks$ = + startBlock != null + ? defer(() => syncPrevousBlocks(dock, startBlock, currentBlocks$)) + : EMPTY; return concat( // Wait for the first block to be emitted currentBlocks$.pipe(first(), filterRx(F)), - defer(() => concat( - previousBlocks$.pipe( - trackSeqProcessed(startBlock, new Subject()), - withLatestFrom(currentBlocks$), - concatMap( - ([ - { block: latestSyncedBlock, maxSeqProcessed, maxReceived }, - currentBlock, - ]) => { - const curNumber = currentBlock.block.header.number.toNumber(); - const done = curNumber === maxReceived && maxSeqProcessed === maxReceived; - - if (done) { - return of(latestSyncedBlock, null); - } else { - return of(latestSyncedBlock); + defer(() => + concat( + previousBlocks$.pipe( + trackSeqProcessed(startBlock, new Subject()), + withLatestFrom(currentBlocks$), + concatMap( + ([ + { block: latestSyncedBlock, maxSeqProcessed, maxReceived }, + currentBlock, + ]) => { + const curNumber = currentBlock.block.header.number.toNumber(); + const done = + curNumber === maxReceived && maxSeqProcessed === maxReceived; + + if (done) { + return of(latestSyncedBlock, null); + } else { + return of(latestSyncedBlock); + } } - }, + ), + takeWhile(Boolean) ), - takeWhile(Boolean), - ), - defer(() => { - timestampLogger.log('Listening for new blocks'); - - return EMPTY; - }), - currentBlocks$, - )), + defer(() => { + timestampLogger.log("Listening for new blocks"); + + return EMPTY; + }), + currentBlocks$ + ) + ) ); }); @@ -370,7 +381,8 @@ const syncPrevousBlocks = curry((dock, startBlock, currentBlocks$) => { }), withLatestFrom(currentBlocks$), scan((lastBlockNumber, [startBlockNumber, lastBlock]) => { - const nextBlockNumber = lastBlockNumber == null ? startBlockNumber : inc(lastBlockNumber); + const nextBlockNumber = + lastBlockNumber == null ? startBlockNumber : inc(lastBlockNumber); if (lastBlock.block.header.number.toNumber() >= nextBlockNumber) { return nextBlockNumber; @@ -380,7 +392,7 @@ const syncPrevousBlocks = curry((dock, startBlock, currentBlocks$) => { }, null), distinctUntilChanged(), mergeMap(blockByNumber(dock), ConcurrentBlocksSyncLimit), - share(), + share() ); return blocks$; @@ -392,48 +404,54 @@ const syncPrevousBlocks = curry((dock, startBlock, currentBlocks$) => { * @param {string} message * @returns {Observable<*>} */ -const sendMessage = curry((header, message) => merge( - from( - postMessage(TYPES.DANGER, header, [ - { - title: 'Summary', - value: message, - short: false, - }, - ]), - ), - from(sendAlarmEmailText(TxWatcherAlarmEmailTo, header, message)), -)); +const sendMessage = curry((header, message) => + merge( + from( + postMessage(TYPES.DANGER, header, [ + { + title: "Summary", + value: message, + short: false, + }, + ]) + ), + from(sendAlarmEmailText(TxWatcherAlarmEmailTo, header, message)) + ) +); /** * Batches notifications received from the observable. */ -export const batchNotifications = curry((timeLimit, notifications$) => notifications$.pipe( - bufferTime(timeLimit, null), - filterRx(complement(isEmpty)), - mapRx((batch) => batch.join('\n')), -)); +export const batchNotifications = curry((timeLimit, notifications$) => + notifications$.pipe( + bufferTime(timeLimit, null), + filterRx(complement(isEmpty)), + mapRx((batch) => batch.join("\n")) + ) +); -const sectionLens = lensProp('section'); -const methodLens = lensProp('method'); +const sectionLens = lensProp("section"); +const methodLens = lensProp("method"); /** * Filters given entity by its `section`/`method(s)` */ -const methodFilter = curry((section, methods) => allPass([ - o(equals(section), view(sectionLens)), - o(includes(__, [].concat(methods)), view(methodLens)), -])); +const methodFilter = curry((section, methods) => + allPass([ + o(equals(section), view(sectionLens)), + o(includes(__, [].concat(methods)), view(methodLens)), + ]) +); /** * Filters given event by its `section`/`method(s)` */ -const eventByMethodFilter = curry(pipe(methodFilter, o(__, prop('event')))); +const eventByMethodFilter = curry(pipe(methodFilter, o(__, prop("event")))); /** * Filters extrinsics to contain at least one event with the given `section`/`method(s)` */ const anyEventByMethodFilter = curry( - pipe(methodFilter, any, o(__, prop('events'))), + pipe(methodFilter, any, o(__, prop("events"))) ); /** * Filters extrinsics by its `section`/`method(s)`. @@ -444,24 +462,24 @@ const txByMethodFilter = curry( o( __, o( - when(({ method }) => typeof method === 'object', view(methodLens)), - prop('tx'), - ), - ), - ), + when(({ method }) => typeof method === "object", view(methodLens)), + prop("tx") + ) + ) + ) ); /** * Returns `true` if given extrinsic has a valid `sudo` event. */ const isValidSudo = pipe( - prop('events'), - filter(methodFilter('sudo', ['Sudid', 'SudoAsDone'])), + prop("events"), + filter(methodFilter("sudo", ["Sudid", "SudoAsDone"])), ifElse( isEmpty, F, - all((event) => event.data.toJSON()[0].err == null), - ), + all((event) => event.data.toJSON()[0].err == null) + ) ); /** @@ -469,21 +487,21 @@ const isValidSudo = pipe( */ const successfulTx = both( either( - complement(anyEventByMethodFilter('sudo', ['Sudid', 'SudoAsDone'])), - isValidSudo, + complement(anyEventByMethodFilter("sudo", ["Sudid", "SudoAsDone"])), + isValidSudo ), complement( either( - anyEventByMethodFilter('utility', 'BatchInterrupted'), - anyEventByMethodFilter('system', 'ExtrinsicFailed'), - ), - ), + anyEventByMethodFilter("utility", "BatchInterrupted"), + anyEventByMethodFilter("system", "ExtrinsicFailed") + ) + ) ); /** * Filters successful extrinsics by its `section`/`method(s)`. */ const successfulTxByMethodFilter = curry( - pipe(txByMethodFilter, both(successfulTx)), + pipe(txByMethodFilter, both(successfulTx)) ); /** * Validates given input against supplied predicate producing an observable. @@ -494,204 +512,217 @@ const checkMap = ifElse(__, __, always(EMPTY)); * Builds formatted urls to the extrinsic and its block. */ const buildExtrinsicUrl = curry( - (blockNumber, txHash) => `<${BaseBlockExplorerUrl}/${blockNumber.toString()} | block #${blockNumber.toString()}> as <${BaseExtrinsicExplorerUrl}/${txHash.toString()} | extrinsic ${txHash.toString()}>.`, + (blockNumber, txHash) => + `<${BaseBlockExplorerUrl}/${blockNumber.toString()} | block #${blockNumber.toString()}> as <${BaseExtrinsicExplorerUrl}/${txHash.toString()} | extrinsic ${txHash.toString()}>.` ); /** * Enhances observable returned by the given function by adding url to the extrinsic and its block. * @param {*} fn * @returns */ -const withExtrinsicUrl = (fn) => curryN(fn.length, (...args) => fn(...args).pipe( - concatMap((msg) => { - const signer = args[0].rootTx?.signature?.signer?.toString() - || args[0].rootTx?.signer?.toString(); - - return from( - args[1].api.query.timestamp.now.at(args[0].block.block.header.hash), - ).pipe( - mapRx( - (timestamp) => `${msg} ${ - signer ? `by \`${signer}\`` : 'sent unsigned' - } at ${new Date( - +timestamp.toString(), - ).toUTCString()} in ${buildExtrinsicUrl( - args[0].block.block.header.number, - args[0].rootTx?.hash, - )}`, - ), - ); - }), -)); +const withExtrinsicUrl = (fn) => + curryN(fn.length, (...args) => + fn(...args).pipe( + concatMap((msg) => { + const signer = + args[0].rootTx?.signature?.signer?.toString() || + args[0].rootTx?.signer?.toString(); + + return from( + args[1].api.query.timestamp.now.at(args[0].block.block.header.hash) + ).pipe( + mapRx( + (timestamp) => + `${msg} ${ + signer ? `by \`${signer}\`` : "sent unsigned" + } at ${new Date( + +timestamp.toString() + ).toUTCString()} in ${buildExtrinsicUrl( + args[0].block.block.header.number, + args[0].rootTx?.hash + )}` + ) + ); + }) + ) + ); /** * Filter events produced by `democracy` pallet. */ -const democracyEvent = eventByMethodFilter('democracy'); +const democracyEvent = eventByMethodFilter("democracy"); /** * Filter events produced by `council` pallet. */ -const councilEvent = eventByMethodFilter('council'); +const councilEvent = eventByMethodFilter("council"); /** * Filter events produced by `balances` pallet. */ -const balancesEvent = eventByMethodFilter('balances'); +const balancesEvent = eventByMethodFilter("balances"); /** * Filter events produced by `technicalCommittee` pallet. */ -const technicalCommitteeEvent = eventByMethodFilter('technicalCommittee'); +const technicalCommitteeEvent = eventByMethodFilter("technicalCommittee"); /** * Filter events produced by `technicalCommitteeMembership` pallet. */ const technicalCommitteeMembershipEvent = eventByMethodFilter( - 'technicalCommitteeMembership', + "technicalCommitteeMembership" ); /** * Filter events produced by `elections` pallet. */ -const electionsEvent = eventByMethodFilter('elections'); +const electionsEvent = eventByMethodFilter("elections"); /** * Filter extrinsics produced by `technicalCommitteeMembership` pallet. */ const technicalCommitteeMembershipTx = successfulTxByMethodFilter( - 'technicalCommitteeMembership', + "technicalCommitteeMembership" ); /** * Filter extrinsics from `democracy` pallet. */ -const democracyTx = successfulTxByMethodFilter('democracy'); +const democracyTx = successfulTxByMethodFilter("democracy"); /** * Filter extrinsics from `balances` pallet. */ -const balancesTx = successfulTxByMethodFilter('balances'); +const balancesTx = successfulTxByMethodFilter("balances"); /** * Filter extrinsics from `system` pallet. */ -const systemTx = successfulTxByMethodFilter('system'); +const systemTx = successfulTxByMethodFilter("system"); /** * Filter extrinsics from `elections` pallet. */ -const electionsTx = successfulTxByMethodFilter('elections'); +const electionsTx = successfulTxByMethodFilter("elections"); const txFilters = [ - checkMap(isValidSudo, () => of('`sudo` transaction executed')), + checkMap(isValidSudo, () => of("`sudo` transaction executed")), // Council candidacy submission - checkMap(electionsTx('submitCandidacy'), () => of('Self-submitted as a council candidate')), + checkMap(electionsTx("submitCandidacy"), () => + of("Self-submitted as a council candidate") + ), // Council member removal checkMap( - electionsTx('removeMember'), + electionsTx("removeMember"), ({ tx: { args: [member], }, - }) => of(`Council member removed ${member.toString()}`), + }) => of(`Council member removed ${member.toString()}`) ), // `set_code` call - checkMap(systemTx('setCode'), () => of('New runtime code was set')), + checkMap(systemTx("setCode"), () => of("New runtime code was set")), // `set_code_without_checks` call - checkMap(systemTx('setCodeWithoutChecks'), () => of('New runtime code was set without checks')), + checkMap(systemTx("setCodeWithoutChecks"), () => + of("New runtime code was set without checks") + ), // `set_storage` call - checkMap(systemTx('setStorage'), () => of('Storage was modified directly')), + checkMap(systemTx("setStorage"), () => of("Storage was modified directly")), // Democracy proposal seconded checkMap( - democracyTx('second'), + democracyTx("second"), ({ tx: { args: [idx], }, - }) => of(`Proposal #${idx.toString()} is seconded`), + }) => of(`Proposal #${idx.toString()} is seconded`) ), // Democracy proposal fast-tracked checkMap( - democracyTx('fastTrack'), + democracyTx("fastTrack"), ({ tx: { args: [proposalHash], }, - }) => of(`Proposal is fast-tracked: ${proposalHash.toString()}`), + }) => of(`Proposal is fast-tracked: ${proposalHash.toString()}`) ), // `force_transfer` call - checkMap(balancesTx('forceTransfer'), ({ tx }) => { + checkMap(balancesTx("forceTransfer"), ({ tx }) => { const [source, dest, value] = tx.args; return of( `\`force_transfer\` was made from ${source} to ${dest} with amount of ${formatDock( - value, - )}`, + value + )}` ); }), // Democracy proposal cancelled checkMap( - democracyTx('cancelProposal'), + democracyTx("cancelProposal"), ({ tx: { args: [proposalIndex], }, - }) => of(`Proposal #${proposalIndex.toString()} was cancelled`), + }) => of(`Proposal #${proposalIndex.toString()} was cancelled`) ), ]; const eventFilters = [ // Democracy proposal checkMap( - democracyEvent('Proposed'), + democracyEvent("Proposed"), ({ tx: { args: [hash], }, - }) => of(`New Democracy proposal: ${hash}`), + }) => of(`New Democracy proposal: ${hash}`) ), // Democracy preimage noted for the proposal checkMap( - democracyEvent('PreimageNoted'), + democracyEvent("PreimageNoted"), ( { event: { data: [proposalHash], }, }, - dock, - ) => from(dock.api.query.democracy.preimages(proposalHash)).pipe( - switchMap((preimageOpt) => { - if (preimageOpt.isSome && preimageOpt.unwrap().isAvailable) { - const proposal = dock.api.createType( - 'Call', - preimageOpt.unwrap().asAvailable.data, - ); - const metadata = dock.api.registry.findMetaCall(proposal.callIndex); - const args = pipe( - map(String), - map((value) => (value.length > 100 - ? `${value.slice(0, 100)}... (truncated)` - : value)), - JSON.stringify, - )(proposal.toJSON().args); - - return of( - `Proposal preimage is noted for ${proposalHash.toString()}: \`${ - metadata.section - }::${metadata.method}\` with args ${args}`, - ); - } else { - return of( - `Proposal preimage is noted for ${proposalHash.toString()}`, - ); - } - }), - ), + dock + ) => + from(dock.api.query.democracy.preimages(proposalHash)).pipe( + switchMap((preimageOpt) => { + if (preimageOpt.isSome && preimageOpt.unwrap().isAvailable) { + const proposal = dock.api.createType( + "Call", + preimageOpt.unwrap().asAvailable.data + ); + const metadata = dock.api.registry.findMetaCall(proposal.callIndex); + const args = pipe( + map(String), + map((value) => + value.length > 100 + ? `${value.slice(0, 100)}... (truncated)` + : value + ), + JSON.stringify + )(proposal.toJSON().args); + + return of( + `Proposal preimage is noted for ${proposalHash.toString()}: \`${ + metadata.section + }::${metadata.method}\` with args ${args}` + ); + } else { + return of( + `Proposal preimage is noted for ${proposalHash.toString()}` + ); + } + }) + ) ), // Council proposal created - checkMap(councilEvent('Proposed'), ({ event }, dock) => { + checkMap(councilEvent("Proposed"), ({ event }, dock) => { const { data: [_, __, hash], } = event.toJSON(); @@ -704,61 +735,62 @@ const eventFilters = [ const { args, section, method } = proposal.unwrap(); return `New Council proposal ${section}::${method}(${JSON.stringify( - args, + args )})`; } - }), + }) ); }), // Council proposal closed - checkMap(councilEvent('Closed'), ({ event }) => { + checkMap(councilEvent("Closed"), ({ event }) => { const { data: [hash, yesVotes, noVotes], } = event.toJSON(); return of( - `Council proposal ${hash} closed with ${yesVotes} yes/${noVotes} no`, + `Council proposal ${hash} closed with ${yesVotes} yes/${noVotes} no` ); }), // Council member renounced checkMap( - electionsEvent('Renounced'), + electionsEvent("Renounced"), ({ event: { data: [member], }, - }) => of(`Council member renounced: ${member.toString()}`), + }) => of(`Council member renounced: ${member.toString()}`) ), // Council members changed checkMap( - electionsEvent('NewTerm'), + electionsEvent("NewTerm"), ({ event: { data: [newMembers], }, - }) => of( - `Council membership changed. New members: ${newMembers - .toJSON() - .map(head)}`, - ), + }) => + of( + `Council membership changed. New members: ${newMembers + .toJSON() + .map(head)}` + ) ), // `set_balance` call - checkMap(balancesEvent('BalanceSet'), ({ event }) => { + checkMap(balancesEvent("BalanceSet"), ({ event }) => { const [who, free, reserved] = event.data.toJSON(); return of( `\`set_balance\` was called on ${who}: free: ${formatDock( - free, - )}, reserved: ${formatDock(reserved)}`, + free + )}, reserved: ${formatDock(reserved)}` ); }), // Techinal Committee proposal - checkMap(technicalCommitteeEvent('Proposed'), ({ event }, dock) => { + checkMap(technicalCommitteeEvent("Proposed"), ({ event }, dock) => { const { data: [_, __, hash], } = event.toJSON(); @@ -771,56 +803,55 @@ const eventFilters = [ const { args, section, method } = proposal.unwrap(); return `New Technical Committee proposal ${section}::${method}(${JSON.stringify( - args, + args )})`; } - }), + }) ); }), // Techinal Committee member added checkMap( both( - technicalCommitteeMembershipEvent('MemberAdded'), - technicalCommitteeMembershipTx('addMember'), + technicalCommitteeMembershipEvent("MemberAdded"), + technicalCommitteeMembershipTx("addMember") ), ({ tx: { args: [member], }, - }) => of(`New technical committee member added: ${member.toString()}`), + }) => of(`New technical committee member added: ${member.toString()}`) ), // Techinal Committee member removed checkMap( both( - technicalCommitteeMembershipEvent('MemberRemoved'), - technicalCommitteeMembershipTx('removeMember'), + technicalCommitteeMembershipEvent("MemberRemoved"), + technicalCommitteeMembershipTx("removeMember") ), ({ tx: { args: [member], }, - }) => of(`Technical committee member removed: ${member.toString()}`), + }) => of(`Technical committee member removed: ${member.toString()}`) ), ]; -const logTx = ({ - tx, rootTx, events, block, -}) => { +const logTx = ({ tx, rootTx, events, block }) => { let msg = `In block #${block.block.header.number} `; - const signer = rootTx?.signature?.signer?.toString() || rootTx?.signer?.toString(); + const signer = + rootTx?.signature?.signer?.toString() || rootTx?.signer?.toString(); if (signer) { msg += `from ${signer}: `; } else { - msg += 'unsigned: '; + msg += "unsigned: "; } msg += `${tx.method.section || tx.section}::${tx.method.method || tx.method}`; timestampLogger.log( msg, - events.map((e) => `${e.section}::${e.method}`), + events.map((e) => `${e.section}::${e.method}`) ); }; @@ -849,19 +880,20 @@ const createTxWithEventsCombinator = (dock) => { appendExtrinsics(extrinsics) { return new TxWithEventsAccumulator( this.extrinsics.concat(extrinsics), - this.nextEvents, + this.nextEvents ); } prependExtrinsics(extrinsics) { return new TxWithEventsAccumulator( extrinsics.concat(this.extrinsics), - this.nextEvents, + this.nextEvents ); } } - const { BatchCompleted, BatchInterrupted, ItemCompleted } = dock.api.events.utility; + const { BatchCompleted, BatchInterrupted, ItemCompleted } = + dock.api.events.utility; const { Sudid, SudoAsDone } = dock.api.events.sudo; /** @@ -871,7 +903,7 @@ const createTxWithEventsCombinator = (dock) => { * @param {Array<*>} events * @param {*} tx * @param {{config: number, rootTx: *}} param2 - * @returns + * @returns Promise<*> */ const pickEventsForExtrinsic = (events, tx, { config, rootTx }) => { let batchIdx = -1; @@ -880,7 +912,7 @@ const createTxWithEventsCombinator = (dock) => { if (config & BATCH) { batchIdx = findIndex( anyPass([ItemCompleted.is, BatchCompleted.is, BatchInterrupted.is]), - events, + events ); if (~batchIdx && ItemCompleted.is(events[batchIdx])) { batchIdx++; @@ -897,25 +929,25 @@ const createTxWithEventsCombinator = (dock) => { const minIdx = Math.min( events.length, - ...[batchIdx, sudoIdx, sudoAsIdx].filter((idx) => ~idx), + ...[batchIdx, sudoIdx, sudoAsIdx].filter((idx) => ~idx) ); const [curEvents, nextEvents] = splitAt(minIdx, events); return new TxWithEventsAccumulator( [{ events: curEvents, tx, rootTx }], - nextEvents, + nextEvents ); }; const isBatch = o( - txByMethodFilter('utility', ['batch', 'batchAll']), - assoc('tx', __, {}), + txByMethodFilter("utility", ["batch", "batchAll"]), + assoc("tx", __, {}) ); const isSudo = o( - txByMethodFilter('sudo', ['sudo', 'sudoUncheckedWeight']), - assoc('tx', __, {}), + txByMethodFilter("sudo", ["sudo", "sudoUncheckedWeight"]), + assoc("tx", __, {}) ); - const isSudoAs = o(txByMethodFilter('sudo', 'sudoAs'), assoc('tx', __, {})); + const isSudoAs = o(txByMethodFilter("sudo", "sudoAs"), assoc("tx", __, {})); /** * Recursively merges extrinsics with their corresponding events. @@ -925,12 +957,13 @@ const createTxWithEventsCombinator = (dock) => { flip(isBatch), (events, tx, { rootTx, config }) => { const acc = addIndex(reduce)( - ({ extrinsics, nextEvents }, tx) => mergeEventsWithExtrs(nextEvents, tx, { - config: config | BATCH, - rootTx, - }).prependExtrinsics(extrinsics), + ({ extrinsics, nextEvents }, tx) => + mergeEventsWithExtrs(nextEvents, tx, { + config: config | BATCH, + rootTx, + }).prependExtrinsics(extrinsics), new TxWithEventsAccumulator([], events), - tx.args[0], + tx.args[0] ); const selfAcc = pickEventsForExtrinsic(acc.nextEvents, tx, { @@ -946,7 +979,7 @@ const createTxWithEventsCombinator = (dock) => { } return selfAcc.prependExtrinsics( - acc.extrinsics.slice(0, acc.nextEvents[0].toJSON().data[0]), + acc.extrinsics.slice(0, acc.nextEvents[0].toJSON().data[0]) ); } }, diff --git a/src/dock-api.js b/packages/dock-blockchain-api/src/api/index.js similarity index 53% rename from src/dock-api.js rename to packages/dock-blockchain-api/src/api/index.js index 8ebbc972b..c73ae083f 100644 --- a/src/dock-api.js +++ b/packages/dock-blockchain-api/src/api/index.js @@ -2,26 +2,12 @@ import { ApiPromise, WsProvider, Keyring } from '@polkadot/api'; import { HttpProvider } from '@polkadot/rpc-provider'; import { cryptoWaitReady } from '@polkadot/util-crypto'; import typesBundle from '@docknetwork/node-types'; -import { KeyringPair } from "@polkadot/keyring/types"; // eslint-disable-line - -import AnchorModule from './modules/anchor'; -import BlobModule from './modules/blob'; -import { DIDModule } from './modules/did'; -import RevocationModule from './modules/revocation'; -import TokenMigration from './modules/migration'; -import StatusListCredentialModule from './modules/status-list-credential'; -import BBSModule from './modules/bbs'; -import BBSPlusModule from './modules/bbs-plus'; -import LegacyBBSPlusModule from './modules/legacy-bbs-plus'; -import PSModule from './modules/ps'; -import OffchainSignaturesModule from './modules/offchain-signatures'; -import AccumulatorModule from './modules/accumulator'; +import { ApiProvider } from '@docknetwork/credential-sdk/modules/common'; import PoaRpcDefs from './rpc-defs/poa-rpc-defs'; import PriceFeedRpcDefs from './rpc-defs/price-feed-rpc-defs'; import CoreModsRpcDefs from './rpc-defs/core-mods-rpc-defs'; -import TrustRegistryModule from './modules/trust-registry'; import { sendWithRetries, patchQueryApi, @@ -29,8 +15,13 @@ import { FASTBLOCK_TIME_MS, FASTBLOCK_CONFIG, STANDARD_CONFIG, -} from './dock-api-retry'; -import { ensureExtrinsicSucceeded } from './utils/extrinsic'; +} from './retry'; +import { + ExtrinsicDispatchError, + ensureExtrinsicSucceeded, + errorMsgFromEventData, +} from '../utils/extrinsic'; +import { getAllExtrinsicsFromBlock } from '../utils/chain-ops'; /** * @typedef {object} Options The Options to use in the function DockAPI. @@ -42,7 +33,7 @@ import { ensureExtrinsicSucceeded } from './utils/extrinsic'; */ /** Helper class to interact with the Dock chain */ -export default class DockAPI { +export default class DockAPI extends ApiProvider { /** * Creates a new instance of the DockAPI object, call init to initialize * @param {function} [customSignTx] - Optional custom transaction sign method, @@ -50,8 +41,9 @@ export default class DockAPI { * @constructor */ constructor(customSignTx) { + super(); + this.customSignTx = customSignTx; - this.anchorModule = new AnchorModule(); } /** @@ -68,17 +60,15 @@ export default class DockAPI { keyring: null, }, ) { - if (this.api) { - if (this.api.isConnected) { - throw new Error('API is already connected'); - } else { - await this.disconnect(); - } + if (this.isConnected) { + throw new Error('API is already connected'); } this.address = address || this.address; - const addressArray = Array.isArray(this.address) ? this.address : [this.address]; + const addressArray = Array.isArray(this.address) + ? this.address + : [this.address]; addressArray.forEach((addr) => { if ( @@ -109,7 +99,9 @@ export default class DockAPI { const isWebsocket = addressStr && addressStr.indexOf('http') === -1; if (!isWebsocket && addressArray.length > 1) { - console.warn('WARNING: HTTP connections do not support more than one URL, ignoring rest'); + console.warn( + 'WARNING: HTTP connections do not support more than one URL, ignoring rest', + ); } const provider = isWebsocket @@ -130,17 +122,6 @@ export default class DockAPI { this.api = await ApiPromise.create(apiOptions); - const runtimeVersion = await this.api.rpc.state.getRuntimeVersion(); - const specVersion = runtimeVersion.specVersion.toNumber(); - - if (specVersion < 50) { - apiOptions.types = { - ...(apiOptions.types || {}), - DidOrDidMethodKey: 'Did', - }; - this.api = await ApiPromise.create(apiOptions); - } - this.api.specVersion = specVersion; const blockTime = this.api.consts.babe.expectedBlockTime.toNumber(); if ( blockTime !== STANDARD_BLOCK_TIME_MS @@ -157,48 +138,6 @@ export default class DockAPI { patchQueryApi(this.api.query); patchQueryApi(this.api.queryMulti); - this.anchorModule.setApi(this.api, this.signAndSend.bind(this)); - this.blobModule = new BlobModule(this.api, this.signAndSend.bind(this)); - this.didModule = new DIDModule(this.api, this.signAndSend.bind(this)); - this.revocationModule = new RevocationModule( - this.api, - this.signAndSend.bind(this), - ); - this.trustRegistryModule = new TrustRegistryModule( - this.api, - this.signAndSend.bind(this), - ); - this.statusListCredentialModule = new StatusListCredentialModule( - this.api, - this.signAndSend.bind(this), - ); - this.legacyBBSPlus = this.api.tx.offchainSignatures == null; - if (this.legacyBBSPlus) { - this.bbsPlusModule = new LegacyBBSPlusModule( - this.api, - this.signAndSend.bind(this), - ); - } else { - this.offchainSignaturesModule = new OffchainSignaturesModule( - this.api, - this.signAndSend.bind(this), - ); - this.bbsModule = new BBSModule(this.api, this.signAndSend.bind(this)); - this.bbsPlusModule = new BBSPlusModule( - this.api, - this.signAndSend.bind(this), - ); - this.psModule = new PSModule(this.api, this.signAndSend.bind(this)); - } - this.accumulatorModule = new AccumulatorModule( - this.api, - this.signAndSend.bind(this), - ); - - if (loadPoaModules) { - this.migrationModule = new TokenMigration(this.api); - } - return this.api; } /* eslint-enable sonarjs/cognitive-complexity */ @@ -211,23 +150,8 @@ export default class DockAPI { } async disconnect() { - if (this.api) { - if (this.api.isConnected) { - await this.api.disconnect(); - } - delete this.api; - delete this.blobModule; - delete this.didModule; - delete this.revocationModule; - delete this.offchainSignaturesModule; - delete this.bbsModule; - delete this.bbsPlusModule; - delete this.psModule; - delete this.accumulatorModule; - delete this.migrationModule; - delete this.legacyBBSPlus; - delete this.statusListCredentialModule; - delete this.trustRegistryModule; + if (this.isConnected) { + await this.api.disconnect(); } } @@ -278,6 +202,21 @@ export default class DockAPI { return await this.send(signedExtrinsic, waitForFinalization); } + /** + * Retreives all extrinsics from the block with supplied number/hash. + * + * @param {*} blockNumberOrHash + * @param {boolean} includeAllExtrinsics + * @returns {Promise<*>} + */ + async getAllExtrinsicsFromBlock(blockNumberOrHash, includeAllExtrinsics) { + return await getAllExtrinsicsFromBlock( + this.api, + blockNumberOrHash, + includeAllExtrinsics, + ); + } + /** * Helper function to send with retries a transaction that has already been signed. * @param extrinsic - Extrinsic to send @@ -294,6 +233,10 @@ export default class DockAPI { ); } + async stateChangeBytes(name, payload) { + return this.api.createType('StateChange', { [name]: payload }).toU8a(); + } + /** * Helper function to send without retrying a transaction that has already been signed. * @param {DockAPI} dock @@ -308,9 +251,19 @@ export default class DockAPI { const promise = new Promise((resolve, reject) => extrinsic .send((extrResult) => { - const { events = [], status } = extrResult; + const { events = [], status, dispatchError } = extrResult; - ensureExtrinsicSucceeded(this.api, events, status); + try { + if (dispatchError != null) { + const msg = errorMsgFromEventData(this.api, [dispatchError]); + + throw new ExtrinsicDispatchError(msg, status, dispatchError); + } + + ensureExtrinsicSucceeded(this.api, events, status); + } catch (err) { + reject(err); + } // If waiting for finalization or if not waiting for finalization, wait for inclusion in the block. if ( @@ -360,144 +313,6 @@ export default class DockAPI { * @return {Boolean} The connection status */ get isConnected() { - if (!this.api) { - return false; - } - - return this.api.isConnected; - } - - /** - * Gets the SDK's Anchor module - * @return {AnchorModule} The module to use - */ - get anchor() { - return this.anchorModule; - } - - /** - * Gets the SDK's Blob module - * @return {BlobModule} The module to use - */ - get blob() { - if (!this.blobModule) { - throw new Error('Unable to get Blob module, SDK is not initialised'); - } - return this.blobModule; - } - - /** - * Gets the SDK's DID module - * @return {DIDModule} The module to use - */ - get did() { - if (!this.didModule) { - throw new Error('Unable to get DID module, SDK is not initialised'); - } - return this.didModule; - } - - /** - * Gets the SDK's StatusListCredentialModule module - * @return {StatusListCredentialModule} The module to use - */ - get statusListCredential() { - if (!this.statusListCredentialModule) { - throw new Error( - 'Unable to get StatusListCredentialModule module, SDK is not initialised', - ); - } - return this.statusListCredentialModule; - } - - /** - * Gets the SDK's TrustRegistryModule module - * @return {TrustRegistryModule} The module to use - */ - get trustRegistry() { - if (!this.trustRegistryModule) { - throw new Error( - 'Unable to get TrustRegistryModule module, SDK is not initialised', - ); - } - return this.trustRegistryModule; - } - - /** - * Gets the SDK's OffchainSignaturesModule module - * @return {OffchainSignaturesModule} The module to use - */ - get offchainSignatures() { - if (!this.didModule) { - throw new Error( - 'Unable to get OffchainSignatures module, SDK is not initialised', - ); - } - return this.offchainSignaturesModule; - } - - /** - * Gets the SDK's revocation module - * @return {RevocationModule} The module to use - */ - get revocation() { - if (!this.revocationModule) { - throw new Error( - 'Unable to get revocation module, SDK is not initialised', - ); - } - return this.revocationModule; - } - - /** - * Gets the SDK's `BBS` module - * @return {BBSModule} The module to use - */ - get bbs() { - if (this.legacyBBSPlus) { - throw new Error("BBS isn't supported by the chain"); - } - if (!this.bbsModule) { - throw new Error('Unable to get BBS module, SDK is not initialised'); - } - return this.bbsModule; - } - - /** - * Gets the SDK's `BBSPlus` module - * @return {BBSPlusModule} The module to use - */ - get bbsPlus() { - if (!this.bbsPlusModule) { - throw new Error('Unable to get BBS+ module, SDK is not initialised'); - } - return this.bbsPlusModule; - } - - /** - * Gets the SDK's `PS` module - * @return {PSModule} The module to use - */ - get ps() { - if (this.legacyBBSPlus) { - throw new Error("PS isn't supported by the chain"); - } - if (!this.psModule) { - throw new Error('Unable to get PS module, SDK is not initialised'); - } - return this.psModule; - } - - /** - * Gets the SDK's `Accumulator` module - * @return {AccumulatorModule} The module to use - */ - get accumulator() { - if (!this.accumulatorModule) { - throw new Error( - 'Unable to get Accumulator module, SDK is not initialised', - ); - } - return this.bbsPlusModule; + return Boolean(this.api) && this.api.isConnected; } } diff --git a/src/dock-api-retry.js b/packages/dock-blockchain-api/src/api/retry.js similarity index 89% rename from src/dock-api-retry.js rename to packages/dock-blockchain-api/src/api/retry.js index f11defbb5..fbb1e6f3a 100644 --- a/src/dock-api-retry.js +++ b/packages/dock-blockchain-api/src/api/retry.js @@ -1,12 +1,12 @@ import { createSubmittable } from '@polkadot/api/submittable'; import { SubmittableResult } from '@polkadot/api/cjs/submittable/Result'; import { filterEvents } from '@polkadot/api/util'; -import { retry } from './utils/async'; +import { retry } from '@docknetwork/credential-sdk/utils/async'; import { ensureExtrinsicSucceeded, findExtrinsicBlock, -} from './utils/extrinsic'; -import { BlocksProvider } from './utils/block'; +} from '../utils/extrinsic'; +import { BlocksProvider } from '../utils/block'; /** Block time in ms for the standard build configuration. */ export const STANDARD_BLOCK_TIME_MS = 3e3; @@ -90,20 +90,24 @@ const wrapFnWithRetries = (obj, prop, path = []) => { if (typeof value !== 'function') { newValue = Object.create(Object.getPrototypeOf(value)); } else { - newValue = async function with8SecsTimeoutAnd2Retries(...args) { - const wrappedFn = () => value.apply(this, args); - wrappedFn.toString = () => value.toString(); - - return await retry(wrappedFn, 8e3, { - maxAttempts: 2, - delay: 5e2, - onTimeoutExceeded: (retrySym) => { - console.error(`\`${path.concat('.')}\` exceeded timeout`); - - return retrySym; - }, - }); + const name = `with8SecsTimeoutAnd2Retries(${value.name})`; + const fnObj = { + async [name](...args) { + const wrappedFn = () => value.apply(this, args); + wrappedFn.toString = () => value.toString(); + + return await retry(wrappedFn, 8e3, { + maxAttempts: 2, + delay: 5e2, + onTimeoutExceeded: (retrySym) => { + console.error(`\`${path.concat('.')}\` exceeded timeout`); + + return retrySym; + }, + }); + }, }; + newValue = fnObj[name]; Object.setPrototypeOf(newValue, Object.getPrototypeOf(value)); } @@ -239,8 +243,12 @@ export async function sendWithRetries( }; const sendExtrinsic = async () => { - sent = dock.sendNoRetries(extrinsic, waitForFinalization); - return await sent; + try { + sent = dock.sendNoRetries(extrinsic, waitForFinalization); + return await sent; + } catch (err) { + throw new Error(err.message); + } }; const onTimeoutExceeded = (retrySym) => { diff --git a/src/rpc-defs/core-mods-rpc-defs.js b/packages/dock-blockchain-api/src/api/rpc-defs/core-mods-rpc-defs.js similarity index 100% rename from src/rpc-defs/core-mods-rpc-defs.js rename to packages/dock-blockchain-api/src/api/rpc-defs/core-mods-rpc-defs.js diff --git a/packages/dock-blockchain-api/src/api/rpc-defs/poa-rpc-defs.js b/packages/dock-blockchain-api/src/api/rpc-defs/poa-rpc-defs.js new file mode 100644 index 000000000..8dcda3c6d --- /dev/null +++ b/packages/dock-blockchain-api/src/api/rpc-defs/poa-rpc-defs.js @@ -0,0 +1,16 @@ +export default { + poa: { + treasuryAccount: { + description: + 'Return account address of treasury. The account address can then be used to query the chain for balance', + params: [], + type: 'AccountId', + }, + treasuryBalance: { + description: + 'Return free balance of treasury account. In the context of PoA, only free balance makes sense for treasury. But just in case, to check all kinds of balance (locked, reserved, etc), get the account address with above call and query the chain.', + params: [], + type: 'Balance', + }, + }, +}; diff --git a/src/rpc-defs/price-feed-rpc-defs.js b/packages/dock-blockchain-api/src/api/rpc-defs/price-feed-rpc-defs.js similarity index 100% rename from src/rpc-defs/price-feed-rpc-defs.js rename to packages/dock-blockchain-api/src/api/rpc-defs/price-feed-rpc-defs.js diff --git a/packages/dock-blockchain-api/src/index.js b/packages/dock-blockchain-api/src/index.js new file mode 100644 index 000000000..4081e5131 --- /dev/null +++ b/packages/dock-blockchain-api/src/index.js @@ -0,0 +1,3 @@ +import DockAPI from './api'; + +export { DockAPI }; diff --git a/src/utils/block.js b/packages/dock-blockchain-api/src/utils/block.js similarity index 92% rename from src/utils/block.js rename to packages/dock-blockchain-api/src/utils/block.js index 1ba9e81e7..6211c4653 100644 --- a/src/utils/block.js +++ b/packages/dock-blockchain-api/src/utils/block.js @@ -1,7 +1,10 @@ -import { BlockHash, BlockNumber } from "@polkadot/types/interfaces"; // eslint-disable-line -import { SignedBlockExtended } from "@polkadot/types/types"; // eslint-disable-line +// import { BlockHash, BlockNumber } from "@polkadot/types/interfaces"; // eslint-disable-line +// import { SignedBlockExtended } from "@polkadot/types/types"; // eslint-disable-line import { ApiPromise } from "@polkadot/api"; // eslint-disable-line -import { ReusablePromiseMap, ReusablePromise } from './async'; +import { + ReusablePromiseMap, + ReusablePromise, +} from '@docknetwork/credential-sdk/utils/async'; /** * Fetches and caches blocks by their hashes and optionally numbers. diff --git a/src/utils/chain-ops.js b/packages/dock-blockchain-api/src/utils/chain-ops.js similarity index 74% rename from src/utils/chain-ops.js rename to packages/dock-blockchain-api/src/utils/chain-ops.js index 979c5efcd..4c8a58935 100644 --- a/src/utils/chain-ops.js +++ b/packages/dock-blockchain-api/src/utils/chain-ops.js @@ -2,10 +2,13 @@ import { Keyring } from '@polkadot/keyring'; import { - randomAsHex, cryptoWaitReady, checkAddress, blake2AsU8a, + randomAsHex, + cryptoWaitReady, + checkAddress, + blake2AsU8a, } from '@polkadot/util-crypto'; import { u8aToHex, formatBalance } from '@polkadot/util'; -import { isHexWithGivenByteSize } from './codec'; +import { isHexWithGivenByteSize } from '@docknetwork/credential-sdk/utils'; // XXX: Following info can be fetched from chain. Integrating in DockAPI object is an option. const TESTNET_ADDR_PREFIX = 21; @@ -35,7 +38,11 @@ export function validateAddress(address, network = 'test') { } // Generate an account. If `secretUri` is not passed, a random one is generated -export async function generateAccount({ secretUri, type = 'sr25519', network = 'test' }) { +export async function generateAccount({ + secretUri, + type = 'sr25519', + network = 'test', +}) { if (['ed25519', 'sr25519', 'ecdsa'].indexOf(type) === -1) { throw new Error(`${type} is not a valid type`); } @@ -78,7 +85,8 @@ export async function getLastFinalizedBlock(api) { } // Given a block number, return the block hash -export async function blockNumberToHash(api, number) { +export async function blockNumberToHash(api, maybeNumber) { + const number = Number(maybeNumber); if (Number.isInteger(number) && number > 0) { const h = await api.rpc.chain.getBlockHash(number); return u8aToHex(h); @@ -94,7 +102,9 @@ export async function blockNumberToHash(api, number) { * @returns {Promise<*|{author: *, block: *}>} */ export async function getBlock(api, numberOrHash, withAuthor = false) { - const hash = isHexWithGivenByteSize(numberOrHash, 32) ? numberOrHash : (await blockNumberToHash(api, numberOrHash)); + const hash = isHexWithGivenByteSize(numberOrHash, 32) + ? numberOrHash + : await blockNumberToHash(api, numberOrHash); if (withAuthor) { const { block, author } = await api.derive.chain.getBlock(hash); return { block, author }; @@ -109,7 +119,7 @@ export async function getBlock(api, numberOrHash, withAuthor = false) { * @returns {*} */ export function getBlockNo(headerOrBlock) { - if ((typeof headerOrBlock.header) === 'object') { + if (typeof headerOrBlock.header === 'object') { return headerOrBlock.header.number.toNumber(); } return headerOrBlock.number.toNumber(); @@ -149,12 +159,20 @@ export async function waitForBlocks(api, n) { * @param {*} numberOrHash * @param {*} includeAllExtrinsics - If false, returns only successful extrinsics. */ -export async function getAllExtrinsicsFromBlock(api, numberOrHash, includeAllExtrinsics = true) { +export async function getAllExtrinsicsFromBlock( + api, + numberOrHash, + includeFailedExtrinsics = true, +) { const block = await getBlock(api, numberOrHash); let { extrinsics } = block; - if (includeAllExtrinsics === false) { + if (!includeFailedExtrinsics) { // Will only include successful extrinsics and using event `ExtrinsicSuccess` which hash index '0x0000' (1st index of 1st pallet which is system) - const events = await getAllEventsFromBlock(api, block.header.number.toNumber(), true); + const events = await getAllEventsFromBlock( + api, + block.header.number.toNumber(), + true, + ); const filteredExtrinsics = []; events.forEach((event) => { if (event.event && event.event.index === '0x0000') { @@ -173,20 +191,34 @@ export async function getAllExtrinsicsFromBlock(api, numberOrHash, includeAllExt * @param {*} numberOrHash * @param {*} formatted */ -export async function getAllEventsFromBlock(api, numberOrHash, formatted = true) { - const hash = isHexWithGivenByteSize(numberOrHash, 32) ? numberOrHash : (await blockNumberToHash(api, numberOrHash)); +export async function getAllEventsFromBlock( + api, + numberOrHash, + formatted = true, +) { + const hash = isHexWithGivenByteSize(numberOrHash, 32) + ? numberOrHash + : await blockNumberToHash(api, numberOrHash); const events = await api.query.system.events.at(hash); return formatted ? events.map((e) => e.toJSON()) : events; } -export async function getTransferEventsFromBlock(api, numberOrHash, formatted = true) { +export async function getTransferEventsFromBlock( + api, + numberOrHash, + formatted = true, +) { const events = await getAllEventsFromBlock(api, numberOrHash, formatted); - return events.filter((event) => event.event && event.event.index === '0x0302'); + return events.filter( + (event) => event.event && event.event.index === '0x0302', + ); } // Format a balance with units or only as number. function formatBalIfNeeded(bal, format = true) { - return format ? formatBalance(bal, { decimals: DECIMAL, withSi: true, withUnit: SYMBOL }) : bal.toNumber(); + return format + ? formatBalance(bal, { decimals: DECIMAL, withSi: true, withUnit: SYMBOL }) + : bal.toNumber(); } /** @@ -196,14 +228,33 @@ function formatBalIfNeeded(bal, format = true) { * @param {*} balanceFormatted * @param {*} includeAllTransfers - If false, will only return successful transfer extrinsics */ -export async function getTransferExtrinsicsFromBlock(api, numberOrHash, balanceFormatted = true, includeAllTransfers = true) { - const extrinsics = await getAllExtrinsicsFromBlock(api, numberOrHash, includeAllTransfers); +export async function getTransferExtrinsicsFromBlock( + api, + numberOrHash, + balanceFormatted = true, + includeAllTransfers = true, +) { + const extrinsics = await getAllExtrinsicsFromBlock( + api, + numberOrHash, + includeAllTransfers, + ); const transfers = []; extrinsics.forEach((ext) => { - if (ext.method && ext.method.section === 'balances' && (ext.method.method === 'transfer' || ext.method.method === 'transferKeepAlive')) { + if ( + ext.method + && ext.method.section === 'balances' + && (ext.method.method === 'transfer' + || ext.method.method === 'transferKeepAlive') + ) { const bal = formatBalIfNeeded(ext.method.args[1], balanceFormatted); const hash = u8aToHex(blake2AsU8a(ext.toU8a(), 256)); - transfers.push([ext.signer.toString(), ext.method.args[0].toString(), bal, hash]); + transfers.push([ + ext.signer.toString(), + ext.method.args[0].toString(), + bal, + hash, + ]); } }); return transfers; @@ -211,21 +262,25 @@ export async function getTransferExtrinsicsFromBlock(api, numberOrHash, balanceF // Get free balance of an account. export async function getBalance(api, address, formatted = true) { - const { data: { free } } = await api.query.system.account(address); + const { + data: { free }, + } = await api.query.system.account(address); return formatBalIfNeeded(free, formatted); } function checkValidMicroAmount(micros) { // TODO: this should handle upto 64 bits if (!Number.isSafeInteger(micros) || micros < 0) { - throw new Error(`Amount must be a positive integer and must fit in 53 bits but was ${micros}`); + throw new Error( + `Amount must be a positive integer and must fit in 53 bits but was ${micros}`, + ); } } // Convert tokens to micros export function docksToMicroDocks(amount) { // Token has `DECIMAL` decimal places - const micros = amount * (10 ** DECIMAL); + const micros = amount * 10 ** DECIMAL; checkValidMicroAmount(micros); return micros; } @@ -239,8 +294,20 @@ export function docksToMicroDocks(amount) { * @param sendTxn - If true, will send the transaction and return transaction hash otherwise return the signed transaction * @returns {Promise<*>} */ -export async function transferDock(api, senderKeypair, recipAddr, amount, sendTxn = true) { - return transferMicroDock(api, senderKeypair, recipAddr, docksToMicroDocks(amount), sendTxn); +export async function transferDock( + api, + senderKeypair, + recipAddr, + amount, + sendTxn = true, +) { + return transferMicroDock( + api, + senderKeypair, + recipAddr, + docksToMicroDocks(amount), + sendTxn, + ); } /** @@ -252,8 +319,16 @@ export async function transferDock(api, senderKeypair, recipAddr, amount, sendTx * @param sendTxn - If true, will send the transaction and return transaction hash otherwise return the signed transaction * @returns {Promise<*>} */ -export async function transferMicroDock(api, senderKeypair, recipAddr, amount, sendTxn = true) { +export async function transferMicroDock( + api, + senderKeypair, + recipAddr, + amount, + sendTxn = true, +) { checkValidMicroAmount(amount); const txn = api.tx.balances.transfer(recipAddr, amount); - return sendTxn ? txn.signAndSend(senderKeypair) : txn.signAsync(senderKeypair); + return sendTxn + ? txn.signAndSend(senderKeypair) + : txn.signAsync(senderKeypair); } diff --git a/src/utils/extrinsic.js b/packages/dock-blockchain-api/src/utils/extrinsic.js similarity index 76% rename from src/utils/extrinsic.js rename to packages/dock-blockchain-api/src/utils/extrinsic.js index b3735f8e2..1d87f30e6 100644 --- a/src/utils/extrinsic.js +++ b/packages/dock-blockchain-api/src/utils/extrinsic.js @@ -1,4 +1,23 @@ -import ExtrinsicError from '../errors/extrinsic-error'; +// Error class for passing extrinsic errors upstream +export class ExtrinsicEventError extends Error { + constructor(message, method, data, status, events) { + super(message); + this.name = 'ExtrinsicEventError'; + this.method = method; + this.data = data; + this.status = status; + this.events = events; + } +} + +export class ExtrinsicDispatchError extends Error { + constructor(message, status, dispatchError) { + super(message); + this.name = 'ExtrinsicDispatchError'; + this.status = status; + this.dispatchError = dispatchError; + } +} /** * Attempts to find extrinsic with the given hash across the blocks with the supplied numbers. @@ -75,14 +94,21 @@ export function errorMsgFromEventData(api, eventData) { * @param {*} status */ export const ensureExtrinsicSucceeded = (api, events, status) => { - // Ensure ExtrinsicFailed event doesnt exist + // Ensure `ExtrinsicFailed` event doesnt exist for (let i = 0; i < events.length; i++) { const { event: { data: eventData, method }, - } = events[i]; + } = events[i].toJSON(); + if (method === 'ExtrinsicFailed' || method === 'BatchInterrupted') { const errorMsg = errorMsgFromEventData(api, eventData); - throw new ExtrinsicError(errorMsg, method, eventData, status, events); + throw new ExtrinsicEventError( + errorMsg, + method, + eventData, + status, + events, + ); } } }; diff --git a/packages/dock-blockchain-modules/.npmignore b/packages/dock-blockchain-modules/.npmignore new file mode 100644 index 000000000..a35bd89d5 --- /dev/null +++ b/packages/dock-blockchain-modules/.npmignore @@ -0,0 +1,10 @@ +src/ +scripts/ +jest.config.js +rollup.config.mjs +out/ +node_modules/ +.vscode/ +.turbo/ +tests/ +*.log diff --git a/packages/dock-blockchain-modules/CHANGELOG.md b/packages/dock-blockchain-modules/CHANGELOG.md new file mode 100644 index 000000000..f78ccd0f5 --- /dev/null +++ b/packages/dock-blockchain-modules/CHANGELOG.md @@ -0,0 +1,12 @@ +# @docknetwork/dock-blockchain-modules + +## 0.1.1 + +### Minor Changes + +- Improved READMEs + +### Patch Changes + +- Updated dependencies + - @docknetwork/credential-sdk@0.1.1 diff --git a/packages/dock-blockchain-modules/README.md b/packages/dock-blockchain-modules/README.md new file mode 100644 index 000000000..308dc7f01 --- /dev/null +++ b/packages/dock-blockchain-modules/README.md @@ -0,0 +1,65 @@ +# @docknetwork/dock-blockchain-modules + +A JavaScript library designed for handling the following elements on the Dock blockchain: + +- Decentralized Identifiers (DIDs) +- Accumulators +- Anchors +- Blobs +- Support for public keys including BBS, BBS+, PS, Ed25519, Sr25519, and Secp256k1 +- BBS/BBS+/PS parameters +- Status List credentials +- Trust Registries + +## Install or build + +- Run `yarn add @docknetwork/dock-blockchain-modules` or `npm install @docknetwork/dock-blockchain-modules` to install the package from npm +- When building from source: + - Run `yarn` to install the dependencies + - Run `yarn build` to create a distribution version. + +## Documentation + +Have a look at the [concepts and tutorials](https://docknetwork.github.io/sdk/tutorials). These are generated from markdown +present over [here](./tutorials/src). Files prefixed with `concepts` describe the concepts and files prefixed with +`tutorials` have a tutorial on using the API. +Checkout the [API reference](https://docknetwork.github.io/sdk/reference) + +## Examples + +The example scripts present in [example directory](./example) are meant to demonstrate a complete feature. The following +commands demonstrate different features. + +## Connecting + +Use Dock's substrate node: https://github.com/docknetwork/dock-substrate + +Running dev node: + +``` +yarn dev-node +``` + +**Use the `mainnet` tag of this repo when interacting with mainnet as the `master` branch isn't guaranteed to be mainnet compatible.** + +## Test and example Configuration + +Configuration variables like websocket endpoint for node `FullNodeEndpoint`, URI for account to pay for extrinsics `TestAccountURI` +and keyring type `TestKeyringType` can be set as environment variables (or in an .env file). If they are not set, default values as +specified in file [test-constants.js](./tests/test-constants.js) are used. +The scripts read parameters from `.env` file. The available parameters are shown in an example env file [env_example](env_example) + +## Test + +Run tests with `yarn test` (required node to be running). + +You can run tests against a temporary node in docker like so: + +``` +yarn test-with-node +``` + +## Linting and type checking + +We use JSDoc and TypeScript for static type checking during the CI process. PRs must pass linting and type checking to be accepted. +You can run via: `yarn lint --fix` and `yarn type-check` diff --git a/packages/dock-blockchain-modules/index.js b/packages/dock-blockchain-modules/index.js new file mode 100644 index 000000000..38c47a249 --- /dev/null +++ b/packages/dock-blockchain-modules/index.js @@ -0,0 +1 @@ +module.exports = require("./dist/cjs/index.cjs"); diff --git a/packages/dock-blockchain-modules/jest.config.js b/packages/dock-blockchain-modules/jest.config.js new file mode 100644 index 000000000..b589e89d0 --- /dev/null +++ b/packages/dock-blockchain-modules/jest.config.js @@ -0,0 +1,35 @@ +import { resolve } from "node:path"; + +export default { + bail: true, + moduleNameMapper: { + "^@docknetwork/credential-sdk/(.*)$": resolve( + "../credential-sdk/dist/esm/$1" + ), + "^@docknetwork/dock-blockchain-api/(.*)$": resolve( + "../dock-blockchain-api/dist/esm/$1" + ), + "^@docknetwork/dock-blockchain-api$": resolve( + "../dock-blockchain-api/dist/esm/index.js" + ), + }, + clearMocks: true, + testTimeout: 30000, + testEnvironment: "./tests/test-environment", + transform: { + "^.+\\.(ts|js)$": ["babel-jest", { rootMode: "upward" }], + }, + transformIgnorePatterns: [ + "/node_modules/(?!@polkadot|@babel|multiformats|@docknetwork|@stablelib)", + ], + workerIdleMemoryLimit: "1G", + verbose: true, + globals: { + Uint8Array, + Uint32Array, + ArrayBuffer, + TextDecoder, + TextEncoder, + Buffer, + }, +}; diff --git a/packages/dock-blockchain-modules/package.json b/packages/dock-blockchain-modules/package.json new file mode 100644 index 000000000..896ba884c --- /dev/null +++ b/packages/dock-blockchain-modules/package.json @@ -0,0 +1,77 @@ +{ + "name": "@docknetwork/dock-blockchain-modules", + "version": "0.1.1", + "license": "MIT", + "type": "module", + "main": "./dist/esm/index.js", + "files": [ + "dist", + "index.js" + ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "default": "./dist/esm/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*", + "default": "./dist/esm/*" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/docknetwork/sdk" + }, + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@docknetwork/credential-sdk": "0.1.1" + }, + "devDependencies": { + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.3", + "@babel/node": "^7.23.9", + "@babel/plugin-syntax-import-attributes": "^7.25.6", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.3", + "@docknetwork/dock-blockchain-api": "0.1.1", + "@rollup/plugin-alias": "^4.0.2", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-wasm": "^5.1.0", + "@types/jest": "^29.5.12", + "aws-sdk": "^2.1057.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^29.7.0", + "eslint": "^8.0.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-sonarjs": "0.5.0", + "eslint-plugin-unused-imports": "^3.0.0", + "jest": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jsdoc": "^3.6.3", + "jsdoc-typeof-plugin": "^1.0.0", + "rollup": "2.78.0", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-multi-input": "^1.3.2", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2" + }, + "scripts": { + "build": "rollup -c", + "lint": "eslint \"src/**/*.js\"", + "docs": "rm -rf out && mkdir out && touch out/.nojekyll && jsdoc src -r -c ../../.jsdoc -d out/reference", + "prepublishOnly": "yarn build", + "dev-node": "../../scripts/run_dock_node_in_docker --dev --rpc-external --ws-external --rpc-cors=all", + "test": "LOG_STATE_CHANGE=1 NODE_ENV=production jest --verbose --runInBand --forceExit ./tests/*", + "test-with-node": "../../scripts/with_dock_docker_test_node yarn test", + "test-with-all-nodes": "../../scripts/with_all_dock_docker_test_nodes yarn test-integration" + } +} diff --git a/packages/dock-blockchain-modules/rollup.config.mjs b/packages/dock-blockchain-modules/rollup.config.mjs new file mode 100644 index 000000000..cad8cbf4b --- /dev/null +++ b/packages/dock-blockchain-modules/rollup.config.mjs @@ -0,0 +1,37 @@ +import json from "@rollup/plugin-json"; +import multiInput from "rollup-plugin-multi-input"; +import commonjs from "@rollup/plugin-commonjs"; + +export default async function () { + return [ + { + plugins: [ + multiInput(), + json(), + // terser(), + commonjs(), + // Temporarily disabled, not sure if required + // since rify is a node module doesnt seem to work + // but would be nice to try embed it + // wasm({ + // sync: ['*.wasm'], + // }), + ], + input: ["src/**/*.js"], + output: [ + { + sourcemap: true, + dir: "dist/esm", + format: "esm", + entryFileNames: "[name].js", + }, + { + sourcemap: true, + dir: "dist/cjs", + format: "cjs", + entryFileNames: "[name].cjs", + }, + ], + }, + ]; +} diff --git a/packages/dock-blockchain-modules/src/accumulator/actions.js b/packages/dock-blockchain-modules/src/accumulator/actions.js new file mode 100644 index 000000000..08d10c203 --- /dev/null +++ b/packages/dock-blockchain-modules/src/accumulator/actions.js @@ -0,0 +1,74 @@ +import { + DockAccumulator, + AccumulatorParams, + DockAccumulatorPublicKey, + DockAccumulatorIdIdent, + DockAccumulatorPublicKeyRef, + DockDidOrDidMethodKey, +} from '@docknetwork/credential-sdk/types'; +import { + TypedBytes, + TypedStruct, + TypedArray, + option, + TypedNumber, +} from '@docknetwork/credential-sdk/types/generic'; + +export class AddAccumulator extends TypedStruct { + static Classes = { + id: DockAccumulatorIdIdent, + accumulator: DockAccumulator, + nonce: TypedNumber, + }; +} + +class ByteArray extends TypedBytes {} + +export class ListOfByteArrays extends TypedArray { + static Class = ByteArray; +} + +export class UpdateAccumulator extends TypedStruct { + static Classes = { + id: DockAccumulatorIdIdent, + newAccumulated: class Accumulated extends TypedBytes {}, + additions: option(ListOfByteArrays), + removals: option(ListOfByteArrays), + witnessUpdateInfo: option(ByteArray), + nonce: TypedNumber, + }; +} + +export class RemoveAccumulator extends TypedStruct { + static Classes = { + id: DockAccumulatorIdIdent, + nonce: TypedNumber, + }; +} + +export class AddAccumulatorPublicKey extends TypedStruct { + static Classes = { + publicKey: DockAccumulatorPublicKey, + did: DockDidOrDidMethodKey, + nonce: TypedNumber, + }; +} + +export class RemoveAccumulatorPublicKey extends TypedStruct { + static Classes = { + keyRef: DockAccumulatorPublicKeyRef, + did: DockDidOrDidMethodKey, + nonce: TypedNumber, + }; +} + +export class AddAccumulatorParams extends TypedStruct { + static Classes = { params: AccumulatorParams, nonce: TypedNumber }; +} + +export class RemoveAccumulatorParams extends TypedStruct { + static Classes = { + paramsRef: DockAccumulatorPublicKeyRef, + nonce: TypedNumber, + }; +} diff --git a/packages/dock-blockchain-modules/src/accumulator/internal.js b/packages/dock-blockchain-modules/src/accumulator/internal.js new file mode 100644 index 000000000..d0b8389da --- /dev/null +++ b/packages/dock-blockchain-modules/src/accumulator/internal.js @@ -0,0 +1,233 @@ +import { DockDidOrDidMethodKey } from '@docknetwork/credential-sdk/types/did/onchain'; +import { + DockAccumulatorCounters, + AccumulatorParams, + AccumulatorPublicKey, + DockAccumulatorId, +} from '@docknetwork/credential-sdk/types'; +import { inclusiveRange, u8aToHex } from '@docknetwork/credential-sdk/utils'; +import { VBWitnessUpdateInfo } from '@docknetwork/credential-sdk/crypto'; +import { ParamsAndPublicKeys, createInternalDockModule } from '../common'; +import { + AddAccumulator, + AddAccumulatorParams, + AddAccumulatorPublicKey, + RemoveAccumulator, + RemoveAccumulatorParams, + RemoveAccumulatorPublicKey, + UpdateAccumulator, +} from './actions'; + +const didMethods = { + addAccumulator: (id, accumulator, _, nonce) => new AddAccumulator(id, accumulator, nonce), + updateAccumulator: ( + id, + newAccumulated, + { additions, removals, witnessUpdateInfo }, + _, + nonce, + ) => new UpdateAccumulator( + id, + newAccumulated, + additions, + removals, + witnessUpdateInfo, + nonce, + ), + removeAccumulator: (id, _, nonce) => new RemoveAccumulator(id, nonce), +}; + +export default class DockInternalAccumulatorModule extends createInternalDockModule( + { didMethods }, + ParamsAndPublicKeys, +) { + static Prop = 'accumulator'; + + static MethodNameOverrides = { + addPublicKey: 'AddAccumulatorPublicKey', + removePublicKey: 'RemoveAccumulatorPublicKey', + addParams: 'AddAccumulatorParams', + removeParams: 'RemoveAccumulatorParams', + }; + + static ParamsQuery = 'accumulatorParams'; + + static PublicKeyQuery = 'accumulatorKeys'; + + static PublicKey = AccumulatorPublicKey; + + static PublicKeyOwner = DockDidOrDidMethodKey; + + static Params = AccumulatorParams; + + static PublicKeyAndParamsActions = { + AddPublicKey: AddAccumulatorPublicKey, + RemovePublicKey: RemoveAccumulatorPublicKey, + AddParams: AddAccumulatorParams, + RemoveParams: RemoveAccumulatorParams, + }; + + async counters(did) { + return DockAccumulatorCounters.from( + await this.query.accumulatorOwnerCounters(DockDidOrDidMethodKey.from(did)), + ); + } + + async paramsCounter(did) { + return (await this.counters(did)).paramsCounter; + } + + async keysCounter(did) { + return (await this.counters(did)).keyCounter; + } + + /** + * Update given witness by downloading necessary blocks and applying the updates if found. Both start and end are inclusive + * @param accumulatorId + * @param member + * @param witness - this will be updated to the latest witness + * @param startBlock - block number to start from + * @param endBlock - block number to end at. If not specified, it will pick the `lastUpdated` field of the accumulator. + * @param batchSize - the number of blocks to fetch in one go + * @returns {Promise} + */ + // eslint-disable-next-line sonarjs/cognitive-complexity + async updateVbAccumulatorWitnessFromUpdatesInBlocks( + accumulatorId, + member, + witness, + startBlock, + endBlock = undefined, + batchSize = 10, + ) { + if (endBlock === undefined) { + const accum = await this.getAccumulator(accumulatorId, false); + + // eslint-disable-next-line no-param-reassign + endBlock = accum.lastModified; + } + // If endBlock < startBlock, it won't throw an error but won't fetch any updates and witness won't be updated. + console.debug( + `Will start updating witness from block ${startBlock} to ${endBlock}`, + ); + let current = startBlock; + while (current <= endBlock) { + const till = current + batchSize <= endBlock ? current + batchSize : endBlock; + // Get updates from blocks [current, current + 1, current + 2, ..., till] + // eslint-disable-next-line no-await-in-loop + const updates = await this.getUpdatesFromBlocks( + accumulatorId, + inclusiveRange(current, till, 1), + ); + for (const update of updates) { + const additions = [...(update.additions ?? [])].map( + (value) => value.bytes, + ); + const removals = [...(update.removals ?? [])].map( + (value) => value.bytes, + ); + + console.debug( + `Found ${additions?.length} additions and ${removals?.length} removals in block no ${current}`, + ); + + const queriedWitnessInfo = new VBWitnessUpdateInfo( + update.witnessUpdateInfo.bytes, + ); + + witness.updateUsingPublicInfoPostBatchUpdate( + member, + additions, + removals, + queriedWitnessInfo, + ); + } + current = till + 1; + } + } + + /** + * Accepts an event and returns the accumulator id and accumulated value if the event was + * `accumulator:AccumulatorUpdated` + * @param event - The event. This is the `event` key in the `event` object, i.e. for the `event` object got in response + * of `api.query.system.events`, the argument to this function is `event.event`. + * @returns {null|string[]} - null if the event is not `accumulator:AccumulatorUpdated` else [accumulatorId, accumulated] + */ + static parseEventAsAccumulatorUpdate(event) { + if ( + event.section === 'accumulator' + && event.method === 'AccumulatorUpdated' + ) { + return [u8aToHex(event.data[0]), u8aToHex(event.data[1])]; + } + return null; + } + + /** + * Fetch a block and get all accumulator updates made in that block's extrinsics corresponding to accumulator id `accumulatorId` + * @param accumulatorId + * @param blockNoOrBlockHash + * @returns {Promise} - Resolves to an array of `update`s where each `update` is an object with keys + * `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. The last keys have value null if they were + * not provided in the extrinsic. + */ + async getUpdatesFromBlock(accumulatorId, blockNoOrBlockHash) { + const extrinsics = await this.apiProvider.getAllExtrinsicsFromBlock( + blockNoOrBlockHash, + false, + ); + + return extrinsics + .map((e) => this.getUpdatesFromExtrinsic(e, accumulatorId)) + .filter(Boolean); + } + + /** + * Fetch blocks corresponding to the given block numbers or hashes and get all accumulator updates made in those blocks' extrinsics corresponding to accumulator id `accumulatorId` + * @param accumulatorId + * @param blockNosOrBlockHashes {number[]|string[]} + * @returns {Promise} - Resolves to an array of `update`s where each `update` is an object with keys + * `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. The last keys have value null if they were + * not provided in the extrinsic. + */ + async getUpdatesFromBlocks(accumulatorId, blockNosOrBlockHashes) { + // NOTE: polkadot-js doesn't allow to fetch more than one block in 1 RPC call. + const extrinsics = await Promise.all( + blockNosOrBlockHashes.map( + async (b) => await this.apiProvider.getAllExtrinsicsFromBlock(b, false), + ), + ); + + return extrinsics + .flat() + .map((e) => this.getUpdatesFromExtrinsic(e, accumulatorId)) + .filter(Boolean); + } + + /** + * Get accumulator updates corresponding to accumulator id `accumulatorId` + * @param ext + * @param accumulatorId + * @returns {Promise} - Resolves to an `update` object with keys `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. + * The last keys have value null if they were not provided in the extrinsic. + */ + getUpdatesFromExtrinsic(ext, accumulatorId) { + const accId = DockAccumulatorId.from(accumulatorId); + + if ( + ext.method + && ext.method.section === 'accumulator' + && ext.method.method === 'updateAccumulator' + ) { + const update = UpdateAccumulator.from( + this.apiProvider.api.createType('UpdateAccumulator', ext.method.args[0]), + ); + + if (update.id.eq(accId)) { + return update; + } + } + + return null; + } +} diff --git a/packages/dock-blockchain-modules/src/accumulator/module.js b/packages/dock-blockchain-modules/src/accumulator/module.js new file mode 100644 index 000000000..f5da794da --- /dev/null +++ b/packages/dock-blockchain-modules/src/accumulator/module.js @@ -0,0 +1,224 @@ +/* eslint-disable camelcase */ + +import { + DockAccumulatorWithUpdateInfo, + DockAccumulatorCommon, + DockKBUniversalAccumulator, + DockUniversalAccumulator, + DockPositiveAccumulator, + AccumulatorParams, + DockAccumulatorPublicKey, + DockAccumulatorParamsRef, + DockAccumulatorId, +} from '@docknetwork/credential-sdk/types'; +import { option, withProp } from '@docknetwork/credential-sdk/types/generic'; +import { AbstractAccumulatorModule } from '@docknetwork/credential-sdk/modules/accumulator'; +import DockInternalAccumulatorModule from './internal'; +import { withParamsAndPublicKeys } from '../common'; + +export const AccumulatorType = { + VBPos: 0, + VBUni: 1, + KBUni: 2, +}; + +/** Class to manage accumulators on chain */ +export default class DockAccumulatorModule extends withParamsAndPublicKeys( + AbstractAccumulatorModule, +) { + static DockOnly = DockInternalAccumulatorModule; + + static ParamsRef = DockAccumulatorParamsRef; + + async addPublicKeyTx(...args) { + if (args.length === 4) { + const [id, publicKey, targetDid, didKeypair] = args; + + return await super.addPublicKeyTx(id, publicKey, targetDid, didKeypair); + } else { + return await super.addPublicKeyTx(...args); + } + } + + /** + * Remove public key + * @param removeKeyId - The key index for key to remove. + * @param targetDid - The DID from which key is being removed + * @param signerDid - The DID that is removing the key by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's signing key reference + * @returns {Promise<*>} + */ + async removePublicKeyTx(...args) { + if (args.length === 3) { + const [id, did, didKeypair] = args; + + return await super.removePublicKeyTx(id, did, didKeypair); + } else { + return await super.removePublicKeyTx(...args); + } + } + + /** + * Add a positive (add-only) accumulator + * @param id - Unique accumulator id + * @param accumulated - Current accumulated value. + * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not + * have any public key on the chain. This is useful for KVAC. + * @param signerDid - Signer of the transaction payload + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addPositiveAccumulatorTx(id, accumulated, publicKeyRef, didKeypair) { + return await this.dockOnly.tx.addAccumulator( + id, + new DockPositiveAccumulator( + new DockAccumulatorCommon(accumulated, publicKeyRef), + ), + didKeypair, + ); + } + + /** + * Add universal (supports add/remove) accumulator + * @param id - Unique accumulator id + * @param accumulated - Current accumulated value. + * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not + * have any public key on the chain. This is useful for KVAC. + * @param maxSize - Maximum size of the accumulator + * @param signerDid - Signer of the transaction payload + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addUniversalAccumulatorTx( + id, + accumulated, + publicKeyRef, + maxSize, + didKeypair, + ) { + return await this.dockOnly.tx.addAccumulator( + id, + new DockUniversalAccumulator( + new DockUniversalAccumulator.Class( + new DockAccumulatorCommon(accumulated, publicKeyRef), + maxSize, + ), + ), + didKeypair, + ); + } + + /** + * Add KB universal (supports add/remove) accumulator + * @param id - Unique accumulator id + * @param accumulated - Current accumulated value. + * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not + * have any public key on the chain. This is useful for KVAC. + * @param signerDid - Signer of the transaction payload + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addKBUniversalAccumulatorTx(id, accumulated, publicKeyRef, didKeypair) { + return await this.dockOnly.tx.addAccumulator( + id, + new DockKBUniversalAccumulator( + new DockAccumulatorCommon(accumulated, publicKeyRef), + ), + didKeypair, + ); + } + + /** + * Update existing accumulator + * @param id + * @param newAccumulated - Accumulated value after the update + * @param additions + * @param removals + * @param witnessUpdateInfo + * @param signerDid - Signer of the transaction payload + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise< object>} + */ + async updateAccumulatorTx( + id, + newAccumulated, + { additions, removals, witnessUpdateInfo }, + didKeypair, + ) { + return await this.dockOnly.tx.updateAccumulator( + id, + newAccumulated, + { + additions, + removals, + witnessUpdateInfo, + }, + didKeypair, + ); + } + + /** + * Remove the accumulator from chain. This frees up the id for reuse. + * @param id - id to remove + * @param signerDid - Signer of the transaction payload + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async removeAccumulatorTx(id, didKeypair) { + return await this.dockOnly.tx.removeAccumulator(id, didKeypair); + } + + /** + * Get the accumulator as an object. The field `type` in object specifies whether it is "positive" or "universal". + * Fields `created` and `lastModified` are block nos where the accumulator was created and last updated respectively. + * Field `nonce` is the last accepted nonce by the chain, the next write to the accumulator should increment the nonce by 1. + * Field `accumulated` contains the current accumulated value. + * @param id + * @param includePublicKey - Fetch public key + * @param includeParams - Fetch params for the publicKey + * @returns {Promise<{created: *, lastModified: *}|null>} + */ + async getAccumulator(id, includePublicKey = false, includeParams = false) { + const PublicKey = includeParams + ? withProp(DockAccumulatorPublicKey, 'params', option(AccumulatorParams)) + : DockAccumulatorPublicKey; + const Accumulator = includePublicKey + ? withProp(DockAccumulatorWithUpdateInfo, 'publicKey', option(PublicKey)) + : DockAccumulatorWithUpdateInfo; + + const acc = option(Accumulator).from( + await this.dockOnly.query.accumulators(DockAccumulatorId.from(id)[1]), + ); + + if (acc == null) { + return null; + } + + if (includePublicKey) { + acc.publicKey = await this.getPublicKey(...acc.keyRef, includeParams); + } + + return acc; + } + + /** + * Update given witness by downloading necessary accumulators (blocks) and applying the updates if found. + * **Both start and end are inclusive.** + * + * @param accumulatorId + * @param member + * @param witness - this will be updated to the latest witness + * @param startBlock - identifier to start from (block number or collection item id) + * @param endBlock - identifier to end in (block number or collection item id) + * @returns {Promise} + */ + async updateWitness(accumulatorId, member, witness, start, end) { + return await this.dockOnly.updateVbAccumulatorWitnessFromUpdatesInBlocks( + accumulatorId, + member, + witness, + start, + end, + ); + } +} diff --git a/packages/dock-blockchain-modules/src/anchor/internal.js b/packages/dock-blockchain-modules/src/anchor/internal.js new file mode 100644 index 000000000..b7dfdc6ce --- /dev/null +++ b/packages/dock-blockchain-modules/src/anchor/internal.js @@ -0,0 +1,12 @@ +import { Anchor } from '@docknetwork/credential-sdk/types'; +import { createInternalDockModule } from '../common'; + +const accountMethods = { + deploy: (anchor) => [Anchor.from(anchor)], +}; + +export default class DockInternalAnchorModule extends createInternalDockModule({ + accountMethods, +}) { + static Prop = 'anchor'; +} diff --git a/packages/dock-blockchain-modules/src/anchor/module.js b/packages/dock-blockchain-modules/src/anchor/module.js new file mode 100644 index 000000000..70956651f --- /dev/null +++ b/packages/dock-blockchain-modules/src/anchor/module.js @@ -0,0 +1,44 @@ +/* eslint-disable camelcase */ +import { AnchorHash, Anchor } from '@docknetwork/credential-sdk/types/anchor'; +import { TypedNumber, option } from '@docknetwork/credential-sdk/types/generic'; +import { + NoAnchorError, + AbstractAnchorModule, +} from '@docknetwork/credential-sdk/modules/anchor'; +import { injectDock } from '../common'; +import DockInternalAnchorModule from './internal'; + +/** Class to create and query anchors from chain. */ +export default class DockAnchorModule extends injectDock(AbstractAnchorModule) { + static DockOnly = DockInternalAnchorModule; + + /** + * Write anchor on chain + * @param anchor + * @returns {Promise<*>} + */ + async deployTx(anchor) { + return await this.dockOnly.tx.deploy(anchor); + } + + /** + * Query anchor from chain + * @param anchor + * @param {Boolean} preHashed - If the anchor has already been hashed. + * @returns {Promise<*>} - The promise will either successfully resolve to the block number where anchor was created + * or reject with an error. + */ + async get(anchorKey, preHashed = false) { + const key = preHashed ? AnchorHash.from(anchorKey) : Anchor.hash(anchorKey); + + const anchor = option(TypedNumber).from( + await this.dockOnly.query.anchors(key), + ); + + if (anchor == null) { + throw new NoAnchorError(key); + } + + return anchor; + } +} diff --git a/packages/dock-blockchain-modules/src/attest/actions.js b/packages/dock-blockchain-modules/src/attest/actions.js new file mode 100644 index 000000000..24bde3361 --- /dev/null +++ b/packages/dock-blockchain-modules/src/attest/actions.js @@ -0,0 +1,12 @@ +import { Attest } from '@docknetwork/credential-sdk/types'; +import { + TypedStruct, + TypedNumber, +} from '@docknetwork/credential-sdk/types/generic'; + +export class SetClaim extends TypedStruct { + static Classes = { + attest: Attest, + nonce: TypedNumber, + }; +} diff --git a/packages/dock-blockchain-modules/src/attest/internal.js b/packages/dock-blockchain-modules/src/attest/internal.js new file mode 100644 index 000000000..3a9189bd8 --- /dev/null +++ b/packages/dock-blockchain-modules/src/attest/internal.js @@ -0,0 +1,26 @@ +import { + Attest, + DockDidOrDidMethodKey, +} from '@docknetwork/credential-sdk/types'; +import { createInternalDockModule } from '../common'; +import { SetClaim } from './actions'; + +const didMethods = { + setClaim: (priority, iri, _, __, nonce) => new SetClaim(new Attest(priority, iri), nonce), +}; + +export default class DockInternalAttestModule extends createInternalDockModule({ + didMethods, +}) { + static Prop = 'attest'; + + static MethodNameOverrides = { + setClaim: 'SetAttestationClaim', + }; + + async attest(did) { + return Attest.from( + await this.query.attestations(DockDidOrDidMethodKey.from(did)), + ); + } +} diff --git a/packages/dock-blockchain-modules/src/attest/module.js b/packages/dock-blockchain-modules/src/attest/module.js new file mode 100644 index 000000000..6c5f257cb --- /dev/null +++ b/packages/dock-blockchain-modules/src/attest/module.js @@ -0,0 +1,36 @@ +import AbstractAttestModule from '@docknetwork/credential-sdk/modules/attest/module'; +import { ensureTargetKeypair, injectDock } from '../common'; +import DockInternalAttestModule from './internal'; + +export default class DockAttestModule extends injectDock(AbstractAttestModule) { + static DockOnly = DockInternalAttestModule; + + /** + * Fetches the DIDs attestations IRI from the chain + * @param {string} hexId - DID in hex format + * @return {Promise} The DID's attestation, if any + */ + async getAttests(did) { + return (await this.dockOnly.attest(did)).iri?.value; + } + + /** + * Creates an attestation claim on chain for a specific DID + * @param priority + * @param iri + * @param did + * @param signingKeyRef + * @param params + */ + async setClaimTx(iri, targetDid, didKeypair) { + ensureTargetKeypair(targetDid, didKeypair); + const currentPriority = (await this.dockOnly.attest(targetDid)).priority?.value ?? 0; + + return await this.dockOnly.tx.setClaim( + 1 + currentPriority, + iri, + targetDid, + didKeypair, + ); + } +} diff --git a/packages/dock-blockchain-modules/src/blob/actions.js b/packages/dock-blockchain-modules/src/blob/actions.js new file mode 100644 index 000000000..117170b52 --- /dev/null +++ b/packages/dock-blockchain-modules/src/blob/actions.js @@ -0,0 +1,12 @@ +import { + TypedStruct, + TypedNumber, +} from '@docknetwork/credential-sdk/types/generic'; +import { BlobWithDockId } from './types'; + +export class AddBlob extends TypedStruct { + static Classes = { + blob: BlobWithDockId, + nonce: class Nonce extends TypedNumber {}, + }; +} diff --git a/packages/dock-blockchain-modules/src/blob/internal.js b/packages/dock-blockchain-modules/src/blob/internal.js new file mode 100644 index 000000000..c228888ed --- /dev/null +++ b/packages/dock-blockchain-modules/src/blob/internal.js @@ -0,0 +1,21 @@ +import { createInternalDockModule } from '../common'; +import { AddBlob } from './actions'; + +const didMethods = { + new: (blobWithId, _, __, nonce) => new AddBlob(blobWithId, nonce), +}; + +export default class DockBlobModuleInternal extends createInternalDockModule({ + didMethods, +}) { + static Prop = 'blobStore'; + + /** + * Maximum size of the blob in bytes + */ + static BlobMaxByteSize = 8192; + + static MethodNameOverrides = { + new: 'AddBlob', + }; +} diff --git a/packages/dock-blockchain-modules/src/blob/module.js b/packages/dock-blockchain-modules/src/blob/module.js new file mode 100644 index 000000000..a09b2c538 --- /dev/null +++ b/packages/dock-blockchain-modules/src/blob/module.js @@ -0,0 +1,40 @@ +import { NoBlobError } from '@docknetwork/credential-sdk/modules/blob/errors'; +import { option } from '@docknetwork/credential-sdk/types/generic'; +import { DockBlobId } from '@docknetwork/credential-sdk/types'; +import { AbstractBlobModule } from '@docknetwork/credential-sdk/modules/blob'; +import { injectDock } from '../common'; +import { OwnerWithBlob } from './types'; +import DockBlobModuleInternal from './internal'; + +/** Class to create and update Blobs on chain. */ +export default class BlobModule extends injectDock(AbstractBlobModule) { + static DockOnly = DockBlobModuleInternal; + + /** + * Write a new blob on chain. + * @param blob + * @param signerDid - Signer of the blob + * @param signingKeyRef - The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification + * @returns {Promise<*>} + */ + async newTx(blobWithId, targetDid, didKeypair) { + return await this.dockOnly.tx.new(blobWithId, targetDid, didKeypair); + } + + /** + * Get blob with given id from the chain. Throws if the blob can't be found. + * @param {string} id - Can either be a full blob id like blob:dock:0x... or just the hex identifier + * @returns {Promise} - A 2-element array where the first is the author and the second is the blob contents. + */ + async get(id) { + const hexId = DockBlobId.from(id); + const resp = option(OwnerWithBlob).from( + await this.dockOnly.query.blobs(hexId), + ); + if (resp == null) { + throw new NoBlobError(String(hexId)); + } + + return resp; + } +} diff --git a/packages/dock-blockchain-modules/src/blob/types.js b/packages/dock-blockchain-modules/src/blob/types.js new file mode 100644 index 000000000..35aca36e4 --- /dev/null +++ b/packages/dock-blockchain-modules/src/blob/types.js @@ -0,0 +1,16 @@ +import { + DockDidOrDidMethodKey, + Blob, + BlobWithId, +} from '@docknetwork/credential-sdk/types'; +import { DockBlobId } from '@docknetwork/credential-sdk/types/blob/blob-id'; +import { + TypedTuple, + withProp, +} from '@docknetwork/credential-sdk/types/generic'; + +export class OwnerWithBlob extends TypedTuple { + static Classes = [DockDidOrDidMethodKey, Blob]; +} + +export class BlobWithDockId extends withProp(BlobWithId, 'id', DockBlobId) {} diff --git a/packages/dock-blockchain-modules/src/common/builders.js b/packages/dock-blockchain-modules/src/common/builders.js new file mode 100644 index 000000000..639c515f0 --- /dev/null +++ b/packages/dock-blockchain-modules/src/common/builders.js @@ -0,0 +1,215 @@ +import { + withExtendedStaticProperties, + ensureInstanceOf, +} from '@docknetwork/credential-sdk/utils'; +import { DockDidOrDidMethodKey } from '@docknetwork/credential-sdk/types/did'; +import DidKeypair from '@docknetwork/credential-sdk/keypairs/did-keypair'; + +const fnNameToMethodName = (methodName) => `${methodName[0].toUpperCase()}${methodName.slice(1)}`; + +export const ensureTargetKeypair = (targetDid, didKeypair) => { + const includes = [] + .concat(didKeypair) + .some( + (keyPair) => String(ensureInstanceOf(keyPair, DidKeypair).did) === String(targetDid), + ); + + if (!includes) { + throw new Error(`No keypair provided for ${targetDid}`); + } +}; + +/** + * Creates DID method transaction with policy builder. + */ +export const createDIDMethodWithPolicyTx = (fnName) => { + const obj = { + async [fnName](...args) { + const { root } = this; + + const [didKeypair] = args.slice(root.payload[fnName].length - 2); + const { did: signer } = ensureInstanceOf(didKeypair, DidKeypair); + // eslint-disable-next-line no-param-reassign + args[root.payload[fnName].length - 1] + ??= 1 + (await root.apiProvider.didNonce(didKeypair.did)); + const { data, nonce } = root.payload[fnName].apply(this.root, args); + + const sig = await DockDidOrDidMethodKey.from(signer).signStateChange( + root.apiProvider, + root.constructor.MethodNameOverrides?.[fnName] + ?? fnNameToMethodName(fnName), + { data, nonce }, + didKeypair, + ); + + return await root.rawTx[fnName](data, [{ sig, nonce }]); + }, + }; + + return obj[fnName]; +}; + +/** + * Creates DID method transaction builder. + */ +export const createDIDMethodTx = (fnName) => { + const obj = { + async [fnName](...args) { + const { root } = this; + + const [didKeypair] = args.slice(root.payload[fnName].length - 2); + ensureInstanceOf(didKeypair, DidKeypair); + // eslint-disable-next-line no-param-reassign + args[root.payload[fnName].length - 1] + ??= 1 + (await root.apiProvider.didNonce(didKeypair.did)); + + return await DockDidOrDidMethodKey.from(didKeypair.did).changeState( + root.apiProvider, + root.rawTx[fnName], + root.constructor.MethodNameOverrides?.[fnName] + ?? fnNameToMethodName(fnName), + root.payload[fnName].apply(this.root, args), + didKeypair, + ); + }, + }; + + return obj[fnName]; +}; + +/** + * Creates a call. + */ +export const createCall = (fnName) => { + const obj = { + async [fnName](...args) { + const { root } = this; + const tx = await root.tx[fnName]( + ...args.slice(0, root.payload[fnName].length), + ); + + return await root.signAndSend(tx, args[root.payload[fnName].length]); + }, + }; + + return obj[fnName]; +}; + +/** + * Creates a call which accepts nonce as last argument. + */ +export const createCallWithNonce = (fnName) => { + const obj = { + async [fnName](...args) { + const { root } = this; + const tx = await root.tx[fnName]( + ...args.slice(0, root.payload[fnName].length - 1), + ); + + return await root.signAndSend(tx, args[root.payload[fnName].length - 1]); + }, + }; + + return obj[fnName]; +}; + +/** + * Creates a transaction builder for account method with the given name. + */ +export const createAccountTx = (fnName) => { + const obj = { + async [fnName](...args) { + return await this.root.rawTx[fnName]( + ...this.root.payload[fnName].apply(this.root, args), + ); + }, + }; + + return obj[fnName]; +}; + +class Root { + constructor(root) { + this.root = root; + } +} + +export function createInternalDockModule( + { + didMethods = Object.create(null), + didMethodsWithPolicy = Object.create(null), + accountMethods = Object.create(null), + } = {}, + baseClass = class DockModuleBaseClass {}, +) { + const name = `internalDockModule(${baseClass.name})`; + class RootPayload extends (baseClass.RootPayload ?? Root) {} + class RootModule extends (baseClass.RootModule ?? Root) {} + class RootSender extends (baseClass.RootSender ?? Root) {} + + const obj = { + [name]: class extends baseClass { + static Prop; + + static RootPayload = RootPayload; + + static RootModule = RootModule; + + static RootSender = RootSender; + + constructor(apiProvider) { + super(apiProvider); + + this.apiProvider = apiProvider; + } + + get query() { + return this.apiProvider.api.query[this.constructor.Prop]; + } + + get rawTx() { + return this.apiProvider.api.tx[this.constructor.Prop]; + } + + get rpc() { + return this.apiProvider.api.rpc[this.constructor.Prop]; + } + + get tx() { + return new RootModule(this); + } + + get send() { + return new RootSender(this); + } + + get payload() { + return new RootPayload(this); + } + + async signAndSend(extrinsic, params) { + return await this.apiProvider.signAndSend(extrinsic, params); + } + }, + }; + + for (const [key, payload] of Object.entries(didMethodsWithPolicy)) { + RootPayload.prototype[key] = payload; + RootModule.prototype[key] = createDIDMethodWithPolicyTx(key); + RootSender.prototype[key] = createCallWithNonce(key); + } + + for (const [key, payload] of Object.entries(didMethods)) { + RootPayload.prototype[key] = payload; + RootModule.prototype[key] = createDIDMethodTx(key); + RootSender.prototype[key] = createCallWithNonce(key); + } + + for (const [key, payload] of Object.entries(accountMethods)) { + RootPayload.prototype[key] = payload; + RootModule.prototype[key] = createAccountTx(key); + RootSender.prototype[key] = createCall(key); + } + + return withExtendedStaticProperties(['Prop'], obj[name]); +} diff --git a/packages/dock-blockchain-modules/src/common/dock-api-provider.js b/packages/dock-blockchain-modules/src/common/dock-api-provider.js new file mode 100644 index 000000000..f72090d23 --- /dev/null +++ b/packages/dock-blockchain-modules/src/common/dock-api-provider.js @@ -0,0 +1,44 @@ +import { ApiProvider } from '@docknetwork/credential-sdk/modules/common'; +import { ensureInstanceOf } from '@docknetwork/credential-sdk/utils/type-helpers'; +import { DockDIDModuleInternal } from '../did/internal'; + +class DockApiProvider extends ApiProvider { + constructor(dock) { + super(); + this.dock = ensureInstanceOf(dock, ApiProvider); + + if (typeof dock.getAllExtrinsicsFromBlock !== 'function') { + throw new Error('`getAllExtrinsicsFromBlock` must be a function'); + } + } + + get api() { + const { api } = this.dock; + if (!api.isConnected) { + throw new Error('API is not connected'); + } + + return api; + } + + async stateChangeBytes(name, payload) { + return await this.dock.stateChangeBytes(name, payload); + } + + async signAndSend(extrinsic, params) { + return await this.dock.signAndSend(extrinsic, params); + } + + async getAllExtrinsicsFromBlock(numberOrHash, includeFailedExtrinsics) { + return await this.dock.getAllExtrinsicsFromBlock( + numberOrHash, + includeFailedExtrinsics, + ); + } + + async didNonce(did) { + return await new DockDIDModuleInternal(this).nonce(did); + } +} + +export default DockApiProvider; diff --git a/packages/dock-blockchain-modules/src/common/index.js b/packages/dock-blockchain-modules/src/common/index.js new file mode 100644 index 000000000..778f0d33b --- /dev/null +++ b/packages/dock-blockchain-modules/src/common/index.js @@ -0,0 +1,4 @@ +export * from './builders'; +export { default as injectDock } from './inject-dock'; +export { default as withParamsAndPublicKeys } from './with-params-and-public-keys'; +export { default as ParamsAndPublicKeys } from './params-and-public-keys'; diff --git a/packages/dock-blockchain-modules/src/common/inject-dock.js b/packages/dock-blockchain-modules/src/common/inject-dock.js new file mode 100644 index 000000000..e4001b1ff --- /dev/null +++ b/packages/dock-blockchain-modules/src/common/inject-dock.js @@ -0,0 +1,27 @@ +import { withExtendedStaticProperties } from '@docknetwork/credential-sdk/utils/inheritance'; +import DockApiProvider from './dock-api-provider'; + +export default function injectDock(klass) { + const name = `withDock(${klass.name})`; + + const obj = { + [name]: class extends klass { + /** + * Associated class which's only available when interacting with the dock blockchain. + * Instance of this class is assigned to `dockOnly` property of the object. + */ + static DockOnly; + + static ApiProvider = DockApiProvider; + + constructor(dock) { + const apiProvider = new DockApiProvider(dock); + super(apiProvider); + + this.dockOnly = new this.constructor.DockOnly(apiProvider); + } + }, + }; + + return withExtendedStaticProperties(['DockOnly'], obj[name]); +} diff --git a/packages/dock-blockchain-modules/src/common/params-and-public-keys.js b/packages/dock-blockchain-modules/src/common/params-and-public-keys.js new file mode 100644 index 000000000..424bc127e --- /dev/null +++ b/packages/dock-blockchain-modules/src/common/params-and-public-keys.js @@ -0,0 +1,37 @@ +import { createInternalDockModule } from './builders'; + +const didMethods = { + addPublicKey(publicKey, targetDid, _, nonce) { + return new this.constructor.PublicKeyAndParamsActions.AddPublicKey( + this.constructor.PublicKey.from(publicKey), + targetDid, + nonce, + ); + }, + removePublicKey(keyId, targetDid, _, nonce) { + const did = this.constructor.PublicKeyOwner.from(targetDid); + + return new this.constructor.PublicKeyAndParamsActions.RemovePublicKey( + [did, keyId], + did, + nonce, + ); + }, + addParams(params, _, __, nonce) { + return new this.constructor.PublicKeyAndParamsActions.AddParams( + this.constructor.Params.from(params), + nonce, + ); + }, + removeParams(paramsId, did, __, nonce) { + return new this.constructor.PublicKeyAndParamsActions.RemoveParams( + [did, paramsId], + nonce, + ); + }, +}; + +export default createInternalDockModule( + { didMethods }, + class ParamsAndPublicKeys {}, +); diff --git a/packages/dock-blockchain-modules/src/common/with-params-and-public-keys.js b/packages/dock-blockchain-modules/src/common/with-params-and-public-keys.js new file mode 100644 index 000000000..839237ce6 --- /dev/null +++ b/packages/dock-blockchain-modules/src/common/with-params-and-public-keys.js @@ -0,0 +1,249 @@ +import { AbstractWithParamsAndPublicKeys } from '@docknetwork/credential-sdk/modules/common'; +import { + TypedNumber, + option, + withProp, + TypedMap, + TypedEnum, + withNullIfNotAVariant, +} from '@docknetwork/credential-sdk/types/generic'; +import { DockDidOrDidMethodKey } from '@docknetwork/credential-sdk/types'; +import { + isEqualToOrPrototypeOf, + withExtendedStaticProperties, +} from '@docknetwork/credential-sdk/utils/inheritance'; +import injectDock from './inject-dock'; + +/** + * Wraps supplied class into a class with logic for public keys and corresponding setup parameters. + */ +/* eslint-disable sonarjs/cognitive-complexity */ +export default function withParamsAndPublicKeys(klass) { + const name = `withParamsAndPublicKeys(${klass.name})`; + + if (!isEqualToOrPrototypeOf(AbstractWithParamsAndPublicKeys, klass)) { + throw new Error( + `Class \`${klass.name}\` must extend \`${AbstractWithParamsAndPublicKeys}\``, + ); + } + + const obj = { + [name]: class extends injectDock(klass) { + static get ParamsMap() { + const { Params } = this; + + return class ParamsMap extends TypedMap { + static KeyClass = TypedNumber; + + static ValueClass = Params; + }; + } + + static get PublicKeysMap() { + const { PublicKey } = this; + + return class PublicKeyMap extends TypedMap { + static KeyClass = TypedNumber; + + static ValueClass = PublicKey; + }; + } + + /** + * Builds module-specific params from the provided value. + */ + static get Params() { + return this.DockOnly.Params; + } + + /** + * Owner of a public key. + */ + static get PublicKeyOwner() { + return this.DockOnly.PublicKeyOwner; + } + + /** + * Builds module-specific public key from the provided value. + */ + static get PublicKey() { + return this.DockOnly.PublicKey; + } + + static get ParamsQuery() { + return this.DockOnly.ParamsQuery; + } + + static get PublicKeyQuery() { + return this.DockOnly.PublicKeyQuery; + } + + /** + * Add new signature params. + * @param param - The signature params to add. + * @param didKeypair - The signer DID's keypair + + * @returns {Promise<*>} + */ + async addParamsTx(id, param, targetDid, didKeypair) { + return await this.dockOnly.tx.addParams(param, targetDid, didKeypair); + } + + /** + * Remove existing BBS+ params. + * @param index - Identifier of the params to be removed + * @param didKeypair - Signer DID's keypair + + * @returns {Promise<*>} + */ + async removeParamsTx(id, targetDid, didKeypair) { + return await this.dockOnly.tx.removeParams(id, targetDid, didKeypair); + } + + /** + * Add a public key + * @param publicKey - public key to add. + * @param targetDid - The DID to which key is being added + * @param signerDid - The DID that is adding the key by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's signingKeyRef + * @returns {Promise<*>} + */ + async addPublicKeyTx(id, publicKey, targetDid, didKeypair) { + return await this.dockOnly.tx.addPublicKey( + publicKey, + targetDid, + didKeypair, + ); + } + + /** + * Remove public key + * @param removeKeyId - Identifier of the public key to be removed. + * @param targetDid - The DID from which key is being removed + * @param signerDid - The DID that is removing the key by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's signing key reference + * @returns {Promise<*>} + */ + async removePublicKeyTx(id, targetDid, didKeypair) { + return await this.dockOnly.tx.removePublicKey( + id, + targetDid, + didKeypair, + ); + } + + /** + * Retrieves params by DID and counter. + * @param {*} did + * @param {*} counter + * @returns {Promise} + */ + async getParams(did, counter) { + return option(this.constructor.Params).from( + await this.dockOnly.query[this.constructor.ParamsQuery]( + DockDidOrDidMethodKey.from(did), + TypedNumber.from(counter), + ), + ); + } + + /** + * Retrieves all params by a DID. + * @param {*} did + * @returns {Promise>} + */ + async getAllParamsByDid(did) { + // TODO: use `multi` + const hexDid = DockDidOrDidMethodKey.from(did); + const paramsMap = new this.constructor.ParamsMap(); + + const paramsCounter = await this.dockOnly.paramsCounter(hexDid); + for (let idx = 1; idx <= paramsCounter; idx++) { + // eslint-disable-next-line no-await-in-loop + const params = await this.getParams(hexDid, idx); + + if (params != null) { + paramsMap.set(idx, params); + } + } + + return paramsMap; + } + + /** + * Retrieves all public keys by a DID. + * @param {*} did + * @returns {Promise>} + */ + async getAllPublicKeysByDid(did, includeParams) { + // TODO: use `multi` + const hexDid = DockDidOrDidMethodKey.from(did); + const publicKeysMap = new this.constructor.PublicKeysMap(); + + const keysCounter = await this.dockOnly.keysCounter(hexDid); + for (let idx = 1; idx <= keysCounter; idx++) { + // eslint-disable-next-line no-await-in-loop + const publicKey = await this.getPublicKey(hexDid, idx, includeParams); + + if (publicKey != null) { + publicKeysMap.set(idx, publicKey); + } + } + + return publicKeysMap; + } + + /** + * + * @param did + * @param keyId + * @param withParams - If true, return the params referenced by the public key. It will throw an error if paramsRef is null + * or params were not found on chain which can happen if they were deleted after this public key was added. + * @returns {Promise<{bytes: string}|null>} + */ + async getPublicKey(did, keyId, includeParams = false) { + const { + PublicKey, ParamsRef, Params, PublicKeyOwner, PublicKeyQuery, + } = this.constructor; + + const PublicKeyWithParamsRef = withProp( + PublicKey, + 'paramsRef', + option(ParamsRef), + ); + const PublicKeyWithParams = includeParams + ? withProp(PublicKeyWithParamsRef, 'params', option(Params)) + : PublicKeyWithParamsRef; + const MaybeNotAVariantPublicKey = isEqualToOrPrototypeOf(TypedEnum, PublicKeyWithParams) + && PublicKeyWithParams.Class != null + ? withNullIfNotAVariant(PublicKeyWithParams) + : PublicKeyWithParams; + const owner = PublicKeyOwner.from(did); + const publicKey = await option(MaybeNotAVariantPublicKey).from( + await this.dockOnly.query[PublicKeyQuery]( + owner, + TypedNumber.from(keyId), + ), + ); + + if (publicKey == null) { + return null; + } + + if (includeParams && publicKey.paramsRef != null) { + const params = await this.getParams(...publicKey.paramsRef); + if (params == null) { + throw new Error( + `Parameters with reference (${publicKey.paramsRef[0]}, ${publicKey.paramsRef[1]}) not found on chain`, + ); + } + publicKey.params = params; + } + + return publicKey; + } + }, + }; + + return withExtendedStaticProperties(['ParamsRef'], obj[name]); +} diff --git a/packages/dock-blockchain-modules/src/did/actions.js b/packages/dock-blockchain-modules/src/did/actions.js new file mode 100644 index 000000000..753d8fc65 --- /dev/null +++ b/packages/dock-blockchain-modules/src/did/actions.js @@ -0,0 +1,72 @@ +import { + DockDidValue, + Controllers, + ServiceEndpoint, + DidKey, + SuffixServiceEndpointId, +} from '@docknetwork/credential-sdk/types'; +import { + TypedNumber, + TypedStruct, + TypedArray, +} from '@docknetwork/credential-sdk/types/generic'; + +export class AddKeys extends TypedStruct { + static Classes = { + did: DockDidValue, + keys: class DidKeys extends TypedArray { + static Class = DidKey; + }, + nonce: TypedNumber, + }; +} + +export class AddControllers extends TypedStruct { + static Classes = { + did: DockDidValue, + controllers: Controllers, + nonce: TypedNumber, + }; +} + +export class AddServiceEndpoint extends TypedStruct { + static Classes = { + did: DockDidValue, + id: SuffixServiceEndpointId, + endpoint: ServiceEndpoint, + nonce: TypedNumber, + }; +} + +export class RemoveKeys extends TypedStruct { + static Classes = { + did: DockDidValue, + keys: class Keys extends TypedArray { + static Class = class KeyId extends TypedNumber {}; + }, + nonce: TypedNumber, + }; +} + +export class RemoveControllers extends TypedStruct { + static Classes = { + did: DockDidValue, + controllers: Controllers, + nonce: TypedNumber, + }; +} + +export class RemoveServiceEndpoint extends TypedStruct { + static Classes = { + did: DockDidValue, + id: SuffixServiceEndpointId, + nonce: TypedNumber, + }; +} + +export class RemoveOnchainDid extends TypedStruct { + static Classes = { + did: DockDidValue, + nonce: TypedNumber, + }; +} diff --git a/packages/dock-blockchain-modules/src/did/index.js b/packages/dock-blockchain-modules/src/did/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/packages/dock-blockchain-modules/src/did/internal.js b/packages/dock-blockchain-modules/src/did/internal.js new file mode 100644 index 000000000..a800eb7d7 --- /dev/null +++ b/packages/dock-blockchain-modules/src/did/internal.js @@ -0,0 +1,494 @@ +import { + DockDidOrDidMethodKey, + DockDid, + ServiceEndpoint, + ServiceEndpointId, + DidKey, + DidMethodKey, + ServiceEndpoints, + DidKeys, + Controllers, + StoredDidDetails, +} from '@docknetwork/credential-sdk/types'; +import { + option, + TypedNumber, + TypedTuple, +} from '@docknetwork/credential-sdk/types/generic'; +import { + NoDIDError, + NoOffchainDIDError, + NoOnchainDIDError, +} from '@docknetwork/credential-sdk/modules/did/errors'; +import { maybeToHuman } from '@docknetwork/credential-sdk/utils'; +import { DidMethodKeyDetails } from '@docknetwork/credential-sdk/types/did/onchain'; +import { + AddServiceEndpoint, + AddKeys, + AddControllers, + RemoveKeys, + RemoveControllers, + RemoveServiceEndpoint, + RemoveOnchainDid, +} from './actions'; +import { createInternalDockModule } from '../common/builders'; + +const didMethods = { + addKeys: (keys, targetDid, _, nonce) => { + const did = DockDid.from(targetDid).asDid; + + return new AddKeys(did, keys, nonce); + }, + + addControllers: (controllers, targetDid, _, nonce) => { + const did = DockDid.from(targetDid).asDid; + + return new AddControllers(did, controllers, nonce); + }, + + addServiceEndpoint: (id, types, origins, targetDid, _, nonce) => new AddServiceEndpoint( + DockDid.from(targetDid).asDid, + id, + new ServiceEndpoint(types, origins), + nonce, + ), + + removeKeys: (keys, targetDid, _, nonce) => { + const did = DockDid.from(targetDid).asDid; + + return new RemoveKeys(did, keys, nonce); + }, + + removeControllers: (controllers, targetDid, _, nonce) => { + const did = DockDid.from(targetDid).asDid; + + return new RemoveControllers(did, controllers, nonce); + }, + + removeServiceEndpoint: (spId, _, nonce) => { + const [did, id] = ServiceEndpointId.from(spId); + + return new RemoveServiceEndpoint(did.asDock, id, nonce); + }, + + removeOnchainDid: (targetDid, _, nonce) => { + const did = DockDid.from(targetDid).asDid; + + return new RemoveOnchainDid(did, nonce); + }, +}; + +const accountMethods = { + /** + * Creates transaction to create a new off-chain DID + * @param did - + * @param {OffChainDidDocRef} didDocRef - Off chain reference for the DID + * @returns {*} + */ + newOffchain: (did, didDocRef) => { + const hexId = DockDid.from(did).asDid; + + return [hexId, didDocRef]; + }, + /** + * Create a transaction to update the DID Doc reference of the off chain DID + * @param did + * @param didDocRef - new reference + * @returns {*} + */ + // eslint-disable-next-line sonarjs/no-identical-functions + setOffchainDidDocRef: (did, didDocRef) => { + const hexId = DockDid.from(did).asDid; + + return [hexId, didDocRef]; + }, + removeOffchainDid: (did) => [DockDid.from(did).asDid], + newOnchain: (did, didKeys, controllers) => [ + DockDid.from(did).asDid, + [...didKeys].map((key) => DidKey.from(key)), + [...controllers].map((c) => DockDidOrDidMethodKey.from(c)), + ], + newDidMethodKey: (didMethodKey) => [ + DidMethodKey.from(didMethodKey).asDidMethodKey, + ], +}; + +export class DockDIDModuleInternal extends createInternalDockModule({ + didMethods, + accountMethods, +}) { + static Prop = 'didModule'; + + static MethodNameOverrides = { + removeOnchainDid: 'DidRemoval', + }; + + /** + * Create a new off-chain DID + * @param did + * @param didDocRef - Off chain reference for the DID + * @returns {Promise<*>} + */ + async newOffchain(did, didDocRef, params = {}) { + return await this.send.newOffchain( + did, + didDocRef, + + params, + ); + } + + /** + * Update the DID Doc reference of the off chain DID + * @param did + * @param didDocRef + * @returns {Promise<*>} + */ + async setOffchainDidDocRef( + did, + didDocRef, + + params = {}, + ) { + return await this.send.setOffchainDidDocRef( + did, + didDocRef, + + params, + ); + } + + /** + * Remove off-chain DID + * @param did + * @returns {Promise<*>} + */ + async removeOffchainDid(did, params = {}) { + return await this.send.removeOffchainDid(did, params); + } + + /** + * Creates a new DID on the Dock chain. + * @param {string} did - The new DID. Can be a full DID or hex identifier + * @param {DidKey[]} didKeys - Array of `DidKey`s as expected by the Substrate node + * @param {array} controllers - Array of `Did`s as expected by the Substrate node. + * @return {Promise} Promise to the pending transaction + */ + async newOnchain( + did, + didKeys, + controllers, + + params = {}, + ) { + return await this.send.newOnchain(did, didKeys, controllers, params); + } + + /** + * Creates a new `did:key:` on the Dock chain. + * @param {{ ed25519: Uint8Array } | { secp256k1: Uint8Array }} did - The new DID. Can be either `PublicKeyEd25519` or `PublicKeySecp256k1`. + * @return {Promise} Promise to the pending transaction + */ + async newDidMethodKey(didMethodKey, params = {}) { + return await this.send.newDidMethodKey(didMethodKey, params); + } + + /** + * Add keys to an on-chain DID + * @param {DidKey[]} didKeys - Array of `DidKey`s as expected by the Substrate node + * @param targetDid - The DID to which keys are being added + * @param signerDid - The DID that is adding the keys by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addKeys(didKeys, targetDid, didKeypair, params = {}) { + return await this.send.addKeys(didKeys, targetDid, didKeypair, params); + } + + /** + * Add controllers to an on-chain DID. + * @param controllers - The DIDs that will control the `targetDid` + * @param targetDid - The DID to which controllers are being added + * @param signerDid - The DID that is adding the controllers by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addControllers( + controllers, + targetDid, + didKeypair, + + params = {}, + ) { + return await this.send.addControllers( + controllers, + targetDid, + didKeypair, + params, + ); + } + + /** + * Add a new service endpoint + * @param endpointId - The id of the service endpoint. Each endpoint has a unique id. + * @param {ServiceEndpointType} endpointType - The type of the endpoint. + * @param {Array} origins - An array of one of URIs encoded as hex. + * @param targetDid - The DID to which service endpoint is being added + * @param signerDid - The DID that is adding the service endpoint by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async addServiceEndpoint( + endpointId, + endpointType, + origins, + targetDid, + didKeypair, + params = {}, + ) { + return await this.send.addServiceEndpoint( + endpointId, + endpointType, + origins, + targetDid, + didKeypair, + params, + ); + } + + /** + * Remove keys from a DID + * @param keyIds - Key indices to remove + * @param targetDid - The DID from which keys are being removed + * @param signerDid - The DID that is removing the keys by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async removeKeys(keyIds, targetDid, didKeypair, params = {}) { + return await this.send.removeKeys(keyIds, targetDid, didKeypair, params); + } + + /** + * Remove controllers from a DID + * @param controllers - Controller DIDs to remove. + * @param targetDid - The DID from which controllers are being removed + * @param signerDid - The DID that is removing the controllers by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async removeControllers(controllers, targetDid, didKeypair, params = {}) { + return await this.send.removeControllers( + controllers, + targetDid, + didKeypair, + params, + ); + } + + /** + * Remove a service endpoint from a DID + * @param endpointId - The endpoint to remove + * @param targetDid - The DID from which endpoint is being removed + * @param signerDid - The DID that is removing the endpoint by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @returns {Promise<*>} + */ + async removeServiceEndpoint(endpointId, didKeypair, params = {}) { + return await this.send.removeServiceEndpoint( + endpointId, + didKeypair, + params, + ); + } + + /** + * Removes an on-chain DID. + * @param targetDid - The DID being removed + * @param signerDid - The DID that is removing `targetDid` by signing the payload because it controls `targetDid` + * @param signingKeyRef - Signer's keypair reference + * @return {Promise} Promise to the pending transaction + */ + async removeOnchainDid( + targetDid, + didKeypair, + + params = {}, + ) { + return await this.send.removeOnchainDid(targetDid, didKeypair, params); + } + + /** + * Returns true if DID `controller` is a controller of DID `controlled`, false otherwise + * @param controlled + * @param controller + * @returns {Promise} + */ + async isController(controlled, controller) { + const controlledDid = DockDid.from(controlled).asDid; + const controllerDid = DockDidOrDidMethodKey.from(controller); + + return ( + option(TypedNumber).from( + await this.query.didControllers(controlledDid, controllerDid), + ) != null + ); + } + + /** + * Returns the service endpoint of the DID and known by `endpointId` + * @param did + * @param endpointId + * @returns {Promise} + */ + async getServiceEndpoint(endpointId) { + const [owner, id] = ServiceEndpointId.from(endpointId); + + const endpoint = option(ServiceEndpoint).from( + await this.query.didServiceEndpoints(owner.asDock, id), + ); + + if (endpoint == null) { + throw new Error( + `No service endpoint found for did ${owner} and with id ${endpointId}`, + ); + } + + return endpoint; + } + + /** + * Get the `DidKey` for the DID with given key index. Key indices start from 1 and can have holes + * @param did + * @param {number} keyIndex + * @returns {Promise} + */ + async getDidKey(did, keyIndex) { + const hexId = DockDid.from(did).asDid; + const key = option(DidKey).from(await this.query.didKeys(hexId, keyIndex)); + if (key == null) { + throw new Error(`No key for found did ${did} and key index ${keyIndex}`); + } + + return key; + } + + /** + * Gets the DID detail of an on chain DID + * the chain and return them. It will throw NoDID if the DID does not exist on + * chain. + * @param {string} didIdentifier - DID identifier as hex. Not accepting full DID intentionally for efficiency as these + * methods are used internally + * @return {Promise} + */ + async getOnchainDidDetail(rawDid) { + const did = DockDid.from(rawDid); + const resp = option(StoredDidDetails).from( + await this.query.dids(did.asDid), + ); + if (resp == null) { + throw new NoDIDError(String(did)); + } + if (resp.isOffChain) { + throw new NoOnchainDIDError(String(did)); + } + + return resp.asOnChain; + } + + async getDidMethodKeyDetail(did) { + const didKey = DidMethodKey.from(did); + const resp = option(DidMethodKeyDetails).from( + await this.query.didMethodKeys(didKey.asDidMethodKey), + ); + if (resp == null) { + throw new NoDIDError(String(didKey)); + } + + return resp; + } + + /** + * Gets the DID detail of an on chain DID + * @param didIdentifier + * @returns {Promise<{accountId: HexString}>} + */ + async getOffchainDidDetail(didIdentifier) { + const did = DockDid.from(didIdentifier); + const resp = option(StoredDidDetails).from( + await this.query.dids(did.asDid), + ); + if (resp == null) { + throw new NoDIDError(String(did)); + } + if (resp.isOnChain) { + throw new NoOffchainDIDError(String(did)); + } + + return resp.asOffChain; + } + + /** + * Gets the current nonce for the DID. It will throw error if the DID does not exist on + * chain or chain returns null response. + * @param {DockDidOrDidMethodKey} did + * @return {Promise} + */ + async nonce(rawDid) { + const did = DockDidOrDidMethodKey.from(rawDid); + + if (did.isDid) { + return (await this.getOnchainDidDetail(did)).nonce; + } else if (did.isDidMethodKey) { + return (await this.getDidMethodKeyDetail(did)).nonce; + } else { + throw new Error(`Invalid did: \`${did}\``); + } + } + + /** + * Gets the nonce that should be used for sending the next transaction by this DID. Its 1 more than the current nonce. + * @param {DockDidOrDidMethodKey} did + * @returns {Promise<*>} + */ + async getNextNonceForDid(did) { + return (await this.nonce(did)) + 1; + } + + async controllers(did) { + const controllers = await this.query.didControllers.entries( + DockDid.from(did).asDid, + ); + + return Controllers.from( + controllers.map(([entry]) => maybeToHuman(entry)[1]), + ); + } + + async serviceEndpoints(did) { + const typedDid = DockDid.from(did); + class ServiceEndpointEntry extends TypedTuple { + static Classes = [ServiceEndpointId, option(ServiceEndpoint)]; + } + + return new ServiceEndpoints( + (await this.query.didServiceEndpoints.entries(typedDid.asDid)) + .map(([key, value]) => ServiceEndpointEntry.from([ + [typedDid, maybeToHuman(key)[1]], + maybeToHuman(value), + ])) + .filter(([_, sp]) => sp), + ); + } + + async keys(did) { + class DidKeyWithId extends TypedTuple { + static Classes = [TypedNumber, option(DidKey)]; + } + + return new DidKeys( + (await this.query.didKeys.entries(DockDid.from(did).asDid)) + .map(([key, value]) => DidKeyWithId.from([maybeToHuman(key)[1], maybeToHuman(value)])) + .filter(([_, pk]) => pk), + ); + } +} diff --git a/packages/dock-blockchain-modules/src/did/module.js b/packages/dock-blockchain-modules/src/did/module.js new file mode 100644 index 000000000..91b538079 --- /dev/null +++ b/packages/dock-blockchain-modules/src/did/module.js @@ -0,0 +1,246 @@ +import bs58 from 'bs58'; +import { AbstractDIDModule } from '@docknetwork/credential-sdk/modules/did'; +import { + DockDid, + DockDidOrDidMethodKey, +} from '@docknetwork/credential-sdk/types'; +import { + DIDDocument, + Service, + CONTEXT_URI, +} from '@docknetwork/credential-sdk/types/did/document'; +import { DockDIDModuleInternal } from './internal'; +import injectDock from '../common/inject-dock'; +import DockAttestModule from '../attest/module'; +import DockOffchainSignaturesModule from '../offchain-signatures/module'; + +export default class DockDIDModule extends injectDock(AbstractDIDModule) { + static DockOnly = DockDIDModuleInternal; + + constructor(apiProvider) { + super(apiProvider); + + this.attest = new DockAttestModule(apiProvider); + this.offchainSignatures = new DockOffchainSignaturesModule(apiProvider); + } + + async createDocumentTx(didDocument, _didSigners) { + const document = DIDDocument.from(didDocument); + + const keys = didDocument.didKeys(); + const { + controller, service, id, '@context': context, + } = document; + if (service?.length) { + throw new Error( + '`service` is not supported in the `createDocument` transaction. Use `updateDocument` to add `service` to the existing document.', + ); + } + if (context.length !== 1 || context[0].value !== CONTEXT_URI) { + throw new Error( + `Context must be equal to \`${[ + CONTEXT_URI, + ]}\`, received: \`${context}\``, + ); + } + + return await this.dockOnly.tx.newOnchain(id, keys.values(), controller); + } + + async updateDocumentTx(didDocument, didKeypair) { + const nextDocument = DIDDocument.from(didDocument); + const signerDid = DockDidOrDidMethodKey.from(didKeypair.did); + + const currentDocument = await this.getDocument(String(didDocument.id)); + + const { + added: newMethods, + removed: removedMethods, + modified, + } = nextDocument.didKeys().diff(currentDocument.didKeys()); + const { added: newControllers, removed: removedControllers } = nextDocument.controller.diff(currentDocument.controller); + const { added: newServices, removed: removedServices } = nextDocument.service.diff(currentDocument.service); + + if (modified.size) { + throw new Error("Can't have modified verificationMethods"); + } + + if ( + [...newMethods.keys()].find((method) => !method.did.eq(didDocument.id)) + || [...removedMethods.keys()].find( + (method) => !method.did.eq(didDocument.id), + ) + ) { + throw new Error('Can change controller keys'); + } + + let nonce = +(await this.dockOnly.nonce(signerDid)); + + const { id: did, '@context': context } = nextDocument; + + if (context.length !== 1 || context[0].value !== CONTEXT_URI) { + throw new Error( + `Context must be equal to \`${[ + CONTEXT_URI, + ]}\`, received: \`${context}\``, + ); + } + + const txs = await Promise.all( + [ + newMethods.size + && this.dockOnly.tx.addKeys( + [...newMethods.values()], + did, + didKeypair, + ++nonce, + ), + newControllers.length + && this.dockOnly.tx.addControllers( + newControllers, + did, + didKeypair, + ++nonce, + ), + ...[...newServices].map(({ id, type, serviceEndpoint }) => this.dockOnly.tx.addServiceEndpoint( + id, + type, + serviceEndpoint, + did, + didKeypair, + ++nonce, + )), + ...[...removedServices].map(({ id }) => this.dockOnly.tx.removeServiceEndpoint(id, did, didKeypair, ++nonce)), + removedControllers.length + && this.dockOnly.tx.removeControllers( + removedControllers, + did, + didKeypair, + ++nonce, + ), + removedMethods.size + && this.dockOnly.tx.removeKeys( + [...removedMethods.keys()].map((method) => method.index), + did, + didKeypair, + ++nonce, + ), + ].filter(Boolean), + ); + + return await this.dockOnly.apiProvider.api.tx.utility.batchAll(txs); + } + + async removeDocumentTx(did, didKeypair) { + return await this.dockOnly.tx.removeOnchainDid(did, didKeypair); + } + + /** + * Gets a DID from the Dock chain and create a DID document according to W3C spec. + * Throws NoDID if the DID does not exist on chain. + * @param {string} did - The DID can be passed as fully qualified DID like `did:dock:` or + * a 32 byte hex string + * @param getOffchainSigKeys + * @return {Promise} The DID document. + */ + // eslint-disable-next-line sonarjs/cognitive-complexity + async getDocument(did) { + const typedDid = DockDid.from(did); + const hexDid = typedDid.asDid; + + const { data: didDetails } = await this.dockOnly.getOnchainDidDetail( + hexDid, + ); + + // Get DIDs attestations + const attests = await this.attest.getAttests(typedDid); + + // If given DID was in hex, encode to SS58 and then construct fully qualified DID else the DID was already fully qualified + const id = String(typedDid); + + // Get controllers + const controllers = didDetails.activeControllers > 0 + ? await this.dockOnly.controllers(typedDid) + : []; + + // Get service endpoints + const serviceEndpoints = await this.dockOnly.serviceEndpoints(hexDid); + + // Get keys and categorize them by verification relationship type + const keys = []; + const assert = []; + const authn = []; + const capInv = []; + const keyAgr = []; + + if (didDetails.lastKeyId > 0) { + const dks = await this.dockOnly.keys(hexDid); + + [...dks.entries()].forEach(([index, { publicKey, verRels }]) => { + keys.push([ + index, + publicKey.constructor.Class.VerKeyType, + publicKey.value.bytes, + ]); + + if (verRels.isAuthentication()) { + authn.push(index); + } + if (verRels.isAssertion()) { + assert.push(index); + } + if (verRels.isCapabilityInvocation()) { + capInv.push(index); + } + if (verRels.isKeyAgreement()) { + keyAgr.push(index); + } + }); + } + + for (const [ + keyId, + key, + ] of await this.offchainSignatures.getAllPublicKeysByDid(hexDid)) { + // The gaps in `keyId` might correspond to removed keys + keys.push([keyId, key.constructor.VerKeyType, key.value.bytes]); + + assert.push(keyId); + } + + keys.sort((a, b) => a[0] - b[0]); + assert.sort(); + authn.sort(); + capInv.sort(); + keyAgr.sort(); + + const verificationMethod = keys.map(([index, type, pk]) => ({ + id: `${id}#keys-${index}`, + type, + controller: id, + publicKeyBase58: bs58.encode(pk), + })); + const assertion = assert.map((i) => `${id}#keys-${i}`); + const authentication = authn.map((i) => `${id}#keys-${i}`); + const capabilityInvocation = capInv.map((i) => `${id}#keys-${i}`); + const keyAgreement = keyAgr.map((i) => `${id}#keys-${i}`); + + const service = [...serviceEndpoints].map(([spId, sp]) => Service.fromServiceEndpoint(spId, sp)); + + // Construct document + return new DIDDocument( + [CONTEXT_URI], + id, + [], + controllers, + verificationMethod, + service, + authentication, + assertion, + keyAgreement, + capabilityInvocation, + [], + attests, + ); + } +} diff --git a/packages/dock-blockchain-modules/src/index.js b/packages/dock-blockchain-modules/src/index.js new file mode 100644 index 000000000..ba57094c9 --- /dev/null +++ b/packages/dock-blockchain-modules/src/index.js @@ -0,0 +1,50 @@ +import { AbstractCoreModules } from '@docknetwork/credential-sdk/modules'; +import DockAttestModule from './attest/module'; +import DockDIDModule from './did/module'; +import DockAccumulatorModule from './accumulator/module'; +import DockAnchorModule from './anchor/module'; +import DockBlobModule from './blob/module'; +import DockOffchainSignaturesModule from './offchain-signatures/module'; +import DockBBSModule from './offchain-signatures/bbs'; +import DockBBSPlusModule from './offchain-signatures/bbs-plus'; +import DockPSModule from './offchain-signatures/ps'; +import DockStatusListCredentialModule from './status-list-credential/module'; +import DockTrustRegistryModule from './trust-registry/module'; + +export class DockCoreModules extends AbstractCoreModules { + static AccumulatorModule = DockAccumulatorModule; + + static AnchorModule = DockAnchorModule; + + static AttestModule = DockAttestModule; + + static BlobModule = DockBlobModule; + + static DIDModule = DockDIDModule; + + static OffchainSignaturesModule = DockOffchainSignaturesModule; + + static BBSModule = DockBBSModule; + + static BBSPlusModule = DockBBSPlusModule; + + static PSModule = DockPSModule; + + static StatusListCredentialModule = DockStatusListCredentialModule; + + static TrustRegistryModule = DockTrustRegistryModule; +} + +export { + DockAttestModule, + DockDIDModule, + DockAccumulatorModule, + DockAnchorModule, + DockBlobModule, + DockOffchainSignaturesModule, + DockBBSModule, + DockBBSPlusModule, + DockPSModule, + DockStatusListCredentialModule, + DockTrustRegistryModule, +}; diff --git a/packages/dock-blockchain-modules/src/offchain-signatures/actions.js b/packages/dock-blockchain-modules/src/offchain-signatures/actions.js new file mode 100644 index 000000000..49f48797e --- /dev/null +++ b/packages/dock-blockchain-modules/src/offchain-signatures/actions.js @@ -0,0 +1,38 @@ +import { + OffchainSignatureParams, + OffchainSignaturePublicKey, + DockDidValue, + DockOffchainSignatureKeyRef, + DockOffchainSignatureParamsRef, +} from '@docknetwork/credential-sdk/types'; +import { + TypedStruct, + TypedNumber, +} from '@docknetwork/credential-sdk/types/generic'; + +export class AddOffchainSignaturePublicKey extends TypedStruct { + static Classes = { + key: OffchainSignaturePublicKey, + did: DockDidValue, + nonce: TypedNumber, + }; +} + +export class RemoveOffchainSignaturePublicKey extends TypedStruct { + static Classes = { + keyRef: DockOffchainSignatureKeyRef, + did: DockDidValue, + nonce: TypedNumber, + }; +} + +export class AddOffchainSignatureParams extends TypedStruct { + static Classes = { params: OffchainSignatureParams, nonce: TypedNumber }; +} + +export class RemoveOffchainSignatureParams extends TypedStruct { + static Classes = { + paramsRef: DockOffchainSignatureParamsRef, + nonce: TypedNumber, + }; +} diff --git a/packages/dock-blockchain-modules/src/offchain-signatures/bbs-plus.js b/packages/dock-blockchain-modules/src/offchain-signatures/bbs-plus.js new file mode 100644 index 000000000..262f75b80 --- /dev/null +++ b/packages/dock-blockchain-modules/src/offchain-signatures/bbs-plus.js @@ -0,0 +1,17 @@ +/* eslint-disable camelcase */ + +import { + BBSPlusPublicKey, + BBSPlusParams, +} from '@docknetwork/credential-sdk/types'; +import DockOffchainSignaturesModule from './module'; +import DockInternalOffchainSignaturesModule from './internal'; + +/** Class to write `BBS+` parameters and keys on chain */ +export default class BBSPlusModule extends DockOffchainSignaturesModule { + static DockOnly = class DockInternalBBSPlusModuleOverrides extends DockInternalOffchainSignaturesModule { + static PublicKey = BBSPlusPublicKey; + + static Params = BBSPlusParams; + }; +} diff --git a/packages/dock-blockchain-modules/src/offchain-signatures/bbs.js b/packages/dock-blockchain-modules/src/offchain-signatures/bbs.js new file mode 100644 index 000000000..5b9635b33 --- /dev/null +++ b/packages/dock-blockchain-modules/src/offchain-signatures/bbs.js @@ -0,0 +1,14 @@ +/* eslint-disable camelcase */ + +import { BBSPublicKey, BBSParams } from '@docknetwork/credential-sdk/types'; +import DockOffchainSignaturesModule from './module'; +import DockInternalOffchainSignaturesModule from './internal'; + +/** Class to write `BBS` parameters and keys on chain */ +export default class BBSModule extends DockOffchainSignaturesModule { + static DockOnly = class DockInternalBBSModuleOverrides extends DockInternalOffchainSignaturesModule { + static PublicKey = BBSPublicKey; + + static Params = BBSParams; + }; +} diff --git a/packages/dock-blockchain-modules/src/offchain-signatures/internal.js b/packages/dock-blockchain-modules/src/offchain-signatures/internal.js new file mode 100644 index 000000000..ddf19785f --- /dev/null +++ b/packages/dock-blockchain-modules/src/offchain-signatures/internal.js @@ -0,0 +1,67 @@ +import { TypedNumber } from '@docknetwork/credential-sdk/types/generic'; +import { + DockDidOrDidMethodKey, + OffchainSignatureParams, + DockOffchainSignaturePublicKey, + DockDidValue, +} from '@docknetwork/credential-sdk/types'; +import { ParamsAndPublicKeys } from '../common'; +import { + AddOffchainSignatureParams, + AddOffchainSignaturePublicKey, + RemoveOffchainSignatureParams, + RemoveOffchainSignaturePublicKey, +} from './actions'; +import { DockDIDModuleInternal } from '../did/internal'; + +export default class DockInternalOffchainSignaturesModule extends ParamsAndPublicKeys { + static Prop = 'offchainSignatures'; + + static MethodNameOverrides = { + addPublicKey: 'AddOffchainSignaturePublicKey', + removePublicKey: 'RemoveOffchainSignaturePublicKey', + addParams: 'AddOffchainSignatureParams', + removeParams: 'RemoveOffchainSignatureParams', + }; + + static PublicKeyAndParamsActions = { + AddPublicKey: AddOffchainSignaturePublicKey, + RemovePublicKey: RemoveOffchainSignaturePublicKey, + AddParams: AddOffchainSignatureParams, + RemoveParams: RemoveOffchainSignatureParams, + }; + + static PublicKey = DockOffchainSignaturePublicKey; + + static Params = OffchainSignatureParams; + + static ParamsQuery = 'signatureParams'; + + static PublicKeyQuery = 'publicKeys'; + + static PublicKeyOwner = DockDidValue; + + /** + * Returns params counter corresponding to the supplied DID. + * @param {*} did + * @returns Promise<*> + */ + async paramsCounter(did) { + return TypedNumber.from( + await this.query.paramsCounter(DockDidOrDidMethodKey.from(did)), + ); + } + + /** + * Returns keys counter corresponding to the supplied DID. + * @param {*} did + * @returns Promise<*> + */ + async keysCounter(did) { + return ( + await new DockDIDModuleInternal(this.apiProvider).getOnchainDidDetail( + DockDidOrDidMethodKey.from(did), + ) + ).lastKeyId; + } +} diff --git a/packages/dock-blockchain-modules/src/offchain-signatures/module.js b/packages/dock-blockchain-modules/src/offchain-signatures/module.js new file mode 100644 index 000000000..3df26429b --- /dev/null +++ b/packages/dock-blockchain-modules/src/offchain-signatures/module.js @@ -0,0 +1,15 @@ +/* eslint-disable camelcase */ + +import { AbstractOffchainSignaturesModule } from '@docknetwork/credential-sdk/modules'; +import { DockOffchainSignatureParamsRef } from '@docknetwork/credential-sdk/types'; +import DockInternalOffchainSignaturesModule from './internal'; +import { withParamsAndPublicKeys } from '../common'; + +/** Class to write offchain signature parameters and keys on chain */ +export default class DockOffchainSignaturesModule extends withParamsAndPublicKeys( + AbstractOffchainSignaturesModule, +) { + static DockOnly = DockInternalOffchainSignaturesModule; + + static ParamsRef = DockOffchainSignatureParamsRef; +} diff --git a/packages/dock-blockchain-modules/src/offchain-signatures/ps.js b/packages/dock-blockchain-modules/src/offchain-signatures/ps.js new file mode 100644 index 000000000..0f9e273c1 --- /dev/null +++ b/packages/dock-blockchain-modules/src/offchain-signatures/ps.js @@ -0,0 +1,14 @@ +/* eslint-disable camelcase */ + +import { PSPublicKey, PSParams } from '@docknetwork/credential-sdk/types'; +import DockOffchainSignaturesModule from './module'; +import DockInternalOffchainSignaturesModule from './internal'; + +/** Class to write `Pointcheval-Sanders` parameters and keys on chain */ +export default class PSModule extends DockOffchainSignaturesModule { + static DockOnly = class DockInternalPSModuleOverrides extends DockInternalOffchainSignaturesModule { + static PublicKey = PSPublicKey; + + static Params = PSParams; + }; +} diff --git a/packages/dock-blockchain-modules/src/status-list-credential/actions.js b/packages/dock-blockchain-modules/src/status-list-credential/actions.js new file mode 100644 index 000000000..695a3fa91 --- /dev/null +++ b/packages/dock-blockchain-modules/src/status-list-credential/actions.js @@ -0,0 +1,30 @@ +import { + TypedStruct, + TypedNumber, +} from '@docknetwork/credential-sdk/types/generic'; +import { + DockStatusList2021CredentialWithId, + DockStatusList2021CredentialWithPolicyWithId, + DockStatusListCredentialWrappedId, +} from './types'; + +export class CreateStatusListCredential extends TypedStruct { + static Classes = { + data: DockStatusList2021CredentialWithPolicyWithId, + nonce: TypedNumber, + }; +} + +export class UpdateStatusListCredential extends TypedStruct { + static Classes = { + data: DockStatusList2021CredentialWithId, + nonce: TypedNumber, + }; +} + +export class RemoveStatusListCredential extends TypedStruct { + static Classes = { + data: DockStatusListCredentialWrappedId, + nonce: TypedNumber, + }; +} diff --git a/packages/dock-blockchain-modules/src/status-list-credential/internal.js b/packages/dock-blockchain-modules/src/status-list-credential/internal.js new file mode 100644 index 000000000..8cfc1f664 --- /dev/null +++ b/packages/dock-blockchain-modules/src/status-list-credential/internal.js @@ -0,0 +1,55 @@ +import { + DockStatusListCredentialId, + OneOfPolicy, +} from '@docknetwork/credential-sdk/types'; +import { + DockStatusList2021CredentialWithPolicy, + DockStatusList2021CredentialWithId, + DockStatusListCredentialWrappedId, +} from './types'; + +import { + RemoveStatusListCredential, + UpdateStatusListCredential, +} from './actions'; +import { createInternalDockModule } from '../common'; + +const accountMethods = { + create(id, statusListCredential, signerDid) { + const credentialWithPolicy = new DockStatusList2021CredentialWithPolicy( + statusListCredential, + new OneOfPolicy([signerDid]), + ); + + return [DockStatusListCredentialId.from(id), credentialWithPolicy]; + }, +}; + +const didMethodsWithPolicy = { + update(id, statusListCredential, _, __, nonce) { + return new UpdateStatusListCredential( + new DockStatusList2021CredentialWithId(id, statusListCredential), + nonce, + ); + }, + remove(statusListCredentialId, _, __, nonce) { + return new RemoveStatusListCredential( + new DockStatusListCredentialWrappedId(statusListCredentialId), + nonce, + ); + }, +}; + +/** + * Module supporting `StatusList2021Credential` and `RevocationList2020Credential`. + */ +export default class DockInternalStatusListCredentialModule extends createInternalDockModule( + { accountMethods, didMethodsWithPolicy }, +) { + static Prop = 'statusListCredential'; + + static MethodNameOverrides = { + update: 'UpdateStatusListCredential', + remove: 'RemoveStatusListCredential', + }; +} diff --git a/packages/dock-blockchain-modules/src/status-list-credential/module.js b/packages/dock-blockchain-modules/src/status-list-credential/module.js new file mode 100644 index 000000000..f0895bc11 --- /dev/null +++ b/packages/dock-blockchain-modules/src/status-list-credential/module.js @@ -0,0 +1,77 @@ +import { option } from '@docknetwork/credential-sdk/types/generic'; +import { AbstractStatusListCredentialModule } from '@docknetwork/credential-sdk/modules/status-list-credential'; +import { DockStatusList2021CredentialWithPolicy } from './types'; +import { injectDock } from '../common'; +import DockStatusListCredentialInternalModule from './internal'; + +export default class DockStatusListCredentialModule extends injectDock( + AbstractStatusListCredentialModule, +) { + static DockOnly = DockStatusListCredentialInternalModule; + + /** + * Fetches `StatusList2021Credential` with the supplied identifier. + * @param {*} statusListCredentialId + * @returns {Promise} + */ + async getStatusListCredential(statusListCredentialId) { + return ( + option(DockStatusList2021CredentialWithPolicy).from( + await this.dockOnly.query.statusListCredentials(statusListCredentialId), + )?.statusListCredential ?? null + ); + } + + /** + * Create a transaction to create a new status list credential on-chain. + * @param id - is the unique id of the status list credential. The function will check whether `id` is already taken or not. + * @param statusListCredential - the credential to be associated with the given `id` + * @return {Promise} - the extrinsic to sign and send. + */ + async createStatusListCredentialTx( + id, + statusListCredential, + signerDid, + _didKeypair, + ) { + return await this.dockOnly.tx.create(id, statusListCredential, signerDid); + } + + /** + * Create a transaction to update an existing status list credential on-chain. + * @param statusListCredentialUpdate - Update for the status list credential. + * @param didSigs - `DID` signatures over an action with a nonce authorizing this action according to the existing policy. + * @return {Promise} - the extrinsic to sign and send. + */ + async updateStatusListCredentialTx( + id, + statusListCredential, + targetDid, + didKeypair, + ) { + return await this.dockOnly.tx.update( + id, + statusListCredential, + targetDid, + didKeypair, + ); + } + + /** + * Create a transaction to remove an existing status list credential from the chain. + * @param statusListCredentialId - is the unique id of the status list credential. The function will check whether `id` is already taken or not. + * @param didSigs - `DID` signatures over an action with a nonce authorizing this action according to the existing policy. + * @return {Promise} - the extrinsic to sign and send. + */ + async removeStatusListCredentialTx( + statusListCredentialId, + targetDid, + didKeypair, + ) { + return await this.dockOnly.tx.remove( + statusListCredentialId, + targetDid, + didKeypair, + ); + } +} diff --git a/packages/dock-blockchain-modules/src/status-list-credential/types.js b/packages/dock-blockchain-modules/src/status-list-credential/types.js new file mode 100644 index 000000000..8b287ff6b --- /dev/null +++ b/packages/dock-blockchain-modules/src/status-list-credential/types.js @@ -0,0 +1,33 @@ +import { TypedStruct } from '@docknetwork/credential-sdk/types/generic'; +import { + DockStatusListCredentialId, + StatusList2021Credential, + OneOfPolicy, +} from '@docknetwork/credential-sdk/types'; + +export class DockStatusListCredentialWrappedId extends TypedStruct { + static Classes = { + id: DockStatusListCredentialId, + }; +} + +export class DockStatusList2021CredentialWithPolicy extends TypedStruct { + static Classes = { + statusListCredential: StatusList2021Credential, + policy: OneOfPolicy, + }; +} + +export class DockStatusList2021CredentialWithPolicyWithId extends TypedStruct { + static Classes = { + id: DockStatusListCredentialId, + credential: DockStatusList2021CredentialWithPolicy, + }; +} + +export class DockStatusList2021CredentialWithId extends TypedStruct { + static Classes = { + id: DockStatusListCredentialId, + credential: StatusList2021Credential, + }; +} diff --git a/packages/dock-blockchain-modules/src/trust-registry/actions.js b/packages/dock-blockchain-modules/src/trust-registry/actions.js new file mode 100644 index 000000000..02fb36460 --- /dev/null +++ b/packages/dock-blockchain-modules/src/trust-registry/actions.js @@ -0,0 +1,59 @@ +import { + TypedArray, + TypedNumber, + TypedStruct, + TypedString, + TypedMap, +} from '@docknetwork/credential-sdk/types/generic'; +import { + DockTrustRegistryId, + DockTrustRegistrySchemaId, + TrustRegistrySchema, + DockDidOrDidMethodKey, +} from '@docknetwork/credential-sdk/types'; +import { TrustRegistryParticipantInformation } from '@docknetwork/credential-sdk/types/trust-registry'; + +export class TrustRegistryIdWithParticipants extends TypedStruct { + static Classes = { + registryId: DockTrustRegistryId, + participants: class Participants extends TypedArray { + static Class = DockDidOrDidMethodKey; + }, + }; +} + +export class InitOrUpdateTrustRegistry extends TypedStruct { + static Classes = { + registryId: DockTrustRegistryId, + name: TypedString, + govFramework: TypedString, + nonce: TypedNumber, + }; +} + +class Schemas extends TypedMap { + static KeyClass = DockTrustRegistrySchemaId; + + static ValueClass = TrustRegistrySchema; +} + +export class SetSchemasMetadata extends TypedStruct { + static Classes = { + Set: Schemas, + }; +} + +export class ChangeParticipants extends TypedStruct { + static Classes = { + data: TrustRegistryIdWithParticipants, + nonce: TypedNumber, + }; +} + +export class SetParticipantInformation extends TypedStruct { + static Classes = { + registryId: DockTrustRegistryId, + participant: DockDidOrDidMethodKey, + participantInformation: TrustRegistryParticipantInformation, + }; +} diff --git a/src/modules/trust-registry.js b/packages/dock-blockchain-modules/src/trust-registry/internal.js similarity index 78% rename from src/modules/trust-registry.js rename to packages/dock-blockchain-modules/src/trust-registry/internal.js index f5c8420a4..368def392 100644 --- a/src/modules/trust-registry.js +++ b/packages/dock-blockchain-modules/src/trust-registry/internal.js @@ -1,8 +1,16 @@ -import { BTreeSet, BTreeMap } from '@polkadot/types'; -import { u8aToHex } from '@polkadot/util'; -import { DidMethodKey, DockDid, DockDidOrDidMethodKey } from '../did'; -import { isHexWithGivenByteSize } from '../utils/codec'; -import { getDidNonce, ensureMatchesPattern } from '../utils/misc'; +import { + DidMethodKey, + DockDid, + DockDidOrDidMethodKey, +} from '@docknetwork/credential-sdk/types/did'; +import { + isHexWithGivenByteSize, + u8aToHex, +} from '@docknetwork/credential-sdk/utils/bytes'; +import { ensureMatchesPattern } from '@docknetwork/credential-sdk/utils/misc'; +import { IssuersSet } from '@docknetwork/credential-sdk/types/trust-registry'; +import { maybeToJSON } from '@docknetwork/credential-sdk/utils'; +import { createInternalDockModule } from '../common'; const callValueMethodOrObjectMethod = (method) => (value) => (typeof value[method] === 'function' ? [...value[method]()] @@ -14,18 +22,8 @@ const values = callValueMethodOrObjectMethod('values'); /** * `Trust Registry` module. */ -export default class TrustRegistryModule { - /** - * Creates a new instance of `StatusListCredentialModule` and sets the api - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param signAndSend - */ - constructor(api, signAndSend) { - this.api = api; - this.module = api.tx.trustRegistry; - this.signAndSend = signAndSend; - } +export default class DockInternalTrustRegistryModule extends createInternalDockModule() { + static Prop = 'trustRegistry'; /** * Returns Trust Registries information according to the supplied `by` argument. @@ -37,7 +35,7 @@ export default class TrustRegistryModule { return this.parseMapEntries( String, this.parseRegistryInfo, - await this.api.rpc.trustRegistry.registriesInfoBy(by), + await this.rpc.registriesInfoBy(by), ); } @@ -53,7 +51,7 @@ export default class TrustRegistryModule { return this.parseMapEntries( String, this.parseSchemaMetadata, - await this.api.rpc.trustRegistry.registrySchemaMetadataBy(by, regId), + await this.rpc.registrySchemaMetadataBy(by, regId), ); } @@ -67,10 +65,7 @@ export default class TrustRegistryModule { async schemaMetadataInRegistry(schemaId, regId) { return this.parseSingleEntry( this.parseSchemaMetadata, - await this.api.rpc.trustRegistry.schemaMetadataInRegistry( - schemaId, - regId, - ), + await this.rpc.schemaMetadataInRegistry(schemaId, regId), ); } @@ -84,7 +79,7 @@ export default class TrustRegistryModule { return this.parseMapEntries( String, this.parseSchemaMetadata, - await this.api.rpc.trustRegistry.schemaMetadata(schemaId), + await this.rpc.schemaMetadata(schemaId), ); } @@ -98,7 +93,7 @@ export default class TrustRegistryModule { async schemaIssuersInRegistry(schemaId, regId) { return this.parseSingleEntry( this.parseSchemaIssuers, - await this.api.rpc.trustRegistry.schemaIssuersInRegistry(schemaId, regId), + await this.rpc.schemaIssuersInRegistry(schemaId, regId), ); } @@ -112,7 +107,7 @@ export default class TrustRegistryModule { return this.parseMapEntries( String, this.parseSchemaIssuers, - await this.api.rpc.trustRegistry.schemaIssuers(schemaId), + await this.rpc.schemaIssuers(schemaId), ); } @@ -126,10 +121,7 @@ export default class TrustRegistryModule { async schemaVerifiersInRegistry(schemaId, regId) { return this.parseSingleEntry( this.parseSchemaVerifiers, - await this.api.rpc.trustRegistry.schemaVerifiersInRegistry( - schemaId, - regId, - ), + await this.rpc.schemaVerifiersInRegistry(schemaId, regId), ); } @@ -143,7 +135,7 @@ export default class TrustRegistryModule { return this.parseMapEntries( String, this.parseSchemaVerifiers, - await this.api.rpc.trustRegistry.schemaVerifiers(schemaId), + await this.rpc.schemaVerifiers(schemaId), ); } @@ -155,11 +147,7 @@ export default class TrustRegistryModule { */ async registryParticipants(registryId) { return [ - ...( - await this.api.query.trustRegistry.trustRegistriesParticipants( - registryId, - ) - ).values(), + ...(await this.query.trustRegistriesParticipants(registryId)).values(), ].map((did) => DockDidOrDidMethodKey.from(did)); } @@ -177,7 +165,7 @@ export default class TrustRegistryModule { : await this.registryParticipants(registryId); const participantWithInfo = async (did) => { - const info = await this.api.query.trustRegistry.trustRegistryParticipantsInformation( + const info = await this.query.trustRegistryParticipantsInformation( registryId, did, ); @@ -198,9 +186,6 @@ export default class TrustRegistryModule { * @param name * @param govFramework * @param signingKeyRef - * @param nonceOrDidModule - * @param waitForFinalization - * @param params * @returns {Promise} */ async initOrUpdate( @@ -209,8 +194,6 @@ export default class TrustRegistryModule { name, govFramework, signingKeyRef, - nonceOrDidModule, - waitForFinalization = true, params = {}, ) { const tx = await this.initOrUpdateTx( @@ -219,9 +202,8 @@ export default class TrustRegistryModule { name, govFramework, signingKeyRef, - nonceOrDidModule, ); - return this.signAndSend(tx, waitForFinalization, params); + return await this.signAndSend(tx, params); } /** @@ -232,9 +214,6 @@ export default class TrustRegistryModule { * @param name * @param govFramework * @param signingKeyRef - * @param nonceOrDidModule - * @param waitForFinalization - * @param params * @returns {Promise} */ async initOrUpdateTx( @@ -243,16 +222,16 @@ export default class TrustRegistryModule { name, govFramework, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, ) { const [convenerHexDid, lastNonce] = await this.getActorDidAndNonce( convenerDid, - { nonce, didModule }, + nonce, ); - return convenerHexDid.changeState( - this.api, - this.module.initOrUpdateTrustRegistry, + return await convenerHexDid.changeState( + this.apiProvider, + this.rawTx.initOrUpdateTrustRegistry, 'InitOrUpdateTrustRegistry', { registryId, @@ -280,16 +259,13 @@ export default class TrustRegistryModule { registryId, participants, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, ) { - const [convenerOrIssuerOrVerifierHexDid, lastNonce] = await this.getActorDidAndNonce(convenerOrIssuerOrVerifierDid, { - nonce, - didModule, - }); + const [convenerOrIssuerOrVerifierHexDid, lastNonce] = await this.getActorDidAndNonce(convenerOrIssuerOrVerifierDid, nonce); return { - sig: convenerOrIssuerOrVerifierHexDid.signStateChange( - this.api, + sig: await convenerOrIssuerOrVerifierHexDid.signStateChange( + this.apiProvider, 'ChangeParticipants', { data: { registryId, participants }, nonce: lastNonce }, signingKeyRef, @@ -309,8 +285,6 @@ export default class TrustRegistryModule { * @param registryId * @param participants * @param sigs - * @param waitForFinalization - * @param params * @returns {Promise} */ async changeParticipants( @@ -320,7 +294,7 @@ export default class TrustRegistryModule { waitForFinalization = true, params = {}, ) { - return this.signAndSend( + return await this.signAndSend( await this.changeParticipantsTx(registryId, participants, sigs), waitForFinalization, params, @@ -341,7 +315,7 @@ export default class TrustRegistryModule { participants, ); - return this.module.changeParticipants( + return this.rawTx.changeParticipants( { registryId, participants, @@ -366,16 +340,13 @@ export default class TrustRegistryModule { participant, participantInformation, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, ) { - const [convenerOrIssuerOrVerifierHexDid, lastNonce] = await this.getActorDidAndNonce(convenerOrIssuerOrVerifierDid, { - nonce, - didModule, - }); + const [convenerOrIssuerOrVerifierHexDid, lastNonce] = await this.getActorDidAndNonce(convenerOrIssuerOrVerifierDid, nonce); return { - sig: convenerOrIssuerOrVerifierHexDid.signStateChange( - this.api, + sig: await convenerOrIssuerOrVerifierHexDid.signStateChange( + this.apiProvider, 'SetParticipantInformation', { data: { registryId, participant, participantInformation }, @@ -395,8 +366,6 @@ export default class TrustRegistryModule { * @param participant * @param participantInformation * @param sigs - * @param waitForFinalization - * @param params * @returns {Promise} */ async setParticipantInformation( @@ -407,7 +376,7 @@ export default class TrustRegistryModule { waitForFinalization = true, params = {}, ) { - return this.signAndSend( + return await this.signAndSend( await this.setParticipantInformationTx( registryId, participant, @@ -439,7 +408,7 @@ export default class TrustRegistryModule { participantInformation, ); - return this.module.setParticipantInformation( + return this.rawTx.setParticipantInformation( { registryId, participant, @@ -456,9 +425,6 @@ export default class TrustRegistryModule { * @param registryId * @param schemas * @param signingKeyRef - * @param nonceOrDidModule - * @param waitForFinalization - * @param params * @returns {Promise} */ async setSchemasMetadata( @@ -466,8 +432,6 @@ export default class TrustRegistryModule { registryId, schemas, signingKeyRef, - nonceOrDidModule, - waitForFinalization = true, params = {}, ) { const tx = await this.setSchemasMetadataTx( @@ -475,9 +439,8 @@ export default class TrustRegistryModule { registryId, schemas, signingKeyRef, - nonceOrDidModule, ); - return this.signAndSend(tx, waitForFinalization, params); + return await this.signAndSend(tx, params); } /** @@ -496,17 +459,14 @@ export default class TrustRegistryModule { registryId, schemas, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, ) { - const [convenerOrIssuerOrVerifierHexDid, lastNonce] = await this.getActorDidAndNonce(convenerOrIssuerOrVerifierDid, { - nonce, - didModule, - }); + const [convenerOrIssuerOrVerifierHexDid, lastNonce] = await this.getActorDidAndNonce(convenerOrIssuerOrVerifierDid, nonce); ensureMatchesPattern(this.constructor.SchemasUpdatePattern, schemas); - return convenerOrIssuerOrVerifierHexDid.changeState( - this.api, - this.module.setSchemasMetadata, + return await convenerOrIssuerOrVerifierHexDid.changeState( + this.apiProvider, + this.rawTx.setSchemasMetadata, 'SetSchemasMetadata', { registryId, schemas, nonce: lastNonce }, signingKeyRef, @@ -520,9 +480,6 @@ export default class TrustRegistryModule { * @param registryId * @param issuers * @param signingKeyRef - * @param nonceOrDidModule - * @param waitForFinalization - * @param params * @returns {Promise} */ async suspendIssuers( @@ -530,8 +487,6 @@ export default class TrustRegistryModule { registryId, issuers, signingKeyRef, - nonceOrDidModule, - waitForFinalization = true, params = {}, ) { const tx = await this.suspendIssuersTx( @@ -539,9 +494,8 @@ export default class TrustRegistryModule { registryId, issuers, signingKeyRef, - nonceOrDidModule, ); - return this.signAndSend(tx, waitForFinalization, params); + return await this.signAndSend(tx, params); } /** @@ -551,29 +505,25 @@ export default class TrustRegistryModule { * @param registryId * @param issuers * @param signingKeyRef - * @param nonceOrDidModule * @returns {Promise} */ async suspendIssuersTx( convenerDid, registryId, - issuers, + rawIssuers, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, ) { const [convenerHexDid, lastNonce] = await this.getActorDidAndNonce( convenerDid, - { nonce, didModule }, + nonce, ); - const hexIssuers = new BTreeSet(this.api.registry, 'Issuer'); - for (const issuer of issuers) { - hexIssuers.add(DockDidOrDidMethodKey.from(issuer)); - } + const hexIssuers = IssuersSet.from(rawIssuers); - return convenerHexDid.changeState( - this.api, - this.module.suspendIssuers, + return await convenerHexDid.changeState( + this.apiProvider, + this.rawTx.suspendIssuers, 'SuspendIssuers', { registryId, issuers: hexIssuers, nonce: lastNonce }, signingKeyRef, @@ -587,9 +537,6 @@ export default class TrustRegistryModule { * @param registryId * @param issuers * @param signingKeyRef - * @param nonceOrDidModule - * @param waitForFinalization - * @param params * @returns {Promise} */ async unsuspendIssuers( @@ -597,8 +544,6 @@ export default class TrustRegistryModule { registryId, issuers, signingKeyRef, - nonceOrDidModule, - waitForFinalization = true, params = {}, ) { const tx = await this.unsuspendIssuersTx( @@ -606,9 +551,8 @@ export default class TrustRegistryModule { registryId, issuers, signingKeyRef, - nonceOrDidModule, ); - return this.signAndSend(tx, waitForFinalization, params); + return await this.signAndSend(tx, params); } /** @@ -618,31 +562,27 @@ export default class TrustRegistryModule { * @param registryId * @param issuers * @param signingKeyRef - * @param nonceOrDidModule * @returns {Promise} */ async unsuspendIssuersTx( convenerDid, registryId, - issuers, + rawIssuers, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, ) { const [convenerHexDid, lastNonce] = await this.getActorDidAndNonce( convenerDid, - { nonce, didModule }, + nonce, ); - const hexIssuers = new BTreeSet(this.api.registry, 'Issuer'); - for (const issuer of issuers) { - hexIssuers.add(DockDidOrDidMethodKey.from(issuer)); - } + const issuers = IssuersSet.from(rawIssuers); - return convenerHexDid.changeState( - this.api, - this.module.unsuspendIssuers, + return await convenerHexDid.changeState( + this.apiProvider, + this.rawTx.unsuspendIssuers, 'UnsuspendIssuers', - { registryId, issuers: hexIssuers, nonce: lastNonce }, + { registryId, issuers, nonce: lastNonce }, signingKeyRef, ); } @@ -656,8 +596,6 @@ export default class TrustRegistryModule { * @param delegated * @param signingKeyRef * @param params - * @param waitForFinalization - * @param params * @returns {Promise} */ async updateDelegatedIssuers( @@ -665,19 +603,19 @@ export default class TrustRegistryModule { registryId, delegated, signingKeyRef, - { nonce = undefined, didModule = undefined } = {}, + nonce, waitForFinalization = true, params = {}, ) { const [issuerHexDid, lastNonce] = await this.getActorDidAndNonce( issuerDid, - { nonce, didModule }, + nonce, ); - return this.signAndSend( - issuerHexDid.changeState( - this.api, - this.module.updateDelegatedIssuers, + return await this.signAndSend( + await issuerHexDid.changeState( + this.apiProvider, + this.rawTx.updateDelegatedIssuers, 'UpdateDelegatedIssuers', { registryId, delegated, nonce: lastNonce }, signingKeyRef, @@ -695,12 +633,9 @@ export default class TrustRegistryModule { * @param didModule * @returns {Promise} */ - async getActorDidAndNonce( - actorDid, - { nonce = undefined, didModule = undefined } = {}, - ) { + async getActorDidAndNonce(actorDid, nonce) { const hexDID = DockDidOrDidMethodKey.from(actorDid); - const lastNonce = nonce ?? (await getDidNonce(hexDID, nonce, didModule)); + const lastNonce = nonce ?? 1 + (await this.apiProvider.didNonce(hexDID)); return [hexDID, lastNonce]; } @@ -787,8 +722,8 @@ export default class TrustRegistryModule { (Array.isArray(issuers) ? values(issuers) : entries(issuers)) .map((issuerWithInfo) => values(issuerWithInfo)) .map(([issuer, info]) => [ - DockDidOrDidMethodKey.from(issuer).toString(), - typeof info.toJSON === 'function' ? info.toJSON() : info, + String(DockDidOrDidMethodKey.from(issuer)), + maybeToJSON(info), ]) .sort(([iss1], [iss2]) => iss1.localeCompare(iss2)), ); @@ -824,12 +759,12 @@ const Hex32Pattern = { }; const VerifiersPattern = { - $instanceOf: BTreeSet, + // $instanceOf: BTreeSet, $iterableOf: DockDidOrDidMethodKeyPattern, }; const VerifiersUpdatePattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [ DockDidOrDidMethodKeyPattern, { @@ -844,12 +779,12 @@ const VerifiersUpdatePattern = { }; const IssuerPricesPattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [{ $matchType: 'string' }, VerificationPricePattern], }; const IssuerPricesUpdatePattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [ { $matchType: 'string' }, { @@ -867,12 +802,12 @@ const IssuerPricesUpdatePattern = { }; const IssuersPattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [DockDidOrDidMethodKeyPattern, IssuerPricesPattern], }; const IssuersUpdatePattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [ DockDidOrDidMethodKeyPattern, { @@ -885,7 +820,7 @@ const IssuersUpdatePattern = { }; const SetAllSchemasPattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [ Hex32Pattern, { @@ -898,7 +833,7 @@ const SetAllSchemasPattern = { }; const ModifySchemasPattern = { - $instanceOf: BTreeMap, + // $instanceOf: BTreeMap, $mapOf: [ Hex32Pattern, { @@ -950,7 +885,7 @@ const AnyOfOrAllDockDidOrDidMethodKeyPattern = { }, }; -TrustRegistryModule.SetParticipantInformationPattern = { +DockInternalTrustRegistryModule.SetParticipantInformationPattern = { $matchObject: { orgName: { $matchType: 'string', @@ -963,13 +898,13 @@ TrustRegistryModule.SetParticipantInformationPattern = { }, }, }; -TrustRegistryModule.SchemasUpdatePattern = { +DockInternalTrustRegistryModule.SchemasUpdatePattern = { $objOf: { Set: SetAllSchemasPattern, Modify: ModifySchemasPattern, }, }; -TrustRegistryModule.ChangeParticipantsPattern = { +DockInternalTrustRegistryModule.ChangeParticipantsPattern = { $mapOf: [ DockDidOrDidMethodKeyPattern, { @@ -984,7 +919,7 @@ TrustRegistryModule.ChangeParticipantsPattern = { }, ], }; -TrustRegistryModule.RegistryQueryByPattern = { +DockInternalTrustRegistryModule.RegistryQueryByPattern = { $matchObject: { issuers: AnyOfOrAllDockDidOrDidMethodKeyPattern, verifiers: AnyOfOrAllDockDidOrDidMethodKeyPattern, @@ -994,7 +929,7 @@ TrustRegistryModule.RegistryQueryByPattern = { }, }, }; -TrustRegistryModule.RegistriesQueryByPattern = { +DockInternalTrustRegistryModule.RegistriesQueryByPattern = { $matchObject: { issuers: AnyOfOrAllDockDidOrDidMethodKeyPattern, verifiers: AnyOfOrAllDockDidOrDidMethodKeyPattern, diff --git a/packages/dock-blockchain-modules/src/trust-registry/module.js b/packages/dock-blockchain-modules/src/trust-registry/module.js new file mode 100644 index 000000000..27aba269a --- /dev/null +++ b/packages/dock-blockchain-modules/src/trust-registry/module.js @@ -0,0 +1,73 @@ +import { AbstractTrustRegistryModule } from '@docknetwork/credential-sdk/modules/trust-registry'; +import { + TrustRegistryInfo, + DockTrustRegistryId, + TrustRegistries, + TrustRegistry, + DockDidOrDidMethodKey, +} from '@docknetwork/credential-sdk/types'; +import { option } from '@docknetwork/credential-sdk/types/generic'; +import { injectDock } from '../common'; +import DockInternalTrustRegistryModule from './internal'; + +export default class DockTrustRegistryModule extends injectDock( + AbstractTrustRegistryModule, +) { + static DockOnly = DockInternalTrustRegistryModule; + + async getRegistry(regId) { + const id = DockTrustRegistryId.from(regId); + + const [infoOpt, metadata] = await Promise.all([ + this.dockOnly.query.trustRegistriesInfo(id), + this.dockOnly.rpc.allRegistrySchemaMetadata(id), + ]); + + const info = option(TrustRegistryInfo).from(infoOpt); + if (info == null) { + return null; + } + + return new TrustRegistry(info, metadata); + } + + async getAllRegistriesByDid(did) { + const hexDid = DockDidOrDidMethodKey.from(did); + const ids = await this.dockOnly.query.convenerTrustRegistries(hexDid); + + return new TrustRegistries( + await Promise.all( + [...ids].map(async (id) => [id, await this.getRegistry(id)]), + ), + ); + } + + async createRegistryTx(id, info, schemas, didKeypair) { + const nonce = await this.dockOnly.apiProvider.didNonce(didKeypair.did); + const init = await this.dockOnly.initOrUpdateTx( + info.convener, + id, + info.name, + info.govFramework, + didKeypair, + 1 + nonce, + ); + + const setSchemas = await this.dockOnly.setSchemasMetadataTx( + didKeypair.did, + id, + { Set: schemas }, + didKeypair, + 2 + nonce, + ); + + return await this.dockOnly.apiProvider.api.tx.utility.batchAll([ + init, + setSchemas, + ]); + } + + async updateRegistryTx(id, info, schemas, didKeypair) { + return await this.createRegistryTx(id, info, schemas, didKeypair); + } +} diff --git a/packages/dock-blockchain-modules/tests/cached-document-loader.js b/packages/dock-blockchain-modules/tests/cached-document-loader.js new file mode 100644 index 000000000..7bfffd586 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/cached-document-loader.js @@ -0,0 +1,50 @@ +import contexts from "@docknetwork/credential-sdk/vc/contexts"; +import network_cache from "./network-cache"; +import jsonFetch from "@docknetwork/credential-sdk/utils/json-fetch"; + +// global document cache, replaces the internet and acts as a did method +const documentRegistry = {}; +for (const [k, v] of contexts) { + addDocument(k, v); +} +for (const k of Object.keys(network_cache)) { + addDocument(k, network_cache[k]); +} + +/// document loader that pulls documents from the local documentRegistry +export async function documentLoader(url) { + if (documentRegistry[url] === undefined) { + if (!(url.startsWith("http://") || url.startsWith("https://"))) { + throw new Error(`failed to resolve ${url}`); + } + documentRegistry[url] = await jsonFetch(url); + console.warn( + "Unit test is making web requests. This is slow. Please update ./test/network-cache.js", + "with: ", + JSON.stringify({ [url]: documentRegistry[url] }, null, 2) + ); + } + return { + documentUrl: url, + document: defensive_copy(documentRegistry[url]), + }; +} + +/// add a document to the registry +export function addDocument(iri, doc) { + documentRegistry[iri] = defensive_copy(doc); +} + +export async function modifyDocument(iri, cb) { + const original = (await documentLoader(iri)).document; + addDocument(iri, cb(original)); +} + +/// check if document is already cached/registered +export function registered(iri) { + return iri in documentRegistry; +} + +function defensive_copy(x) { + return JSON.parse(JSON.stringify(x)); +} diff --git a/packages/dock-blockchain-modules/tests/create-presentation.js b/packages/dock-blockchain-modules/tests/create-presentation.js new file mode 100644 index 000000000..5fb671280 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/create-presentation.js @@ -0,0 +1,25 @@ +import VerifiablePresentation from "@docknetwork/credential-sdk/vc/verifiable-presentation"; + +/** + * Create an unsigned Verifiable Presentation + * @param {object|Array} verifiableCredential - verifiable credential (or an array of them) to be bundled as a presentation. + * @param {string} id - optional verifiable presentation id to use + * @param {string} [holder] - optional presentation holder url + * @return {object} verifiable presentation. + */ +export function createPresentation( + verifiableCredential, + id = "http://example.edu/presentation/2803", + holder = null +) { + const presentation = new VerifiablePresentation(id); + if (Array.isArray(verifiableCredential)) { + presentation.addCredentials(verifiableCredential); + } else { + presentation.addCredential(verifiableCredential); + } + if (holder) { + presentation.setHolder(String(holder)); + } + return presentation.toJSON(); +} diff --git a/packages/dock-blockchain-modules/tests/example-credential.js b/packages/dock-blockchain-modules/tests/example-credential.js new file mode 100644 index 000000000..675fa90bd --- /dev/null +++ b/packages/dock-blockchain-modules/tests/example-credential.js @@ -0,0 +1,36 @@ +export default { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + { + emailAddress: "https://schema.org/email", + alumniOf: "https://schema.org/alumniOf", + }, + ], + id: "uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc", + type: ["VerifiableCredential", "AlumniCredential"], + issuanceDate: "2020-03-18T19:23:24Z", + credentialSchema: { + // this is the schema + id: "blob:dock:5C78GCA", + type: "JsonSchemaValidator2018", + }, + credentialSubject: { + id: "did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", + emailAddress: "johnsmith@example.com", + alumniOf: "Example University", + }, + credentialStatus: { + id: "rev-reg:dock:0x0194...", + type: "CredentialStatusList2017", + }, + issuer: "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr", + proof: { + type: "Ed25519Signature2018", + created: "2020-04-22T07:50:13Z", + jws: "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg", + proofPurpose: "assertionMethod", + verificationMethod: + "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1", + }, +}; diff --git a/packages/dock-blockchain-modules/tests/example-schema.js b/packages/dock-blockchain-modules/tests/example-schema.js new file mode 100644 index 000000000..d70b5ddf4 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/example-schema.js @@ -0,0 +1,19 @@ +export default { + $schema: "http://json-schema.org/draft-07/schema#", + description: "Alumni", + type: "object", + properties: { + id: { + type: "string", + }, + emailAddress: { + type: "string", + format: "email", + }, + alumniOf: { + type: "string", + }, + }, + required: ["emailAddress", "alumniOf"], + additionalProperties: false, +}; diff --git a/packages/dock-blockchain-modules/tests/integration/anchor.test.js b/packages/dock-blockchain-modules/tests/integration/anchor.test.js new file mode 100644 index 000000000..e140c6b31 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/anchor.test.js @@ -0,0 +1,58 @@ +import { randomAsU8a, u8aToHex } from "@docknetwork/credential-sdk/utils"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; + +import { + FullNodeEndpoint, + TestKeyringOpts, + TestAccountURI, +} from "../test-constants"; +import { BlocksProvider } from "@docknetwork/dock-blockchain-api/utils/block"; +import { DockCoreModules, DockAnchorModule } from "../../src"; + +describe("Anchoring Module", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + }); + + test("Can create and query anchors", async () => { + const provider = new BlocksProvider(dock); + const documents = Array(8) + .fill(undefined) + .map(() => randomAsU8a(300)); + + // The root is to be written to chain and proofs must be stored. + const [root, proofs] = + DockAnchorModule.batchDocumentsInMerkleTree(documents); + + // Check that the proof is correct + documents.forEach((d, i) => { + const r = DockAnchorModule.verifyMerkleProofOfDocument( + d, + proofs[i], + root + ); + expect(r).toBe(true); + }); + + const resp = await modules.anchor.deploy(root); + const block = await provider.blockByHash( + u8aToHex( + resp.status.isInBlock ? resp.status.asInBlock : resp.status.asFinalized + ) + ); + const blockNumber = await modules.anchor.get(root); + expect(block.toJSON().block.header.number).toBe(+blockNumber); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); +}); diff --git a/tests/integration/anoncreds/accumulator.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/accumulator.test.js similarity index 50% rename from tests/integration/anoncreds/accumulator.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/accumulator.test.js index 68a070c46..10456a46a 100644 --- a/tests/integration/anoncreds/accumulator.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/accumulator.test.js @@ -1,4 +1,9 @@ -import { randomAsHex } from '@polkadot/util-crypto'; +import { + randomAsHex, + hexToU8a, + stringToHex, + u8aToHex, +} from "@docknetwork/credential-sdk/utils"; import { initializeWasm, Accumulator, @@ -7,38 +12,48 @@ import { AccumulatorParams, KBUniversalAccumulator, KBUniversalMembershipWitnessUpdateInfo, -} from '@docknetwork/crypto-wasm-ts'; +} from "@docknetwork/crypto-wasm-ts"; import { InMemoryKBUniversalState, InMemoryState, -} from '@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence'; -import { hexToU8a, stringToHex, u8aToHex } from '@polkadot/util'; -import { DockAPI } from '../../../src'; +} from "@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, -} from '../../test-constants'; -import { DidKeypair, DockDid } from '../../../src/did'; +} from "../../test-constants"; +import { DockDid, DockAccumulatorId } from "@docknetwork/credential-sdk/types"; -import AccumulatorModule, { +import { + AbstractAccumulatorModule, AccumulatorType, -} from '../../../src/modules/accumulator'; -import { getAllEventsFromBlock } from '../../../src/utils/chain-ops'; -import { registerNewDIDUsingPair } from '../helpers'; - -describe('Accumulator Module', () => { +} from "@docknetwork/credential-sdk/modules/accumulator"; +import { getAllEventsFromBlock } from "@docknetwork/dock-blockchain-api/utils/chain-ops"; +import { registerNewDIDUsingPair } from "../helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockAccumulatorPublicKeyRef } from "@docknetwork/credential-sdk/types"; +import { ListOfByteArrays } from "../../../src/accumulator/actions"; +import { DockAccumulatorModule } from "../../../src"; + +describe("Accumulator Module", () => { const dock = new DockAPI(); + const chainModule = new DockAccumulatorModule(dock); let account; - let did1; - let did2; - let pair1; - let pair2; - let chainModule; - const chainModuleClass = AccumulatorModule; const seed1 = randomAsHex(32); const seed2 = randomAsHex(32); + + const did1 = DockDid.random(); + const did2 = DockDid.random(); + const pair1 = new DidKeypair([did1, 1], new Ed25519Keypair(seed1)); + const pair2 = new DidKeypair([did2, 1], new Ed25519Keypair(seed2)); + + const chainModuleClass = DockAccumulatorModule; + const seedAccum = randomAsHex(32); beforeAll(async () => { @@ -46,177 +61,149 @@ describe('Accumulator Module', () => { keyring: TestKeyringOpts, address: FullNodeEndpoint, }); - chainModule = dock.accumulatorModule; + account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); - pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - pair2 = new DidKeypair(dock.keyring.addFromUri(seed2), 1); - did1 = DockDid.random(); - did2 = DockDid.random(); + await registerNewDIDUsingPair(dock, did1, pair1); await registerNewDIDUsingPair(dock, did2, pair2); await initializeWasm(); }, 20000); - test('Can create new params', async () => { - let label = stringToHex('accumulator-params-label'); + test("Can create new params", async () => { + let label = stringToHex("accumulator-params-label"); let params = Accumulator.generateParams(hexToU8a(label)); const bytes1 = u8aToHex(params.bytes); - const params1 = chainModuleClass.prepareAddParameters( - bytes1, - undefined, - label, - ); - await chainModule.addParams( - params1, + const params1 = chainModuleClass.prepareAddParameters(bytes1, label); + await chainModule.addParams(null, params1, did1, pair1); + const paramsWritten1 = await chainModule.getParams( did1, - pair1, - { didModule: dock.did }, - false, + await chainModule.dockOnly.paramsCounter(did1) ); - const paramsWritten1 = await chainModule.getLastParamsWritten(did1); expect(paramsWritten1.bytes).toEqual(params1.bytes); expect(paramsWritten1.label).toEqual(params1.label); const queriedParams1 = await chainModule.getParams(did1, 1); - expect(paramsWritten1).toEqual(queriedParams1); + expect(paramsWritten1.eq(queriedParams1)).toBe(true); - label = stringToHex('some label'); + label = stringToHex("some label"); params = Accumulator.generateParams(hexToU8a(label)); const bytes2 = u8aToHex(params.bytes); const params2 = chainModuleClass.prepareAddParameters(bytes2); - await chainModule.addParams( - params2, + await chainModule.addParams(null, params2, did2, pair2); + const paramsWritten2 = await chainModule.getParams( did2, - pair2, - { didModule: dock.did }, - false, + await chainModule.dockOnly.paramsCounter(did2) ); - const paramsWritten2 = await chainModule.getLastParamsWritten(did2); expect(paramsWritten2.bytes).toEqual(params2.bytes); expect(paramsWritten2.label).toBe(null); const queriedParams2 = await chainModule.getParams(did2, 1); - expect(paramsWritten2).toEqual(queriedParams2); + expect(paramsWritten2.eq(queriedParams2)).toBe(true); - label = stringToHex('some label'); + label = stringToHex("some label"); params = Accumulator.generateParams(hexToU8a(label)); const bytes3 = u8aToHex(params.bytes); const params3 = chainModuleClass.prepareAddParameters(bytes3); - await chainModule.addParams( - params3, + await chainModule.addParams(null, params3, did1, pair1); + const paramsWritten3 = await chainModule.getParams( did1, - pair1, - { didModule: dock.did }, - false, + await chainModule.dockOnly.paramsCounter(did1) ); - const paramsWritten3 = await chainModule.getLastParamsWritten(did1); expect(paramsWritten3.bytes).toEqual(params3.bytes); expect(paramsWritten3.label).toBe(null); const queriedParams3 = await chainModule.getParams(did1, 2); - expect(paramsWritten3).toEqual(queriedParams3); - - const paramsByDid1 = await chainModule.getAllParamsByDid(did1); - expect(paramsByDid1[0]).toEqual(paramsWritten1); - expect(paramsByDid1[1]).toEqual(paramsWritten3); - - const paramsByDid2 = await chainModule.getAllParamsByDid(did2); - expect(paramsByDid2[0]).toEqual(paramsWritten2); + expect(paramsWritten3.eq(queriedParams3)).toBe(true); + + const paramsByDid1 = [ + ...(await chainModule.getAllParamsByDid(did1)).values(), + ]; + expect(paramsByDid1[0].eq(paramsWritten1)).toBe(true); + expect(paramsByDid1[1].eq(paramsWritten3)).toBe(true); + + const paramsByDid2 = [ + ...(await chainModule.getAllParamsByDid(did2)).values(), + ]; + expect(paramsByDid2[0].eq(paramsWritten2)).toBe(true); }, 30000); - test('Can create public keys', async () => { + test("Can create public keys", async () => { const params = Accumulator.generateParams(); let keypair = Accumulator.generateKeypair(params); const bytes1 = u8aToHex(keypair.publicKey.bytes); const pk1 = chainModuleClass.prepareAddPublicKey(bytes1); - await chainModule.addPublicKey( - pk1, - did1, - pair1, - { didModule: dock.did }, - false, - ); + await chainModule.addPublicKey(null, pk1, did1, pair1); const queriedPk1 = await chainModule.getPublicKey(did1, 1); expect(queriedPk1.bytes).toEqual(pk1.bytes); expect(queriedPk1.paramsRef).toBe(null); const params1 = await chainModule.getParams(did1, 1); - const aparams1 = new AccumulatorParams(hexToU8a(params1.bytes)); + const aparams1 = new AccumulatorParams(params1.bytes.bytes); keypair = Accumulator.generateKeypair(aparams1, hexToU8a(seedAccum)); const bytes2 = u8aToHex(keypair.publicKey.bytes); - const pk2 = chainModuleClass.prepareAddPublicKey(bytes2, undefined, [ - did1, - 1, - ]); - await chainModule.addPublicKey( - pk2, - did2, - pair2, - { didModule: dock.did }, - false, - ); + const pk2 = chainModuleClass.prepareAddPublicKey(bytes2, [did1, 1]); + await chainModule.addPublicKey(null, pk2, did2, pair2); const queriedPk2 = await chainModule.getPublicKey(did2, 1); expect(queriedPk2.bytes).toEqual(pk2.bytes); - expect(queriedPk2.paramsRef).toEqual([DockDid.from(did1), 1]); + expect( + queriedPk2.paramsRef.eq(new DockAccumulatorPublicKeyRef(did1, 1)) + ).toBe(true); const queriedPk2WithParams = await chainModule.getPublicKey(did2, 1, true); - expect(queriedPk2WithParams.params).toEqual(params1); + expect(queriedPk2WithParams.params.eq(params1)).toBe(true); const params2 = await chainModule.getParams(did1, 2); - const aparams2 = new AccumulatorParams(hexToU8a(params2.bytes)); + const aparams2 = new AccumulatorParams(params2.bytes.bytes); keypair = Accumulator.generateKeypair(aparams2); const bytes3 = u8aToHex(keypair.publicKey.bytes); - const pk3 = chainModuleClass.prepareAddPublicKey(bytes3, undefined, [ - did1, - 2, - ]); - await chainModule.addPublicKey( - pk3, - did2, - pair2, - { didModule: dock.did }, - false, - ); + const pk3 = chainModuleClass.prepareAddPublicKey(bytes3, [did1, 2]); + await chainModule.addPublicKey(null, pk3, did2, pair2); const queriedPk3 = await chainModule.getPublicKey(did2, 2); expect(queriedPk3.bytes).toEqual(pk3.bytes); - expect(queriedPk3.paramsRef).toEqual([DockDid.from(did1), 2]); + expect( + queriedPk3.paramsRef.eq(new DockAccumulatorPublicKeyRef(did1, 2)) + ).toBe(true); const queriedPk3WithParams = await chainModule.getPublicKey(did2, 2, true); - expect(queriedPk3WithParams.params).toEqual(params2); - - const pksByDid1 = await chainModule.getAllPublicKeysByDid(did1); - expect(pksByDid1[0]).toEqual(queriedPk1); - - const pksByDid2 = await chainModule.getAllPublicKeysByDid(did2); - expect(pksByDid2[0]).toEqual(queriedPk2); - expect(pksByDid2[1]).toEqual(queriedPk3); - - const pksWithParamsByDid2 = await chainModule.getAllPublicKeysByDid( - did2, - true, + expect(queriedPk3WithParams.params.eq(params2)).toBe(true); + + const pksByDid1 = [ + ...(await chainModule.getAllPublicKeysByDid(did1)).values(), + ]; + expect(pksByDid1[0].toJSON()).toEqual(queriedPk1.toJSON()); + + const pksByDid2 = [ + ...(await chainModule.getAllPublicKeysByDid(did2)).values(), + ]; + expect(pksByDid2[0].toJSON()).toEqual(queriedPk2.toJSON()); + expect(pksByDid2[1].toJSON()).toEqual(queriedPk3.toJSON()); + + const pksWithParamsByDid2 = [ + ...(await chainModule.getAllPublicKeysByDid(did2, true)).values(), + ]; + expect(pksWithParamsByDid2[0].toJSON()).toEqual( + queriedPk2WithParams.toJSON() + ); + expect(pksWithParamsByDid2[1].toJSON()).toEqual( + queriedPk3WithParams.toJSON() ); - expect(pksWithParamsByDid2[0]).toEqual(queriedPk2WithParams); - expect(pksWithParamsByDid2[1]).toEqual(queriedPk3WithParams); }, 30000); async function checkAddRemove(keyId) { - const id1 = randomAsHex(32); + const id1 = DockAccumulatorId.random(did1); const accumulated1 = randomAsHex(100); await chainModule.addPositiveAccumulator( id1, accumulated1, [did1, keyId], - did1, - pair1, - { didModule: dock.did }, - false, + pair1 ); - const id2 = randomAsHex(32); + const id2 = DockAccumulatorId.random(did2); const accumulated2 = randomAsHex(100); const maxSize = 100000; await chainModule.addUniversalAccumulator( @@ -224,105 +211,97 @@ describe('Accumulator Module', () => { accumulated2, [did2, keyId], maxSize, - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); const accum1 = await chainModule.getAccumulator(id1, false); expect(accum1.created > 0).toBe(true); expect(accum1.lastModified > 0).toBe(true); expect(accum1.created).toEqual(accum1.lastModified); - expect(accum1.type).toEqual('positive'); - expect(accum1.accumulated).toEqual(accumulated1); - expect(accum1.keyRef).toEqual([DockDid.from(did1), keyId]); + expect(accum1.type).toEqual("positive"); + expect(accum1.accumulated.value).toEqual(accumulated1); + expect(accum1.keyRef.eq(new DockAccumulatorPublicKeyRef(did1, keyId))).toBe( + true + ); expect(accum1.publicKey).toBeUndefined(); const accum2 = await chainModule.getAccumulator(id2, false); expect(accum2.created > 0).toBe(true); expect(accum2.lastModified > 0).toBe(true); expect(accum2.created).toEqual(accum2.lastModified); - expect(accum2.type).toEqual('universal'); - expect(accum2.accumulated).toEqual(accumulated2); - expect(accum2.keyRef).toEqual([DockDid.from(did2), keyId]); + expect(accum2.type).toEqual("universal"); + expect(accum2.accumulated.value).toEqual(accumulated2); + expect(accum2.keyRef.eq(new DockAccumulatorPublicKeyRef(did2, keyId))).toBe( + true + ); expect(accum2.publicKey).toBeUndefined(); - const keyWithParams = keyId > 0 ? await chainModule.getPublicKey(did2, keyId, true) : null; - const accum2WithKeyAndParams = keyId > 0 - ? await chainModule.getAccumulator(id2, true) - : await chainModule.getAccumulator(id2, false, false); + const keyWithParams = + keyId > 0 ? await chainModule.getPublicKey(did2, keyId, true) : null; + const accum2WithKeyAndParams = await chainModule.getAccumulator( + id2, + true, + true + ); expect(accum2WithKeyAndParams.created > 0).toBe(true); expect(accum2WithKeyAndParams.lastModified > 0).toBe(true); expect(accum2WithKeyAndParams.created).toEqual( - accum2WithKeyAndParams.lastModified, + accum2WithKeyAndParams.lastModified ); - expect(accum2WithKeyAndParams.type).toEqual('universal'); - expect(accum2WithKeyAndParams.accumulated).toEqual(accumulated2); - expect(accum2WithKeyAndParams.keyRef).toEqual([DockDid.from(did2), keyId]); + expect(accum2WithKeyAndParams.type).toEqual("universal"); + expect(accum2WithKeyAndParams.accumulated.value).toEqual(accumulated2); + expect( + accum2WithKeyAndParams.keyRef.eq( + new DockAccumulatorPublicKeyRef(did2, keyId) + ) + ).toBe(true); if (keyId > 0) { - expect(accum2WithKeyAndParams.publicKey).toEqual(keyWithParams); + expect(accum2WithKeyAndParams.publicKey.eq(keyWithParams)).toBe(true); } else { - expect(accum2WithKeyAndParams.publicKey).toBeUndefined(); + expect(accum2WithKeyAndParams.publicKey).toEqual(null); } - await chainModule.removeAccumulator( - id1, - did1, - pair1, - { didModule: dock.did }, - false, - ); + await chainModule.removeAccumulator(id1, pair1); expect(await chainModule.getAccumulator(id1, false)).toEqual(null); - await chainModule.removeAccumulator( - id2, - did2, - pair2, - { didModule: dock.did }, - false, - ); + await chainModule.removeAccumulator(id2, pair2); expect(await chainModule.getAccumulator(id2, false)).toEqual(null); - const id3 = randomAsHex(32); + const id3 = DockAccumulatorId.random(did2); const accumulated3 = randomAsHex(100); await chainModule.addKBUniversalAccumulator( id3, accumulated3, [did2, keyId], - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); const accum3 = await chainModule.getAccumulator(id3, false); expect(accum3.created > 0).toBe(true); expect(accum3.lastModified > 0).toBe(true); expect(accum3.created).toEqual(accum3.lastModified); - expect(accum3.type).toEqual('kb-universal'); - expect(accum3.accumulated).toEqual(accumulated3); - expect(accum3.keyRef).toEqual([DockDid.from(did2), keyId]); + expect(accum3.type).toEqual("kbUniversal"); + expect(accum3.accumulated.value).toEqual(accumulated3); + expect(accum3.keyRef.eq(new DockAccumulatorPublicKeyRef(did2, keyId))).toBe( + true + ); expect(accum3.publicKey).toBeUndefined(); - await chainModule.removeAccumulator( - id3, - did2, - pair2, - { didModule: dock.did }, - false, - ); + await chainModule.removeAccumulator(id3, pair2); expect(await chainModule.getAccumulator(id3, false)).toEqual(null); } async function checkUpdate(keyId) { async function check(typ) { - const accumState = typ === 0 ? new InMemoryState() : new InMemoryKBUniversalState(); - - const queriedPkWithParams = keyId > 0 ? await chainModule.getPublicKey(did2, keyId, true) : null; - const aparams = keyId > 0 - ? new AccumulatorParams(hexToU8a(queriedPkWithParams.params.bytes)) - : Accumulator.generateParams(); + const accumState = + typ === 0 ? new InMemoryState() : new InMemoryKBUniversalState(); + + const queriedPkWithParams = + keyId > 0 ? await chainModule.getPublicKey(did2, keyId, true) : null; + const aparams = + keyId > 0 + ? new AccumulatorParams(queriedPkWithParams.params.bytes.bytes) + : Accumulator.generateParams(); const keypair = Accumulator.generateKeypair(aparams, hexToU8a(seedAccum)); let accumulator; const members = [ @@ -335,7 +314,7 @@ describe('Accumulator Module', () => { if (typ === 0) { accumulator = PositiveAccumulator.initialize( aparams, - keypair.secretKey, + keypair.secretKey ); } else { const domain = []; @@ -346,58 +325,44 @@ describe('Accumulator Module', () => { domain, aparams, keypair.secretKey, - accumState, + accumState ); } const member1 = members.pop(); await accumulator.add(member1, keypair.secretKey, accumState); - const accumulated1 = AccumulatorModule.accumulatedAsHex( + const accumulated1 = AbstractAccumulatorModule.accumulatedAsHex( accumulator.accumulated, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ); - const id = randomAsHex(32); + const id = DockAccumulatorId.random(did2); if (typ === 0) { await chainModule.addPositiveAccumulator( id, accumulated1, [did2, keyId], - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); } else { await chainModule.addKBUniversalAccumulator( id, accumulated1, [did2, keyId], - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); } const accum1 = await chainModule.getAccumulator(id, false); - expect(accum1.accumulated).toEqual(accumulated1); + expect(accum1.accumulated.value).toEqual(accumulated1); - const accumulated2 = AccumulatorModule.accumulatedAsHex( + const accumulated2 = AbstractAccumulatorModule.accumulatedAsHex( accumulator.accumulated, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, - ); - await chainModule.updateAccumulator( - id, - accumulated2, - {}, - did2, - pair2, - { didModule: dock.did }, - false, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ); + await chainModule.updateAccumulator(id, accumulated2, {}, pair2); const accum2 = await chainModule.getAccumulator(id, false); - expect(accum2.accumulated).toEqual(accumulated2); + expect(accum2.accumulated.value).toEqual(accumulated2); const member2 = members.pop(); await accumulator.add(member2, keypair.secretKey, accumState); @@ -407,26 +372,27 @@ describe('Accumulator Module', () => { await accumulator.remove(member1, keypair.secretKey, accumState); - const witUpdCls = typ === 0 - ? VBWitnessUpdateInfo - : KBUniversalMembershipWitnessUpdateInfo; + const witUpdCls = + typ === 0 + ? VBWitnessUpdateInfo + : KBUniversalMembershipWitnessUpdateInfo; - const accumulated3 = AccumulatorModule.accumulatedAsHex( + const accumulated3 = AbstractAccumulatorModule.accumulatedAsHex( accumulator.accumulated, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ); const additions1 = [u8aToHex(member2), u8aToHex(member3)]; const removals1 = [u8aToHex(member1)]; const witUpd1 = u8aToHex( witUpdCls.new( - AccumulatorModule.accumulatedFromHex( + AbstractAccumulatorModule.accumulatedFromHex( accumulated2, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ), [member2, member3], [member1], - keypair.secretKey, - ).value, + keypair.secretKey + ).value ); await chainModule.updateAccumulator( id, @@ -436,13 +402,10 @@ describe('Accumulator Module', () => { removals: removals1, witnessUpdateInfo: witUpd1, }, - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); const accum3 = await chainModule.getAccumulator(id, false); - expect(accum3.accumulated).toEqual(accumulated3); + expect(accum3.accumulated.value).toEqual(accumulated3); const member4 = members.pop(); await accumulator.add(member4, keypair.secretKey, accumState); @@ -450,207 +413,181 @@ describe('Accumulator Module', () => { const member5 = members.pop(); await accumulator.add(member5, keypair.secretKey, accumState); - const accumulated4 = AccumulatorModule.accumulatedAsHex( + const accumulated4 = AbstractAccumulatorModule.accumulatedAsHex( accumulator.accumulated, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ); const additions2 = [u8aToHex(member4), u8aToHex(member5)]; const witUpd2 = u8aToHex( witUpdCls.new( - AccumulatorModule.accumulatedFromHex( + AbstractAccumulatorModule.accumulatedFromHex( accumulated3, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ), [member4, member5], [], - keypair.secretKey, - ).value, + keypair.secretKey + ).value ); await chainModule.updateAccumulator( id, accumulated4, { additions: additions2, witnessUpdateInfo: witUpd2 }, - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); const accum4 = await chainModule.getAccumulator(id, false); - expect(accum4.accumulated).toEqual(accumulated4); + expect(accum4.accumulated.value).toEqual(accumulated4); await accumulator.remove(member2, keypair.secretKey, accumState); await accumulator.remove(member4, keypair.secretKey, accumState); - const accumulated5 = AccumulatorModule.accumulatedAsHex( + const accumulated5 = AbstractAccumulatorModule.accumulatedAsHex( accumulator.accumulated, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ); const removals3 = [u8aToHex(member2), u8aToHex(member4)]; const witUpd3 = u8aToHex( witUpdCls.new( - AccumulatorModule.accumulatedFromHex( + AbstractAccumulatorModule.accumulatedFromHex( accumulated4, - typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni, + typ === 0 ? AccumulatorType.VBPos : AccumulatorType.KBUni ), [], [member2, member4], - keypair.secretKey, - ).value, + keypair.secretKey + ).value ); await chainModule.updateAccumulator( id, accumulated5, { removals: removals3, witnessUpdateInfo: witUpd3 }, - did2, - pair2, - { didModule: dock.did }, - false, + pair2 ); const accum5 = await chainModule.getAccumulator(id, false); - expect(accum5.accumulated).toEqual(accumulated5); + expect(accum5.accumulated.value).toEqual(accumulated5); - const updates1 = await chainModule.getUpdatesFromBlock( + const updates1 = await chainModule.dockOnly.getUpdatesFromBlock( id, - accum2.lastModified, + accum2.lastModified ); - expect(updates1[0].newAccumulated).toEqual(accumulated2); + expect(updates1[0].newAccumulated.value).toEqual(accumulated2); expect(updates1[0].additions).toEqual(null); expect(updates1[0].removals).toEqual(null); expect(updates1[0].witnessUpdateInfo).toEqual(null); const events1 = ( - await getAllEventsFromBlock(chainModule.api, accum2.lastModified, false) - ).filter(({ event }) => event.section === 'accumulator'); + await getAllEventsFromBlock(dock.api, accum2.lastModified, false) + ).filter(({ event }) => event.section === "accumulator"); expect( - chainModuleClass.parseEventAsAccumulatorUpdate(events1[0].event), - ).toEqual([id, accumulated2]); + chainModule.dockOnly.constructor.parseEventAsAccumulatorUpdate( + events1[0].event + ) + ).toEqual([id[1].value, accumulated2]); - const updates2 = await chainModule.getUpdatesFromBlock( + const updates2 = await chainModule.dockOnly.getUpdatesFromBlock( id, - accum3.lastModified, + accum3.lastModified + ); + expect(updates2[0].newAccumulated.value).toEqual(accumulated3); + expect(updates2[0].additions.eq(ListOfByteArrays.from(additions1))).toBe( + true + ); + expect(updates2[0].removals.eq(ListOfByteArrays.from(removals1))).toBe( + true ); - expect(updates2[0].newAccumulated).toEqual(accumulated3); - expect(updates2[0].additions).toEqual(additions1); - expect(updates2[0].removals).toEqual(removals1); - expect(updates2[0].witnessUpdateInfo).toEqual(witUpd1); + expect(updates2[0].witnessUpdateInfo.value).toEqual(witUpd1); const events2 = ( - await getAllEventsFromBlock(chainModule.api, accum3.lastModified, false) - ).filter(({ event }) => event.section === 'accumulator'); + await getAllEventsFromBlock(dock.api, accum3.lastModified, false) + ).filter(({ event }) => event.section === "accumulator"); expect( - chainModuleClass.parseEventAsAccumulatorUpdate(events2[0].event), - ).toEqual([id, accumulated3]); + chainModule.dockOnly.constructor.parseEventAsAccumulatorUpdate( + events2[0].event + ) + ).toEqual([id[1].value, accumulated3]); - const updates3 = await chainModule.getUpdatesFromBlock( + const updates3 = await chainModule.dockOnly.getUpdatesFromBlock( id, - accum4.lastModified, + accum4.lastModified + ); + expect(updates3[0].newAccumulated.value).toEqual(accumulated4); + expect(updates3[0].additions.eq(ListOfByteArrays.from(additions2))).toBe( + true ); - expect(updates3[0].newAccumulated).toEqual(accumulated4); - expect(updates3[0].additions).toEqual(additions2); expect(updates3[0].removals).toEqual(null); - expect(updates3[0].witnessUpdateInfo).toEqual(witUpd2); + expect(updates3[0].witnessUpdateInfo.value).toEqual(witUpd2); - const updates4 = await chainModule.getUpdatesFromBlock( + const updates4 = await chainModule.dockOnly.getUpdatesFromBlock( id, - accum5.lastModified, + accum5.lastModified ); - expect(updates4[0].newAccumulated).toEqual(accumulated5); + expect(updates4[0].newAccumulated.value).toEqual(accumulated5); expect(updates4[0].additions).toEqual(null); - expect(updates4[0].removals).toEqual(removals3); - expect(updates4[0].witnessUpdateInfo).toEqual(witUpd3); + expect(updates4[0].removals.eq(ListOfByteArrays.from(removals3))).toBe( + true + ); + expect(updates4[0].witnessUpdateInfo.value).toEqual(witUpd3); } await check(0); await check(1); } - test('Can add and remove accumulator', async () => { + test("Can add and remove accumulator", async () => { await checkAddRemove(1); }, 50000); - test('Update accumulator', async () => { + test("Update accumulator", async () => { await checkUpdate(1); }, 50000); - test('Can remove public keys and params', async () => { - await chainModule.removePublicKey( - 1, - did1, - pair1, - { didModule: dock.did }, - false, - ); + test("Can remove public keys and params", async () => { + await chainModule.removePublicKey(1, did1, pair1); const pk1 = await chainModule.getPublicKey(did1, 1); expect(pk1).toEqual(null); - const pksByDid1 = await chainModule.getAllPublicKeysByDid(did1); + const pksByDid1 = [ + ...(await chainModule.getAllPublicKeysByDid(did1)).values(), + ]; expect(pksByDid1.length).toEqual(0); - await chainModule.removeParams( - 1, - did1, - pair1, - { didModule: dock.did }, - false, - ); + await chainModule.removeParams(1, did1, pair1); const params1 = await chainModule.getParams(did1, 1); expect(params1).toEqual(null); await expect(chainModule.getPublicKey(did2, 1, true)).rejects.toThrow(); - await chainModule.removePublicKey( - 1, - did2, - pair2, - { didModule: dock.did }, - false, - ); + await chainModule.removePublicKey(1, did2, pair2); const pk2 = await chainModule.getPublicKey(did2, 1); expect(pk2).toEqual(null); - const pksByDid2 = await chainModule.getAllPublicKeysByDid(did2); + const pksByDid2 = [ + ...(await chainModule.getAllPublicKeysByDid(did2)).values(), + ]; expect(pksByDid2.length).toEqual(1); const queriedPk2 = await chainModule.getPublicKey(did2, 2); - expect(pksByDid2[0]).toEqual(queriedPk2); + expect(pksByDid2[0].eq(queriedPk2)).toBe(true); - await chainModule.removePublicKey( - 2, - did2, - pair2, - { didModule: dock.did }, - false, - ); + await chainModule.removePublicKey(2, did2, pair2); const pk3 = await chainModule.getPublicKey(did2, 2); expect(pk3).toEqual(null); - await chainModule.removeParams( - 2, - did1, - pair1, - { didModule: dock.did }, - false, - ); + await chainModule.removeParams(2, did1, pair1); const params2 = await chainModule.getParams(did1, 2); expect(params2).toEqual(null); - await chainModule.removeParams( - 1, - did2, - pair2, - { didModule: dock.did }, - false, - ); + await chainModule.removeParams(1, did2, pair2); const params3 = await chainModule.getParams(did2, 1); expect(params3).toEqual(null); }, 50000); - test('Can add and remove accumulator without public key', async () => { + test("Can add and remove accumulator without public key", async () => { await checkAddRemove(0); }, 50000); - test('Update accumulator without public key', async () => { + test("Update accumulator without public key", async () => { await checkUpdate(0); }, 50000); diff --git a/tests/integration/anoncreds/bbs-wallet.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/bbs-wallet.test.js similarity index 51% rename from tests/integration/anoncreds/bbs-wallet.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/bbs-wallet.test.js index 6cc8149b8..912831cfc 100644 --- a/tests/integration/anoncreds/bbs-wallet.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/bbs-wallet.test.js @@ -1,224 +1,230 @@ -import { initializeWasm } from '@docknetwork/crypto-wasm-ts'; -import dock from '../../../src'; -import BbsPlusPresentation from '../../../src/presentation'; -import VerifiableCredential from '../../../src/verifiable-credential'; +import { initializeWasm } from "@docknetwork/credential-sdk/crypto"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import BbsPlusPresentation from "@docknetwork/credential-sdk/vc/presentation"; +import VerifiableCredential from "@docknetwork/credential-sdk/vc/verifiable-credential"; import { DIDKeyResolver, DockResolver, WildcardMultiResolver, -} from '../../../src/resolver'; -import VerifiablePresentation from '../../../src/verifiable-presentation'; -import { keyDocToKeypair } from './wallet-util'; -import { verifyCredential, verifyPresentation } from '../../../src/utils/vc'; +} from "@docknetwork/credential-sdk/resolver"; +import VerifiablePresentation from "@docknetwork/credential-sdk/vc/verifiable-presentation"; +import { keyDocToKeypair } from "./wallet-util"; +import { + verifyCredential, + verifyPresentation, +} from "@docknetwork/credential-sdk/vc"; +import { DockCoreModules } from "../../../src"; const credential1 = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', + "@context": [ + "https://www.w3.org/2018/credentials/v1", { - dk: 'https://ld.dock.io/credentials#', - UniversityDegree: 'dk:UniversityDegree', - dateEarned: 'dk:dateEarned', - name: 'dk:name', - degreeName: 'dk:degreeName', - degreeType: 'dk:degreeType', - dateOfBirth: 'dk:dateOfBirth', + dk: "https://ld.dock.io/credentials#", + UniversityDegree: "dk:UniversityDegree", + dateEarned: "dk:dateEarned", + name: "dk:name", + degreeName: "dk:degreeName", + degreeType: "dk:degreeType", + dateOfBirth: "dk:dateOfBirth", }, - 'https://ld.dock.io/credentials/prettyvc', + "https://ld.dock.io/credentials/prettyvc", ], - id: 'https://creds-staging.dock.io/54b6fc3134d1eff67838b40db6195d526472ae11cec3cdceddf1d64cf304aa56', + id: "https://creds-staging.dock.io/54b6fc3134d1eff67838b40db6195d526472ae11cec3cdceddf1d64cf304aa56", type: [ - 'VerifiableCredential', - 'UniversityDegree', - 'PrettyVerifiableCredential', + "VerifiableCredential", + "UniversityDegree", + "PrettyVerifiableCredential", ], credentialSubject: { - dateEarned: '2023-09-08', - name: 'Maycon', - degreeName: 'UniversityDegree for Range Proofs', - degreeType: 'Range Proofs', - dateOfBirth: '2023-10-04', + dateEarned: "2023-09-08", + name: "Maycon", + degreeName: "UniversityDegree for Range Proofs", + degreeType: "Range Proofs", + dateOfBirth: "2023-10-04", }, - issuanceDate: '2023-10-02T20:08:33.376Z', + issuanceDate: "2023-10-02T20:08:33.376Z", issuer: { - name: 'Profile bbs', - id: 'did:dock:5CDpZeS2fAas4Du87f2VyTj1BospmvQ5BZwZrKFtb3GeAppq', + name: "Profile bbs", + id: "did:dock:5CDpZeS2fAas4Du87f2VyTj1BospmvQ5BZwZrKFtb3GeAppq", }, - name: 'University Degree', + name: "University Degree", prettyVC: { - type: 'liquid', - orientation: 'landscape', - size: 'a4', + type: "liquid", + orientation: "landscape", + size: "a4", proof: '
Certificate Title
{{subject.name}}
Presented to
Issued by: {{issuer.name}}
for completing the {{credential.name}}
Issued on {{credential.issuanceDate | date: "%B %d, %Y"}}
Scan QR
', }, credentialSchema: { - id: 'data:application/json;charset=utf-8,%7B%22%24schema%22%3A%22http%3A%2F%2Fjson-schema.org%2Fdraft-07%2Fschema%23%22%2C%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22credentialSubject%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22dateEarned%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22degreeName%22%3A%7B%22type%22%3A%22string%22%7D%2C%22degreeType%22%3A%7B%22type%22%3A%22string%22%7D%2C%22dateOfBirth%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date%22%7D%7D%7D%2C%22proof%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40context%22%3A%7B%22type%22%3A%22array%22%2C%22items%22%3A%5B%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22sec%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22%40id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40container%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%7D%7D%2C%7B%22type%22%3A%22string%22%7D%5D%7D%2C%22created%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date-time%22%7D%2C%22verificationMethod%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proofPurpose%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%2C%22cryptoVersion%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSchema%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40context%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22issuanceDate%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date-time%22%7D%2C%22issuer%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22prettyVC%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22orientation%22%3A%7B%22type%22%3A%22string%22%7D%2C%22size%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22definitions%22%3A%7B%22encryptableString%22%3A%7B%22type%22%3A%22string%22%7D%2C%22encryptableCompString%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D', - type: 'JsonSchemaValidator2018', + id: "data:application/json;charset=utf-8,%7B%22%24schema%22%3A%22http%3A%2F%2Fjson-schema.org%2Fdraft-07%2Fschema%23%22%2C%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22credentialSubject%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22dateEarned%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22degreeName%22%3A%7B%22type%22%3A%22string%22%7D%2C%22degreeType%22%3A%7B%22type%22%3A%22string%22%7D%2C%22dateOfBirth%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date%22%7D%7D%7D%2C%22proof%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40context%22%3A%7B%22type%22%3A%22array%22%2C%22items%22%3A%5B%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22sec%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22%40id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40container%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%7D%7D%2C%7B%22type%22%3A%22string%22%7D%5D%7D%2C%22created%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date-time%22%7D%2C%22verificationMethod%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proofPurpose%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%2C%22cryptoVersion%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSchema%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40context%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22issuanceDate%22%3A%7B%22type%22%3A%22string%22%2C%22format%22%3A%22date-time%22%7D%2C%22issuer%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22prettyVC%22%3A%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22orientation%22%3A%7B%22type%22%3A%22string%22%7D%2C%22size%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22definitions%22%3A%7B%22encryptableString%22%3A%7B%22type%22%3A%22string%22%7D%2C%22encryptableCompString%22%3A%7B%22type%22%3A%22string%22%7D%7D%7D", + type: "JsonSchemaValidator2018", parsingOptions: { useDefaults: false, defaultMinimumInteger: -4294967295, defaultMinimumDate: -17592186044415, defaultDecimalPlaces: 0, }, - version: '0.0.3', + version: "0.0.3", }, proof: { - '@context': [ + "@context": [ { - sec: 'https://w3id.org/security#', + sec: "https://w3id.org/security#", proof: { - '@id': 'sec:proof', - '@type': '@id', - '@container': '@graph', + "@id": "sec:proof", + "@type": "@id", + "@container": "@graph", }, }, - 'https://ld.dock.io/security/bbs/v1', + "https://ld.dock.io/security/bbs/v1", ], - type: 'Bls12381BBS+SignatureDock2022', - created: '2023-10-02T20:09:30Z', + type: "Bls12381BBS+SignatureDock2022", + created: "2023-10-02T20:09:30Z", verificationMethod: - 'did:dock:5CDpZeS2fAas4Du87f2VyTj1BospmvQ5BZwZrKFtb3GeAppq#keys-2', - proofPurpose: 'assertionMethod', + "did:dock:5CDpZeS2fAas4Du87f2VyTj1BospmvQ5BZwZrKFtb3GeAppq#keys-2", + proofPurpose: "assertionMethod", proofValue: - 'zZMnHk1Ta835PxKWtbNttHDhbEoVZLuBGsm1WgpwTANQ8vhN2JMWZk7KRkVB6svdfH5qNKmuY98u5sdxd5d2sUVkA7kuAXLLFm2tCWxJhScxWua9PdV2txVtXqnSa1JkaXBUDhUTMVYoX4emrudMFEdDFS', + "zZMnHk1Ta835PxKWtbNttHDhbEoVZLuBGsm1WgpwTANQ8vhN2JMWZk7KRkVB6svdfH5qNKmuY98u5sdxd5d2sUVkA7kuAXLLFm2tCWxJhScxWua9PdV2txVtXqnSa1JkaXBUDhUTMVYoX4emrudMFEdDFS", }, }; const credential2 = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://ld.dock.io/security/bbs/v1', + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://ld.dock.io/security/bbs/v1", { - dk: 'https://ld.dock.io/credentials#', - BasicCredential: 'dk:BasicCredential', - name: 'dk:name', + dk: "https://ld.dock.io/credentials#", + BasicCredential: "dk:BasicCredential", + name: "dk:name", }, - 'https://ld.dock.io/credentials/prettyvc', + "https://ld.dock.io/credentials/prettyvc", ], - id: 'https://creds-staging.dock.io/76ff57a976a88fe0a3aabdc8d61aaf3dbfee9e98c2b46aa8863fa3afc4cb3be0', + id: "https://creds-staging.dock.io/76ff57a976a88fe0a3aabdc8d61aaf3dbfee9e98c2b46aa8863fa3afc4cb3be0", type: [ - 'VerifiableCredential', - 'BasicCredential', - 'PrettyVerifiableCredential', + "VerifiableCredential", + "BasicCredential", + "PrettyVerifiableCredential", ], credentialSubject: { - id: 'Test', - name: 'Test', + id: "Test", + name: "Test", }, - issuanceDate: '2024-02-27T18:59:05.028Z', + issuanceDate: "2024-02-27T18:59:05.028Z", issuer: { - name: 'profile bbs+', - id: 'did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU', + name: "profile bbs+", + id: "did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU", }, - name: 'Test', + name: "Test", prettyVC: { - type: 'liquid', - orientation: 'landscape', - size: 'a4', - proof: '
Certificate Title
{{subject.name}}
Presented to
Issued by: {{issuer.name}}
for completing the {{credential.name}}
Issued on {{credential.issuanceDate | date: "%B %d, %Y"}}
Scan QR
', + type: "liquid", + orientation: "landscape", + size: "a4", + proof: + '
Certificate Title
{{subject.name}}
Presented to
Issued by: {{issuer.name}}
for completing the {{credential.name}}
Issued on {{credential.issuanceDate | date: "%B %d, %Y"}}
Scan QR
', }, - cryptoVersion: '0.4.0', + cryptoVersion: "0.4.0", credentialSchema: { - id: 'data:application/json;charset=utf-8,%7B%22%24schema%22%3A%22http%3A%2F%2Fjson-schema.org%2Fdraft-07%2Fschema%23%22%2C%22definitions%22%3A%7B%22encryptableCompString%22%3A%7B%22type%22%3A%22string%22%7D%2C%22encryptableString%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22properties%22%3A%7B%22%40context%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSchema%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSubject%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22cryptoVersion%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22issuanceDate%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22issuer%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22prettyVC%22%3A%7B%22properties%22%3A%7B%22orientation%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22type%22%3A%22string%22%7D%2C%22size%22%3A%7B%22type%22%3A%22string%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22proof%22%3A%7B%22properties%22%3A%7B%22%40context%22%3A%7B%22items%22%3A%5B%7B%22properties%22%3A%7B%22proof%22%3A%7B%22properties%22%3A%7B%22%40container%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22sec%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%7B%22type%22%3A%22string%22%7D%5D%2C%22type%22%3A%22array%22%7D%2C%22created%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22proofPurpose%22%3A%7B%22type%22%3A%22string%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22verificationMethod%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D', - type: 'JsonSchemaValidator2018', + id: "data:application/json;charset=utf-8,%7B%22%24schema%22%3A%22http%3A%2F%2Fjson-schema.org%2Fdraft-07%2Fschema%23%22%2C%22definitions%22%3A%7B%22encryptableCompString%22%3A%7B%22type%22%3A%22string%22%7D%2C%22encryptableString%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22properties%22%3A%7B%22%40context%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSchema%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSubject%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22cryptoVersion%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22issuanceDate%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22issuer%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22prettyVC%22%3A%7B%22properties%22%3A%7B%22orientation%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22type%22%3A%22string%22%7D%2C%22size%22%3A%7B%22type%22%3A%22string%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22proof%22%3A%7B%22properties%22%3A%7B%22%40context%22%3A%7B%22items%22%3A%5B%7B%22properties%22%3A%7B%22proof%22%3A%7B%22properties%22%3A%7B%22%40container%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22sec%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%7B%22type%22%3A%22string%22%7D%5D%2C%22type%22%3A%22array%22%7D%2C%22created%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22proofPurpose%22%3A%7B%22type%22%3A%22string%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22verificationMethod%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D", + type: "JsonSchemaValidator2018", parsingOptions: { useDefaults: false, defaultMinimumInteger: -4294967295, defaultMinimumDate: -17592186044415, defaultDecimalPlaces: 0, }, - version: '0.2.0', + version: "0.2.0", }, proof: { - '@context': [ + "@context": [ { - sec: 'https://w3id.org/security#', + sec: "https://w3id.org/security#", proof: { - '@id': 'sec:proof', - '@type': '@id', - '@container': '@graph', + "@id": "sec:proof", + "@type": "@id", + "@container": "@graph", }, }, - 'https://ld.dock.io/security/bbs/v1', + "https://ld.dock.io/security/bbs/v1", ], - type: 'Bls12381BBS+SignatureDock2022', - created: '2024-02-27T18:59:40Z', - verificationMethod: 'did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU#keys-2', - proofPurpose: 'assertionMethod', - proofValue: 'zY5or1yvEqgwY3hfyZK4MHvGQHKSNJKSQbjVZ6KZaEBnGC8xuFDJgkj6pg9XmJpsVt2PQMTZ3SBBsmsz8TKBDVz16FBZXYzR7yLs7iKW4bXdAD55X7oKTiGS6XUJDDzb824uaViAfWZx5ggQgFbY1zP5ga', + type: "Bls12381BBS+SignatureDock2022", + created: "2024-02-27T18:59:40Z", + verificationMethod: + "did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU#keys-2", + proofPurpose: "assertionMethod", + proofValue: + "zY5or1yvEqgwY3hfyZK4MHvGQHKSNJKSQbjVZ6KZaEBnGC8xuFDJgkj6pg9XmJpsVt2PQMTZ3SBBsmsz8TKBDVz16FBZXYzR7yLs7iKW4bXdAD55X7oKTiGS6XUJDDzb824uaViAfWZx5ggQgFbY1zP5ga", }, }; const credential3 = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://ld.dock.io/security/bbs/v1', + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://ld.dock.io/security/bbs/v1", { - dk: 'https://ld.dock.io/credentials#', - BasicCredential: 'dk:BasicCredential', - name: 'dk:name', + dk: "https://ld.dock.io/credentials#", + BasicCredential: "dk:BasicCredential", + name: "dk:name", }, ], - id: 'https://creds-staging.dock.io/5aad81cbb67125fb9c35142201a304aa7d4fc06c4ed76152f94e0564d3fefa70', - type: [ - 'VerifiableCredential', - 'BasicCredential', - ], + id: "https://creds-staging.dock.io/5aad81cbb67125fb9c35142201a304aa7d4fc06c4ed76152f94e0564d3fefa70", + type: ["VerifiableCredential", "BasicCredential"], credentialSubject: { - id: 'did:key:z6MksGZrsWeNpmEjpCAPaFRNZ4Ho7Yfrd93tYFfJr2gd4izj', - name: 'Test', + id: "did:key:z6MksGZrsWeNpmEjpCAPaFRNZ4Ho7Yfrd93tYFfJr2gd4izj", + name: "Test", }, - issuanceDate: '2023-11-01T15:43:59.361Z', + issuanceDate: "2023-11-01T15:43:59.361Z", issuer: { - name: 'profile bbs+', - id: 'did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU', + name: "profile bbs+", + id: "did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU", }, - name: 'Test2', - cryptoVersion: '0.5.0', + name: "Test2", + cryptoVersion: "0.5.0", credentialSchema: { - id: 'data:application/json;charset=utf-8,%7B%22%24schema%22%3A%22http%3A%2F%2Fjson-schema.org%2Fdraft-07%2Fschema%23%22%2C%22definitions%22%3A%7B%22encryptableCompString%22%3A%7B%22type%22%3A%22string%22%7D%2C%22encryptableString%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22properties%22%3A%7B%22%40context%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSchema%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSubject%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22cryptoVersion%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22issuanceDate%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22issuer%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22properties%22%3A%7B%22%40context%22%3A%7B%22items%22%3A%5B%7B%22properties%22%3A%7B%22proof%22%3A%7B%22properties%22%3A%7B%22%40container%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22sec%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%7B%22type%22%3A%22string%22%7D%5D%2C%22type%22%3A%22array%22%7D%2C%22created%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22proofPurpose%22%3A%7B%22type%22%3A%22string%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22verificationMethod%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D', - type: 'JsonSchemaValidator2018', + id: "data:application/json;charset=utf-8,%7B%22%24schema%22%3A%22http%3A%2F%2Fjson-schema.org%2Fdraft-07%2Fschema%23%22%2C%22definitions%22%3A%7B%22encryptableCompString%22%3A%7B%22type%22%3A%22string%22%7D%2C%22encryptableString%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22properties%22%3A%7B%22%40context%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSchema%22%3A%7B%22type%22%3A%22string%22%7D%2C%22credentialSubject%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22cryptoVersion%22%3A%7B%22type%22%3A%22string%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22issuanceDate%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22issuer%22%3A%7B%22properties%22%3A%7B%22id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22name%22%3A%7B%22type%22%3A%22string%22%7D%2C%22proof%22%3A%7B%22properties%22%3A%7B%22%40context%22%3A%7B%22items%22%3A%5B%7B%22properties%22%3A%7B%22proof%22%3A%7B%22properties%22%3A%7B%22%40container%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40id%22%3A%7B%22type%22%3A%22string%22%7D%2C%22%40type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22sec%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%7B%22type%22%3A%22string%22%7D%5D%2C%22type%22%3A%22array%22%7D%2C%22created%22%3A%7B%22format%22%3A%22date-time%22%2C%22type%22%3A%22string%22%7D%2C%22proofPurpose%22%3A%7B%22type%22%3A%22string%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%2C%22verificationMethod%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D%2C%22type%22%3A%7B%22type%22%3A%22string%22%7D%7D%2C%22type%22%3A%22object%22%7D", + type: "JsonSchemaValidator2018", parsingOptions: { useDefaults: false, defaultMinimumInteger: -4294967295, defaultMinimumDate: -17592186044415, defaultDecimalPlaces: 0, }, - version: '0.3.0', + version: "0.3.0", }, proof: { - '@context': [ + "@context": [ { - sec: 'https://w3id.org/security#', + sec: "https://w3id.org/security#", proof: { - '@id': 'sec:proof', - '@type': '@id', - '@container': '@graph', + "@id": "sec:proof", + "@type": "@id", + "@container": "@graph", }, }, - 'https://ld.dock.io/security/bbs/v1', + "https://ld.dock.io/security/bbs/v1", ], - type: 'Bls12381BBS+SignatureDock2022', - created: '2024-04-10T19:00:24Z', - verificationMethod: 'did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU#keys-2', - proofPurpose: 'assertionMethod', - proofValue: 'zV8Wtta6j4yfyHtQUpMr2XbdNUFQ2eA65djFcj41T5A9FFVpkGSx23k5fNCpKvdB3FpK6t7e4p7tMm6CD3GTebmNCiKDxx5ZLkS3kjM426Zav7gmn7RjVFTR1KpNRewv2s8Jd8KWsKEpZN8andwFFakpLg', + type: "Bls12381BBS+SignatureDock2022", + created: "2024-04-10T19:00:24Z", + verificationMethod: + "did:dock:5GJeBeStWSxqyPGUJnERMFhm3wKcfCZP6nhqtoKyRAmq9FeU#keys-2", + proofPurpose: "assertionMethod", + proofValue: + "zV8Wtta6j4yfyHtQUpMr2XbdNUFQ2eA65djFcj41T5A9FFVpkGSx23k5fNCpKvdB3FpK6t7e4p7tMm6CD3GTebmNCiKDxx5ZLkS3kjM426Zav7gmn7RjVFTR1KpNRewv2s8Jd8KWsKEpZN8andwFFakpLg", }, }; const keyDoc = { - id: 'did:key:z6MkhQc8mYYTjrw8dfarS8AKcSqAEhoPZCE81YJz6hRJJmHU#z6MkhQc8mYYTjrw8dfarS8AKcSqAEhoPZCE81YJz6hRJJmHU', - controller: 'did:key:z6MkhQc8mYYTjrw8dfarS8AKcSqAEhoPZCE81YJz6hRJJmHU', - type: 'Ed25519VerificationKey2018', - publicKeyBase58: '3xM6BJJ2QKSfXAk9kZCUmMHAR8XY9JymKXQ4GRTHPYW6', + id: "did:key:z6MkhQc8mYYTjrw8dfarS8AKcSqAEhoPZCE81YJz6hRJJmHU#z6MkhQc8mYYTjrw8dfarS8AKcSqAEhoPZCE81YJz6hRJJmHU", + controller: "did:key:z6MkhQc8mYYTjrw8dfarS8AKcSqAEhoPZCE81YJz6hRJJmHU", + type: "Ed25519VerificationKey2018", + publicKeyBase58: "3xM6BJJ2QKSfXAk9kZCUmMHAR8XY9JymKXQ4GRTHPYW6", privateKeyBase58: - '3jisssjec4StaeRNpbdLR6o1UWVn4iLBYLujah6GfcxTiQHHkSKgMmJcTtf3P7F2BqMdd9PDMwSuNgHkP6WuhcFk', - publicKeyMultibase: 'z3xM6BJJ2QKSfXAk9kZCUmMHAR8XY9JymKXQ4GRTHPYW6', + "3jisssjec4StaeRNpbdLR6o1UWVn4iLBYLujah6GfcxTiQHHkSKgMmJcTtf3P7F2BqMdd9PDMwSuNgHkP6WuhcFk", + publicKeyMultibase: "z3xM6BJJ2QKSfXAk9kZCUmMHAR8XY9JymKXQ4GRTHPYW6", privateKeyMultibase: - 'z3jisssjec4StaeRNpbdLR6o1UWVn4iLBYLujah6GfcxTiQHHkSKgMmJcTtf3P7F2BqMdd9PDMwSuNgHkP6WuhcFk', + "z3jisssjec4StaeRNpbdLR6o1UWVn4iLBYLujah6GfcxTiQHHkSKgMmJcTtf3P7F2BqMdd9PDMwSuNgHkP6WuhcFk", }; -async function verifyDerivedCredential(credential, resolver) { +async function verifyDerivedCredential(dock, credential, resolver) { // eslint-disable-next-line no-await-in-loop const result = await verifyCredential(credential, { resolver }); expect(result.verified).toEqual(true); @@ -229,12 +235,14 @@ async function verifyDerivedCredential(credential, resolver) { resolver, }); - bbsPlusPresentation.addAttributeToReveal(0, ['credentialSubject.name']); + bbsPlusPresentation.addAttributeToReveal(0, ["credentialSubject.name"]); const pres = await bbsPlusPresentation.createPresentation(); const { verified } = await verifyPresentation(pres, { resolver }); expect(verified).toEqual(true); - expect(pres.spec.credentials[0].revealedAttributes.issuer).toEqual(credential.issuer); + expect(pres.spec.credentials[0].revealedAttributes.issuer).toEqual( + credential.issuer + ); const bbsPlusPresentation2 = new BbsPlusPresentation(); @@ -242,25 +250,29 @@ async function verifyDerivedCredential(credential, resolver) { resolver, }); - bbsPlusPresentation2.addAttributeToReveal(0, ['credentialSubject.name']); + bbsPlusPresentation2.addAttributeToReveal(0, ["credentialSubject.name"]); - const credentialsFromPresentation = await bbsPlusPresentation2.deriveCredentials({}); + const credentialsFromPresentation = + await bbsPlusPresentation2.deriveCredentials({}); expect(credentialsFromPresentation[0].issuer).toEqual(credential.issuer); - const credentialResult = await verifyCredential(credentialsFromPresentation[0], { - resolver, - }); + const credentialResult = await verifyCredential( + credentialsFromPresentation[0], + { + resolver, + } + ); expect(credentialResult.verified).toBe(true); // Question: Why is context being modified in a signed credential? const derivedCredentials = credentialsFromPresentation.map( (credentialJSON) => { - credentialJSON['@context'].push('https://ld.dock.io/security/bbs/v1'); + credentialJSON["@context"].push("https://ld.dock.io/security/bbs/v1"); return VerifiableCredential.fromJSON(credentialJSON); - }, + } ); - const id = keyDoc.controller.startsWith('did:key:') + const id = keyDoc.controller.startsWith("did:key:") ? keyDoc.id : `${keyDoc.controller}#keys-1`; const vp = new VerifiablePresentation(id); @@ -271,15 +283,16 @@ async function verifyDerivedCredential(credential, resolver) { keyDoc.keypair = keyDocToKeypair(keyDoc, dock); - const challenge = '08ec5ca2e2446b50b25a55e1b6b21f2b'; - const domain = 'dock.io'; + const challenge = "08ec5ca2e2446b50b25a55e1b6b21f2b"; + const domain = "dock.io"; const presentation = await vp.sign(keyDoc, challenge, domain, resolver); - console.log('Presentation:'); + console.log("Presentation:"); console.log(presentation); - const templateResponseURL = 'https://api-staging.dock.io/proof-requests/d3c0c23e-efb5-41fc-a8a9-6213507f419a/send-presentation'; + const templateResponseURL = + "https://api-staging.dock.io/proof-requests/d3c0c23e-efb5-41fc-a8a9-6213507f419a/send-presentation"; // const result = await axios // .post(templateResponseURL, presentation) @@ -289,33 +302,34 @@ async function verifyDerivedCredential(credential, resolver) { // console.log(result); } -describe('Presentation from older credentials', () => { - let resolver; +describe("Presentation from older credentials", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + const resolver = new WildcardMultiResolver([ + new DockResolver(modules), + new DIDKeyResolver(), + ]); + beforeAll(async () => { - await dock - .init({ - address: 'wss://knox-1.dock.io', - }); + await dock.init({ + address: "wss://knox-1.dock.io", + }); await initializeWasm(); - resolver = new WildcardMultiResolver([ - new DockResolver(dock), - new DIDKeyResolver(), - ]); }); afterAll(async () => { await dock.disconnect(); }); - test('works for credential1', async () => { - await verifyDerivedCredential(credential1, resolver); + test("works for credential1", async () => { + await verifyDerivedCredential(dock, credential1, resolver); }); - test('works for credential2', async () => { - await verifyDerivedCredential(credential2, resolver); + test("works for credential2", async () => { + await verifyDerivedCredential(dock, credential2, resolver); }); - test('works for credential3', async () => { - await verifyDerivedCredential(credential3, resolver); + test("works for credential3", async () => { + await verifyDerivedCredential(dock, credential3, resolver); }); }); diff --git a/tests/integration/anoncreds/circom/not_equal_public.circom b/packages/dock-blockchain-modules/tests/integration/anoncreds/circom/not_equal_public.circom similarity index 100% rename from tests/integration/anoncreds/circom/not_equal_public.circom rename to packages/dock-blockchain-modules/tests/integration/anoncreds/circom/not_equal_public.circom diff --git a/tests/integration/anoncreds/circom/not_equal_public.r1cs b/packages/dock-blockchain-modules/tests/integration/anoncreds/circom/not_equal_public.r1cs similarity index 100% rename from tests/integration/anoncreds/circom/not_equal_public.r1cs rename to packages/dock-blockchain-modules/tests/integration/anoncreds/circom/not_equal_public.r1cs diff --git a/tests/integration/anoncreds/circom/not_equal_public.wasm b/packages/dock-blockchain-modules/tests/integration/anoncreds/circom/not_equal_public.wasm similarity index 100% rename from tests/integration/anoncreds/circom/not_equal_public.wasm rename to packages/dock-blockchain-modules/tests/integration/anoncreds/circom/not_equal_public.wasm diff --git a/tests/integration/anoncreds/demo.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/demo.test.js similarity index 56% rename from tests/integration/anoncreds/demo.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/demo.test.js index b8b60794f..06c07d8af 100644 --- a/tests/integration/anoncreds/demo.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/demo.test.js @@ -1,7 +1,10 @@ -import { randomAsHex } from '@polkadot/util-crypto'; import { - hexToU8a, stringToHex, stringToU8a, u8aToHex, -} from '@polkadot/util'; + randomAsHex, + hexToU8a, + stringToHex, + stringToU8a, + u8aToHex, +} from "@docknetwork/credential-sdk/utils"; import { Accumulator, PositiveAccumulator, @@ -18,20 +21,26 @@ import { AccumulatorParams, AccumulatorPublicKey, initializeWasm, -} from '@docknetwork/crypto-wasm-ts'; -import { InMemoryState } from '@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence'; -import { DockAPI } from '../../../src'; +} from "@docknetwork/crypto-wasm-ts"; +import { InMemoryState } from "@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, Schemes, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; -import AccumulatorModule from '../../../src/modules/accumulator'; -import { getAllEventsFromBlock } from '../../../src/utils/chain-ops'; -import { getRevealedUnrevealed } from './utils'; -import { registerNewDIDUsingPair } from '../helpers'; +} from "../../test-constants"; +import { DockDid, DockAccumulatorId } from "@docknetwork/credential-sdk/types"; +import { AbstractAccumulatorModule } from "@docknetwork/credential-sdk/modules/accumulator"; +import { getAllEventsFromBlock } from "@docknetwork/dock-blockchain-api/utils/chain-ops"; +import { getRevealedUnrevealed } from "./utils"; +import { registerNewDIDUsingPair } from "../helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import DockInternalAccumulatorModule from "../../../src/accumulator/internal"; +import { DockCoreModules } from "../../../src"; for (const { Name, @@ -45,13 +54,15 @@ for (const { buildProverStatement, buildVerifierStatement, } of Schemes) { - const isKvac = Name === 'BBDT16'; + const isKvac = Name === "BBDT16"; const skipIfKvac = isKvac ? describe.skip : describe; skipIfKvac( `Complete demo of anonymous credentials using ${Name} and accumulator`, () => { const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + let account; let issuerDid; let issuerKeypair; @@ -71,12 +82,12 @@ for (const { // User's attributes which will be signed by the issuer of the credential const attributes = [ - stringToU8a('John'), // First name - stringToU8a('Smith'), // Last name - stringToU8a('M'), // Gender - stringToU8a('New York'), // City - stringToU8a('129086521911'), // SSN - stringToU8a('userid-xyz'), // user/credential id, this is put in the accumulator and used for revocation + stringToU8a("John"), // First name + stringToU8a("Smith"), // Last name + stringToU8a("M"), // Gender + stringToU8a("New York"), // City + stringToU8a("129086521911"), // SSN + stringToU8a("userid-xyz"), // user/credential id, this is put in the accumulator and used for revocation ]; const attributeCount = attributes.length; @@ -88,7 +99,7 @@ for (const { // different way. encoded.push(Accumulator.encodeBytesAsAccumulatorMember(attrs[i])); } else { - encoded.push(Signature.encodeMessageForSigningConstantTime(attrs[i])); + encoded.push(Signature.encodeMessageForSigning(attrs[i])); } } return encoded; @@ -102,45 +113,43 @@ for (const { revealedAttrIndices.add(1); const [revealedAttrs, unrevealedAttrs] = getRevealedUnrevealed( encodedAttrs, - revealedAttrIndices, + revealedAttrIndices ); const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - true, + true ); const sigParams = new SignatureParams( - SignatureParams.valueFromBytes(hexToU8a(queriedPk.params.bytes)), + SignatureParams.valueFromBytes(queriedPk.params.bytes) ); - const sigPk = new PublicKey(hexToU8a(queriedPk.bytes)); + const sigPk = new PublicKey(queriedPk.bytes.bytes); - const accum = await dock.accumulatorModule.getAccumulator( + const accum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); - const accumParams = new AccumulatorParams( - hexToU8a(accum.publicKey.params.bytes), - ); - const accumPk = new AccumulatorPublicKey( - hexToU8a(accum.publicKey.bytes), - ); - const accumulated = hexToU8a(accum.accumulated); + const accumParams = new AccumulatorParams(accum.publicKey.params.bytes); + const accumPk = new AccumulatorPublicKey(accum.publicKey.bytes.bytes); + const accumulated = accum.accumulated.bytes; const provingKey = Accumulator.generateMembershipProvingKey(); - const statement1 = 'adaptForLess' in sigPk - ? buildProverStatement( - sigParams, - sigPk.adaptForLess(sigParams.supportedMessageCount()), - revealedAttrs, - false, - ) - : buildProverStatement(sigParams, revealedAttrs, false); + const statement1 = + "adaptForLess" in sigPk + ? buildProverStatement( + sigParams, + sigPk.adaptForLess(sigParams.supportedMessageCount()), + revealedAttrs, + false + ) + : buildProverStatement(sigParams, revealedAttrs, false); const statement2 = Statement.vbAccumulatorMembership( accumParams, accumPk, provingKey, - accumulated, + accumulated ); const statements = new Statements(); statements.add(statement1); @@ -154,19 +163,19 @@ for (const { const metaStatements = new MetaStatements(); metaStatements.add(ms); - const context = stringToU8a('some context'); + const context = stringToU8a("some context"); const proofSpec = new ProofSpec( statements, metaStatements, [], - context, + context ); const witness1 = buildWitness(signature, unrevealedAttrs, false); const witness2 = Witness.vbAccumulatorMembership( encodedAttrs[attributeCount - 1], - membershipWitness, + membershipWitness ); const witnesses = new Witnesses(); witnesses.add(witness1); @@ -175,13 +184,13 @@ for (const { const proof = CompositeProof.generate(proofSpec, witnesses); const statement3 = !isKvac ? buildVerifierStatement( - sigParams, - 'adaptForLess' in sigPk - ? sigPk.adaptForLess(sigParams.supportedMessageCount()) - : sigPk, - revealedAttrs, - false, - ) + sigParams, + "adaptForLess" in sigPk + ? sigPk.adaptForLess(sigParams.supportedMessageCount()) + : sigPk, + revealedAttrs, + false + ) : buildVerifierStatement(sigParams, revealedAttrs, false); const verifierStatements = new Statements(); verifierStatements.add(statement3); @@ -191,7 +200,7 @@ for (const { verifierStatements, metaStatements, [], - context, + context ); expect(proof.verify(verifierProofSpec).verified).toEqual(true); } @@ -203,319 +212,296 @@ for (const { }); account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); - issuerKeypair = new DidKeypair( - dock.keyring.addFromUri(randomAsHex(32)), - 1, - ); issuerDid = DockDid.random(); + issuerKeypair = new DidKeypair([issuerDid, 1], Ed25519Keypair.random()); await registerNewDIDUsingPair(dock, issuerDid, issuerKeypair); + accumulatorManagerDid = DockDid.random(); accumulatorManagerKeypair = new DidKeypair( - dock.keyring.addFromUri(randomAsHex(32)), - 1, + [accumulatorManagerDid, 1], + Ed25519Keypair.random() ); - accumulatorManagerDid = DockDid.random(); await registerNewDIDUsingPair( dock, accumulatorManagerDid, - accumulatorManagerKeypair, + accumulatorManagerKeypair ); await initializeWasm(); }, 20000); - test('Create params', async () => { - const label = stringToHex('My params'); + test("Create params", async () => { + const label = stringToHex("My params"); const bytes = u8aToHex( - SignatureParams.generate(attributeCount, hexToU8a(label)).toBytes(), + SignatureParams.generate(attributeCount, hexToU8a(label)).toBytes() ); - const params = Module.prepareAddParameters(bytes, undefined, label); - await getModule(dock).addParams( - params, + const params = Module.prepareAddParameters(bytes, label); + await getModule(dock).addParams(null, params, issuerDid, issuerKeypair); + const paramsWritten = await getModule(dock).getParams( issuerDid, - issuerKeypair, - { didModule: dock.did }, - false, + await getModule(dock).dockOnly.paramsCounter(issuerDid) ); - const paramsWritten = await getModule(dock).getLastParamsWritten(issuerDid); expect(paramsWritten.bytes).toEqual(params.bytes); expect(paramsWritten.label).toEqual(params.label); }, 10000); - test('Create keypair', async () => { + test("Create keypair", async () => { const queriedParams = await getModule(dock).getParams(issuerDid, 1); const paramsVal = SignatureParams.valueFromBytes( - hexToU8a(queriedParams.bytes), + queriedParams.bytes.bytes ); const params = new SignatureParams( paramsVal, - hexToU8a(queriedParams.label), + queriedParams.label.bytes ); issuerBbsPlusKeypair = KeyPair.generate(params); const pk = Module.prepareAddPublicKey( u8aToHex(issuerBbsPlusKeypair.publicKey.bytes), - undefined, - [issuerDid, 1], - ); - await getModule(dock).addPublicKey( - pk, - issuerDid, - issuerDid, - issuerKeypair, - { didModule: dock.did }, - false, + [issuerDid, 1] ); + await getModule(dock).addPublicKey(null, pk, issuerDid, issuerKeypair); }, 10000); - test('Create Accumulator params', async () => { - const label = stringToHex('My Accumulator params'); + test("Create Accumulator params", async () => { + const label = stringToHex("My Accumulator params"); const bytes = u8aToHex( - Accumulator.generateParams(hexToU8a(label)).bytes, + Accumulator.generateParams(hexToU8a(label)).bytes ); - const params = AccumulatorModule.prepareAddParameters( + const params = AbstractAccumulatorModule.prepareAddParameters( bytes, - undefined, - label, + label ); - await dock.accumulatorModule.addParams( + await modules.accumulator.addParams( + null, params, accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); - const paramsWritten = await dock.accumulatorModule.getLastParamsWritten( + const paramsWritten = await modules.accumulator.getParams( accumulatorManagerDid, + await modules.accumulator.dockOnly.paramsCounter( + accumulatorManagerDid + ) ); expect(paramsWritten.bytes).toEqual(params.bytes); expect(paramsWritten.label).toEqual(params.label); }, 10000); - test('Create Accumulator keypair', async () => { - const queriedParams = await dock.accumulatorModule.getParams( + test("Create Accumulator keypair", async () => { + const queriedParams = await modules.accumulator.getParams( accumulatorManagerDid, - 1, + 1 ); accumulatorKeypair = Accumulator.generateKeypair( - new AccumulatorParams(hexToU8a(queriedParams.bytes)), - hexToU8a(seedAccum), + new AccumulatorParams(queriedParams.bytes.bytes), + hexToU8a(seedAccum) ); - const pk = AccumulatorModule.prepareAddPublicKey( + const pk = AbstractAccumulatorModule.prepareAddPublicKey( u8aToHex(accumulatorKeypair.publicKey.bytes), - undefined, - [accumulatorManagerDid, 1], + [accumulatorManagerDid, 1] ); - await dock.accumulatorModule.addPublicKey( + await modules.accumulator.addPublicKey( + null, pk, accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); }, 10000); - test('Create Accumulator', async () => { - const queriedParams = await dock.accumulatorModule.getParams( + test("Create Accumulator", async () => { + const queriedParams = await modules.accumulator.getParams( accumulatorManagerDid, - 1, + 1 ); accumulator = PositiveAccumulator.initialize( - new AccumulatorParams(hexToU8a(queriedParams.bytes)), - accumulatorKeypair.secretKey, + new AccumulatorParams(queriedParams.bytes.bytes), + accumulatorKeypair.secretKey ); - accumulatorId = randomAsHex(32); + accumulatorId = DockAccumulatorId.random(accumulatorManagerDid); const accumulated = u8aToHex(accumulator.accumulated); - await dock.accumulatorModule.addPositiveAccumulator( + await modules.accumulator.addPositiveAccumulator( accumulatorId, accumulated, [accumulatorManagerDid, 1], - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); }, 10000); - test('Sign attributes, i.e. issue credential', async () => { + test("Sign attributes, i.e. issue credential", async () => { const encodedAttrs = encodedAttributes(attributes); const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - true, + true ); const paramsVal = SignatureParams.valueFromBytes( - hexToU8a(queriedPk.params.bytes), + queriedPk.params.bytes.bytes ); const params = new SignatureParams( paramsVal, - hexToU8a(queriedPk.params.label), + queriedPk.params.label.bytes ); signature = Signature.generate( encodedAttrs, issuerBbsPlusKeypair.secretKey, params, - false, + false ); // User verifies the credential (signature) const result = signature.verify( encodedAttrs, - new PublicKey(hexToU8a(queriedPk.bytes)), + new PublicKey(queriedPk.bytes.bytes), params, - false, + false ); expect(result.verified).toEqual(true); }); - test('Add attribute to accumulator for checking revocation later', async () => { + test("Add attribute to accumulator for checking revocation later", async () => { const encodedAttrs = encodedAttributes(attributes); await accumulator.add( encodedAttrs[attributeCount - 1], accumulatorKeypair.secretKey, - accumulatorState, + accumulatorState ); await expect( - accumulatorState.has(encodedAttrs[attributeCount - 1]), + accumulatorState.has(encodedAttrs[attributeCount - 1]) ).resolves.toEqual(true); membershipWitness = await accumulator.membershipWitness( encodedAttrs[attributeCount - 1], accumulatorKeypair.secretKey, - accumulatorState, + accumulatorState ); const accumulated = u8aToHex(accumulator.accumulated); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated, { additions: [u8aToHex(encodedAttrs[attributeCount - 1])] }, - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); - const queriedAccum = await dock.accumulatorModule.getAccumulator( + const queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); - expect(queriedAccum.accumulated).toEqual(accumulated); + expect(queriedAccum.accumulated.value).toEqual(accumulated); const tempAccumulator = PositiveAccumulator.fromAccumulated( - hexToU8a(queriedAccum.accumulated), + queriedAccum.accumulated.bytes ); expect( tempAccumulator.verifyMembershipWitness( encodedAttrs[attributeCount - 1], membershipWitness, - new AccumulatorPublicKey(hexToU8a(queriedAccum.publicKey.bytes)), - new AccumulatorParams( - hexToU8a(queriedAccum.publicKey.params.bytes), - ), - ), + new AccumulatorPublicKey(queriedAccum.publicKey.bytes.bytes), + new AccumulatorParams(queriedAccum.publicKey.params.bytes) + ) ).toEqual(true); }, 20000); - test('Prove knowledge of signature, i.e. possession of credential and accumulator membership', async () => { + test("Prove knowledge of signature, i.e. possession of credential and accumulator membership", async () => { await proveAndVerify(); }); - test('Add new members to the accumulator and update witness', async () => { + test("Add new members to the accumulator and update witness", async () => { const encodedAttrs = encodedAttributes(attributes); - const member1 = Accumulator.encodePositiveNumberAsAccumulatorMember(100); - const member2 = Accumulator.encodePositiveNumberAsAccumulatorMember(105); + const member1 = + Accumulator.encodePositiveNumberAsAccumulatorMember(100); + const member2 = + Accumulator.encodePositiveNumberAsAccumulatorMember(105); await accumulator.addBatch( [member1, member2], accumulatorKeypair.secretKey, - accumulatorState, + accumulatorState ); - let accum = await dock.accumulatorModule.getAccumulator( + let accum = await modules.accumulator.getAccumulator( accumulatorId, - false, + false ); const witnessUpdInfo = VBWitnessUpdateInfo.new( - hexToU8a(accum.accumulated), + accum.accumulated.bytes, [member1, member2], [], - accumulatorKeypair.secretKey, + accumulatorKeypair.secretKey ); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, u8aToHex(accumulator.accumulated), { additions: [u8aToHex(member1), u8aToHex(member2)], witnessUpdateInfo: u8aToHex(witnessUpdInfo.value), }, - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); - accum = await dock.accumulatorModule.getAccumulator( - accumulatorId, - false, - ); - const updates = await dock.accumulatorModule.getUpdatesFromBlock( + accum = await modules.accumulator.getAccumulator(accumulatorId, false); + const updates = await modules.accumulator.dockOnly.getUpdatesFromBlock( accumulatorId, - accum.lastModified, + accum.lastModified ); expect(updates.length).toEqual(1); const queriedWitnessInfo = new VBWitnessUpdateInfo( - hexToU8a(updates[0].witnessUpdateInfo), + updates[0].witnessUpdateInfo.bytes ); const additions = []; const removals = []; if (updates[0].additions !== null) { for (const a of updates[0].additions) { - additions.push(hexToU8a(a)); + additions.push(a.bytes); } } if (updates[0].removals !== null) { for (const a of updates[0].removals) { - removals.push(hexToU8a(a)); + removals.push(a.bytes); } } membershipWitness.updateUsingPublicInfoPostBatchUpdate( encodedAttrs[attributeCount - 1], additions, removals, - queriedWitnessInfo, + queriedWitnessInfo ); - const queriedAccum = await dock.accumulatorModule.getAccumulator( + const queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); const tempAccumulator = PositiveAccumulator.fromAccumulated( - hexToU8a(queriedAccum.accumulated), + queriedAccum.accumulated.bytes ); expect( tempAccumulator.verifyMembershipWitness( encodedAttrs[attributeCount - 1], membershipWitness, - new AccumulatorPublicKey(hexToU8a(queriedAccum.publicKey.bytes)), - new AccumulatorParams( - hexToU8a(queriedAccum.publicKey.params.bytes), - ), - ), + new AccumulatorPublicKey(queriedAccum.publicKey.bytes.bytes), + new AccumulatorParams(queriedAccum.publicKey.params.bytes) + ) ).toEqual(true); }); - test('After witness update, prove knowledge of signature, i.e. possession of credential and accumulator membership', async () => { + test("After witness update, prove knowledge of signature, i.e. possession of credential and accumulator membership", async () => { await proveAndVerify(); }); - test('Do several updates to the accumulator and update witness', async () => { + test("Do several updates to the accumulator and update witness", async () => { const encodedAttrs = encodedAttributes(attributes); - const member1 = Accumulator.encodePositiveNumberAsAccumulatorMember(100); - const member2 = Accumulator.encodePositiveNumberAsAccumulatorMember(105); + const member1 = + Accumulator.encodePositiveNumberAsAccumulatorMember(100); + const member2 = + Accumulator.encodePositiveNumberAsAccumulatorMember(105); - const member3 = Accumulator.encodePositiveNumberAsAccumulatorMember(110); - const member4 = Accumulator.encodePositiveNumberAsAccumulatorMember(111); + const member3 = + Accumulator.encodePositiveNumberAsAccumulatorMember(110); + const member4 = + Accumulator.encodePositiveNumberAsAccumulatorMember(111); await expect(accumulatorState.has(member1)).resolves.toEqual(true); await expect(accumulatorState.has(member2)).resolves.toEqual(true); @@ -523,20 +509,20 @@ for (const { [member3, member4], [member1, member2], accumulatorKeypair.secret_key, - accumulatorState, + accumulatorState ); - let accum = await dock.accumulatorModule.getAccumulator( + let accum = await modules.accumulator.getAccumulator( accumulatorId, - false, + false ); let witnessUpdInfo = VBWitnessUpdateInfo.new( - hexToU8a(accum.accumulated), + accum.accumulated.bytes, [member3, member4], [member1, member2], - accumulatorKeypair.secretKey, + accumulatorKeypair.secretKey ); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, u8aToHex(accumulator.accumulated), { @@ -544,34 +530,29 @@ for (const { removals: [u8aToHex(member1), u8aToHex(member2)], witnessUpdateInfo: u8aToHex(witnessUpdInfo.value), }, - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); - const member5 = Accumulator.encodePositiveNumberAsAccumulatorMember(200); + const member5 = + Accumulator.encodePositiveNumberAsAccumulatorMember(200); const member6 = Accumulator.encodePositiveNumberAsAccumulatorMember(25); await accumulator.addRemoveBatches( [member5, member6], [member4], accumulatorKeypair.secret_key, - accumulatorState, + accumulatorState ); - accum = await dock.accumulatorModule.getAccumulator( - accumulatorId, - false, - ); + accum = await modules.accumulator.getAccumulator(accumulatorId, false); const startingBlock = accum.lastModified; witnessUpdInfo = VBWitnessUpdateInfo.new( - hexToU8a(accum.accumulated), + accum.accumulated.bytes, [member5, member6], [member4], - accumulatorKeypair.secretKey, + accumulatorKeypair.secretKey ); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, u8aToHex(accumulator.accumulated), { @@ -579,33 +560,30 @@ for (const { removals: [u8aToHex(member4)], witnessUpdateInfo: u8aToHex(witnessUpdInfo.value), }, - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); - const member7 = Accumulator.encodePositiveNumberAsAccumulatorMember(201); - const member8 = Accumulator.encodePositiveNumberAsAccumulatorMember(202); - const member9 = Accumulator.encodePositiveNumberAsAccumulatorMember(203); + const member7 = + Accumulator.encodePositiveNumberAsAccumulatorMember(201); + const member8 = + Accumulator.encodePositiveNumberAsAccumulatorMember(202); + const member9 = + Accumulator.encodePositiveNumberAsAccumulatorMember(203); await accumulator.addBatch( [member7, member8, member9], accumulatorKeypair.secret_key, - accumulatorState, + accumulatorState ); - accum = await dock.accumulatorModule.getAccumulator( - accumulatorId, - false, - ); + accum = await modules.accumulator.getAccumulator(accumulatorId, false); witnessUpdInfo = VBWitnessUpdateInfo.new( - hexToU8a(accum.accumulated), + accum.accumulated.bytes, [member7, member8, member9], [], - accumulatorKeypair.secretKey, + accumulatorKeypair.secretKey ); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, u8aToHex(accumulator.accumulated), { @@ -617,15 +595,13 @@ for (const { removals: [], witnessUpdateInfo: u8aToHex(witnessUpdInfo.value), }, - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); - accum = await dock.accumulatorModule.getAccumulator( + accum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); const latestUpdateBlockNo = accum.lastModified; @@ -636,13 +612,15 @@ for (const { const evs = await getAllEventsFromBlock( dock.api, currentBlockNo, - false, + false ); for (const event of evs) { - const ret = AccumulatorModule.parseEventAsAccumulatorUpdate( - event.event, - ); - if (ret !== null && ret[0] === accumulatorId) { + const ret = + DockInternalAccumulatorModule.parseEventAsAccumulatorUpdate( + event.event + ); + // console.log(ret?.toJSON(), accumulatorId.toJSON()); + if (ret !== null && accumulatorId[1].eq(ret[0])) { blockNosWithUpdates.push(currentBlockNo); } } @@ -652,12 +630,13 @@ for (const { const updateInfo = []; for (const blockNo of blockNosWithUpdates) { // eslint-disable-next-line no-await-in-loop - const updates = await dock.accumulatorModule.getUpdatesFromBlock( - accumulatorId, - blockNo, - ); + const updates = + await modules.accumulator.dockOnly.getUpdatesFromBlock( + accumulatorId, + blockNo + ); const wi = new VBWitnessUpdateInfo( - hexToU8a(updates[0].witnessUpdateInfo), + updates[0].witnessUpdateInfo.bytes ); updateInfo.push(wi); } @@ -670,43 +649,43 @@ for (const { [member7, member8, member9], ], [[member1, member2], [member4], []], - [updateInfo[0], updateInfo[1], updateInfo[2]], + [updateInfo[0], updateInfo[1], updateInfo[2]] ); const tempAccumulator = PositiveAccumulator.fromAccumulated( - hexToU8a(accum.accumulated), + accum.accumulated.bytes ); expect( tempAccumulator.verifyMembershipWitness( encodedAttrs[attributeCount - 1], membershipWitness, - new AccumulatorPublicKey(hexToU8a(accum.publicKey.bytes)), - new AccumulatorParams(hexToU8a(accum.publicKey.params.bytes)), - ), + new AccumulatorPublicKey(accum.publicKey.bytes.bytes), + new AccumulatorParams(accum.publicKey.params.bytes.bytes) + ) ).toEqual(true); }, 30000); - test('After another witness update, prove knowledge of signature, i.e. possession of credential and accumulator membership', async () => { + test("After another witness update, prove knowledge of signature, i.e. possession of credential and accumulator membership", async () => { await proveAndVerify(); }); - test('Revoke by removing from the accumulator', async () => { + test("Revoke by removing from the accumulator", async () => { const encodedAttrs = encodedAttributes(attributes); await accumulator.remove( encodedAttrs[attributeCount - 1], - accumulatorKeypair.secretKey, + accumulatorKeypair.secretKey ); - const accum = await dock.accumulatorModule.getAccumulator( + const accum = await modules.accumulator.getAccumulator( accumulatorId, - false, + false ); const witnessUpdInfo = VBWitnessUpdateInfo.new( - hexToU8a(accum.accumulated), + accum.accumulated.bytes, [], [encodedAttrs[attributeCount - 1]], - accumulatorKeypair.secretKey, + accumulatorKeypair.secretKey ); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, u8aToHex(accumulator.accumulated), { @@ -714,36 +693,35 @@ for (const { removals: [u8aToHex(encodedAttrs[attributeCount - 1])], witnessUpdateInfo: u8aToHex(witnessUpdInfo.value), }, - accumulatorManagerDid, - accumulatorManagerKeypair, - { didModule: dock.did }, - false, + accumulatorManagerKeypair ); }); - test('Witness update should not be possible after removal from accumulator', async () => { + test("Witness update should not be possible after removal from accumulator", async () => { const encodedAttrs = encodedAttributes(attributes); - const accum = await dock.accumulatorModule.getAccumulator( + const accum = await modules.accumulator.getAccumulator( accumulatorId, - false, + false ); - const updates = await dock.accumulatorModule.getUpdatesFromBlock( + const updates = await modules.accumulator.dockOnly.getUpdatesFromBlock( accumulatorId, - accum.lastModified, + accum.lastModified ); expect(updates.length).toEqual(1); const queriedWitnessInfo = new VBWitnessUpdateInfo( - hexToU8a(updates[0].witnessUpdateInfo), + updates[0].witnessUpdateInfo.bytes ); - expect(() => membershipWitness.updateUsingPublicInfoPostBatchUpdate( - encodedAttrs[attributeCount - 1], - [], - [hexToU8a(updates[0].removals[0])], - queriedWitnessInfo, - )).toThrow(); + expect(() => + membershipWitness.updateUsingPublicInfoPostBatchUpdate( + encodedAttrs[attributeCount - 1], + [], + [hexToU8a(updates[0].removals[0])], + queriedWitnessInfo + ) + ).toThrow(); }); - test('After revocation, i.e. removing from accumulator, prove verification should fail', async () => { + test("After revocation, i.e. removing from accumulator, prove verification should fail", async () => { let failed = false; try { await proveAndVerify(); @@ -756,6 +734,6 @@ for (const { afterAll(async () => { await dock.disconnect(); }, 10000); - }, + } ); } diff --git a/packages/dock-blockchain-modules/tests/integration/anoncreds/derived-credentials.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/derived-credentials.test.js new file mode 100644 index 000000000..a03770b1f --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/derived-credentials.test.js @@ -0,0 +1,995 @@ +import { + randomAsHex, + stringToU8a, + u8aToHex, +} from "@docknetwork/credential-sdk/utils"; +import b58 from "bs58"; +import { + initializeWasm, + BoundCheckSnarkSetup, + Accumulator, + PositiveAccumulator, + dockAccumulatorParams, + AccumulatorPublicKey, + Encoder, + BBDT16MacSecretKey, + MEM_CHECK_STR, + KBUniversalAccumulator, + MEM_CHECK_KV_STR, + RevocationStatusProtocol, +} from "@docknetwork/crypto-wasm-ts"; +import { + InMemoryState, + InMemoryKBUniversalState, +} from "@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence"; +import stringify from "json-stringify-deterministic"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { + FullNodeEndpoint, + TestAccountURI, + TestKeyringOpts, + Schemes, +} from "../../test-constants"; +import { DockDid, DockAccumulatorId } from "@docknetwork/credential-sdk/types"; +import { getProofMatcherDoc, registerNewDIDUsingPair } from "../helpers"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { + issueCredential, + signPresentation, + verifyPresentation, + verifyCredential, +} from "@docknetwork/credential-sdk/vc"; +import { DockResolver } from "@docknetwork/credential-sdk/resolver"; +import { createPresentation } from "../../create-presentation"; +import AccumulatorModule, { + AccumulatorType, +} from "@docknetwork/credential-sdk/modules/accumulator/module"; +import { getKeyedProofsFromVerifiedPresentation } from "@docknetwork/credential-sdk/vc/presentations"; +import { deepClone } from "@docknetwork/credential-sdk/rdf-and-cd/common"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockCoreModules } from "../../../src"; + +// TODO: move to fixtures +const id = "https://ld.dock.io/examples/resident-card-schema.json"; +const residentCardSchema = { + $schema: "http://json-schema.org/draft-07/schema#", + $id: id, + title: "Resident Card Example", + type: "object", + properties: { + // TOOD: fix and restore below for future + // // NOTE: schema here defines context/type to make sure + // // that the string conversion works even with it defined in schema + // '@context': { + // type: 'array', + // }, + // type: { + // type: 'array', + // }, + credentialSubject: { + type: "object", + properties: { + givenName: { + title: "Given Name", + type: "string", + }, + familyName: { + title: "Family Name", + type: "string", + }, + lprNumber: { + title: "LPR Number", + type: "integer", + minimum: 0, + }, + }, + required: ["givenName", "familyName", "lprNumber"], + }, + }, +}; + +const embeddedSchema = { + id, + type: "JsonSchemaValidator2018", + details: stringify({ jsonSchema: residentCardSchema }), +}; + +describe.each(Schemes)( + "Derived Credentials", + ({ + Name, + Module, + Presentation, + CryptoKeyPair, + VerKey, + getModule, + Context, + derivedToAnoncredsPresentation, + }) => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + const resolver = new DockResolver(modules); + const did1 = DockDid.random(); + if (Name === "PS") { + return; + } + + let account; + let pair1; + let chainModule; + let keypair; + let didDocument; + + const holder3DID = DockDid.random(); + // seed used for 3rd holder keys + const holder3KeySeed = randomAsHex(32); + + // TODO: move to fixtures + const credentialJSON = { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/citizenship/v1", + Context, + ], + id: "https://issuer.oidp.uscis.gov/credentials/83627465", + type: ["VerifiableCredential", "PermanentResidentCard"], + credentialSchema: embeddedSchema, + identifier: "83627465", + name: "Permanent Resident Card", + description: "Government of Example Permanent Resident Card.", + issuanceDate: "2019-12-03T12:19:52Z", + expirationDate: "2029-12-03T12:19:52Z", + credentialSubject: { + id: "did:example:b34ca6cd37bbf23", + type: ["PermanentResident", "Person"], + givenName: "JOHN", + familyName: "SMITH", + lprNumber: 1234, + }, + }; + + // Setup 4 accumulators, 2 with keyed verification and 2 with public key verification + + const posAccumulatorId = DockAccumulatorId.random(did1); + const posAccumState = new InMemoryState(); + let posAccumKeypair; + let posAccumWitness; + + const posKvAccumulatorId = DockAccumulatorId.random(did1); + const posKvAccumState = new InMemoryState(); + let posKvAccumSecretKey; + let posKvAccumWitness; + + const uniAccumulatorId = DockAccumulatorId.random(did1); + const uniAccumState = new InMemoryKBUniversalState(); + let uniAccumKeypair; + let uniAccumWitness; + + const uniKvAccumulatorId = DockAccumulatorId.random(did1); + const uniKvAccumState = new InMemoryKBUniversalState(); + let uniKvAccumSecretKey; + let uniKvAccumWitness; + + let accumMember; + let encodedMember; + + async function writeAccumToChain(accumId, keyId, accumulator) { + let accumulated; + if (accumulator instanceof PositiveAccumulator) { + accumulated = AccumulatorModule.accumulatedAsHex( + accumulator.accumulated + ); + await modules.accumulator.addPositiveAccumulator( + accumId, + accumulated, + [did1, keyId], + pair1 + ); + } else { + accumulated = AccumulatorModule.accumulatedAsHex( + accumulator.accumulated, + AccumulatorType.KBUni + ); + await modules.accumulator.addKBUniversalAccumulator( + accumId, + accumulated, + [did1, keyId], + pair1 + ); + } + const queriedAccum = await modules.accumulator.getAccumulator( + accumId, + false + ); + expect(queriedAccum.accumulated.value).toEqual(accumulated); + } + + beforeAll(async () => { + await initializeWasm(); + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + chainModule = getModule(dock); + account = dock.keyring.addFromUri(TestAccountURI); + + dock.setAccount(account); + pair1 = new DidKeypair([did1, 1], Ed25519Keypair.random()); + await registerNewDIDUsingPair(dock, did1, pair1); + + keypair = CryptoKeyPair.generate({ + controller: did1, + msgCount: 100, + }); + + if (Name !== "BBDT16") { + const pk1 = Module.prepareAddPublicKey( + u8aToHex(keypair.publicKeyBuffer) + ); + await chainModule.addPublicKey(null, pk1, did1, pair1); + + didDocument = (await modules.did.getDocument(did1)).toJSON(); + const { verificationMethod } = didDocument; + expect(verificationMethod.length).toEqual(2); + expect(verificationMethod[1].type).toEqual(VerKey); + keypair.id = verificationMethod[1].id; + } else { + // For KVAC, the public doesn't need to published as its not used in credential or presentation verification (except issuers). + // But the signer still adds a key identifier in the credential to determine which key will be used for verification + keypair.id = "my-key-id"; + } + + // Register holder DID with ed25519 key + await registerNewDIDUsingPair( + dock, + holder3DID, + new Ed25519Keypair(holder3KeySeed) + ); + + const params = dockAccumulatorParams(); + + posAccumKeypair = Accumulator.generateKeypair(params); + const bytes1 = posAccumKeypair.publicKey.value; + const posAccumPk = AccumulatorModule.prepareAddPublicKey(bytes1); + await modules.accumulator.addPublicKey(null, posAccumPk, did1, pair1); + + // For keyed-verification accumulator, public key is not written on chain. + const posKvAccumKeypair = Accumulator.generateKeypair(params); + + uniAccumKeypair = Accumulator.generateKeypair(params); + const bytes2 = u8aToHex(uniAccumKeypair.publicKey.bytes); + const uniAccumPk = AccumulatorModule.prepareAddPublicKey(bytes2); + await modules.accumulator.addPublicKey(null, uniAccumPk, did1, pair1); + + // For keyed-verification accumulator, public key is not written on chain. + const uniKvAccumKeypair = Accumulator.generateKeypair(params); + + // All 4 accumulators will have the same member + accumMember = "10"; + encodedMember = Encoder.defaultEncodeFunc()(accumMember); + + // The 2 positive accumulators are pre-filled with the following members and the other 2 have the domain set to these + const members = []; + for (let i = 1; i < 100; i++) { + // Using default encoder since thats what the is used in credential by default. Ideally, the encoder specified in + // the particular schema should be used but for that is the default one + members.push(Encoder.defaultEncodeFunc()(i.toString())); + } + + const accumulator = PositiveAccumulator.initialize( + params, + posAccumKeypair.secretKey + ); + await accumulator.addBatch( + members, + posAccumKeypair.secretKey, + posAccumState + ); + await writeAccumToChain(posAccumulatorId, 1, accumulator); + posAccumWitness = await accumulator.membershipWitness( + encodedMember, + posAccumKeypair.secretKey, + posAccumState + ); + expect( + accumulator.verifyMembershipWitness( + encodedMember, + posAccumWitness, + posAccumKeypair.publicKey, + params + ) + ).toEqual(true); + + const accumulator1 = PositiveAccumulator.initialize( + params, + posKvAccumKeypair.secretKey + ); + await accumulator1.addBatch( + members, + posKvAccumKeypair.secretKey, + posKvAccumState + ); + // For KV accumulator, keyId is 0 + await writeAccumToChain(posKvAccumulatorId, 0, accumulator1); + posKvAccumWitness = await accumulator1.membershipWitness( + encodedMember, + posKvAccumKeypair.secretKey, + posKvAccumState + ); + posKvAccumSecretKey = posKvAccumKeypair.secretKey; + + const accumulator2 = await KBUniversalAccumulator.initialize( + members, + params, + uniAccumKeypair.secretKey, + uniAccumState + ); + await accumulator2.add( + encodedMember, + uniAccumKeypair.secretKey, + uniAccumState + ); + await writeAccumToChain(uniAccumulatorId, 2, accumulator2); + uniAccumWitness = await accumulator2.membershipWitness( + encodedMember, + uniAccumKeypair.secretKey, + uniAccumState + ); + expect( + accumulator2.verifyMembershipWitness( + encodedMember, + uniAccumWitness, + uniAccumKeypair.publicKey, + params + ) + ).toEqual(true); + + const accumulator3 = await KBUniversalAccumulator.initialize( + members, + params, + uniKvAccumKeypair.secretKey, + uniKvAccumState + ); + await accumulator3.add( + encodedMember, + uniKvAccumKeypair.secretKey, + uniKvAccumState + ); + // For KV accumulator, keyId is 0 + await writeAccumToChain(uniKvAccumulatorId, 0, accumulator3); + uniKvAccumWitness = await accumulator3.membershipWitness( + encodedMember, + uniKvAccumKeypair.secretKey, + uniKvAccumState + ); + uniKvAccumSecretKey = uniKvAccumKeypair.secretKey; + }, 30000); + + async function createAndVerifyPresentation( + credentials, + verifyOptions = {}, + accumSecretKey = undefined + ) { + const holderKey = getKeyDoc( + holder3DID, + new Ed25519Keypair(holder3KeySeed) + ); + + const presId = `https://example.com/pres/${randomAsHex(32)}`; + const chal = randomAsHex(32); + const domain = "test domain"; + const presentation = createPresentation(credentials, presId); + + // This is done by the verifier + const reconstructedPres = derivedToAnoncredsPresentation( + presentation.verifiableCredential[0] + ); + const keyedProofs = + getKeyedProofsFromVerifiedPresentation(reconstructedPres); + const isKvac = Name === "BBDT16"; + const isKvacStatus = accumSecretKey ? 1 : 0; + // Keyed proofs only exist for KVAC + expect(keyedProofs.size).toEqual(isKvac || isKvacStatus ? 1 : 0); + if (isKvac) { + // This block is executed by the issuer or anyone having the secret key but not by the verifier + const sk = new BBDT16MacSecretKey(keypair.privateKeyBuffer); + // eslint-disable-next-line jest/no-conditional-expect + expect( + keyedProofs.get(0)?.credential?.proof.verify(sk).verified + ).toEqual(true); + } + if (isKvacStatus) { + // This block is executed by the issuer or anyone having the secret key but not by the verifier + expect( + keyedProofs.get(0)?.status?.proof.verify(accumSecretKey).verified + ).toEqual(true); + } + + expect(presentation).toMatchObject( + // NOTE: json parse+stringify to remove any undefined properties + expect.objectContaining( + JSON.parse( + JSON.stringify({ + type: ["VerifiablePresentation"], + verifiableCredential: credentials, + id: presId, + }) + ) + ) + ); + + // NOTE: typically for BBS+ presentations you shouldnt sign it by the holder, but we do it here just to make sure it works + // Verifying this would require knowing the holder's public key which makes the holder linkable and defeats the purpose of BBS+ + const signedPres = await signPresentation( + presentation, + holderKey, + chal, + domain, + resolver + ); + + expect(signedPres).toMatchObject( + expect.objectContaining({ + type: ["VerifiablePresentation"], + verifiableCredential: credentials, + id: presId, + proof: expect.objectContaining({ + type: "Ed25519Signature2018", + challenge: chal, + domain, + proofPurpose: "authentication", + }), + }) + ); + + const result = await verifyPresentation(signedPres, { + challenge: chal, + domain, + resolver, + ...verifyOptions, + }); + + expect(result.verified).toBe(true); + expect(result.presentationResult.verified).toBe(true); + expect(result.credentialResults.length).toBe(1); + expect(result.credentialResults[0].verified).toBe(true); + } + + async function getPresentationInstance(credentialStatus) { + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + credentialStatus, + issuer: String(did1), + }; + + const presentationOptions = { + nonce: stringToU8a("noncetest"), + context: "my context", + }; + + // Create W3C credential + const credential = await issueCredential(issuerKey, unsignedCred); + expect(credential.id).toBeDefined(); + + // Begin to derive a credential from the above issued one + const presentationInstance = new Presentation(); + const idx = await presentationInstance.addCredentialToPresent( + credential, + { resolver } + ); + + // NOTE: revealing subject type because of JSON-LD processing for this certain credential + // you may not always need to do this depending on your JSON-LD contexts + await presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.type.0", + ]); + await presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.type.1", + ]); + + return [presentationInstance, presentationOptions]; + } + + test(`For ${Name}, holder creates a derived verifiable credential from a credential with selective disclosure`, async () => { + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + issuer: String(did1), + }; + + const presentationOptions = { + nonce: stringToU8a("noncetest"), + context: "my context", + }; + + // Create W3C credential + const credential = await issueCredential(issuerKey, unsignedCred); + const result = await verifyCredential(credential, { resolver }); + expect(result).toMatchObject( + expect.objectContaining(getProofMatcherDoc()) + ); + + // Begin to derive a credential from the above issued one + const presentationInstance = new Presentation(); + const idx = await presentationInstance.addCredentialToPresent( + credential, + { resolver } + ); + + // Reveal subject attributes + presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.lprNumber", + ]); + + // NOTE: revealing subject type because of JSON-LD processing for this certain credential + // you may not always need to do this depending on your JSON-LD contexts + presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.type.0", + ]); + presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.type.1", + ]); + + // Begin to derive a credential from the above issued one + const presentationInstance2 = new Presentation(); + const idx2 = await presentationInstance2.addCredentialToPresent( + credential, + { resolver } + ); + + // Reveal subject attributes + presentationInstance2.addAttributeToReveal(idx2, [ + "credentialSubject.lprNumber", + ]); + + // NOTE: revealing subject type because of JSON-LD processing for this certain credential + // you may not always need to do this depending on your JSON-LD contexts + presentationInstance2.addAttributeToReveal(idx2, [ + "credentialSubject.type.0", + ]); + presentationInstance2.addAttributeToReveal(idx2, [ + "credentialSubject.type.1", + ]); + + // Derive a W3C Verifiable Credential JSON from the above presentation + const credentials = await presentationInstance.deriveCredentials( + presentationOptions + ); + expect(credentials.length).toEqual(1); + expect(credentials[0].proof).toBeDefined(); + expect(credentials[0]).toHaveProperty("credentialSubject"); + expect(credentials[0].credentialSubject).toMatchObject( + expect.objectContaining({ + type: unsignedCred.credentialSubject.type, + lprNumber: 1234, + }) + ); + expect(credentials[0].issuer).toEqual(credential.issuer); + expect(credentials[0].credentialSchema.id).toEqual( + residentCardSchema.$id + ); + + // Ensure reconstructing presentation from credential matches + // NOTE: ignoring proof here as itll differ when signed twice as above + const presentation = await presentationInstance2.createPresentation( + presentationOptions + ); + + // Question: What is the point of this? A single credential cant be converted to a presentation and a presentation + // has other data that credential won't have + const reconstructedPres = derivedToAnoncredsPresentation(credentials[0]); + expect(reconstructedPres.proof).toBeDefined(); + expect({ + ...reconstructedPres, + proof: "", + }).toMatchObject({ ...presentation, proof: "" }); + + // Try to verify the derived credential alone + const credentialResult = await verifyCredential(credentials[0], { + resolver, + }); + expect(credentialResult.verified).toBe(true); + expect(credentialResult.error).toBe(undefined); + + // Modify the credential after issuance, verification should fail + const modifiedCred = deepClone(credentials[0]); + modifiedCred.credentialSubject.lprNumber = 0xdeadbeef; + const credentialResult1 = await verifyCredential(modifiedCred, { + resolver, + }); + expect(credentialResult1.verified).toBe(false); + + // This is done by the verifier + const keyedProofs = + getKeyedProofsFromVerifiedPresentation(reconstructedPres); + const isKvac = Name === "BBDT16"; + // Keyed proofs only exist for KVAC + expect(keyedProofs.size).toEqual(isKvac ? 1 : 0); + if (isKvac) { + // This block is executed by the issuer or anyone having the secret key but not by the verifier + const sk = new BBDT16MacSecretKey(keypair.privateKeyBuffer); + // eslint-disable-next-line jest/no-conditional-expect + expect( + keyedProofs.get(0)?.credential?.proof.verify(sk).verified + ).toEqual(true); + } + // Create a VP and verify it from this credential + await createAndVerifyPresentation(credentials); + }, 30000); + + test(`For ${Name}, persist credential status using VB positive accumulator when deriving`, async () => { + const queriedAccum = await modules.accumulator.getAccumulator( + posAccumulatorId, + true + ); + const verifAccumulator = PositiveAccumulator.fromAccumulated( + AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated) + ); + + const accumPk = new AccumulatorPublicKey( + queriedAccum.publicKey.bytes.bytes + ); + expect( + verifAccumulator.verifyMembershipWitness( + encodedMember, + posAccumWitness, + accumPk, + dockAccumulatorParams() + ) + ).toEqual(true); + + const credentialStatus = { + id: `dock:accumulator:${posAccumulatorId}`, + type: RevocationStatusProtocol.Vb22, + revocationCheck: MEM_CHECK_STR, + revocationId: accumMember, + }; + const [presentationInstance, presentationOptions] = + await getPresentationInstance(credentialStatus); + + presentationInstance.presBuilder.addAccumInfoForCredStatus( + 0, + posAccumWitness, + AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated), + accumPk + ); + + // Derive a W3C Verifiable Credential JSON from the above presentation + const credentials = await presentationInstance.deriveCredentials( + presentationOptions + ); + + expect(credentials.length).toEqual(1); + expect(credentials[0].issuer).toEqual(String(did1)); + expect(credentials[0].credentialStatus).toBeDefined(); + expect(credentials[0].credentialStatus).toEqual({ + ...credentialStatus, + revocationId: undefined, // Because revocation id is never revealed + accumulated: b58.encode( + AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated) + ), + extra: {}, + }); + + const accumulatorPublicKeys = new Map(); + accumulatorPublicKeys.set(0, accumPk); + + // Create a VP and verify it from this credential + await createAndVerifyPresentation(credentials, { + resolver, + accumulatorPublicKeys, + }); + }); + + test(`For ${Name}, persist credential status using VB positive accumulator with keyed-verification when deriving`, async () => { + // No public key exists + const queriedAccum = await modules.accumulator.getAccumulator( + posKvAccumulatorId, + false, + false + ); + + const credentialStatus = { + id: `dock:accumulator:${posKvAccumulatorId}`, + type: RevocationStatusProtocol.Vb22, + revocationCheck: MEM_CHECK_KV_STR, + revocationId: accumMember, + }; + const [presentationInstance, presentationOptions] = + await getPresentationInstance(credentialStatus); + + presentationInstance.presBuilder.addAccumInfoForCredStatus( + 0, + posKvAccumWitness, + AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated) + ); + + // Derive a W3C Verifiable Credential JSON from the above presentation + const credentials = await presentationInstance.deriveCredentials( + presentationOptions + ); + + expect(credentials.length).toEqual(1); + expect(credentials[0].issuer).toEqual(String(did1)); + expect(credentials[0].credentialStatus).toBeDefined(); + expect(credentials[0].credentialStatus).toEqual({ + ...credentialStatus, + revocationId: undefined, // Because revocation id is never revealed + accumulated: b58.encode( + AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated) + ), + extra: {}, + }); + + // Create a VP and verify it from this credential + await createAndVerifyPresentation( + credentials, + { + resolver, + }, + posKvAccumSecretKey + ); + }); + + test(`For ${Name}, persist credential status using KB universal accumulator when deriving`, async () => { + const queriedAccum = await modules.accumulator.getAccumulator( + uniAccumulatorId, + true + ); + const verifAccumulator = KBUniversalAccumulator.fromAccumulated( + AccumulatorModule.accumulatedFromHex( + queriedAccum.accumulated, + AccumulatorType.KBUni + ) + ); + + const accumPk = new AccumulatorPublicKey( + queriedAccum.publicKey.bytes.bytes + ); + expect( + verifAccumulator.verifyMembershipWitness( + encodedMember, + uniAccumWitness, + accumPk, + dockAccumulatorParams() + ) + ).toEqual(true); + + const credentialStatus = { + id: `dock:accumulator:${uniAccumulatorId}`, + type: RevocationStatusProtocol.KbUni24, + revocationCheck: MEM_CHECK_STR, + revocationId: accumMember, + }; + const [presentationInstance, presentationOptions] = + await getPresentationInstance(credentialStatus); + + presentationInstance.presBuilder.addAccumInfoForCredStatus( + 0, + uniAccumWitness, + AccumulatorModule.accumulatedFromHex( + queriedAccum.accumulated, + AccumulatorType.KBUni + ) + ); + + // Derive a W3C Verifiable Credential JSON from the above presentation + const credentials = await presentationInstance.deriveCredentials( + presentationOptions + ); + + const accAsU8 = AccumulatorModule.accumulatedFromHex( + queriedAccum.accumulated, + AccumulatorType.KBUni + ); + expect(credentials.length).toEqual(1); + expect(credentials[0].issuer).toEqual(String(did1)); + expect(credentials[0].credentialStatus).toBeDefined(); + expect(credentials[0].credentialStatus).toEqual({ + ...credentialStatus, + revocationId: undefined, // Because revocation id is never revealed + accumulated: `${b58.encode(accAsU8.toBytes())}`, + extra: {}, + }); + + const accumulatorPublicKeys = new Map(); + accumulatorPublicKeys.set(0, accumPk); + + // Create a VP and verify it from this credential + await createAndVerifyPresentation(credentials, { + resolver, + accumulatorPublicKeys, + }); + }); + + test(`For ${Name}, persist credential status using KB universal accumulator with keyed-verification when deriving`, async () => { + // No public key exists + const queriedAccum = await modules.accumulator.getAccumulator( + uniKvAccumulatorId, + false, + false + ); + + const credentialStatus = { + id: `dock:accumulator:${uniKvAccumulatorId}`, + type: RevocationStatusProtocol.KbUni24, + revocationCheck: MEM_CHECK_KV_STR, + revocationId: accumMember, + }; + const [presentationInstance, presentationOptions] = + await getPresentationInstance(credentialStatus); + + presentationInstance.presBuilder.addAccumInfoForCredStatus( + 0, + uniKvAccumWitness, + AccumulatorModule.accumulatedFromHex( + queriedAccum.accumulated, + AccumulatorType.KBUni + ) + ); + + // Derive a W3C Verifiable Credential JSON from the above presentation + const credentials = await presentationInstance.deriveCredentials( + presentationOptions + ); + + const accAsU8 = AccumulatorModule.accumulatedFromHex( + queriedAccum.accumulated, + AccumulatorType.KBUni + ); + expect(credentials.length).toEqual(1); + expect(credentials[0].issuer).toEqual(String(did1)); + expect(credentials[0].credentialStatus).toBeDefined(); + expect(credentials[0].credentialStatus).toEqual({ + ...credentialStatus, + revocationId: undefined, // Because revocation id is never revealed + accumulated: `${b58.encode(accAsU8.toBytes())}`, + extra: {}, + }); + + // Create a VP and verify it from this credential + await createAndVerifyPresentation( + credentials, + { + resolver, + }, + uniKvAccumSecretKey + ); + }); + + // TODO: unskip, currently doesn't work for PS + (Name === "PS" ? test.skip : test)( + "Holder creates a derived verifiable credential from a credential with range proofs", + async () => { + const provingKeyId = "provingKeyId"; + const pk = BoundCheckSnarkSetup(); + const provingKey = pk.decompress(); + + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + issuer: String(did1), + }; + + const presentationOptions = { + nonce: stringToU8a("noncetest"), + context: "my context", + }; + + // Create W3C credential + const credential = await issueCredential(issuerKey, unsignedCred); + + // Begin to derive a credential from the above issued one + const presentationInstance = new Presentation(); + const idx = await presentationInstance.addCredentialToPresent( + credential, + { resolver } + ); + + // NOTE: revealing subject type because of JSON-LD processing for this certain credential + // you may not always need to do this depending on your JSON-LD contexts + await presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.type.0", + ]); + await presentationInstance.addAttributeToReveal(idx, [ + "credentialSubject.type.1", + ]); + + // Enforce LPR number to be between values as well as revealed + // NOTE: unlike other tests, we cannot "reveal" this value and enforce bounds at the same time! + presentationInstance.presBuilder.enforceBounds( + idx, + "credentialSubject.lprNumber", + 1233, + 1235, + provingKeyId, + provingKey + ); + + // Enforce issuance date to be between values + // NOTE: we dont need to set proving key value here (must still set ID though!) as its done above, should pass undefined + presentationInstance.presBuilder.enforceBounds( + idx, + "issuanceDate", + new Date("2019-10-01"), + new Date("2020-01-01"), + provingKeyId, + undefined + ); + + // Derive a W3C Verifiable Credential JSON from the above presentation + const credentials = await presentationInstance.deriveCredentials( + presentationOptions + ); + expect(credentials.length).toEqual(1); + expect(credentials[0].proof).toBeDefined(); + expect(credentials[0].issuer).toEqual(credential.issuer); + expect(credentials[0].proof.bounds).toBeDefined(); + expect(credentials[0].proof.bounds).toEqual({ + issuanceDate: [ + { + min: 1569888000000, + max: 1577836800000, + paramId: "provingKeyId", + protocol: "LegoGroth16", + }, + ], + credentialSubject: { + lprNumber: [ + { + min: 1233, + max: 1235, + paramId: "provingKeyId", + protocol: "LegoGroth16", + }, + ], + }, + }); + expect(credentials[0]).toHaveProperty("credentialSubject"); + expect(credentials[0].credentialSubject).toMatchObject( + expect.objectContaining({ + type: unsignedCred.credentialSubject.type, + }) + ); + + const reconstructedPres = derivedToAnoncredsPresentation( + credentials[0] + ); + expect(reconstructedPres.proof).toBeDefined(); + expect(reconstructedPres.spec.credentials[0].bounds).toEqual( + credentials[0].proof.bounds + ); + + // Setup predicate params with the verifying key for range proofs + const predicateParams = new Map(); + predicateParams.set(provingKeyId, pk.getVerifyingKey()); + + // Try to verify the derived credential alone + const credentialResult = await verifyCredential(credentials[0], { + resolver, + predicateParams, + }); + if (credentialResult.error) { + console.log( + "credentialResult.error", + JSON.stringify(credentialResult.error, null, 2) + ); + } + expect(credentialResult.error).toBe(undefined); + expect(credentialResult.verified).toBe(true); + + // Create a VP and verify it from this credential + await createAndVerifyPresentation(credentials, { predicateParams }); + }, + 60000 + ); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + } +); diff --git a/packages/dock-blockchain-modules/tests/integration/anoncreds/issuing.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/issuing.test.js new file mode 100644 index 000000000..d5be9c56c --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/issuing.test.js @@ -0,0 +1,345 @@ +import { u8aToHex } from "@docknetwork/credential-sdk/utils"; +import { + DefaultSchemaParsingOpts, + CredentialBuilder, + CredentialSchema, + initializeWasm, + EMPTY_SCHEMA_ID, +} from "@docknetwork/credential-sdk/crypto"; +import stringify from "json-stringify-deterministic"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { DockResolver } from "@docknetwork/credential-sdk/resolver"; +import { + registerNewDIDUsingPair, + getCredMatcherDoc, + getProofMatcherDoc, +} from "../helpers"; +import { + issueCredential, + verifyCredential, +} from "@docknetwork/credential-sdk/vc"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { getJsonSchemaFromCredential } from "@docknetwork/credential-sdk/vc/credentials"; +import { + getResidentCardCredentialAndSchema, + setupExternalSchema, +} from "./utils"; +import { + FullNodeEndpoint, + TestAccountURI, + TestKeyringOpts, + Schemes, +} from "../../test-constants"; +import defaultDocumentLoader from "@docknetwork/credential-sdk/vc/document-loader"; +import DockCryptoSignature from "@docknetwork/credential-sdk/vc/crypto/common/DockCryptoSignature"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockCoreModules } from "../../../src"; + +describe.each(Schemes)( + "Issuance", + ({ Name, Module, Context, CryptoKeyPair, getModule, VerKey, SigType }) => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + const resolver = new DockResolver(modules); + + const did1 = DockDid.random(); + const pair1 = new DidKeypair([did1, 1], Ed25519Keypair.random()); + + let account; + let chainModule; + let keypair; + + const [credentialJSON, residentCardSchema] = + getResidentCardCredentialAndSchema(Context); + + beforeAll(async () => { + await initializeWasm(); + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + chainModule = getModule(dock); + account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + + await registerNewDIDUsingPair(dock, did1, pair1); + + keypair = CryptoKeyPair.generate({ + controller: did1, + msgCount: 100, + }); + + if (Name !== "BBDT16") { + // Setup public key on blockchain + const pk1 = Module.prepareAddPublicKey( + u8aToHex(keypair.publicKeyBuffer) + ); + await chainModule.addPublicKey(null, pk1, did1, pair1); + + const didDocument = (await modules.did.getDocument(did1)).toJSON(); + const { verificationMethod } = didDocument; + + expect(verificationMethod.length).toEqual(2); + expect(verificationMethod[1].type).toEqual(VerKey); + + keypair.id = verificationMethod[1].id; + } else { + // For KVAC, the public doesn't need to published as its not used in credential or presentation verification (except issuers). + // But the signer still adds a key identifier in the credential to determine which key will be used for verification + keypair.id = "my-key-id"; + } + }, 20000); + + test(`Can issue+verify a ${Name} credential with external schema reference`, async () => { + const [externalSchemaEncoded, schemaId] = await setupExternalSchema( + residentCardSchema, + "Resident Card Example", + did1, + pair1, + modules.blob + ); + + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + issuer: String(did1), + }; + unsignedCred.credentialSchema = externalSchemaEncoded; + + // The schema will be fetched from the blockchain before issuing + const credential = await issueCredential( + issuerKey, + unsignedCred, + true, + defaultDocumentLoader(resolver) + ); + expect(credential).toMatchObject( + expect.objectContaining( + getCredMatcherDoc(unsignedCred, did1, issuerKey.id, SigType) + ) + ); + + // Get JSON schema from the credential + const fullSchema = getJsonSchemaFromCredential(credential, true); + const externalSchema = getJsonSchemaFromCredential(credential, false); + expect(externalSchema.$id).toEqual(schemaId); + expect(fullSchema.$id).toEqual(residentCardSchema.$id); + expect(externalSchema.properties).not.toBeDefined(); + // properties don't match exactly because some are generated while signing + expect(fullSchema.properties.credentialSubject.properties).toMatchObject( + expect.objectContaining( + residentCardSchema.properties.credentialSubject.properties + ) + ); + + // Ensure extra properties from crypto-wasm-ts are assigned to schema object + expect(credential.cryptoVersion).toEqual(CredentialBuilder.VERSION); + expect(credential.credentialSchema.version).toEqual( + CredentialSchema.VERSION + ); + expect(credential.credentialSchema.id).toEqual(schemaId); + const details = JSON.parse(credential.credentialSchema.details); + expect(details.parsingOptions).toEqual({ + useDefaults: false, + defaultMinimumInteger: -4294967295, + defaultMinimumDate: -17592186044415, + defaultDecimalPlaces: 0, + }); + expect(details.fullJsonSchema).toBeDefined(); + + const result = await verifyCredential(credential, { resolver }); + expect(result).toMatchObject( + expect.objectContaining(getProofMatcherDoc()) + ); + }, 30000); + + test(`Can issue+verify a ${Name} credential with embedded schema`, async () => { + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + issuer: String(did1), + }; + + const credential = await issueCredential(issuerKey, unsignedCred); + expect(credential).toMatchObject( + expect.objectContaining( + getCredMatcherDoc(unsignedCred, did1, issuerKey.id, SigType) + ) + ); + + const fullSchema = getJsonSchemaFromCredential(credential, true); + const externalSchema = getJsonSchemaFromCredential(credential, false); + expect(externalSchema.$id).toEqual(residentCardSchema.$id); + expect(fullSchema.$id).toEqual(residentCardSchema.$id); + expect(externalSchema.properties).toBeDefined(); + // properties don't match exactly because some are generated while signing + expect(fullSchema.properties.credentialSubject.properties).toMatchObject( + expect.objectContaining( + residentCardSchema.properties.credentialSubject.properties + ) + ); + expect( + externalSchema.properties.credentialSubject.properties + ).toMatchObject( + expect.objectContaining( + residentCardSchema.properties.credentialSubject.properties + ) + ); + + // Ensure extra properties from crypto-wasm-ts are assigned to schema object + expect(credential.cryptoVersion).toEqual(CredentialBuilder.VERSION); + expect(credential.credentialSchema.version).toEqual( + CredentialSchema.VERSION + ); + expect(credential.credentialSchema.id).toEqual(residentCardSchema.$id); + const details = JSON.parse(credential.credentialSchema.details); + expect(details.parsingOptions).toEqual({ + useDefaults: false, + defaultMinimumInteger: -4294967295, + defaultMinimumDate: -17592186044415, + defaultDecimalPlaces: 0, + }); + expect(details.fullJsonSchema).not.toBeDefined(); + + const result = await verifyCredential(credential, { resolver }); + expect(result).toMatchObject( + expect.objectContaining(getProofMatcherDoc()) + ); + }, 30000); + + test(`Can issue+verify a ${Name} credential with default schema`, async () => { + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + issuer: String(did1), + }; + delete unsignedCred.credentialSchema; + + const credential = await issueCredential(issuerKey, unsignedCred); + expect(credential).toMatchObject( + expect.objectContaining( + getCredMatcherDoc(unsignedCred, did1, issuerKey.id, SigType) + ) + ); + + const fullSchema = getJsonSchemaFromCredential(credential, true); + const externalSchema = getJsonSchemaFromCredential(credential, false); + // These won't be defined as the whole schema was autogenerated + expect(externalSchema.$id).not.toBeDefined(); + expect(fullSchema.$id).not.toBeDefined(); + expect(credential.credentialSchema.id).toEqual(EMPTY_SCHEMA_ID); + + for (const props of [ + fullSchema.properties.credentialSubject.properties, + externalSchema.properties.credentialSubject.properties, + ]) { + // properties don't match exactly because some are generated while signing + expect( + residentCardSchema.properties.credentialSubject.properties.familyName + ).toMatchObject(expect.objectContaining(props.familyName)); + expect( + residentCardSchema.properties.credentialSubject.properties.givenName + ).toMatchObject(expect.objectContaining(props.givenName)); + } + + // Ensure schema was now defined, added by crypto-wasm-ts + expect(credential.cryptoVersion).toEqual(CredentialBuilder.VERSION); + expect(credential.credentialSchema).toBeDefined(); + expect(credential.credentialSchema.version).toEqual( + CredentialSchema.VERSION + ); + const details = JSON.parse(credential.credentialSchema.details); + expect(details.parsingOptions).toEqual({ + useDefaults: false, + defaultMinimumInteger: -4294967295, + defaultMinimumDate: -17592186044415, + defaultDecimalPlaces: 0, + }); + expect(details.fullJsonSchema).not.toBeDefined(); + + const result = await verifyCredential(credential, { resolver }); + expect(result).toMatchObject( + expect.objectContaining(getProofMatcherDoc()) + ); + }, 30000); + + test(`Can issue+verify a ${Name} credential with blank schema and custom parsingOptions`, async () => { + const parsingOptions = { + ...DefaultSchemaParsingOpts, + defaultDecimalPlaces: 5, + useDefaults: true, + }; + + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const unsignedCred = { + ...credentialJSON, + issuer: String(did1), + }; + + unsignedCred.credentialSchema = { + id: "", + type: "JsonSchemaValidator2018", + details: stringify({ + parsingOptions, + }), + }; + + const credential = await issueCredential(issuerKey, unsignedCred); + + // Ensure schema was now defined, added by crypto-wasm-ts + const details = JSON.parse(credential.credentialSchema.details); + expect(details.parsingOptions).toEqual(parsingOptions); + expect(details.fullJsonSchema).not.toBeDefined(); + expect(credential.credentialSchema.id).toEqual(EMPTY_SCHEMA_ID); + + const result = await verifyCredential(credential, { resolver }); + expect(result).toMatchObject( + expect.objectContaining(getProofMatcherDoc()) + ); + }, 30000); + + test(`Can issue+verify a ${Name} credential with embedded schema and custom parsingOptions`, async () => { + const parsingOptions = { + ...DefaultSchemaParsingOpts, + defaultDecimalPlaces: 5, + useDefaults: true, + }; + + const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); + const schemaWithGivenParsingOptions = + DockCryptoSignature.withUpdatedParsingOptions( + credentialJSON.credentialSchema, + parsingOptions + ); + const unsignedCred = { + ...credentialJSON, + credentialSchema: schemaWithGivenParsingOptions, + issuer: String(did1), + }; + + expect(unsignedCred.credentialSchema.id).toBeDefined(); + expect(unsignedCred.credentialSchema.id).not.toEqual(""); + + const credential = await issueCredential(issuerKey, unsignedCred); + + // Ensure schema was now defined, added by crypto-wasm-ts + const details = JSON.parse(credential.credentialSchema.details); + expect(details.parsingOptions).toEqual(parsingOptions); + expect(details.fullJsonSchema).not.toBeDefined(); + expect(credential.credentialSchema.id).toEqual(residentCardSchema.$id); + + const result = await verifyCredential(credential, { resolver }); + expect(result).toMatchObject( + expect.objectContaining(getProofMatcherDoc()) + ); + }, 30000); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + } +); diff --git a/tests/integration/anoncreds/prefilled-positive-accumulator.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/prefilled-positive-accumulator.test.js similarity index 70% rename from tests/integration/anoncreds/prefilled-positive-accumulator.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/prefilled-positive-accumulator.test.js index 21d83826c..ff65db7f1 100644 --- a/tests/integration/anoncreds/prefilled-positive-accumulator.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/prefilled-positive-accumulator.test.js @@ -1,4 +1,4 @@ -import { hexToU8a, stringToHex, u8aToHex } from '@polkadot/util'; +import { hexToU8a, stringToHex, u8aToHex } from "@polkadot/util"; import { initializeWasm, Accumulator, @@ -7,23 +7,31 @@ import { PositiveAccumulator, VBWitnessUpdateInfo, VBMembershipWitness, -} from '@docknetwork/crypto-wasm-ts'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { InMemoryState } from '@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence'; -import { DockAPI } from '../../../src'; +} from "@docknetwork/crypto-wasm-ts"; +import { randomAsHex } from "@polkadot/util-crypto"; +import { InMemoryState } from "@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import AccumulatorModule, { AccumulatorType, -} from '../../../src/modules/accumulator'; +} from "@docknetwork/credential-sdk/modules/accumulator/module"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; -import { registerNewDIDUsingPair } from '../helpers'; -import { getLastBlockNo, waitForBlocks } from '../../../src/utils/chain-ops'; +} from "../../test-constants"; +import { DockDid, DockAccumulatorId } from "@docknetwork/credential-sdk/types"; +import { registerNewDIDUsingPair } from "../helpers"; +import { + getLastBlockNo, + waitForBlocks, +} from "@docknetwork/dock-blockchain-api/utils/chain-ops"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockCoreModules } from "../../../src"; -describe('Prefilled positive accumulator', () => { +describe("Prefilled positive accumulator", () => { // Incase updating an accumulator is expensive like making a blockchain txn, a cheaper strategy // is to add the members to the accumulator beforehand but not giving out the witnesses yet. // Eg. accumulator manager wants to add a million members over an year, rather than publishing @@ -39,16 +47,18 @@ describe('Prefilled positive accumulator', () => { // Manager estimates that he will have `total_members` members over the course of time const totalMembers = 100; const members = []; + const seed1 = randomAsHex(32); + const seedAccum = randomAsHex(32); const dock = new DockAPI(); + const modules = new DockCoreModules(dock); let account; - let did; - let pair; + const did = DockDid.random(); + const pair = new DidKeypair([did, 1], new Ed25519Keypair(seed1)); + let chainModule; const chainModuleClass = AccumulatorModule; - const seed1 = randomAsHex(32); - const seedAccum = randomAsHex(32); let keypair; let accumulatorId; let accumulator; @@ -59,45 +69,25 @@ describe('Prefilled positive accumulator', () => { keyring: TestKeyringOpts, address: FullNodeEndpoint, }); - chainModule = dock.accumulatorModule; + chainModule = modules.accumulator; account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); - pair = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - did = DockDid.random(); + await registerNewDIDUsingPair(dock, did, pair); await initializeWasm(); }, 20000); - test('Prefill', async () => { - const label = stringToHex('accumulator-params-label'); + test("Prefill", async () => { + const label = stringToHex("accumulator-params-label"); const params = Accumulator.generateParams(hexToU8a(label)); const bytes1 = u8aToHex(params.bytes); - const params1 = chainModuleClass.prepareAddParameters( - bytes1, - undefined, - label, - ); - await chainModule.addParams( - params1, - did, - pair, - { didModule: dock.didModule }, - false, - ); + const params1 = chainModuleClass.prepareAddParameters(bytes1, label); + await chainModule.addParams(null, params1, did, pair); keypair = Accumulator.generateKeypair(params, seedAccum); const bytes2 = u8aToHex(keypair.publicKey.bytes); - const pk1 = chainModuleClass.prepareAddPublicKey(bytes2, undefined, [ - did, - 1, - ]); - await chainModule.addPublicKey( - pk1, - did, - pair, - { didModule: dock.didModule }, - false, - ); + const pk1 = chainModuleClass.prepareAddPublicKey(bytes2, [did, 1]); + await chainModule.addPublicKey(null, pk1, did, pair); accumulator = PositiveAccumulator.initialize(params, keypair.secretKey); @@ -107,37 +97,36 @@ describe('Prefilled positive accumulator', () => { await accumulator.addBatch(members, keypair.secretKey, accumState); expect(accumState.state.size).toEqual(totalMembers); - accumulatorId = randomAsHex(32); + accumulatorId = DockAccumulatorId.random(did); const accumulated = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); - await dock.accumulatorModule.addPositiveAccumulator( + await modules.accumulator.addPositiveAccumulator( accumulatorId, accumulated, [did, 1], - did, - pair, - { didModule: dock.didModule }, - false, + pair ); - const queriedAccum = await dock.accumulatorModule.getAccumulator( + const queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); - expect(queriedAccum.accumulated).toEqual(accumulated); + expect(queriedAccum.accumulated.value).toEqual(accumulated); }); - test('Witness creation, verification should work', async () => { - let queriedAccum = await dock.accumulatorModule.getAccumulator( + test("Witness creation, verification should work", async () => { + let queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); let verifAccumulator = PositiveAccumulator.fromAccumulated( AccumulatorModule.accumulatedFromHex( queriedAccum.accumulated, - AccumulatorType.VBPos, - ), + AccumulatorType.VBPos + ) ); // Witness created for member 1 @@ -145,21 +134,19 @@ describe('Prefilled positive accumulator', () => { const witness1 = await accumulator.membershipWitness( member1, keypair.secretKey, - accumState, - ); - let accumPk = new AccumulatorPublicKey( - hexToU8a(queriedAccum.publicKey.bytes), + accumState ); + let accumPk = new AccumulatorPublicKey(queriedAccum.publicKey.bytes.bytes); let accumParams = new AccumulatorParams( - hexToU8a(queriedAccum.publicKey.params.bytes), + queriedAccum.publicKey.params.bytes.bytes ); expect( verifAccumulator.verifyMembershipWitness( member1, witness1, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Witness created for member 2 @@ -167,15 +154,15 @@ describe('Prefilled positive accumulator', () => { const witness2 = await accumulator.membershipWitness( member2, keypair.secretKey, - accumState, + accumState ); expect( verifAccumulator.verifyMembershipWitness( member2, witness2, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Witness created for member 3 @@ -183,15 +170,15 @@ describe('Prefilled positive accumulator', () => { const witness3 = await accumulator.membershipWitness( member3, keypair.secretKey, - accumState, + accumState ); expect( verifAccumulator.verifyMembershipWitness( member3, witness3, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Previous users' witness still works @@ -200,16 +187,16 @@ describe('Prefilled positive accumulator', () => { member1, witness1, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); expect( verifAccumulator.verifyMembershipWitness( member2, witness2, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Manager decides to remove a member, the new accumulated value will be published along with witness update info @@ -217,45 +204,40 @@ describe('Prefilled positive accumulator', () => { accumulator.accumulated, [], [member2], - keypair.secretKey, + keypair.secretKey ); await accumulator.remove(member2, keypair.secretKey, accumState); - let accum = await dock.accumulatorModule.getAccumulator( - accumulatorId, - false, - ); + let accum = await modules.accumulator.getAccumulator(accumulatorId, false); const accumulated = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); const witUpdBytes = u8aToHex(witnessUpdInfo.value); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated, { removals: [u8aToHex(member2)], witnessUpdateInfo: witUpdBytes }, - did, - pair, - { didModule: dock.didModule }, - false, + pair ); - queriedAccum = await dock.accumulatorModule.getAccumulator( + queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); - expect(queriedAccum.accumulated).toEqual(accumulated); + expect(queriedAccum.accumulated.value).toEqual(accumulated); verifAccumulator = PositiveAccumulator.fromAccumulated( AccumulatorModule.accumulatedFromHex( queriedAccum.accumulated, - AccumulatorType.VBPos, - ), + AccumulatorType.VBPos + ) ); - accumPk = new AccumulatorPublicKey(hexToU8a(queriedAccum.publicKey.bytes)); + accumPk = new AccumulatorPublicKey(queriedAccum.publicKey.bytes.bytes); accumParams = new AccumulatorParams( - hexToU8a(queriedAccum.publicKey.params.bytes), + queriedAccum.publicKey.params.bytes.bytes ); // Witness created for member 3 @@ -263,101 +245,102 @@ describe('Prefilled positive accumulator', () => { const witness4 = await accumulator.membershipWitness( member4, keypair.secretKey, - accumState, + accumState ); expect( verifAccumulator.verifyMembershipWitness( member4, witness4, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Older witnesses need to be updated - accum = await dock.accumulatorModule.getAccumulator(accumulatorId, false); - const updates = await dock.accumulatorModule.getUpdatesFromBlock( + accum = await modules.accumulator.getAccumulator(accumulatorId); + const updates = await modules.accumulator.dockOnly.getUpdatesFromBlock( accumulatorId, - accum.lastModified, + accum.lastModified ); const additions = []; const removals = []; if (updates[0].additions !== null) { for (const a of updates[0].additions) { - additions.push(hexToU8a(a)); + additions.push(a); } } if (updates[0].removals !== null) { for (const a of updates[0].removals) { - removals.push(hexToU8a(a)); + removals.push(a); } } const queriedWitnessInfo = new VBWitnessUpdateInfo( - hexToU8a(updates[0].witnessUpdateInfo), + updates[0].witnessUpdateInfo.bytes ); witness1.updateUsingPublicInfoPostBatchUpdate( member1, additions, removals, - queriedWitnessInfo, + queriedWitnessInfo ); expect( verifAccumulator.verifyMembershipWitness( member1, witness1, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); witness3.updateUsingPublicInfoPostBatchUpdate( member3, additions, removals, - queriedWitnessInfo, + queriedWitnessInfo ); expect( verifAccumulator.verifyMembershipWitness( member3, witness3, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); }); - test('Witness update after several batch upgrades', async () => { - let queriedAccum = await dock.accumulatorModule.getAccumulator( + test("Witness update after several batch upgrades", async () => { + let queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); let verifAccumulator = PositiveAccumulator.fromAccumulated( AccumulatorModule.accumulatedFromHex( queriedAccum.accumulated, - AccumulatorType.VBPos, - ), + AccumulatorType.VBPos + ) ); const member = members[10]; let witness = await accumulator.membershipWitness( member, keypair.secretKey, - accumState, + accumState ); const accumPk = new AccumulatorPublicKey( - hexToU8a(queriedAccum.publicKey.bytes), + queriedAccum.publicKey.bytes.bytes ); const accumParams = new AccumulatorParams( - hexToU8a(queriedAccum.publicKey.params.bytes), + queriedAccum.publicKey.params.bytes.bytes ); expect( verifAccumulator.verifyMembershipWitness( member, witness, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); await waitForBlocks(dock.api, 2); @@ -369,25 +352,22 @@ describe('Prefilled positive accumulator', () => { accumulator.accumulated, [], removals1, - keypair.secretKey, + keypair.secretKey ); await accumulator.removeBatch(removals1, keypair.secretKey, accumState); const accumulated1 = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); const witUpdBytes1 = u8aToHex(witnessUpdInfo1.value); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated1, { removals: removals1.map((r) => u8aToHex(r)), witnessUpdateInfo: witUpdBytes1, }, - did, - pair, - { didModule: dock.didModule }, - false, + pair ); await waitForBlocks(dock.api, 5); @@ -397,25 +377,22 @@ describe('Prefilled positive accumulator', () => { accumulator.accumulated, [], removals2, - keypair.secretKey, + keypair.secretKey ); await accumulator.removeBatch(removals2, keypair.secretKey, accumState); const accumulated2 = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); const witUpdBytes2 = u8aToHex(witnessUpdInfo2.value); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated2, { removals: removals2.map((r) => u8aToHex(r)), witnessUpdateInfo: witUpdBytes2, }, - did, - pair, - { didModule: dock.didModule }, - false, + pair ); await waitForBlocks(dock.api, 5); @@ -425,32 +402,29 @@ describe('Prefilled positive accumulator', () => { accumulator.accumulated, [], removals3, - keypair.secretKey, + keypair.secretKey ); await accumulator.removeBatch(removals3, keypair.secretKey, accumState); const accumulated3 = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); const witUpdBytes3 = u8aToHex(witnessUpdInfo3.value); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated3, { removals: removals3.map((r) => u8aToHex(r)), witnessUpdateInfo: witUpdBytes3, }, - did, - pair, - { didModule: dock.didModule }, - false, + pair ); // Get a witness from the accumulator manager. This will be updated after the following updates. witness = await accumulator.membershipWitness( member, keypair.secretKey, - accumState, + accumState ); // The user should be told the block number from which he is supposed to update the witnesses from. It will be one block // ahead from where the last update was posted. @@ -464,25 +438,22 @@ describe('Prefilled positive accumulator', () => { accumulator.accumulated, [], removals4, - keypair.secretKey, + keypair.secretKey ); await accumulator.removeBatch(removals4, keypair.secretKey, accumState); const accumulated4 = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); const witUpdBytes4 = u8aToHex(witnessUpdInfo4.value); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated4, { removals: removals4.map((r) => u8aToHex(r)), witnessUpdateInfo: witUpdBytes4, }, - did, - pair, - { didModule: dock.didModule }, - false, + pair ); console.log(`Updated witness at block ${await getLastBlockNo(dock.api)}`); await waitForBlocks(dock.api, 5); @@ -492,38 +463,36 @@ describe('Prefilled positive accumulator', () => { accumulator.accumulated, [], removals5, - keypair.secretKey, + keypair.secretKey ); await accumulator.removeBatch(removals5, keypair.secretKey, accumState); const accumulated5 = AccumulatorModule.accumulatedAsHex( accumulator.accumulated, - AccumulatorType.VBPos, + AccumulatorType.VBPos ); const witUpdBytes5 = u8aToHex(witnessUpdInfo5.value); - await dock.accumulatorModule.updateAccumulator( + await modules.accumulator.updateAccumulator( accumulatorId, accumulated5, { removals: removals5.map((r) => u8aToHex(r)), witnessUpdateInfo: witUpdBytes5, }, - did, - pair, - { didModule: dock.didModule }, - false, + pair ); console.log(`Updated witness at block ${await getLastBlockNo(dock.api)}`); await waitForBlocks(dock.api, 5); - queriedAccum = await dock.accumulatorModule.getAccumulator( + queriedAccum = await modules.accumulator.getAccumulator( accumulatorId, true, + true ); verifAccumulator = PositiveAccumulator.fromAccumulated( AccumulatorModule.accumulatedFromHex( queriedAccum.accumulated, - AccumulatorType.VBPos, - ), + AccumulatorType.VBPos + ) ); // Old witness doesn't verify with new accumulator expect( @@ -531,8 +500,8 @@ describe('Prefilled positive accumulator', () => { member, witness, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(false); const oldWitness1 = new VBMembershipWitness(witness.value); @@ -540,12 +509,12 @@ describe('Prefilled positive accumulator', () => { const oldWitness3 = new VBMembershipWitness(witness.value); // Update witness by downloading necessary blocks and applying the updates if found - await dock.accumulatorModule.updateVbAccumulatorWitnessFromUpdatesInBlocks( + await modules.accumulator.updateWitness( accumulatorId, member, witness, blockNoToUpdateFrom, - queriedAccum.lastModified, + queriedAccum.lastModified ); // Updated witness verifies with new accumulator @@ -554,61 +523,61 @@ describe('Prefilled positive accumulator', () => { member, witness, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Test again with a batch size bigger than the total number of blocks - await dock.accumulatorModule.updateVbAccumulatorWitnessFromUpdatesInBlocks( + await modules.accumulator.updateWitness( accumulatorId, member, oldWitness1, blockNoToUpdateFrom, queriedAccum.lastModified, - queriedAccum.lastModified - blockNoToUpdateFrom + 10, + queriedAccum.lastModified - blockNoToUpdateFrom + 10 ); expect( verifAccumulator.verifyMembershipWitness( member, oldWitness1, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); // Test again with few other batch sizes - await dock.accumulatorModule.updateVbAccumulatorWitnessFromUpdatesInBlocks( + await modules.accumulator.updateWitness( accumulatorId, member, oldWitness2, blockNoToUpdateFrom, queriedAccum.lastModified, - 3, + 3 ); expect( verifAccumulator.verifyMembershipWitness( member, oldWitness2, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); - await dock.accumulatorModule.updateVbAccumulatorWitnessFromUpdatesInBlocks( + await modules.accumulator.updateWitness( accumulatorId, member, oldWitness3, blockNoToUpdateFrom, queriedAccum.lastModified, - 4, + 4 ); expect( verifAccumulator.verifyMembershipWitness( member, oldWitness3, accumPk, - accumParams, - ), + accumParams + ) ).toEqual(true); }, 60000); diff --git a/tests/integration/anoncreds/presentation.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/presentation.test.js similarity index 71% rename from tests/integration/anoncreds/presentation.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/presentation.test.js index c1cb3d45b..964db6218 100644 --- a/tests/integration/anoncreds/presentation.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/presentation.test.js @@ -1,37 +1,44 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { u8aToHex, stringToU8a } from '@polkadot/util'; -import b58 from 'bs58'; +import { u8aToHex, stringToU8a } from "@docknetwork/credential-sdk/utils/bytes"; +import b58 from "bs58"; import { BBDT16MacSecretKey, BoundCheckSnarkSetup, CredentialBuilder, initializeWasm, PresentationBuilder, -} from '@docknetwork/crypto-wasm-ts'; -import { DockAPI } from '../../../src'; +} from "@docknetwork/credential-sdk/crypto"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, Schemes, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; -import { registerNewDIDUsingPair } from '../helpers'; -import { getKeyDoc } from '../../../src/utils/vc/helpers'; -import { issueCredential, verifyPresentation } from '../../../src/utils/vc'; -import { DockResolver } from '../../../src/resolver'; +} from "../../test-constants"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { registerNewDIDUsingPair } from "../helpers"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { + issueCredential, + verifyPresentation, +} from "@docknetwork/credential-sdk/vc"; +import { DockResolver } from "@docknetwork/credential-sdk/resolver"; import { getResidentCardCredentialAndSchema, setupExternalSchema, -} from './utils'; +} from "./utils"; import { getKeyedProofsFromVerifiedPresentation, getJsonSchemasFromPresentation, -} from '../../../src/utils/vc/presentations'; -import defaultDocumentLoader from '../../../src/utils/vc/document-loader'; +} from "@docknetwork/credential-sdk/vc/presentations"; +import defaultDocumentLoader from "@docknetwork/credential-sdk/vc/document-loader"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockCoreModules } from "../../../src"; describe.each(Schemes)( - 'Presentation', + "Presentation", ({ Name, Module, @@ -42,7 +49,8 @@ describe.each(Schemes)( getModule, }) => { const dock = new DockAPI(); - const resolver = new DockResolver(dock); + const modules = new DockCoreModules(dock); + const resolver = new DockResolver(modules); let account; let did1; let pair1; @@ -50,7 +58,8 @@ describe.each(Schemes)( let didDocument; let chainModule; - const [credentialJSON, residentCardSchema] = getResidentCardCredentialAndSchema(Context); + const [credentialJSON, residentCardSchema] = + getResidentCardCredentialAndSchema(Context); beforeAll(async () => { await initializeWasm(); @@ -61,8 +70,8 @@ describe.each(Schemes)( account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); - pair1 = new DidKeypair(dock.keyring.addFromUri(randomAsHex(32)), 1); did1 = DockDid.random(); + pair1 = new DidKeypair([did1, 1], Ed25519Keypair.random()); await registerNewDIDUsingPair(dock, did1, pair1); keypair = CryptoKeyPair.generate({ @@ -70,30 +79,23 @@ describe.each(Schemes)( msgCount: 100, }); - if (Name !== 'BBDT16') { + if (Name !== "BBDT16") { chainModule = getModule(dock); const pk1 = Module.prepareAddPublicKey( - u8aToHex(keypair.publicKeyBuffer), - ); - await chainModule.addPublicKey( - pk1, - did1, - did1, - pair1, - { didModule: dock.did }, - false, + u8aToHex(keypair.publicKeyBuffer) ); + await chainModule.addPublicKey(null, pk1, did1, pair1); - didDocument = await dock.did.getDocument(did1); - const { publicKey } = didDocument; - expect(publicKey.length).toEqual(2); - expect(publicKey[1].type).toEqual(VerKey); - keypair.id = publicKey[1].id; + didDocument = (await modules.did.getDocument(did1)).toJSON(); + const { verificationMethod } = didDocument; + expect(verificationMethod.length).toEqual(2); + expect(verificationMethod[1].type).toEqual(VerKey); + keypair.id = verificationMethod[1].id; } else { // For KVAC, the public doesn't need to published as its not used in credential or presentation verification (except issuers). // But the signer still adds a key identifier in the credential to determine which key will be used for verification - keypair.id = 'my-key-id'; + keypair.id = "my-key-id"; } }, 30000); @@ -103,22 +105,22 @@ describe.each(Schemes)( for (let i = 0; i < presentation.spec.credentials.length; i++) { // Ensure verificationMethod & type is revealed always expect( - presentation.spec.credentials[i].revealedAttributes.proof, + presentation.spec.credentials[i].revealedAttributes.proof ).toBeDefined(); expect( - presentation.spec.credentials[i].revealedAttributes.proof, + presentation.spec.credentials[i].revealedAttributes.proof ).toHaveProperty( - 'verificationMethod', - credentials[i].proof.verificationMethod, + "verificationMethod", + credentials[i].proof.verificationMethod ); expect( - presentation.spec.credentials[0].revealedAttributes.proof, - ).toHaveProperty('type', credentials[i].proof.type); + presentation.spec.credentials[0].revealedAttributes.proof + ).toHaveProperty("type", credentials[i].proof.type); expect(presentation.spec.credentials[i].schema).toBeDefined(); expect(presentation.spec.credentials[i].sigType).toBeDefined(); expect(presentation.spec.credentials[i].version).toEqual( - CredentialBuilder.VERSION, + CredentialBuilder.VERSION ); } } @@ -126,10 +128,10 @@ describe.each(Schemes)( test(`from ${Name} credentials with external schema reference and embedded schema`, async () => { const [externalSchemaEncoded, schemaId] = await setupExternalSchema( residentCardSchema, - 'Resident Card Example', + "Resident Card Example", did1, pair1, - dock, + modules.blob ); const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); @@ -143,7 +145,7 @@ describe.each(Schemes)( issuerKey, unsignedCred, true, - defaultDocumentLoader(resolver), + defaultDocumentLoader(resolver) ); // This credential has embedded schema @@ -156,36 +158,36 @@ describe.each(Schemes)( const presentationInstance = new Presentation(); const idx = await presentationInstance.addCredentialToPresent( credential, - { resolver }, + { resolver } ); const idx2 = await presentationInstance.addCredentialToPresent( credential2, - { resolver }, + { resolver } ); await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.lprNumber', + "credentialSubject.lprNumber", ]); await presentationInstance.addAttributeToReveal(idx2, [ - 'credentialSubject.lprNumber', + "credentialSubject.lprNumber", ]); const presentation = await presentationInstance.createPresentation(); expect( - presentation.spec.credentials[0].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[0].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[0].revealedAttributes.credentialSubject, - ).toHaveProperty('lprNumber', 1234); + presentation.spec.credentials[0].revealedAttributes.credentialSubject + ).toHaveProperty("lprNumber", 1234); expect( - presentation.spec.credentials[1].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[1].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[1].revealedAttributes.credentialSubject, - ).toHaveProperty('lprNumber', 1234); + presentation.spec.credentials[1].revealedAttributes.credentialSubject + ).toHaveProperty("lprNumber", 1234); const schemas = getJsonSchemasFromPresentation(presentation, false); // For schema with external reference, it should be equal to the reference id (on-chain id here) @@ -199,23 +201,23 @@ describe.each(Schemes)( expect(verified).toEqual(true); const keyedProofs = getKeyedProofsFromVerifiedPresentation(presentation); - const isKvac = Name === 'BBDT16'; + const isKvac = Name === "BBDT16"; // Keyed proofs only exist for KVAC expect(keyedProofs.size).toEqual(isKvac ? 2 : 0); if (isKvac) { const sk = new BBDT16MacSecretKey(keypair.privateKeyBuffer); // eslint-disable-next-line jest/no-conditional-expect expect( - keyedProofs.get(0)?.credential?.proof.verify(sk).verified, + keyedProofs.get(0)?.credential?.proof.verify(sk).verified ).toEqual(true); // eslint-disable-next-line jest/no-conditional-expect expect( - keyedProofs.get(1)?.credential?.proof.verify(sk).verified, + keyedProofs.get(1)?.credential?.proof.verify(sk).verified ).toEqual(true); } }, 40000); - test('expect to reveal specified attributes', async () => { + test("expect to reveal specified attributes", async () => { const presentationInstance = new Presentation(); const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); const unsignedCred = { @@ -227,21 +229,21 @@ describe.each(Schemes)( const idx = await presentationInstance.addCredentialToPresent( credential, - { resolver }, + { resolver } ); await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.lprNumber', + "credentialSubject.lprNumber", ]); const presentation = await presentationInstance.createPresentation(); expect( - presentation.spec.credentials[0].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[0].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[0].revealedAttributes.credentialSubject, - ).toHaveProperty('lprNumber', 1234); + presentation.spec.credentials[0].revealedAttributes.credentialSubject + ).toHaveProperty("lprNumber", 1234); checkCommonRevealedFields(presentation, [credential]); @@ -249,19 +251,19 @@ describe.each(Schemes)( expect(verified).toEqual(true); const keyedProofs = getKeyedProofsFromVerifiedPresentation(presentation); - const isKvac = Name === 'BBDT16'; + const isKvac = Name === "BBDT16"; // Keyed proofs only exist for KVAC expect(keyedProofs.size).toEqual(isKvac ? 1 : 0); if (isKvac) { const sk = new BBDT16MacSecretKey(keypair.privateKeyBuffer); // eslint-disable-next-line jest/no-conditional-expect expect( - keyedProofs.get(0)?.credential?.proof.verify(sk).verified, + keyedProofs.get(0)?.credential?.proof.verify(sk).verified ).toEqual(true); } }, 30000); - test('expect to create presentation from multiple credentials', async () => { + test("expect to create presentation from multiple credentials", async () => { const presentationInstance = new Presentation(); const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); @@ -275,34 +277,34 @@ describe.each(Schemes)( const idx = await presentationInstance.addCredentialToPresent( credential, - { resolver }, + { resolver } ); const idx2 = await presentationInstance.addCredentialToPresent( credential2, - { resolver }, + { resolver } ); await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.lprNumber', + "credentialSubject.lprNumber", ]); await presentationInstance.addAttributeToReveal(idx2, [ - 'credentialSubject.familyName', + "credentialSubject.familyName", ]); const presentation = await presentationInstance.createPresentation(); expect( - presentation.spec.credentials[0].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[0].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[0].revealedAttributes.credentialSubject, - ).toHaveProperty('lprNumber', 1234); + presentation.spec.credentials[0].revealedAttributes.credentialSubject + ).toHaveProperty("lprNumber", 1234); expect( - presentation.spec.credentials[1].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[1].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[1].revealedAttributes.credentialSubject, - ).toHaveProperty('familyName', 'SMITH'); + presentation.spec.credentials[1].revealedAttributes.credentialSubject + ).toHaveProperty("familyName", "SMITH"); checkCommonRevealedFields(presentation, [credential, credential2]); @@ -310,8 +312,8 @@ describe.each(Schemes)( expect(verified).toEqual(true); }, 30000); - test('expect to range proofs', async () => { - const provingKeyId = 'provingKeyId'; + test("expect to range proofs", async () => { + const provingKeyId = "provingKeyId"; const pk = BoundCheckSnarkSetup(); const provingKey = pk.decompress(); const presentationInstance = new Presentation(); @@ -325,21 +327,21 @@ describe.each(Schemes)( const idx = await presentationInstance.addCredentialToPresent( credential, - { resolver }, + { resolver } ); await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.lprNumber', + "credentialSubject.lprNumber", ]); // Enforce issuance date to be between values presentationInstance.presBuilder.enforceBounds( idx, - 'issuanceDate', - new Date('2019-10-01'), - new Date('2020-01-01'), + "issuanceDate", + new Date("2019-10-01"), + new Date("2020-01-01"), provingKeyId, - provingKey, + provingKey ); const presentation = await presentationInstance.createPresentation(); @@ -350,18 +352,18 @@ describe.each(Schemes)( { min: 1569888000000, max: 1577836800000, - paramId: 'provingKeyId', - protocol: 'LegoGroth16', + paramId: "provingKeyId", + protocol: "LegoGroth16", }, ], }); expect( - presentation.spec.credentials[0].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[0].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[0].revealedAttributes.credentialSubject, - ).toHaveProperty('lprNumber', 1234); + presentation.spec.credentials[0].revealedAttributes.credentialSubject + ).toHaveProperty("lprNumber", 1234); checkCommonRevealedFields(presentation, [credential]); @@ -377,7 +379,7 @@ describe.each(Schemes)( expect(verified).toEqual(true); }, 60000); - test('expect to throw exception when attributes provided is not an array', async () => { + test("expect to throw exception when attributes provided is not an array", async () => { const presentationInstance = new Presentation(); const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); const unsignedCred = { @@ -388,7 +390,7 @@ describe.each(Schemes)( const idx = await presentationInstance.addCredentialToPresent( credential, - { resolver }, + { resolver } ); expect(() => { @@ -396,7 +398,7 @@ describe.each(Schemes)( }).toThrow(); }, 30000); - test('expect to create presentation with nonce', async () => { + test("expect to create presentation with nonce", async () => { const presentationInstance = new Presentation(); const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); @@ -409,22 +411,22 @@ describe.each(Schemes)( const idx = await presentationInstance.addCredentialToPresent( credential, - { resolver }, + { resolver } ); await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.lprNumber', + "credentialSubject.lprNumber", ]); const presentation = await presentationInstance.createPresentation({ - nonce: '1234', + nonce: "1234", }); - expect(presentation.nonce).toEqual(b58.encode(stringToU8a('1234'))); + expect(presentation.nonce).toEqual(b58.encode(stringToU8a("1234"))); expect( - presentation.spec.credentials[0].revealedAttributes, - ).toHaveProperty('credentialSubject'); + presentation.spec.credentials[0].revealedAttributes + ).toHaveProperty("credentialSubject"); expect( - presentation.spec.credentials[0].revealedAttributes.credentialSubject, - ).toHaveProperty('lprNumber', 1234); + presentation.spec.credentials[0].revealedAttributes.credentialSubject + ).toHaveProperty("lprNumber", 1234); const { verified } = await verifyPresentation(presentation, { resolver }); expect(verified).toEqual(true); @@ -433,5 +435,5 @@ describe.each(Schemes)( afterAll(async () => { await dock.disconnect(); }, 10000); - }, + } ); diff --git a/tests/integration/anoncreds/r1cs-circom.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/r1cs-circom.test.js similarity index 66% rename from tests/integration/anoncreds/r1cs-circom.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/r1cs-circom.test.js index f8be36947..f8b8737f4 100644 --- a/tests/integration/anoncreds/r1cs-circom.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/r1cs-circom.test.js @@ -1,5 +1,8 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { hexToU8a, stringToHex, u8aToHex } from '@polkadot/util'; +import { + hexToU8a, + stringToHex, + u8aToHex, +} from "@docknetwork/credential-sdk/utils/bytes"; import { Encoder, @@ -18,18 +21,22 @@ import { CircomInputs, encodeRevealedMsgs, MessageEncoder, -} from '@docknetwork/crypto-wasm-ts'; +} from "@docknetwork/credential-sdk/crypto"; -import { DockAPI } from '../../../src'; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, Schemes, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; -import { getWasmBytes, parseR1CSFile } from './utils'; -import { checkMapsEqual, registerNewDIDUsingPair } from '../helpers'; +} from "../../test-constants"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { getWasmBytes, parseR1CSFile } from "./utils"; +import { checkMapsEqual, registerNewDIDUsingPair } from "../helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; // Test for a scenario where a user wants to prove that his blood group is AB- without revealing the blood group. // Similar test can be written for other "not-equals" relations like user is not resident of certain city @@ -46,7 +53,7 @@ for (const { buildWitness, getModule, } of Schemes) { - const attrName = 'physical.bloodGroup'; + const attrName = "physical.bloodGroup"; describe(`${Name} Proving that blood group is not AB-`, () => { const dock = new DockAPI(); let account; @@ -56,7 +63,7 @@ for (const { let encoder; let encodedABNeg; - const label = stringToHex('My params'); + const label = stringToHex("My params"); const labelBytes = hexToU8a(label); let issuerSchemeKeypair; @@ -67,7 +74,7 @@ for (const { let wasm; let snarkPk; let snarkVk; - const isKvac = Name === 'BBDT16'; + const isKvac = Name === "BBDT16"; // Structure of credential that has the blood group attribute const attributesStruct = { @@ -81,37 +88,37 @@ for (const { gender: undefined, bloodGroup: undefined, }, - 'user-id': undefined, + "user-id": undefined, }; // 1st credential where blood group is AB+ and a satisfactory proof can be created const attributes1 = { - fname: 'John', - lname: 'Smith', + fname: "John", + lname: "Smith", verySensitive: { - email: 'john.smith@example.com', - SSN: '123-456789-0', + email: "john.smith@example.com", + SSN: "123-456789-0", }, physical: { - gender: 'male', - bloodGroup: 'AB+', + gender: "male", + bloodGroup: "AB+", }, - 'user-id': 'user:123-xyz-#', + "user-id": "user:123-xyz-#", }; // 2nd credential where blood group is AB- and its not acceptable so proof will fail const attributes2 = { - fname: 'Carol', - lname: 'Smith', + fname: "Carol", + lname: "Smith", verySensitive: { - email: 'carol.smith@example.com', - SSN: '233-456788-1', + email: "carol.smith@example.com", + SSN: "233-456788-1", }, physical: { - gender: 'female', - bloodGroup: 'AB-', + gender: "female", + bloodGroup: "AB-", }, - 'user-id': 'user:764-xyz-#', + "user-id": "user:764-xyz-#", }; beforeAll(async () => { @@ -122,26 +129,24 @@ for (const { account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); - issuerKeypair = new DidKeypair( - dock.keyring.addFromUri(randomAsHex(32)), - 1, - ); issuerDid = DockDid.random(); + issuerKeypair = new DidKeypair([issuerDid, 1], Ed25519Keypair.random()); await registerNewDIDUsingPair(dock, issuerDid, issuerKeypair); await initializeWasm(); // Setup encoder - const defaultEncoder = (v) => Signature.encodeMessageForSigningConstantTime( - Uint8Array.from(Buffer.from(v.toString(), 'utf-8')), - ); + const defaultEncoder = (v) => + Signature.encodeMessageForSigning( + Uint8Array.from(Buffer.from(v.toString(), "utf-8")) + ); encoder = new Encoder(undefined, defaultEncoder); - encodedABNeg = encoder.encodeDefault('AB-'); + encodedABNeg = encoder.encodeDefault("AB-"); // This should ideally be done by the verifier but the verifier can publish only the Circom program and // prover can check that the same R1CS and WASM are generated. - r1cs = await parseR1CSFile('not_equal_public.r1cs'); - wasm = getWasmBytes('not_equal_public.wasm'); + r1cs = await parseR1CSFile("not_equal_public.r1cs"); + wasm = getWasmBytes("not_equal_public.wasm"); // Message count shouldn't matter as `label` is known const sigParams = SignatureParams.generate(100, labelBytes); @@ -151,20 +156,13 @@ for (const { if (!isKvac) { const pk = Module.prepareAddPublicKey( - u8aToHex(issuerSchemeKeypair.publicKey.bytes), - ); - await getModule(dock).addPublicKey( - pk, - issuerDid, - issuerDid, - issuerKeypair, - { didModule: dock.didModule }, - false, + u8aToHex(issuerSchemeKeypair.publicKey.bytes) ); + await getModule(dock).addPublicKey(null, pk, issuerDid, issuerKeypair); } }, 10000); - test('Sign attributes, i.e. issue credentials', async () => { + test("Sign attributes, i.e. issue credentials", async () => { let verifParam; if (isKvac) { verifParam = issuerSchemeKeypair.sk; @@ -172,107 +170,109 @@ for (const { const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - false, + false ); - verifParam = new PublicKey(hexToU8a(queriedPk.bytes)); + verifParam = new PublicKey(queriedPk.bytes.bytes); } credential1 = Signature.signMessageObject( attributes1, issuerSchemeKeypair.sk, labelBytes, - encoder, + encoder ); expect( credential1.signature.verifyMessageObject( attributes1, verifParam, labelBytes, - encoder, - ).verified, + encoder + ).verified ).toBe(true); credential2 = Signature.signMessageObject( attributes2, issuerSchemeKeypair.sk, labelBytes, - encoder, + encoder ); expect( credential2.signature.verifyMessageObject( attributes2, verifParam, labelBytes, - encoder, - ).verified, + encoder + ).verified ).toBe(true); }); - it('verifier generates SNARk proving and verifying key', async () => { + it("verifier generates SNARk proving and verifying key", async () => { const pk = R1CSSnarkSetup.fromParsedR1CSFile(r1cs, 1); snarkPk = pk.decompress(); snarkVk = pk.getVerifyingKeyUncompressed(); }); - it('proof verifies when blood groups is not AB-', async () => { + it("proof verifies when blood groups is not AB-", async () => { expect(JSON.stringify(encodedABNeg)).not.toEqual( - JSON.stringify(credential1.encodedMessages[attrName]), + JSON.stringify(credential1.encodedMessages[attrName]) ); - await check(attributes1, credential1, 'John', true); + await check(attributes1, credential1, "John", true); }); - it('proof does not verify when blood groups is AB-', async () => { + it("proof does not verify when blood groups is AB-", async () => { expect(JSON.stringify(encodedABNeg)).toEqual( - JSON.stringify(credential2.encodedMessages[attrName]), + JSON.stringify(credential2.encodedMessages[attrName]) ); - await check(attributes2, credential2, 'Carol', false); + await check(attributes2, credential2, "Carol", false); }); async function check( credentialAttributesRaw, credential, expectedFirstName, - shouldProofVerify, + shouldProofVerify ) { let sigPk; if (!isKvac) { const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - false, + false ); - sigPk = new PublicKey(hexToU8a(queriedPk.bytes)); + sigPk = new PublicKey(queriedPk.bytes.bytes); } const revealedNames = new Set(); - revealedNames.add('fname'); + revealedNames.add("fname"); const sigParams = !isKvac ? SignatureParams.getSigParamsForMsgStructure( - attributesStruct, - labelBytes, - ) + attributesStruct, + labelBytes + ) : SignatureParams.getMacParamsForMsgStructure( - attributesStruct, - labelBytes, + attributesStruct, + labelBytes + ); + const [revealedMsgs, unrevealedMsgs, revealedMsgsRaw] = + getRevealedAndUnrevealed( + credentialAttributesRaw, + revealedNames, + encoder ); - const [revealedMsgs, unrevealedMsgs, revealedMsgsRaw] = getRevealedAndUnrevealed( - credentialAttributesRaw, - revealedNames, - encoder, - ); expect(revealedMsgsRaw).toEqual({ fname: expectedFirstName }); - const statement1 = !isKvac && 'adaptForLess' in sigPk - ? buildProverStatement( - sigParams, - sigPk.adaptForLess(sigParams.supportedMessageCount()), - revealedMsgs, - false, - ) - : buildProverStatement(sigParams, revealedMsgs, false); + const statement1 = + !isKvac && "adaptForLess" in sigPk + ? buildProverStatement( + sigParams, + sigPk.adaptForLess(sigParams.supportedMessageCount()), + revealedMsgs, + false + ) + : buildProverStatement(sigParams, revealedMsgs, false); const statement2 = Statement.r1csCircomProver(r1cs, wasm, snarkPk); const statementsProver = new Statements(); @@ -283,7 +283,7 @@ for (const { const witnessEq1 = new WitnessEqualityMetaStatement(); witnessEq1.addWitnessRef( sIdx1, - getIndicesForMsgNames([attrName], attributesStruct)[0], + getIndicesForMsgNames([attrName], attributesStruct)[0] ); witnessEq1.addWitnessRef(sIdx2, 0); @@ -297,12 +297,12 @@ for (const { const witness1 = buildWitness( credential.signature, unrevealedMsgs, - false, + false ); const inputs = new CircomInputs(); - inputs.setPrivateInput('in', credential.encodedMessages[attrName]); - inputs.setPublicInput('pub', encodedABNeg); + inputs.setPrivateInput("in", credential.encodedMessages[attrName]); + inputs.setPublicInput("pub", encodedABNeg); const witness2 = Witness.r1csCircomWitness(inputs); const witnesses = new Witnesses(); @@ -315,19 +315,19 @@ for (const { const revealedMsgsFromVerifier = encodeRevealedMsgs( revealedMsgsRaw, attributesStruct, - encoder, + encoder ); checkMapsEqual(revealedMsgs, revealedMsgsFromVerifier); const statement3 = !isKvac ? buildVerifierStatement( - sigParams, - 'adaptForLess' in sigPk - ? sigPk.adaptForLess(sigParams.supportedMessageCount()) - : sigPk, - revealedMsgsFromVerifier, - false, - ) + sigParams, + "adaptForLess" in sigPk + ? sigPk.adaptForLess(sigParams.supportedMessageCount()) + : sigPk, + revealedMsgsFromVerifier, + false + ) : buildVerifierStatement(sigParams, revealedMsgsFromVerifier, false); const pub = [ MessageEncoder.encodePositiveNumberForSigning(1), @@ -342,7 +342,7 @@ for (const { const witnessEq2 = new WitnessEqualityMetaStatement(); witnessEq2.addWitnessRef( sIdx3, - getIndicesForMsgNames([attrName], attributesStruct)[0], + getIndicesForMsgNames([attrName], attributesStruct)[0] ); witnessEq2.addWitnessRef(sIdx4, 0); @@ -351,12 +351,12 @@ for (const { const proofSpecVerifier = new ProofSpec( statementsVerifier, - metaStmtsVerifier, + metaStmtsVerifier ); expect(proofSpecVerifier.isValid()).toEqual(true); expect(proof.verify(proofSpecVerifier).verified).toEqual( - shouldProofVerify, + shouldProofVerify ); } diff --git a/tests/integration/anoncreds/saver-and-bound-check.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/saver-and-bound-check.test.js similarity index 71% rename from tests/integration/anoncreds/saver-and-bound-check.test.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/saver-and-bound-check.test.js index 1385c3579..ad48ecbd3 100644 --- a/tests/integration/anoncreds/saver-and-bound-check.test.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/saver-and-bound-check.test.js @@ -1,7 +1,9 @@ -import { randomAsHex } from '@polkadot/util-crypto'; import { - hexToU8a, stringToHex, stringToU8a, u8aToHex, -} from '@polkadot/util'; + hexToU8a, + stringToHex, + stringToU8a, + u8aToHex, +} from "@docknetwork/credential-sdk/utils/bytes"; import { Statement, @@ -18,18 +20,22 @@ import { QuasiProofSpec, BoundCheckSnarkSetup, initializeWasm, -} from '@docknetwork/crypto-wasm-ts'; +} from "@docknetwork/credential-sdk/crypto"; -import { DockAPI } from '../../../src'; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, Schemes, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; -import { getRevealedUnrevealed } from './utils'; -import { registerNewDIDUsingPair } from '../helpers'; +} from "../../test-constants"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { getRevealedUnrevealed } from "./utils"; +import { registerNewDIDUsingPair } from "../helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; for (const { Name, @@ -43,7 +49,7 @@ for (const { buildWitness, getModule, } of Schemes) { - const isKvac = Name === 'BBDT16'; + const isKvac = Name === "BBDT16"; const skipIfKvac = isKvac ? describe.skip : describe; skipIfKvac( `${Name} Complete demo of verifiable encryption using SAVER and bound check using LegoGroth16`, @@ -65,11 +71,11 @@ for (const { // User's attributes which will be signed by the issuer of the credential const attributes = [ - stringToU8a('John'), // First name - stringToU8a('Smith'), // Last name + stringToU8a("John"), // First name + stringToU8a("Smith"), // Last name 10000, // Salary - stringToU8a('New York'), // City - '129086521911', // SSN + stringToU8a("New York"), // City + "129086521911", // SSN ]; const attributeCount = attributes.length; @@ -84,7 +90,7 @@ for (const { } else if (i === boundedAttrIdx) { encoded.push(Signature.encodePositiveNumberForSigning(attrs[i])); } else { - encoded.push(Signature.encodeMessageForSigningConstantTime(attrs[i])); + encoded.push(Signature.encodeMessageForSigning(attrs[i])); } } return encoded; @@ -98,101 +104,92 @@ for (const { account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); + issuerDid = DockDid.random(); issuerKeypair = new DidKeypair( - dock.keyring.addFromUri(randomAsHex(32)), - 1, + [issuerDid, 1], + Ed25519Keypair.random(), + 1 ); - issuerDid = DockDid.random(); await registerNewDIDUsingPair(dock, issuerDid, issuerKeypair); + decryptorDid = DockDid.random(); decryptorKeypair = new DidKeypair( - dock.keyring.addFromUri(randomAsHex(32)), - 1, + [decryptorDid, 1], + Ed25519Keypair.random(), + 1 ); - decryptorDid = DockDid.random(); await registerNewDIDUsingPair(dock, decryptorDid, decryptorKeypair); await initializeWasm(); }, 20000); - test('Create params and keys', async () => { - const label = stringToHex('My params'); + test("Create params and keys", async () => { + const label = stringToHex("My params"); const sigParams = SignatureParams.generate( attributeCount, - hexToU8a(label), + hexToU8a(label) ); const bytes = u8aToHex(sigParams.toBytes()); - const params = Module.prepareAddParameters(bytes, undefined, label); - await getModule(dock).addParams( - params, + const params = Module.prepareAddParameters(bytes, label); + await getModule(dock).addParams(null, params, issuerDid, issuerKeypair); + const paramsWritten = await getModule(dock).getParams( issuerDid, - issuerKeypair, - { didModule: dock.didModule }, - false, + await getModule(dock).dockOnly.paramsCounter(issuerDid) ); - const paramsWritten = await getModule(dock).getLastParamsWritten(issuerDid); expect(paramsWritten.bytes).toEqual(params.bytes); expect(paramsWritten.label).toEqual(params.label); issuerSchemeKeypair = KeyPair.generate(sigParams); const pk = Module.prepareAddPublicKey( u8aToHex(issuerSchemeKeypair.publicKey.bytes), - undefined, - [issuerDid, 1], - ); - await getModule(dock).addPublicKey( - pk, - issuerDid, - issuerDid, - issuerKeypair, - { didModule: dock.didModule }, - false, + [issuerDid, 1] ); + await getModule(dock).addPublicKey(null, pk, issuerDid, issuerKeypair); }, 10000); - test('Sign attributes, i.e. issue credential', async () => { + test("Sign attributes, i.e. issue credential", async () => { const encodedAttrs = encodedAttributes(attributes); const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - true, + true ); const paramsVal = SignatureParams.valueFromBytes( - hexToU8a(queriedPk.params.bytes), + queriedPk.params.bytes.bytes ); const params = new SignatureParams( paramsVal, - hexToU8a(queriedPk.params.label), + queriedPk.params.label.bytes ); signature = Signature.generate( encodedAttrs, issuerSchemeKeypair.secretKey, params, - false, + false ); // User verifies the credential (signature) const result = signature.verify( encodedAttrs, - new PublicKey(hexToU8a(queriedPk.bytes)), + new PublicKey(queriedPk.bytes.bytes), params, - false, + false ); expect(result.verified).toEqual(true); }); - test('Setup for decryptor', async () => { + test("Setup for decryptor", async () => { encryptionGens = SaverEncryptionGens.generate(); [snarkPk, , encryptionKey] = SaverDecryptor.setup( encryptionGens, - chunkBitSize, + chunkBitSize ); }, 20000); - test('Encrypt attribute and prove verifiably encrypted', async () => { + test("Encrypt attribute and prove verifiably encrypted", async () => { // Verifier creates and shares with the prover const gens = SaverChunkedCommitmentKey.generate( - hexToU8a(stringToHex('some label')), + hexToU8a(stringToHex("some label")) ); const commGens = gens.decompress(); @@ -208,35 +205,36 @@ for (const { const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - true, + true ); const sigParams = new SignatureParams( - SignatureParams.valueFromBytes(hexToU8a(queriedPk.params.bytes)), + SignatureParams.valueFromBytes(queriedPk.params.bytes.bytes) ); - const sigPk = new PublicKey(hexToU8a(queriedPk.bytes)); + const sigPk = new PublicKey(queriedPk.bytes.bytes); const encodedAttrs = encodedAttributes(attributes); const revealedAttrIndices = new Set(); const [revealedAttrs, unrevealedAttrs] = getRevealedUnrevealed( encodedAttrs, - revealedAttrIndices, + revealedAttrIndices ); - const statement1 = 'adaptForLess' in sigPk - ? buildProverStatement( - sigParams, - sigPk.adaptForLess(sigParams.supportedMessageCount()), - revealedAttrs, - false, - ) - : buildProverStatement(sigParams, revealedAttrs, false); + const statement1 = + "adaptForLess" in sigPk + ? buildProverStatement( + sigParams, + sigPk.adaptForLess(sigParams.supportedMessageCount()), + revealedAttrs, + false + ) + : buildProverStatement(sigParams, revealedAttrs, false); const statement2 = Statement.saverProver( encGens, commGens, ek, pk, - chunkBitSize, + chunkBitSize ); const proverStatements = new Statements(); @@ -257,11 +255,11 @@ for (const { const proverProofSpec = new QuasiProofSpec( proverStatements, - metaStatements, + metaStatements ); const proof = CompositeProof.generateUsingQuasiProofSpec( proverProofSpec, - witnesses, + witnesses ); // Verifier only needs the verification key @@ -271,17 +269,17 @@ for (const { commGens, ek, vk, - chunkBitSize, + chunkBitSize ); const statement4 = !isKvac ? buildVerifierStatement( - sigParams, - 'adaptForLess' in sigPk - ? sigPk.adaptForLess(sigParams.supportedMessageCount()) - : sigPk, - revealedAttrs, - false, - ) + sigParams, + "adaptForLess" in sigPk + ? sigPk.adaptForLess(sigParams.supportedMessageCount()) + : sigPk, + revealedAttrs, + false + ) : buildVerifierStatement(sigParams, revealedAttrs, false); const verifierStatements = new Statements(); verifierStatements.add(statement4); @@ -289,14 +287,14 @@ for (const { const verifierProofSpec = new QuasiProofSpec( verifierStatements, - metaStatements, + metaStatements ); expect( - proof.verifyUsingQuasiProofSpec(verifierProofSpec).verified, + proof.verifyUsingQuasiProofSpec(verifierProofSpec).verified ).toEqual(true); }, 180000); - test('Prove bounded message', async () => { + test("Prove bounded message", async () => { // Verifier does setup and shares proving key with prover. This key does not need to be published on chain. const pk = BoundCheckSnarkSetup(); @@ -311,12 +309,12 @@ for (const { const queriedPk = await getModule(dock).getPublicKey( issuerDid, 2, - true, + true ); const sigParams = new SignatureParams( - SignatureParams.valueFromBytes(hexToU8a(queriedPk.params.bytes)), + SignatureParams.valueFromBytes(queriedPk.params.bytes.bytes) ); - const sigPk = new PublicKey(hexToU8a(queriedPk.bytes)); + const sigPk = new PublicKey(queriedPk.bytes.bytes); const encodedAttrs = encodedAttributes(attributes); @@ -324,21 +322,22 @@ for (const { revealedAttrIndices.add(0); const [revealedAttrs, unrevealedAttrs] = getRevealedUnrevealed( encodedAttrs, - revealedAttrIndices, + revealedAttrIndices ); - const statement1 = 'adaptForLess' in sigPk - ? buildProverStatement( - sigParams, - sigPk.adaptForLess(sigParams.supportedMessageCount()), - revealedAttrs, - false, - ) - : buildProverStatement(sigParams, revealedAttrs, false); + const statement1 = + "adaptForLess" in sigPk + ? buildProverStatement( + sigParams, + sigPk.adaptForLess(sigParams.supportedMessageCount()), + revealedAttrs, + false + ) + : buildProverStatement(sigParams, revealedAttrs, false); const statement2 = Statement.boundCheckLegoProver( min, max, - snarkProvingKey, + snarkProvingKey ); const proverStatements = new Statements(); proverStatements.add(statement1); @@ -352,7 +351,7 @@ for (const { const witness1 = buildWitness(signature, unrevealedAttrs, false); const witness2 = Witness.boundCheckLegoGroth16( - encodedAttrs[boundedAttrIdx], + encodedAttrs[boundedAttrIdx] ); const witnesses = new Witnesses(); witnesses.add(witness1); @@ -360,28 +359,28 @@ for (const { const proverProofSpec = new QuasiProofSpec( proverStatements, - metaStatements, + metaStatements ); const proof = CompositeProof.generateUsingQuasiProofSpec( proverProofSpec, - witnesses, + witnesses ); const snarkVerifyingKey = pk.getVerifyingKeyUncompressed(); const statement3 = Statement.boundCheckLegoVerifier( min, max, - snarkVerifyingKey, + snarkVerifyingKey ); const statement4 = !isKvac ? buildVerifierStatement( - sigParams, - 'adaptForLess' in sigPk - ? sigPk.adaptForLess(sigParams.supportedMessageCount()) - : sigPk, - revealedAttrs, - false, - ) + sigParams, + "adaptForLess" in sigPk + ? sigPk.adaptForLess(sigParams.supportedMessageCount()) + : sigPk, + revealedAttrs, + false + ) : buildVerifierStatement(sigParams, revealedAttrs, false); const verifierStatements = new Statements(); verifierStatements.add(statement4); @@ -389,16 +388,16 @@ for (const { const verifierProofSpec = new QuasiProofSpec( verifierStatements, - metaStatements, + metaStatements ); expect( - proof.verifyUsingQuasiProofSpec(verifierProofSpec).verified, + proof.verifyUsingQuasiProofSpec(verifierProofSpec).verified ).toEqual(true); }, 45000); afterAll(async () => { await dock.disconnect(); }, 10000); - }, + } ); } diff --git a/packages/dock-blockchain-modules/tests/integration/anoncreds/scheme.test.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/scheme.test.js new file mode 100644 index 000000000..21109bb47 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/scheme.test.js @@ -0,0 +1,312 @@ +import { + randomAsHex, + hexToU8a, + u8aToHex, + stringToHex, +} from "@docknetwork/credential-sdk/utils"; +import { initializeWasm } from "@docknetwork/credential-sdk/crypto"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { + FullNodeEndpoint, + TestAccountURI, + TestKeyringOpts, + Schemes, +} from "../../test-constants"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; + +import { registerNewDIDUsingPair } from "../helpers"; +import { OffchainSignaturePublicKeyValueWithParamsValue } from "@docknetwork/credential-sdk/types"; +import { DockCoreModules } from "../../../src"; + +const addParticipantIdIfNotPresent = (key) => { + if (!("participantId" in key)) { + key.participantId = null; + } + return key; +}; + +for (const { + Name, + Module, + getModule, + KeyPair, + SignatureParams, + VerKey, + getParamsByDid, + getPublicKeyWithParamsByStorageKey, + getPublicKeysByDid, +} of Schemes.slice(0, 1)) { + const skipIfKvac = Name === "BBDT16" ? describe.skip : describe; + skipIfKvac(`${Name} Module`, () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + let account; + let chainModule; + const chainModuleClass = Module; + + const seed1 = randomAsHex(32); + const seed2 = randomAsHex(32); + + const did1 = DockDid.random(); + const did2 = DockDid.random(); + + const pair1 = new DidKeypair([did1, 1], new Ed25519Keypair(seed1)); + const pair2 = new DidKeypair([did2, 1], new Ed25519Keypair(seed2)); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + chainModule = getModule(dock); + account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + + await registerNewDIDUsingPair(dock, did1, pair1); + await registerNewDIDUsingPair(dock, did2, pair2); + await initializeWasm(); + }, 20000); + + test("Can create new params", async () => { + let label = stringToHex("test-params-label"); + let params = SignatureParams.generate(10, hexToU8a(label)); + const bytes1 = u8aToHex(params.toBytes()); + const params1 = chainModuleClass.prepareAddParameters(bytes1, label); + await chainModule.addParams(null, params1, did1, pair1); + const paramsWritten1 = await chainModule.getParams( + did1, + await chainModule.dockOnly.paramsCounter(did1) + ); + expect(paramsWritten1.bytes).toEqual(params1.bytes); + expect(paramsWritten1.label).toEqual(params1.label); + const allParams = await getParamsByDid(dock.api, did1); + + expect(Object.values(allParams.toJSON())).toEqual([ + params1.value.toJSON(), + ]); + + const queriedParams1 = await chainModule.getParams(did1, 1); + expect(paramsWritten1.eq(queriedParams1)).toBe(true); + + params = SignatureParams.generate(20); + const bytes2 = u8aToHex(params.toBytes()); + const params2 = chainModuleClass.prepareAddParameters(bytes2); + await chainModule.addParams(null, params2, did2, pair2); + const paramsWritten2 = await chainModule.getParams( + did2, + await chainModule.dockOnly.paramsCounter(did2) + ); + expect(paramsWritten2.bytes).toEqual(params2.bytes); + expect(paramsWritten2.label).toBe(null); + + const queriedParams2 = await chainModule.getParams(did2, 1); + expect(paramsWritten2.eq(queriedParams2)).toBe(true); + + label = stringToHex("test-params-label-2"); + params = SignatureParams.generate(23, hexToU8a(label)); + const bytes3 = u8aToHex(params.toBytes()); + const params3 = chainModuleClass.prepareAddParameters(bytes3, label); + await chainModule.addParams(null, params3, did1, pair1); + const paramsWritten3 = await chainModule.getParams( + did1, + await chainModule.dockOnly.paramsCounter(did1) + ); + expect(paramsWritten3.bytes).toEqual(params3.bytes); + expect(paramsWritten3.label).toEqual(params3.label); + + const queriedParams3 = await chainModule.getParams(did1, 2); + expect(paramsWritten3.eq(queriedParams3)).toBe(true); + + const paramsByDid1 = [ + ...(await chainModule.getAllParamsByDid(did1)).values(), + ]; + expect(paramsByDid1[0].eq(paramsWritten1)).toBe(true); + expect(paramsByDid1[1].eq(paramsWritten3)).toBe(true); + + const paramsByDid2 = [ + ...(await chainModule.getAllParamsByDid(did2)).values(), + ]; + expect(paramsByDid2[0].eq(paramsWritten2)).toBe(true); + }, 30000); + + test("Can create public keys", async () => { + const params = SignatureParams.generate(5); + let keypair = KeyPair.generate(params); + const bytes1 = u8aToHex(keypair.publicKey.bytes); + const pk1 = chainModuleClass.prepareAddPublicKey(bytes1); + await chainModule.addPublicKey(null, pk1, did1, pair1); + const queriedPk1 = await chainModule.getPublicKey(did1, 2); + expect(queriedPk1.bytes).toEqual(pk1.bytes); + expect(queriedPk1.paramsRef).toBe(null); + + const queriedParams1 = await chainModule.getParams(did1, 1); + const params1Val = SignatureParams.valueFromBytes( + queriedParams1.bytes.bytes + ); + const params1 = new SignatureParams( + params1Val, + queriedParams1.label.bytes + ); + keypair = KeyPair.generate(params1); + const bytes2 = u8aToHex(keypair.publicKey.bytes); + const pk2 = chainModuleClass.prepareAddPublicKey(bytes2, [did1, 1]); + await chainModule.addPublicKey(null, pk2, did2, pair2); + const queriedPk2 = await chainModule.getPublicKey(did2, 2); + expect(queriedPk2.bytes).toEqual(pk2.bytes); + + expect(queriedPk2.paramsRef.eq([did1, 1])).toBe(true); + const keyWithParams = await getPublicKeyWithParamsByStorageKey(dock.api, [ + DockDid.from(did2).asDid, + 2, + ]); + const jsonKeyWithParams = keyWithParams.toJSON(); + addParticipantIdIfNotPresent(jsonKeyWithParams[0]); + expect(jsonKeyWithParams).toEqual( + new OffchainSignaturePublicKeyValueWithParamsValue( + queriedPk2.value, + queriedParams1.value + ).toJSON() + ); + + const queriedPk2WithParams = await chainModule.getPublicKey( + did2, + 2, + true + ); + expect(queriedPk2WithParams.params.eq(queriedParams1)).toBe(true); + + const queriedParams2 = await chainModule.getParams(did1, 2); + const params2Val = SignatureParams.valueFromBytes( + queriedParams2.bytes.bytes + ); + const params2 = new SignatureParams( + params2Val, + queriedParams2.label.bytes + ); + keypair = KeyPair.generate(params2); + const bytes3 = u8aToHex(keypair.publicKey.bytes); + const pk3 = chainModuleClass.prepareAddPublicKey(bytes3, [did1, 2]); + await chainModule.addPublicKey(null, pk3, did2, pair2); + + const queriedPk3 = await chainModule.getPublicKey(did2, 3); + expect(queriedPk3.bytes).toEqual(pk3.bytes); + expect(queriedPk3.paramsRef.eq([did1, 2])).toBe(true); + + const queriedPk3WithParams = await chainModule.getPublicKey( + did2, + 3, + true + ); + expect(queriedPk3WithParams.params.eq(queriedParams2)).toBe(true); + const allPks = await getPublicKeysByDid(dock.api, DockDid.from(did2)); + expect( + Object.values(allPks.toJSON()).map((keyWithParams) => { + addParticipantIdIfNotPresent(keyWithParams[0]); + return keyWithParams; + }) + ).toEqual([ + new OffchainSignaturePublicKeyValueWithParamsValue( + queriedPk2.value, + queriedParams1.value + ).toJSON(), + new OffchainSignaturePublicKeyValueWithParamsValue( + queriedPk3.value, + queriedParams2.value + ).toJSON(), + ]); + }, 30000); + + test("Get public keys with DID resolution", async () => { + const document1 = (await modules.did.getDocument(did1)).toJSON(); + expect(document1.verificationMethod.length).toEqual(2); + expect(document1.assertionMethod.length).toEqual(2); + expect(document1.verificationMethod[1].id.endsWith("#keys-2")).toEqual( + true + ); + expect(document1.verificationMethod[1].type).toEqual(VerKey); + expect(document1.assertionMethod[1].endsWith("#keys-2")).toEqual(true); + + const document2 = (await modules.did.getDocument(did2)).toJSON(); + expect(document2.verificationMethod.length).toEqual(3); + expect(document2.assertionMethod.length).toEqual(3); + expect(document2.verificationMethod[1].id.endsWith("#keys-2")).toEqual( + true + ); + expect(document2.verificationMethod[1].type).toEqual(VerKey); + expect(document2.verificationMethod[2].id.endsWith("#keys-3")).toEqual( + true + ); + expect(document2.verificationMethod[2].type).toEqual(VerKey); + expect(document2.assertionMethod[1].endsWith("#keys-2")).toEqual(true); + expect(document2.assertionMethod[2].endsWith("#keys-3")).toEqual(true); + }); + + test("Can remove public keys and params", async () => { + await chainModule.removePublicKey(2, did1, pair1); + const pk1 = await chainModule.getPublicKey(did1, 2); + expect(pk1).toEqual(null); + + const document1 = (await modules.did.getDocument(did1)).toJSON(); + expect(document1.verificationMethod.length).toEqual(1); + expect(document1.assertionMethod.length).toEqual(1); + expect(document1.verificationMethod[0].id.endsWith("#keys-1")).toEqual( + true + ); + expect(document1.verificationMethod[0].type).not.toEqual(VerKey); + expect(document1.assertionMethod[0].endsWith("#keys-1")).toEqual(true); + + await chainModule.removeParams(1, did1, pair1); + const params1 = await chainModule.getParams(did1, 1); + expect(params1).toEqual(null); + + await expect(chainModule.getPublicKey(did2, 2, true)).rejects.toThrow(); + + await chainModule.removePublicKey(2, did2, pair2); + const pk2 = await chainModule.getPublicKey(did2, 2); + expect(pk2).toEqual(null); + + let document2 = (await modules.did.getDocument(did2)).toJSON(); + expect(document2.verificationMethod.length).toEqual(2); + expect(document2.assertionMethod.length).toEqual(2); + expect(document2.verificationMethod[0].id.endsWith("#keys-1")).toEqual( + true + ); + expect(document2.verificationMethod[0].type).not.toEqual(VerKey); + expect(document2.assertionMethod[0].endsWith("#keys-1")).toEqual(true); + expect(document2.verificationMethod[1].id.endsWith("#keys-3")).toEqual( + true + ); + expect(document2.verificationMethod[1].type).toEqual(VerKey); + expect(document2.assertionMethod[1].endsWith("#keys-3")).toEqual(true); + + await chainModule.removePublicKey(3, did2, pair2); + const pk3 = await chainModule.getPublicKey(did2, 3); + expect(pk3).toEqual(null); + + document2 = (await modules.did.getDocument(did2)).toJSON(); + expect(document2.verificationMethod.length).toEqual(1); + expect(document2.assertionMethod.length).toEqual(1); + expect(document2.verificationMethod[0].id.endsWith("#keys-1")).toEqual( + true + ); + expect(document2.verificationMethod[0].type).not.toEqual(VerKey); + expect(document2.assertionMethod[0].endsWith("#keys-1")).toEqual(true); + + await chainModule.removeParams(2, did1, pair1); + const params2 = await chainModule.getParams(did1, 2); + expect(params2).toEqual(null); + + await chainModule.removeParams(1, did2, pair2); + const params3 = await chainModule.getParams(did2, 1); + expect(params3).toEqual(null); + }, 50000); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + }); +} diff --git a/tests/integration/anoncreds/utils.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/utils.js similarity index 52% rename from tests/integration/anoncreds/utils.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/utils.js index 3cfd4e33a..504777a4a 100644 --- a/tests/integration/anoncreds/utils.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/utils.js @@ -1,10 +1,9 @@ -import * as path from 'path'; -import * as r1csf from 'r1csfile'; -import * as fs from 'fs'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { stringToHex } from '@polkadot/util'; -import stringify from 'json-stringify-deterministic'; -import { blobHexIdToQualified, DockBlobIdByteSize } from '../../../src/modules/blob'; +import * as path from "path"; +import * as r1csf from "r1csfile"; +import * as fs from "fs"; +import { stringToHex } from "@docknetwork/credential-sdk/utils"; +import stringify from "json-stringify-deterministic"; +import { DockBlobId } from "@docknetwork/credential-sdk/types"; /** * Given messages and indices to reveal, returns 2 maps, one for revealed messages and one for unrevealed @@ -27,7 +26,7 @@ export function getRevealedUnrevealed(messages, revealedIndices) { } export function circomArtifactPath(fileName) { - return `${path.resolve('./')}/tests/integration/anoncreds/circom/${fileName}`; + return `${path.resolve("./")}/tests/integration/anoncreds/circom/${fileName}`; } export function getWasmBytes(fileName) { @@ -50,14 +49,20 @@ export async function parseR1CSFile(r1csName) { * @param dock * @returns {Promise<[{id: string, type: string},{$schema: string, title, type: string, $id: string},string]>} */ -export async function setupExternalSchema(fullSchema, title, did, pair, dock) { - const blobId = randomAsHex(DockBlobIdByteSize); - const qualifiedBlobId = blobHexIdToQualified(blobId); +export async function setupExternalSchema( + fullSchema, + title, + did, + pair, + blobModule +) { + const blobId = DockBlobId.random(); + const qualifiedBlobId = String(blobId); const schemaExternal = { - $schema: 'http://json-schema.org/draft-07/schema#', + $schema: "http://json-schema.org/draft-07/schema#", $id: qualifiedBlobId, title, - type: 'object', + type: "object", }; const blobStr = JSON.stringify(fullSchema); @@ -65,39 +70,42 @@ export async function setupExternalSchema(fullSchema, title, did, pair, dock) { id: blobId, blob: stringToHex(blobStr), }; - await dock.blob.new(blob, did, pair, { didModule: dock.didModule }, false); + await blobModule.new(blob, did, pair); - return [{ - id: qualifiedBlobId, - type: 'JsonSchemaValidator2018', - details: stringify({ - jsonSchema: schemaExternal, - }), - }, blobHexIdToQualified(blobId)]; + return [ + { + id: qualifiedBlobId, + type: "JsonSchemaValidator2018", + details: stringify({ + jsonSchema: schemaExternal, + }), + }, + qualifiedBlobId, + ]; } export function getResidentCardCredentialAndSchema(context) { - const id = 'https://ld.dock.io/examples/resident-card-schema.json'; + const id = "https://ld.dock.io/examples/resident-card-schema.json"; const residentCardSchema = { - $schema: 'http://json-schema.org/draft-07/schema#', + $schema: "http://json-schema.org/draft-07/schema#", $id: id, - title: 'Resident Card Example', - type: 'object', + title: "Resident Card Example", + type: "object", properties: { credentialSubject: { - type: 'object', + type: "object", properties: { givenName: { - title: 'Given Name', - type: 'string', + title: "Given Name", + type: "string", }, familyName: { - title: 'Family Name', - type: 'string', + title: "Family Name", + type: "string", }, lprNumber: { - title: 'LPR Number', - type: 'integer', + title: "LPR Number", + type: "integer", minimum: 0, }, }, @@ -108,29 +116,29 @@ export function getResidentCardCredentialAndSchema(context) { const encodedSchema = { id, - type: 'JsonSchemaValidator2018', + type: "JsonSchemaValidator2018", details: stringify({ jsonSchema: residentCardSchema }), }; const credentialJSON = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://w3id.org/citizenship/v1', + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/citizenship/v1", context, ], - id: 'https://issuer.oidp.uscis.gov/credentials/83627465', - type: ['VerifiableCredential', 'PermanentResidentCard'], + id: "https://issuer.oidp.uscis.gov/credentials/83627465", + type: ["VerifiableCredential", "PermanentResidentCard"], credentialSchema: encodedSchema, - identifier: '83627465', - name: 'Permanent Resident Card', - description: 'Government of Example Permanent Resident Card.', - issuanceDate: '2019-12-03T12:19:52Z', - expirationDate: '2029-12-03T12:19:52Z', + identifier: "83627465", + name: "Permanent Resident Card", + description: "Government of Example Permanent Resident Card.", + issuanceDate: "2019-12-03T12:19:52Z", + expirationDate: "2029-12-03T12:19:52Z", credentialSubject: { - id: 'did:example:b34ca6cd37bbf23', - type: ['PermanentResident', 'Person'], - givenName: 'JOHN', - familyName: 'SMITH', + id: "did:example:b34ca6cd37bbf23", + type: ["PermanentResident", "Person"], + givenName: "JOHN", + familyName: "SMITH", lprNumber: 1234, }, }; diff --git a/tests/integration/anoncreds/wallet-util.js b/packages/dock-blockchain-modules/tests/integration/anoncreds/wallet-util.js similarity index 65% rename from tests/integration/anoncreds/wallet-util.js rename to packages/dock-blockchain-modules/tests/integration/anoncreds/wallet-util.js index 34538bc1b..2ffc9af30 100644 --- a/tests/integration/anoncreds/wallet-util.js +++ b/packages/dock-blockchain-modules/tests/integration/anoncreds/wallet-util.js @@ -1,19 +1,18 @@ -import b58 from 'bs58'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; -import { generateEcdsaSecp256k1Keypair } from '../../../src/utils/misc'; -import Bls12381G2KeyPairDock2022 from '../../../src/utils/vc/crypto/Bls12381G2KeyPairDock2022'; +import b58 from "bs58"; +import { u8aToHex } from "@docknetwork/credential-sdk/utils"; +import Bls12381G2KeyPairDock2022 from "@docknetwork/credential-sdk/vc/crypto/Bls12381G2KeyPairDock2022"; +import { Secp256k1Keypair } from "@docknetwork/credential-sdk/keypairs"; function createSecp256k1Keypair(privateKeyHex) { const pk = privateKeyHex || randomAsHex(32); - const kp = generateEcdsaSecp256k1Keypair(pk); + const kp = new Secp256k1Keypair(pk); kp.pk = pk; return kp; } const docToKeyMap = { - Sr25519VerificationKey2020: 'sr25519', - Ed25519VerificationKey2018: 'ed25519', + Sr25519VerificationKey2020: "sr25519", + Ed25519VerificationKey2018: "ed25519", }; export function keyDocToKeypair(keyDoc, dock) { @@ -28,9 +27,9 @@ export function keyDocToKeypair(keyDoc, dock) { const privateKeyEncoded = privateKeyBase58 || privateKeyMultibase.substr(1); const privateKeyBytes = b58.decode(privateKeyEncoded); - if (type === 'EcdsaSecp256k1VerificationKey2019') { + if (type === "EcdsaSecp256k1VerificationKey2019") { return createSecp256k1Keypair(u8aToHex(privateKeyBytes)); - } else if (type === 'Bls12381G2VerificationKeyDock2022') { + } else if (type === "Bls12381G2VerificationKeyDock2022") { return new Bls12381G2KeyPairDock2022(keyDoc); } else { const publicKeyEncoded = publicKeyBase58 || publicKeyMultibase.substr(1); @@ -45,7 +44,7 @@ export function keyDocToKeypair(keyDoc, dock) { secretKey: privateKeyBytes, }, {}, - keyType, + keyType ); } } diff --git a/packages/dock-blockchain-modules/tests/integration/blob.test.js b/packages/dock-blockchain-modules/tests/integration/blob.test.js new file mode 100644 index 000000000..ca5276e37 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/blob.test.js @@ -0,0 +1,151 @@ +import { + u8aToString, + u8aToHex, + randomAsHex, +} from "@docknetwork/credential-sdk/utils"; + +import { DockAPI } from "@docknetwork/dock-blockchain-api"; + +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { + FullNodeEndpoint, + TestKeyringOpts, + TestAccountURI, +} from "../test-constants"; +import { registerNewDIDUsingPair } from "./helpers"; +import { + DockBlobId, + BlobWithId, + Blob, +} from "@docknetwork/credential-sdk/types"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockCoreModules } from "../../src"; + +let account; +let pair; +const dockDID = DockDid.random(); +let blobId; + +function errorInResult(result) { + try { + return result.events[0].event.data[0].toJSON().Module.error === 1; + } catch (e) { + return false; + } +} + +describe("Blob Module", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + // Generate first key with this seed. The key type is Sr25519 + const firstKeySeed = randomAsHex(32); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + pair = new DidKeypair([dockDID, 1], new Ed25519Keypair(firstKeySeed)); + await registerNewDIDUsingPair(dock, DockDid.from(dockDID), pair); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + beforeEach(async () => { + blobId = DockBlobId.random(); + }, 30000); + + test("Can create and read a JSON Blob.", async () => { + const blobJSON = new Blob({ + jsonBlob: true, + }); + const blob = new BlobWithId(blobId, blobJSON); + const result = await modules.blob.new(blob, dockDID, pair); + + expect(!!result).toBe(true); + + const chainBlob = await modules.blob.get(blobId); + expect(!!chainBlob).toBe(true); + expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); + expect(chainBlob[1]).toEqual(blobJSON); + }, 30000); + + test("Can create and read a string Blob.", async () => { + const blobHex = "my string"; + const blob = new BlobWithId(blobId, blobHex); + const result = await modules.blob.new(blob, dockDID, pair); + + expect(!!result).toBe(true); + + const chainBlob = await modules.blob.get(blobId); + expect(!!chainBlob).toBe(true); + expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); + expect(u8aToString(chainBlob[1])).toEqual(blobHex); + }, 30000); + + test("Can create and read a hex Blob.", async () => { + const blobHex = randomAsHex(32); + const blob = new BlobWithId(blobId, blobHex); + + const result = await modules.blob.new(blob, dockDID, pair); + + expect(!!result).toBe(true); + + const chainBlob = await modules.blob.get(blobId); + expect(!!chainBlob).toBe(true); + expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); + expect(u8aToHex(chainBlob[1])).toEqual(blobHex); + }, 30000); + + test("Can create and read a Vector Blob.", async () => { + const blobVect = new Uint8Array([1, 2, 3]); + const blob = new BlobWithId(blobId, blobVect); + + const result = await modules.blob.new(blob, dockDID, pair); + + expect(!!result).toBe(true); + + const chainBlob = await modules.blob.get(blobId); + expect(!!chainBlob).toBe(true); + expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); + expect([...chainBlob[1]]).toEqual([...blobVect]); + }, 30000); + + test("Fails to write blob with size greater than allowed.", async () => { + const blobHex = randomAsHex(8193); // Max size is 1024 + const blob = new BlobWithId(blobId, blobHex); + await expect(modules.blob.new(blob, dockDID, pair)).rejects.toThrow(); + + await expect(modules.blob.get(blobId)).rejects.toThrowError( + "does not exist" + ); + }, 30000); + + test("Fails to write blob with id already used.", async () => { + const blobHexFirst = randomAsHex(12); + let blob = new BlobWithId(blobId, blobHexFirst); + const resultFirst = await modules.blob.new(blob, dockDID, pair); + + expect(!!resultFirst).toBe(true); + expect(errorInResult(resultFirst)).toBe(false); + + blob = new BlobWithId(blobId, randomAsHex(123)); + + await expect(modules.blob.new(blob, dockDID, pair)).rejects.toThrow(); + }, 60000); + + test("Should throw error when cannot read blob with given id from chain.", async () => { + const nonExistentBlobId = DockBlobId.random(); + await expect(modules.blob.get(nonExistentBlobId)).rejects.toThrowError( + "does not exist" + ); + }, 30000); +}); diff --git a/packages/dock-blockchain-modules/tests/integration/did/controllers.test.js b/packages/dock-blockchain-modules/tests/integration/did/controllers.test.js new file mode 100644 index 000000000..403252ec2 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/did/controllers.test.js @@ -0,0 +1,315 @@ +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; +import { NoDIDError } from "@docknetwork/credential-sdk/modules"; +import { + FullNodeEndpoint, + TestAccountURI, + TestKeyringOpts, +} from "../../test-constants"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { + DockDid, + DidKey, + VerificationRelationship, +} from "@docknetwork/credential-sdk/types"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { checkVerificationMethods } from "../helpers"; +import { DockCoreModules } from "../../../src"; + +describe("DID controllers", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + const dockDid1 = DockDid.random(); + + // This DID will be controlled by itself and dockDid1 + const dockDid2 = DockDid.random(); + + // This DID will not control itself but will be controlled by dockDid1 and dockDid2 + const dockDid3 = DockDid.random(); + + const seed1 = randomAsHex(32); + const seed2 = randomAsHex(32); + const seed3 = randomAsHex(32); + const seed4 = randomAsHex(32); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + test("Create self controlled DIDs", async () => { + const pair1 = new Ed25519Keypair(seed1); + const publicKey1 = pair1.publicKey(); + const verRels1 = new VerificationRelationship(); + const didKey1 = new DidKey(publicKey1, verRels1); + await modules.did.dockOnly.send.newOnchain(dockDid1, [didKey1], [], false); + + const pair2 = new Ed25519Keypair(seed2); + const publicKey2 = pair2.publicKey(); + const verRels2 = new VerificationRelationship(); + const didKey2 = new DidKey(publicKey2, verRels2); + await modules.did.dockOnly.send.newOnchain( + dockDid2, + [didKey2], + [dockDid1], + false + ); + + const didDetail1 = await modules.did.dockOnly.getOnchainDidDetail( + dockDid1.asDid + ); + expect(didDetail1.lastKeyId).toBe(1); + expect(didDetail1.activeControllerKeys).toBe(1); + expect(didDetail1.activeControllers).toBe(1); + await expect( + modules.did.dockOnly.isController(dockDid1, dockDid1) + ).resolves.toEqual(true); + + const didDetail2 = await modules.did.dockOnly.getOnchainDidDetail( + dockDid2.asDid + ); + expect(didDetail2.lastKeyId).toBe(1); + expect(didDetail2.activeControllerKeys).toBe(1); + expect(didDetail2.activeControllers).toBe(2); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid2) + ).resolves.toEqual(true); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid1) + ).resolves.toEqual(true); + + for (const [newSeed, signer, pair, keyCount] of [ + [seed3, dockDid1, pair1, 2], + [seed4, dockDid2, pair2, 3], + ]) { + const newPair = new Ed25519Keypair(newSeed); + const verRels = new VerificationRelationship(); + verRels.setAssertion(); + const didKey = DidKey.fromKeypair(newPair, verRels); + + await modules.did.dockOnly.addKeys( + [didKey], + dockDid2, + new DidKeypair([signer, 1], pair) + ); + const didDetail = await modules.did.dockOnly.getOnchainDidDetail( + dockDid2.asDid + ); + expect(didDetail.lastKeyId).toBe(keyCount); + expect(didDetail.activeControllerKeys).toBe(1); + expect(didDetail.activeControllers).toBe(2); + } + }, 60000); + + test("Get DID documents", async () => { + const doc1 = (await modules.did.getDocument(dockDid1)).toJSON(); + expect(doc1.controller.length).toEqual(1); + + checkVerificationMethods(dockDid1, doc1, 1, 0); + + expect(doc1.authentication.length).toEqual(1); + expect(doc1.authentication[0]).toEqual(`${dockDid1}#keys-1`); + expect(doc1.assertionMethod.length).toEqual(1); + expect(doc1.assertionMethod[0]).toEqual(`${dockDid1}#keys-1`); + expect(doc1.capabilityInvocation.length).toEqual(1); + expect(doc1.capabilityInvocation[0]).toEqual(`${dockDid1}#keys-1`); + + const doc2 = (await modules.did.getDocument(dockDid2)).toJSON(); + expect(doc2.controller.length).toEqual(2); + + checkVerificationMethods(dockDid2, doc2, 3, 0); + checkVerificationMethods(dockDid2, doc2, 3, 1); + checkVerificationMethods(dockDid2, doc2, 3, 2); + + expect(doc2.authentication.length).toEqual(1); + expect(doc2.authentication[0]).toEqual(`${dockDid2}#keys-1`); + expect(doc2.assertionMethod.length).toEqual(3); + expect(doc2.assertionMethod[0]).toEqual(`${dockDid2}#keys-1`); + expect(doc2.assertionMethod[1]).toEqual(`${dockDid2}#keys-2`); + expect(doc2.assertionMethod[2]).toEqual(`${dockDid2}#keys-3`); + expect(doc2.capabilityInvocation.length).toEqual(1); + expect(doc2.capabilityInvocation[0]).toEqual(`${dockDid2}#keys-1`); + }, 10000); + + test("Create DID controlled by other", async () => { + await modules.did.dockOnly.send.newOnchain(dockDid3, [], [dockDid1], false); + + const didDetail1 = await modules.did.dockOnly.getOnchainDidDetail( + dockDid3.asDid + ); + expect(didDetail1.lastKeyId).toBe(0); + expect(didDetail1.activeControllerKeys).toBe(0); + expect(didDetail1.activeControllers).toBe(1); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid3) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid1) + ).resolves.toEqual(true); + }); + + test("Get DID document", async () => { + const doc3 = (await modules.did.getDocument(dockDid3)).toJSON(); + expect(doc3.controller.length).toEqual(1); + checkVerificationMethods(dockDid3, doc3, 0); + expect(doc3.authentication.length).toBe(0); + expect(doc3.assertionMethod.length).toBe(0); + expect(doc3.capabilityInvocation.length).toBe(0); + }, 10000); + + test("Add keys and more controllers to a DID by its other controller", async () => { + const pair1 = new DidKeypair([dockDid1, 1], new Ed25519Keypair(seed1)); + + // Add key to the DID using its controller + const pair3 = new Ed25519Keypair(seed3); + const publicKey1 = pair3.publicKey(); + const verRels1 = new VerificationRelationship(); + verRels1.setAuthentication(); + const didKey3 = new DidKey(publicKey1, verRels1); + + await modules.did.dockOnly.addKeys([didKey3], dockDid3, pair1); + + let didDetail = await modules.did.dockOnly.getOnchainDidDetail( + dockDid3.asDid + ); + expect(didDetail.lastKeyId).toBe(1); + expect(didDetail.activeControllerKeys).toBe(0); + expect(didDetail.activeControllers).toBe(1); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid3) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid1) + ).resolves.toEqual(true); + + const dk1 = await modules.did.dockOnly.getDidKey(dockDid3, 1); + expect(dk1.publicKey).toEqual(publicKey1); + expect(dk1.verRels.isAuthentication()).toEqual(true); + expect(dk1.verRels.isAssertion()).toEqual(false); + expect(dk1.verRels.isCapabilityInvocation()).toEqual(false); + expect(dk1.verRels.isKeyAgreement()).toEqual(false); + + // Add another controller to the DID using its existing controller + await modules.did.dockOnly.addControllers([dockDid2], dockDid3, pair1); + + didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid3.asDid); + expect(didDetail.lastKeyId).toBe(1); + expect(didDetail.activeControllerKeys).toBe(0); + expect(didDetail.activeControllers).toBe(2); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid3) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid1) + ).resolves.toEqual(true); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid2) + ).resolves.toEqual(true); + }); + + test("Get DID document after update", async () => { + const doc3 = (await modules.did.getDocument(dockDid3)).toJSON(); + expect(doc3.controller.length).toEqual(2); + // expect(doc3.verificationMethod.length).toEqual(1); + checkVerificationMethods(dockDid3, doc3, 1, 0); + expect(doc3.authentication.length).toEqual(1); + expect(doc3.authentication[0]).toEqual(`${dockDid3}#keys-1`); + expect(doc3.assertionMethod.length).toBe(0); + expect(doc3.capabilityInvocation.length).toBe(0); + }, 10000); + + test("Remove existing controllers from a DID by its controller", async () => { + const pair2 = new DidKeypair([dockDid2, 1], new Ed25519Keypair(seed2)); + await modules.did.dockOnly.removeControllers([dockDid1], dockDid3, pair2); + + const didDetail = await modules.did.dockOnly.getOnchainDidDetail( + dockDid3.asDid + ); + expect(didDetail.lastKeyId).toBe(1); + expect(didDetail.activeControllerKeys).toBe(0); + expect(didDetail.activeControllers).toBe(1); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid3) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid1) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid2) + ).resolves.toEqual(true); + }); + + test("Remove DID using its controller", async () => { + const pair2 = new DidKeypair([dockDid2, 1], new Ed25519Keypair(seed2)); + await modules.did.removeDocument(dockDid3, pair2); + await expect(modules.did.getDocument(dockDid3)).rejects.toThrow(NoDIDError); + await expect( + modules.did.dockOnly.getOnchainDidDetail(dockDid3.asDid) + ).rejects.toThrow(NoDIDError); + await expect(modules.did.dockOnly.getDidKey(dockDid3, 1)).rejects.toThrow(); + await expect( + modules.did.dockOnly.isController(dockDid3, dockDid2) + ).resolves.toEqual(false); + }); + + test("Add and remove multiple controllers", async () => { + const pair1 = new DidKeypair([dockDid1, 1], new Ed25519Keypair(seed1)); + const pair2 = new DidKeypair([dockDid2, 1], new Ed25519Keypair(seed2)); + + const dockDid4 = DockDid.random(); + + await modules.did.dockOnly.addControllers( + [dockDid3, dockDid4], + dockDid2, + pair1 + ); + + let didDetail = await modules.did.dockOnly.getOnchainDidDetail( + dockDid2.asDid + ); + expect(didDetail.activeControllers).toBe(4); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid1) + ).resolves.toEqual(true); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid2) + ).resolves.toEqual(true); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid3) + ).resolves.toEqual(true); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid4) + ).resolves.toEqual(true); + + await modules.did.dockOnly.removeControllers( + [dockDid1, dockDid3, dockDid4], + dockDid2, + pair2 + ); + didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid2.asDid); + expect(didDetail.activeControllers).toBe(1); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid1) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid2) + ).resolves.toEqual(true); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid3) + ).resolves.toEqual(false); + await expect( + modules.did.dockOnly.isController(dockDid2, dockDid4) + ).resolves.toEqual(false); + }); +}); diff --git a/packages/dock-blockchain-modules/tests/integration/did/did-basic.test.js b/packages/dock-blockchain-modules/tests/integration/did/did-basic.test.js new file mode 100644 index 000000000..b77872cd6 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/did/did-basic.test.js @@ -0,0 +1,195 @@ +import { + DockDid, + VerificationRelationship, + DidKey, +} from "@docknetwork/credential-sdk/types"; +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; +import { + NoDIDError, + NoOffchainDIDError, +} from "@docknetwork/credential-sdk/modules"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; + +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { DockCoreModules } from "../../../src"; + +import { + FullNodeEndpoint, + TestKeyringOpts, + TestAccountURI, +} from "../../test-constants"; +import { checkVerificationMethods } from "../helpers"; +import { + DIDDocument, + ServiceEndpoint, +} from "@docknetwork/credential-sdk/types"; + +describe("Basic DID tests", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + // Generate a random DID + const dockDid = DockDid.random(); + + // Generate first key with this seed. The key type is Sr25519 + const seed = randomAsHex(32); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + test("Has keyring and account", () => { + expect(!!dock.keyring).toBe(true); + expect(!!dock.account).toBe(true); + }); + + test("Can create and update document", async () => { + const did = DockDid.random(); + + const pair = new Ed25519Keypair(seed); + const publicKey = pair.publicKey(); + + const verRels = new VerificationRelationship(); + const didKey = new DidKey(publicKey, verRels); + + const doc = DIDDocument.create(did, [didKey], [did]); + + await modules.did.createDocument(doc); + expect((await modules.did.getDocument(did)).toJSON()).toEqual(doc.toJSON()); + + const pair2 = Ed25519Keypair.random(); + const didKey2 = new DidKey(pair2.publicKey(), verRels); + + const service1 = new ServiceEndpoint("LinkedDomains", [ + "ServiceEndpoint#1", + ]); + + doc + .addServiceEndpoint([did, "service1"], service1) + .addKey([did, 2], didKey2) + .removeKey([did, 1]); + + await modules.did.updateDocument(doc, new DidKeypair([did, 1], pair)); + + expect((await modules.did.getDocument(did)).toJSON()).toEqual(doc.toJSON()); + + const service2 = new ServiceEndpoint("LinkedDomains", [ + "ServiceEndpoint#1", + ]); + + doc + .removeServiceEndpoint("service1") + .addServiceEndpoint([did, "service2"], service2); + await modules.did.updateDocument(doc, new DidKeypair([did, 2], pair2)); + + expect((await modules.did.getDocument(did)).toJSON()).toEqual(doc.toJSON()); + }); + + test("Can create a DID", async () => { + // DID does not exist + await expect( + modules.did.dockOnly.getOnchainDidDetail(dockDid) + ).rejects.toThrow(NoDIDError); + + const pair = new Ed25519Keypair(seed); + const publicKey = pair.publicKey(); + + const verRels = new VerificationRelationship(); + const didKey = new DidKey(publicKey, verRels); + + await modules.did.dockOnly.newOnchain(dockDid, [didKey], [], false); + const didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid); + expect(didDetail.lastKeyId).toBe(1); + expect(didDetail.activeControllerKeys).toBe(1); + expect(didDetail.activeControllers).toBe(1); + await expect( + modules.did.dockOnly.isController(dockDid, dockDid) + ).resolves.toEqual(true); + + // DID cannot be fetched as off-chain DID + await expect( + modules.did.dockOnly.getOffchainDidDetail(dockDid) + ).rejects.toThrow(NoOffchainDIDError); + }, 30000); + + test("Get key for DID", async () => { + const dk = await modules.did.dockOnly.getDidKey(dockDid, 1); + const pair = new Ed25519Keypair(seed); + expect(dk.publicKey).toEqual(pair.publicKey()); + expect(dk.verRels.isAuthentication()).toEqual(true); + expect(dk.verRels.isAssertion()).toEqual(true); + expect(dk.verRels.isCapabilityInvocation()).toEqual(true); + expect(dk.verRels.isKeyAgreement()).toEqual(false); + }); + + test("Can get a DID document", async () => { + function check(typedDoc) { + const doc = typedDoc.toJSON(); + expect(!!doc).toBe(true); + expect(doc.controller.length).toEqual(1); + checkVerificationMethods(dockDid, doc, 1, 0); + expect(doc.authentication.length).toEqual(1); + expect(doc.authentication[0]).toEqual(`${dockDid}#keys-1`); + expect(doc.assertionMethod.length).toEqual(1); + expect(doc.assertionMethod[0]).toEqual(`${dockDid}#keys-1`); + expect(doc.capabilityInvocation.length).toEqual(1); + expect(doc.capabilityInvocation[0]).toEqual(`${dockDid}#keys-1`); + } + + const doc = await modules.did.getDocument(dockDid); + check(doc); + + // The same checks should pass when passing the flag for keys + const doc1 = await modules.did.getDocument(dockDid, { + getOffchainSigKeys: false, + }); + check(doc1); + + const doc2 = await modules.did.getDocument(dockDid, { + getOffchainSigKeys: true, + }); + check(doc2); + }, 10000); + + test("Can attest with a DID", async () => { + const iri = "my iri"; + const pair = new DidKeypair([dockDid, 1], new Ed25519Keypair(seed)); + + await modules.attest.setClaim(iri, dockDid, pair); + + const att = await modules.attest.getAttests(dockDid); + expect(att).toEqual(iri); + + // Get document to verify the claim is there + const didDocument = await modules.did.getDocument(dockDid); + + // Verify attests property exists + expect(didDocument.attests.value).toBe(iri); + }, 30000); + + test("Can remove DID", async () => { + const pair = new DidKeypair([dockDid, 1], new Ed25519Keypair(seed)); + await modules.did.removeDocument(dockDid, pair); + // DID removed + await expect(modules.did.getDocument(dockDid)).rejects.toThrow(NoDIDError); + await expect( + modules.did.dockOnly.getOnchainDidDetail(dockDid) + ).rejects.toThrow(NoDIDError); + await expect(modules.did.dockOnly.getDidKey(dockDid, 1)).rejects.toThrow(); + await expect( + modules.did.dockOnly.isController(dockDid, dockDid) + ).resolves.toEqual(false); + }); +}); diff --git a/packages/dock-blockchain-modules/tests/integration/did/did-key.test.js b/packages/dock-blockchain-modules/tests/integration/did/did-key.test.js new file mode 100644 index 000000000..0929f8d88 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/did/did-key.test.js @@ -0,0 +1,110 @@ +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { NoDIDError } from "@docknetwork/credential-sdk/modules"; +import { + Ed25519Keypair, + Secp256k1Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { + DidMethodKey, + DockDidOrDidMethodKey, +} from "@docknetwork/credential-sdk/types"; +import { + FullNodeEndpoint, + TestKeyringOpts, + TestAccountURI, +} from "../../test-constants"; +import { DockCoreModules } from "../../../src"; + +describe("Basic DID tests", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + // Generate a random DID + let testDidMethodKeyPair1; + let testDidMethodKey1; + + let testDidMethodKeyPair2; + let testDidMethodKey2; + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + + testDidMethodKeyPair1 = Ed25519Keypair.random(); + testDidMethodKey1 = DidMethodKey.fromKeypair(testDidMethodKeyPair1); + + testDidMethodKeyPair2 = Secp256k1Keypair.random(); + testDidMethodKey2 = DidMethodKey.fromKeypair(testDidMethodKeyPair2); + + await modules.did.dockOnly.newDidMethodKey(testDidMethodKey1, false); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + test("Can create a did:key", async () => { + // DID does not exist + await expect( + modules.did.dockOnly.getDidMethodKeyDetail(testDidMethodKey2) + ).rejects.toThrow(NoDIDError); + + await modules.did.dockOnly.newDidMethodKey(testDidMethodKey2, false); + const { nonce } = await modules.did.dockOnly.getDidMethodKeyDetail( + testDidMethodKey2 + ); + expect(+nonce).toBeGreaterThan(1); + expect(testDidMethodKey2.toString().startsWith("did:key:z")).toBe(true); + }, 30000); + + test("Can attest with a DID", async () => { + const iri = "my iri"; + + await modules.attest.setClaim( + iri, + testDidMethodKey1, + DidKeypair.didMethodKey(testDidMethodKeyPair1) + ); + + const att1 = await modules.attest.getAttests(testDidMethodKey1); + expect(att1).toEqual(iri); + + await modules.attest.setClaim( + iri, + testDidMethodKey2, + DidKeypair.didMethodKey(testDidMethodKeyPair2) + ); + + const att2 = await modules.attest.getAttests(testDidMethodKey2); + expect(att2).toEqual(iri); + }, 30000); + + test("Conversion works properly (including SS58 format)", () => { + const substrateDid1 = dock.api.createType( + "DidOrDidMethodKey", + testDidMethodKey1 + ); + expect(DockDidOrDidMethodKey.from(substrateDid1)).toEqual( + testDidMethodKey1 + ); + expect(testDidMethodKey1).toEqual( + DockDidOrDidMethodKey.from(testDidMethodKey1) + ); + + const substrateDid2 = dock.api.createType( + "DidOrDidMethodKey", + testDidMethodKey2 + ); + expect(DockDidOrDidMethodKey.from(substrateDid2)).toEqual( + testDidMethodKey2 + ); + expect(testDidMethodKey2).toEqual( + DockDidOrDidMethodKey.from(testDidMethodKey2) + ); + }); +}); diff --git a/tests/integration/did/keys.test.js b/packages/dock-blockchain-modules/tests/integration/did/keys.test.js similarity index 58% rename from tests/integration/did/keys.test.js rename to packages/dock-blockchain-modules/tests/integration/did/keys.test.js index 7a794434b..931e18932 100644 --- a/tests/integration/did/keys.test.js +++ b/packages/dock-blockchain-modules/tests/integration/did/keys.test.js @@ -1,25 +1,30 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { DockAPI, PublicKeySecp256k1 } from '../../../src'; -import { DockDid, DidKeypair } from '../../../src/did'; +import { + Secp256k1Keypair, + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { + DockDid, + PublicKeyX25519, + DidKey, + VerificationRelationship, +} from "@docknetwork/credential-sdk/types"; +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; import { FullNodeEndpoint, TestAccountURI, TestKeyringOpts, -} from '../../test-constants'; -import { - generateEcdsaSecp256k1Keypair, - getPublicKeyFromKeyringPair, -} from '../../../src/utils/misc'; -import { DidKey, VerificationRelationship } from '../../../src/public-keys'; -import { checkVerificationMethods } from '../helpers'; -import PublicKeyX25519 from '../../../src/public-keys/public-key-x25519'; - -describe('Key support for DIDs', () => { +} from "../../test-constants"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { DockCoreModules } from "../../../src"; +import { checkVerificationMethods } from "../helpers"; + +describe("Key support for DIDs", () => { const dock = new DockAPI(); + const modules = new DockCoreModules(dock); // Generate a random DID const dockDid = DockDid.random(); - let hexDid; const seed1 = randomAsHex(32); const seed2 = randomAsHex(32); @@ -33,47 +38,45 @@ describe('Key support for DIDs', () => { }); const account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); - - hexDid = DockDid.from(dockDid); }); afterAll(async () => { await dock.disconnect(); }, 10000); - test('Create a DID with many keys', async () => { - const pair1 = dock.keyring.addFromUri(seed1); - const publicKey1 = getPublicKeyFromKeyringPair(pair1); - const verRels1 = new VerificationRelationship(); - const didKey1 = new DidKey(publicKey1, verRels1); + test("Create a DID with many keys", async () => { + const pair1 = new Ed25519Keypair(seed1); + const didKey1 = DidKey.fromKeypair(pair1); - const pair2 = dock.keyring.addFromUri(seed2, null, 'ed25519'); - const publicKey2 = getPublicKeyFromKeyringPair(pair2); - const verRels2 = new VerificationRelationship(); - const didKey2 = new DidKey(publicKey2, verRels2); + const pair2 = new Ed25519Keypair(seed2); + const didKey2 = DidKey.fromKeypair(pair2); - const pair3 = dock.keyring.addFromUri(seed3, null, 'ed25519'); - const publicKey3 = getPublicKeyFromKeyringPair(pair3); + const pair3 = new Ed25519Keypair(seed3); const verRels3 = new VerificationRelationship(); verRels3.setAssertion(); - const didKey3 = new DidKey(publicKey3, verRels3); + const didKey3 = DidKey.fromKeypair(pair3, verRels3); - await dock.did.new(dockDid, [didKey1, didKey2, didKey3], [], false); + await modules.did.dockOnly.newOnchain( + dockDid, + [didKey1, didKey2, didKey3], + [], + false + ); - const didDetail = await dock.did.getOnchainDidDetail(hexDid.asDid); + const didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid); expect(didDetail.lastKeyId).toBe(3); expect(didDetail.activeControllerKeys).toBe(2); expect(didDetail.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid, dockDid)).resolves.toEqual( - true, - ); + await expect( + modules.did.dockOnly.isController(dockDid, dockDid) + ).resolves.toEqual(true); for (const [i, pk] of [ - [1, publicKey1], - [2, publicKey2], + [1, pair1.publicKey()], + [2, pair2.publicKey()], ]) { // eslint-disable-next-line no-await-in-loop - const dk = await dock.did.getDidKey(dockDid, i); + const dk = await modules.did.dockOnly.getDidKey(dockDid, i); expect(dk.publicKey).toEqual(pk); expect(dk.verRels.isAuthentication()).toEqual(true); expect(dk.verRels.isAssertion()).toEqual(true); @@ -81,16 +84,17 @@ describe('Key support for DIDs', () => { expect(dk.verRels.isKeyAgreement()).toEqual(false); } - const dk = await dock.did.getDidKey(dockDid, 3); - expect(dk.publicKey).toEqual(publicKey3); + const dk = await modules.did.dockOnly.getDidKey(dockDid, 3); + expect(dk.publicKey).toEqual(pair3.publicKey()); expect(dk.verRels.isAuthentication()).toEqual(false); expect(dk.verRels.isAssertion()).toEqual(true); expect(dk.verRels.isCapabilityInvocation()).toEqual(false); expect(dk.verRels.isKeyAgreement()).toEqual(false); }); - test('Get DID document', async () => { - function check(doc) { + test("Get DID document", async () => { + function check(obj) { + const doc = obj.toJSON(); expect(doc.controller.length).toEqual(1); checkVerificationMethods(dockDid, doc, 3, 0); checkVerificationMethods(dockDid, doc, 3, 1); @@ -107,50 +111,47 @@ describe('Key support for DIDs', () => { expect(doc.capabilityInvocation[1]).toEqual(`${dockDid}#keys-2`); } - const doc = await dock.did.getDocument(dockDid); + const doc = await modules.did.getDocument(dockDid); check(doc); // The same checks should pass when passing the flag for keys - const doc1 = await dock.did.getDocument(dockDid, { + const doc1 = await modules.did.getDocument(dockDid, { getOffchainSigKeys: false, }); check(doc1); - const doc2 = await dock.did.getDocument(dockDid, { + const doc2 = await modules.did.getDocument(dockDid, { getOffchainSigKeys: true, }); check(doc2); }); - test('Add more keys to DID', async () => { - const pair1 = generateEcdsaSecp256k1Keypair(seed4); - const publicKey1 = PublicKeySecp256k1.fromKeyringPair(pair1); + test("Add more keys to DID", async () => { + const pair1 = new Secp256k1Keypair(seed4); const verRels1 = new VerificationRelationship(); verRels1.setCapabilityInvocation(); verRels1.setAssertion(); - const didKey1 = new DidKey(publicKey1, verRels1); + const didKey1 = DidKey.fromKeypair(pair1, verRels1); - const pair = new DidKeypair( - dock.keyring.addFromUri(seed2, null, 'ed25519'), - 2, - ); - await dock.did.addKeys([didKey1], dockDid, dockDid, pair); + const pair = new DidKeypair([dockDid, 2], new Ed25519Keypair(seed2)); + await modules.did.dockOnly.addKeys([didKey1], dockDid, pair); - const didDetail = await dock.did.getOnchainDidDetail(hexDid.asDid); + const didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid); expect(didDetail.lastKeyId).toBe(4); expect(didDetail.activeControllerKeys).toBe(3); expect(didDetail.activeControllers).toBe(1); - const dk1 = await dock.did.getDidKey(dockDid, 4); - expect(dk1.publicKey).toEqual(publicKey1); + const dk1 = await modules.did.dockOnly.getDidKey(dockDid, 4); + expect(dk1.publicKey).toEqual(pair1.publicKey()); expect(dk1.verRels.isAuthentication()).toEqual(false); expect(dk1.verRels.isAssertion()).toEqual(true); expect(dk1.verRels.isCapabilityInvocation()).toEqual(true); expect(dk1.verRels.isKeyAgreement()).toEqual(false); }); - test('Get DID document after key addition', async () => { - function check(doc) { + test("Get DID document after key addition", async () => { + function check(obj) { + const doc = obj.toJSON(); expect(doc.controller.length).toEqual(1); checkVerificationMethods(dockDid, doc, 4, 0); @@ -174,95 +175,91 @@ describe('Key support for DIDs', () => { expect(doc.capabilityInvocation[2]).toEqual(`${dockDid}#keys-4`); } - const doc = await dock.did.getDocument(dockDid); + const doc = await modules.did.getDocument(dockDid); check(doc); // The same checks should pass when passing the flag for keys - const doc1 = await dock.did.getDocument(dockDid, { + const doc1 = await modules.did.getDocument(dockDid, { getOffchainSigKeys: false, }); check(doc1); - const doc2 = await dock.did.getDocument(dockDid, { + const doc2 = await modules.did.getDocument(dockDid, { getOffchainSigKeys: true, }); check(doc2); }); - test('Remove keys from DID', async () => { - const pair = new DidKeypair(generateEcdsaSecp256k1Keypair(seed4), 4); - await dock.did.removeKeys([1, 3], dockDid, dockDid, pair); + test("Remove keys from DID", async () => { + const pair = new DidKeypair([dockDid, 4], new Secp256k1Keypair(seed4)); + await modules.did.dockOnly.removeKeys([1, 3], dockDid, pair); - const didDetail = await dock.did.getOnchainDidDetail(hexDid.asDid); + const didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid); expect(didDetail.lastKeyId).toBe(4); expect(didDetail.activeControllerKeys).toBe(2); expect(didDetail.activeControllers).toBe(1); - await expect(dock.did.getDidKey(dockDid, 1)).rejects.toThrow(); - await expect(dock.did.getDidKey(dockDid, 3)).rejects.toThrow(); + await expect(modules.did.dockOnly.getDidKey(dockDid, 1)).rejects.toThrow(); + await expect(modules.did.dockOnly.getDidKey(dockDid, 3)).rejects.toThrow(); - const pair2 = dock.keyring.addFromUri(seed2, null, 'ed25519'); - const publicKey2 = getPublicKeyFromKeyringPair(pair2); - const dk2 = await dock.did.getDidKey(dockDid, 2); + const pair2 = new Ed25519Keypair(seed2); + const publicKey2 = pair2.publicKey(); + const dk2 = await modules.did.dockOnly.getDidKey(dockDid, 2); expect(dk2.publicKey).toEqual(publicKey2); expect(dk2.verRels.isAuthentication()).toEqual(true); expect(dk2.verRels.isAssertion()).toEqual(true); expect(dk2.verRels.isCapabilityInvocation()).toEqual(true); expect(dk2.verRels.isKeyAgreement()).toEqual(false); - const pair4 = generateEcdsaSecp256k1Keypair(seed4); - const publicKey4 = PublicKeySecp256k1.fromKeyringPair(pair4); - const dk4 = await dock.did.getDidKey(dockDid, 4); - expect(dk4.publicKey).toEqual(publicKey4); + const pair4 = new Secp256k1Keypair(seed4); + const dk4 = await modules.did.dockOnly.getDidKey(dockDid, 4); + expect(dk4.publicKey).toEqual(pair4.publicKey()); expect(dk4.verRels.isAuthentication()).toEqual(false); expect(dk4.verRels.isAssertion()).toEqual(true); expect(dk4.verRels.isCapabilityInvocation()).toEqual(true); expect(dk4.verRels.isKeyAgreement()).toEqual(false); }); - test('Get DID document after key removal', async () => { + test("Get DID document after key removal", async () => { function check(doc) { expect(doc.controller.length).toEqual(1); checkVerificationMethods(dockDid, doc, 2, 0, 2); checkVerificationMethods(dockDid, doc, 2, 1, 4); } - const doc = await dock.did.getDocument(dockDid); + const doc = await modules.did.getDocument(dockDid); check(doc); // The same checks should pass when passing the flag for keys - const doc1 = await dock.did.getDocument(dockDid, { + const doc1 = await modules.did.getDocument(dockDid, { getOffchainSigKeys: false, }); check(doc1); - const doc2 = await dock.did.getDocument(dockDid, { + const doc2 = await modules.did.getDocument(dockDid, { getOffchainSigKeys: true, }); check(doc2); }); - test('Add x25519 key-agreement to DID', async () => { + test("Add x25519 key-agreement to DID", async () => { const verRels = new VerificationRelationship(); verRels.setKeyAgreement(); // Generating a random X25519 public key const publicKey = new PublicKeyX25519(randomAsHex(32)); const didKey = new DidKey(publicKey, verRels); - const pair = new DidKeypair( - dock.keyring.addFromUri(seed2, null, 'ed25519'), - 2, - ); - await dock.did.addKeys([didKey], dockDid, dockDid, pair); - const didDetail = await dock.did.getOnchainDidDetail(hexDid.asDid); + const pair = new DidKeypair([dockDid, 2], new Ed25519Keypair(seed2)); + await modules.did.dockOnly.addKeys([didKey], dockDid, pair); + const didDetail = await modules.did.dockOnly.getOnchainDidDetail(dockDid); expect(didDetail.lastKeyId).toBe(5); - const dk = await dock.did.getDidKey(dockDid, 5); + const dk = await modules.did.dockOnly.getDidKey(dockDid, 5); expect(dk.publicKey).toEqual(publicKey); expect(dk.verRels.isAuthentication()).toEqual(false); expect(dk.verRels.isAssertion()).toEqual(false); expect(dk.verRels.isCapabilityInvocation()).toEqual(false); expect(dk.verRels.isKeyAgreement()).toEqual(true); - const doc = await dock.did.getDocument(dockDid); + const doc = await modules.did.getDocument(dockDid); checkVerificationMethods(dockDid, doc, 3, 2, 5); }); }); diff --git a/packages/dock-blockchain-modules/tests/integration/did/offchain-did.test.js b/packages/dock-blockchain-modules/tests/integration/did/offchain-did.test.js new file mode 100644 index 000000000..8e70a4fb3 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/did/offchain-did.test.js @@ -0,0 +1,92 @@ +import { randomAsHex } from "@polkadot/util-crypto"; + +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { + NoDIDError, + NoOnchainDIDError, +} from "@docknetwork/credential-sdk/modules"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { u8aToHex } from "@docknetwork/credential-sdk/utils"; +import { + FullNodeEndpoint, + TestAccountURI, + TestKeyringOpts, +} from "../../test-constants"; +import { + CIDOffchainDocRef, + CustomOffchainDocRef, + URLOffchainDocRef, +} from "@docknetwork/credential-sdk/types"; +import { DockCoreModules } from "../../../src"; + +describe("Off-chain DIDs", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + // Generate a random DID + const dockDID = DockDid.random(); + + const firstDocRef = randomAsHex(100); + const secondDocRef = randomAsHex(110); + const thirdDocRef = randomAsHex(89); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + test("Can create an off-chain DID", async () => { + // DID does not exist + await expect( + modules.did.dockOnly.getOffchainDidDetail(dockDID) + ).rejects.toThrow(NoDIDError); + + const docRef = new CIDOffchainDocRef(firstDocRef); + await modules.did.dockOnly.newOffchain(dockDID, docRef, false); + const didDetail = await modules.did.dockOnly.getOffchainDidDetail(dockDID); + expect(didDetail.docRef).toEqual(docRef); + expect(didDetail.accountId.value).toEqual( + u8aToHex(dock.account.addressRaw) + ); + + // DID cannot be fetched as on-chain DID + await expect( + modules.did.dockOnly.getOnchainDidDetail(dockDID) + ).rejects.toThrow(NoOnchainDIDError); + }); + + test("Can update DIDDoc reference for the DID to URL", async () => { + const docRef = new URLOffchainDocRef(secondDocRef); + await modules.did.dockOnly.setOffchainDidDocRef(dockDID, docRef, false); + const didDetail = await modules.did.dockOnly.getOffchainDidDetail(dockDID); + expect(didDetail.docRef).toEqual(docRef); + expect(didDetail.accountId.value).toEqual( + u8aToHex(dock.account.addressRaw) + ); + }); + + test("Can update DIDDoc reference for the DID to Custom", async () => { + const docRef = new CustomOffchainDocRef(thirdDocRef); + await modules.did.dockOnly.setOffchainDidDocRef(dockDID, docRef, false); + const didDetail = await modules.did.dockOnly.getOffchainDidDetail(dockDID); + expect(didDetail.docRef).toEqual(docRef); + expect(didDetail.accountId.value).toEqual( + u8aToHex(dock.account.addressRaw) + ); + }); + + test("Can remove the DID", async () => { + await modules.did.dockOnly.removeOffchainDid(dockDID, false); + await expect( + modules.did.dockOnly.getOffchainDidDetail(dockDID) + ).rejects.toThrow(NoDIDError); + }); +}); diff --git a/packages/dock-blockchain-modules/tests/integration/did/service-endpoint.test.js b/packages/dock-blockchain-modules/tests/integration/did/service-endpoint.test.js new file mode 100644 index 000000000..f7090e30d --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/did/service-endpoint.test.js @@ -0,0 +1,196 @@ +import { randomAsHex, u8aToHex } from "@docknetwork/credential-sdk/utils"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { + DockDid, + DidKey, + VerificationRelationship, + LinkedDomains, +} from "@docknetwork/credential-sdk/types"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { NoDIDError } from "@docknetwork/credential-sdk/modules"; +import { + FullNodeEndpoint, + TestAccountURI, + TestKeyringOpts, +} from "../../test-constants"; +import { ServiceEndpointOrigins } from "@docknetwork/credential-sdk/types"; +import { DockCoreModules } from "../../../src"; + +describe("DID service endpoints", () => { + const encoder = new TextEncoder(); + + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + const dockDid1 = DockDid.random(); + + // This DID will not be controlled by itself + const dockDid2 = DockDid.random(); + + const seed1 = randomAsHex(32); + const seed2 = randomAsHex(32); + + const pair1 = new DidKeypair([dockDid1, 1], new Ed25519Keypair(seed1)); + + const spId1Text = `${dockDid1}#linked-domain-1`; + const spId2Text = `${dockDid2}#linked-domain-1`; + const spId3Text = `${dockDid2}#linked-domain-2`; + const spId1 = spId1Text; + const spId2 = spId2Text; + const spId3 = spId3Text; + + const origins1Text = ["https://foo.example.com"]; + const origins2Text = [ + "https://foo.example.com", + "https://bar.example.com", + "https://baz.example.com", + ]; + const origins3Text = ["https://biz.example.com"]; + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + }); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + test("Create DIDs and add service endpoint", async () => { + const publicKey1 = pair1.publicKey(); + const didKey1 = new DidKey(publicKey1); + + await modules.did.dockOnly.send.newOnchain(dockDid1, [didKey1], [], false); + + const spType = new LinkedDomains(); + + // `dockDid1` adds service endpoint for itself + const origins1 = new ServiceEndpointOrigins( + ...origins1Text.map((u) => u8aToHex(encoder.encode(u))) + ); + await modules.did.dockOnly.addServiceEndpoint( + spId1, + spType, + origins1, + dockDid1, + pair1 + ); + + const sp = await modules.did.dockOnly.getServiceEndpoint(spId1); + expect(sp.types).toEqual(spType); + expect(sp.origins).toEqual(origins1); + + const pair2 = new DidKeypair([dockDid2, 1], new Ed25519Keypair(seed2)); + const publicKey2 = pair2.publicKey(); + const vr = new VerificationRelationship(); + // vr.setAssertion(); + const didKey2 = new DidKey(publicKey2, vr); + + await modules.did.dockOnly.send.newOnchain( + dockDid2, + [didKey2], + [dockDid1], + false + ); + + // `dockDid1` adds service endpoint to `dockDid2` + const origins2 = new ServiceEndpointOrigins( + ...origins2Text.map((u) => u8aToHex(encoder.encode(u))) + ); + await modules.did.dockOnly.addServiceEndpoint( + spId2, + spType, + origins2, + dockDid2, + pair2 + ); + + const sp1 = await modules.did.dockOnly.getServiceEndpoint(spId2); + expect(sp1.types).toEqual(spType); + expect(sp1.origins).toEqual(origins2); + }, 3e4); + + test("Get DID document with service endpoints", async () => { + const [doc1, doc2] = ( + await Promise.all([ + modules.did.getDocument(dockDid1), + modules.did.getDocument(dockDid2), + ]) + ).map((doc) => doc.toJSON()); + expect(doc1.service.length).toEqual(1); + expect(doc1.service[0].id).toEqual(spId1Text); + expect(doc1.service[0].type).toEqual("LinkedDomains"); + expect(doc1.service[0].serviceEndpoint).toEqual(origins1Text); + + expect(doc2.service.length).toEqual(1); + expect(doc2.service[0].id).toEqual(spId2Text); + expect(doc2.service[0].type).toEqual("LinkedDomains"); + expect(doc2.service[0].serviceEndpoint).toEqual(origins2Text); + }, 3e4); + + test("Add another service endpoint", async () => { + const spType = new LinkedDomains(); + const origins = new ServiceEndpointOrigins( + ...origins3Text.map((u) => u8aToHex(encoder.encode(u))) + ); + await modules.did.dockOnly.addServiceEndpoint( + spId3, + spType, + origins, + dockDid2, + pair1 + ); + const sp = await modules.did.dockOnly.getServiceEndpoint(spId3); + expect(sp.types).toEqual(spType); + expect(sp.origins).toEqual(origins); + }, 3e4); + + test("Get DID document with multiple service endpoints", async () => { + const doc = (await modules.did.getDocument(dockDid2)).toJSON(); + expect(doc.service.length).toEqual(2); + expect(doc.service[0].type).toEqual("LinkedDomains"); + expect(doc.service[1].type).toEqual("LinkedDomains"); + expect( + (doc.service[0].id === spId2Text && doc.service[1].id === spId3Text) || + (doc.service[0].id === spId3Text && doc.service[1].id === spId2Text) + ).toBe(true); + + expect( + (JSON.stringify(doc.service[0].serviceEndpoint) === + JSON.stringify(origins2Text) && + JSON.stringify(doc.service[1].serviceEndpoint) === + JSON.stringify(origins3Text)) || + (JSON.stringify(doc.service[0].serviceEndpoint) === + JSON.stringify(origins3Text) && + JSON.stringify(doc.service[1].serviceEndpoint) === + JSON.stringify(origins2Text)) + ).toBe(true); + }); + + test("Remove service endpoint", async () => { + console.log(spId2); + // `dockDid1` removes service endpoint of `dockDid2` + await modules.did.dockOnly.removeServiceEndpoint(spId2, pair1); + await expect( + modules.did.dockOnly.getServiceEndpoint(spId2) + ).rejects.toThrow(); + }, 3e4); + + test("Removing DID removes service endpoint as well", async () => { + await modules.did.removeDocument(dockDid1, pair1); + + await expect( + modules.did.dockOnly.getOnchainDidDetail(dockDid1.asDid) + ).rejects.toThrow(NoDIDError); + await expect( + modules.did.dockOnly.getServiceEndpoint(spId1) + ).rejects.toThrow(); + }, 3e4); +}); diff --git a/tests/integration/helpers.js b/packages/dock-blockchain-modules/tests/integration/helpers.js similarity index 68% rename from tests/integration/helpers.js rename to packages/dock-blockchain-modules/tests/integration/helpers.js index 2ac8623e9..4a500c8e2 100644 --- a/tests/integration/helpers.js +++ b/packages/dock-blockchain-modules/tests/integration/helpers.js @@ -1,9 +1,10 @@ -import { bnToBn } from '@polkadot/util'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { getPublicKeyFromKeyringPair } from '../../src/utils/misc'; -import { MaxGas, MinGasPrice } from '../test-constants'; -import { DidKey, VerificationRelationship } from '../../src/public-keys'; -import { DockDid } from '../../src/did'; +import { bnToBn } from "@polkadot/util"; +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; +import { MaxGas, MinGasPrice } from "../test-constants"; +import { DockDid, DidKey } from "@docknetwork/credential-sdk/types/did"; +import { Ed25519Keypair } from "@docknetwork/credential-sdk/keypairs"; +import { DIDDocument } from "@docknetwork/credential-sdk/types/did/document"; +import DockDIDModule from "../../src/did/module"; /** * Registers a new DID on dock chain, keeps the controller same as the DID @@ -18,16 +19,14 @@ export async function registerNewDIDUsingPair( dockAPI, did, pair, - verRels = undefined, - controllers = [], + verRels, + controllers = [] ) { - if (verRels === undefined) { - // eslint-disable-next-line no-param-reassign - verRels = new VerificationRelationship(); - } // No additional controller const didKey = new DidKey(pair.publicKey(), verRels); - return dockAPI.did.new(did, [didKey], controllers, false); + return await new DockDIDModule(dockAPI).createDocument( + DIDDocument.create(did, [didKey], controllers) + ); } /** @@ -39,17 +38,17 @@ export async function registerNewDIDUsingPair( */ export function getUnsignedCred(credId, holderDID, additionalContext = []) { return { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", ...additionalContext, ], id: credId, - type: ['VerifiableCredential', 'AlumniCredential'], - issuanceDate: '2020-03-18T19:23:24Z', + type: ["VerifiableCredential", "AlumniCredential"], + issuanceDate: "2020-03-18T19:23:24Z", credentialSubject: { id: String(holderDID), - alumniOf: 'Example University', + alumniOf: "Example University", }, }; } @@ -63,16 +62,20 @@ export function checkVerificationMethods( doc, length, index = undefined, - keyNo = undefined, + keyNo = undefined ) { - expect(doc.publicKey.length).toEqual(length); + expect(doc.verificationMethod.length).toEqual(length); if (length > 0 && index !== undefined) { if (keyNo === undefined) { keyNo = index + 1; } - expect(doc.publicKey[index].id).toEqual(`${did}#keys-${keyNo}`); - expect(doc.publicKey[index].controller).toEqual(String(did)); - expect(doc.publicKey[index].publicKeyBase58).toBeDefined(); + expect(String(doc.verificationMethod[index].id)).toEqual( + `${did}#keys-${keyNo}` + ); + expect(String(doc.verificationMethod[index].controller)).toEqual( + String(did) + ); + expect(doc.verificationMethod[index].publicKeyBase58).toBeDefined(); } } @@ -100,7 +103,7 @@ export function getCredMatcherDoc(cred, issuer, issuerKeyId, sigType) { issuer: String(issuer), proof: expect.objectContaining({ type: sigType, - proofPurpose: 'assertionMethod', + proofPurpose: "assertionMethod", verificationMethod: issuerKeyId, }), }; @@ -142,8 +145,7 @@ export async function getBalance(api, account) { export function createDidPair(dock) { const did = DockDid.random(); const seed = randomAsHex(32); - const pair = dock.keyring.addFromUri(seed, null, 'sr25519'); - const publicKey = getPublicKeyFromKeyringPair(pair); - const didKey = new DidKey(publicKey, new VerificationRelationship()); + const pair = new Ed25519Keypair(seed); + const didKey = DidKey.fromKeypair(pair); return [did, pair, didKey]; } diff --git a/tests/integration/issuing-and-presentation-with-2-subjects.test.js b/packages/dock-blockchain-modules/tests/integration/issuing-and-presentation-with-2-subjects.test.js similarity index 64% rename from tests/integration/issuing-and-presentation-with-2-subjects.test.js rename to packages/dock-blockchain-modules/tests/integration/issuing-and-presentation-with-2-subjects.test.js index a126a5166..e902b4643 100644 --- a/tests/integration/issuing-and-presentation-with-2-subjects.test.js +++ b/packages/dock-blockchain-modules/tests/integration/issuing-and-presentation-with-2-subjects.test.js @@ -1,31 +1,36 @@ // Mock fetch -import { randomAsHex } from '@polkadot/util-crypto'; -import jsonld from 'jsonld'; -import mockFetch from '../mocks/fetch'; +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; +import jsonld from "jsonld"; +import mockFetch from "../mocks/fetch"; -import { DockDid, DidKeypair } from '../../src/did'; +import { DockDid } from "@docknetwork/credential-sdk/types"; -import { DockAPI } from '../../src/index'; -import { DockResolver } from '../../src/resolver'; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { DockResolver } from "@docknetwork/credential-sdk/resolver"; import { FullNodeEndpoint, TestKeyringOpts, TestAccountURI, -} from '../test-constants'; +} from "../test-constants"; import { getCredMatcherDoc, getProofMatcherDoc, registerNewDIDUsingPair, -} from './helpers'; +} from "./helpers"; import { issueCredential, signPresentation, verifyCredential, verifyPresentation, -} from '../../src/utils/vc/index'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import { createPresentation } from '../create-presentation'; +} from "@docknetwork/credential-sdk/vc"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { createPresentation } from "../create-presentation"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockCoreModules } from "../../src"; mockFetch(); @@ -44,21 +49,21 @@ const credId = randomAsHex(32); let credential; const unsignedCred = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", ], id: credId, - type: ['VerifiableCredential', 'DocumentAccessCredential'], - issuanceDate: '2020-03-18T19:23:24Z', + type: ["VerifiableCredential", "DocumentAccessCredential"], + issuanceDate: "2020-03-18T19:23:24Z", credentialSubject: [ { id: String(subject1DID), // DID of the user who is given read access to the document - type: 'reader', + type: "reader", }, { id: String(subject2DID), // DID of the document - type: 'document', + type: "document", }, ], }; @@ -69,9 +74,10 @@ const unsignedCred = { // The document creator, when giving access issues a credential to the recipient and the credential contains both the recipient's and the document's DID. // When requesting access to the document, recipient creates a presentation with the credential and verifier checks whether the // presenter is indeed the recipient of the credential and the requested document DID is present in the credential -describe('Verifiable Credential issuance and presentation where the credential has 2 subjects and of the subject acts as the holder of the presentation', () => { +describe("Verifiable Credential issuance and presentation where the credential has 2 subjects and of the subject acts as the holder of the presentation", () => { const dock = new DockAPI(); - const resolver = new DockResolver(dock); + const modules = new DockCoreModules(dock); + const resolver = new DockResolver(modules); beforeAll(async () => { await dock.init({ @@ -87,31 +93,36 @@ describe('Verifiable Credential issuance and presentation where the credential h // issuer DID const pair1 = new DidKeypair( - dock.keyring.addFromUri(issuerKeySeed, null, 'ed25519'), - 1, + [issuerDID, 1], + new Ed25519Keypair(issuerKeySeed) ); await registerNewDIDUsingPair(dock, issuerDID, pair1); // 1st subject's DID const pair2 = new DidKeypair( - dock.keyring.addFromUri(subject1Seed, null, 'ed25519'), - 1, + [subject1DID, 1], + new Ed25519Keypair(subject1Seed) ); await registerNewDIDUsingPair(dock, subject1DID, pair2); // 2nd subject's DID, has no key but is controlled by subject1DID - await dock.did.new(subject2DID, [], [subject1DID], false); + await modules.did.dockOnly.newOnchain( + subject2DID, + [], + [subject1DID], + false + ); }, 60000); afterAll(async () => { await dock.disconnect(); }, 10000); - test('Issue a verifiable credential with 2 subjects and verify it', async () => { + test("Issue a verifiable credential with 2 subjects and verify it", async () => { const issuerKey = getKeyDoc( issuerDID, - dock.keyring.addFromUri(issuerKeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', + new Ed25519Keypair(issuerKeySeed), + "Ed25519VerificationKey2018" ); credential = await issueCredential(issuerKey, unsignedCred); expect(credential).toMatchObject( @@ -120,19 +131,19 @@ describe('Verifiable Credential issuance and presentation where the credential h unsignedCred, issuerDID, issuerKey.id, - 'Ed25519Signature2018', - ), - ), + "Ed25519Signature2018" + ) + ) ); expect(credential.credentialSubject).toMatchObject([ { id: String(subject1DID), - type: 'reader', + type: "reader", }, { id: String(subject2DID), - type: 'document', + type: "document", }, ]); @@ -140,25 +151,25 @@ describe('Verifiable Credential issuance and presentation where the credential h expect(result).toMatchObject(expect.objectContaining(getProofMatcherDoc())); }, 40000); - test('Holder creates a verifiable presentation and verifier verifies it and does some other checks', async () => { + test("Holder creates a verifiable presentation and verifier verifies it and does some other checks", async () => { const holderKey = getKeyDoc( subject1DID, - dock.keyring.addFromUri(subject1Seed, null, 'ed25519'), - 'Ed25519VerificationKey2018', + new Ed25519Keypair(subject1Seed), + "Ed25519VerificationKey2018" ); const presId = `https://pres.com/${randomAsHex(32)}`; const challenge = randomAsHex(32); - const domain = 'test domain'; + const domain = "test domain"; const presentation = createPresentation(credential, presId, subject1DID); expect(presentation).toMatchObject( expect.objectContaining({ - type: ['VerifiablePresentation'], + type: ["VerifiablePresentation"], verifiableCredential: [credential], id: presId, - }), + }) ); const signedPres = await signPresentation( @@ -166,47 +177,47 @@ describe('Verifiable Credential issuance and presentation where the credential h holderKey, challenge, domain, - resolver, + resolver ); expect(signedPres).toMatchObject( expect.objectContaining({ - type: ['VerifiablePresentation'], + type: ["VerifiablePresentation"], verifiableCredential: [credential], id: presId, proof: expect.objectContaining({ - type: 'Ed25519Signature2018', + type: "Ed25519Signature2018", challenge, domain, - proofPurpose: 'authentication', + proofPurpose: "authentication", }), - }), + }) ); // Before verifying the presentation, check that the holder is a specific subject of the credential and the // holder did sign it // Get the recipient DID and document DID from the presentation - const credentials = jsonld.getValues(signedPres, 'verifiableCredential'); - const credSubject = jsonld.getValues(credentials[0], 'credentialSubject'); - const recipientDid = jsonld.getValues(credSubject[0], 'id')[0]; - expect(jsonld.getValues(credSubject[0], 'type')[0]).toEqual('reader'); - const documentDid = jsonld.getValues(credSubject[1], 'id')[0]; - expect(jsonld.getValues(credSubject[1], 'type')[0]).toEqual('document'); + const credentials = jsonld.getValues(signedPres, "verifiableCredential"); + const credSubject = jsonld.getValues(credentials[0], "credentialSubject"); + const recipientDid = jsonld.getValues(credSubject[0], "id")[0]; + expect(jsonld.getValues(credSubject[0], "type")[0]).toEqual("reader"); + const documentDid = jsonld.getValues(credSubject[1], "id")[0]; + expect(jsonld.getValues(credSubject[1], "type")[0]).toEqual("document"); expect(recipientDid).toEqual(String(subject1DID)); expect(documentDid).toEqual(String(subject2DID)); // Check that presentation signer is the recipient of the credential - const proofs = jsonld.getValues(signedPres, 'proof'); + const proofs = jsonld.getValues(signedPres, "proof"); const verificationMethod = jsonld.getValues( proofs[0], - 'verificationMethod', + "verificationMethod" ); - const didOfPresSigner = verificationMethod[0].split('#')[0]; + const didOfPresSigner = verificationMethod[0].split("#")[0]; expect(didOfPresSigner).toEqual(recipientDid); // This check isn't mandatory or sufficient as the signer can put whatever it wants as the "holder" - const presHolder = jsonld.getValues(signedPres, 'holder'); + const presHolder = jsonld.getValues(signedPres, "holder"); expect(presHolder).toEqual([recipientDid]); const result = await verifyPresentation(signedPres, { diff --git a/packages/dock-blockchain-modules/tests/integration/schema.test.js b/packages/dock-blockchain-modules/tests/integration/schema.test.js new file mode 100644 index 000000000..fbac5ebf3 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/schema.test.js @@ -0,0 +1,294 @@ +import { stringToHex, randomAsHex } from "@docknetwork/credential-sdk/utils"; + +import { DockAPI } from "@docknetwork/dock-blockchain-api"; + +import { DockDid, DockBlobId } from "@docknetwork/credential-sdk/types"; +import { + FullNodeEndpoint, + TestKeyringOpts, + TestAccountURI, +} from "../test-constants"; +import { + verifyCredential, + verifyPresentation, +} from "@docknetwork/credential-sdk/vc"; +import { Schema } from "@docknetwork/credential-sdk/modules"; +import VerifiableCredential from "@docknetwork/credential-sdk/vc/verifiable-credential"; +import exampleSchema from "../example-schema"; +import VerifiablePresentation from "@docknetwork/credential-sdk/vc/verifiable-presentation"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { DockResolver } from "@docknetwork/credential-sdk/resolver"; +import { DockCoreModules } from "../../src"; +import { registerNewDIDUsingPair } from "./helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; + +let account; +let pair; +let dockDID; +let blobId; +let keyDoc; +let validCredential; +let invalidCredential; +let invalidFormatBlobId; +let dockResolver; + +const ctx1 = { + "@context": { + emailAddress: "https://schema.org/email", + alumniOf: "https://schema.org/alumniOf", + }, +}; + +const ctx2 = { + "@context": { + emailAddress: "https://schema.org/email", + notAlumniOf: "https://schema.org/alumniOf", + }, +}; + +describe("Schema Blob Module Integration", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + + // Generate first key with this seed. The key type is Sr25519 + const firstKeySeed = randomAsHex(32); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + dockDID = DockDid.random(); + pair = new DidKeypair([dockDID, 1], Ed25519Keypair.random()); + await registerNewDIDUsingPair(dock, dockDID, pair); + blobId = DockBlobId.random(); + + // Write a blob with invalid JSON-schema format + invalidFormatBlobId = DockBlobId.random(); + let blob = { + id: invalidFormatBlobId, + blob: stringToHex("hello world"), + }; + await modules.blob.new(blob, dockDID, pair); + + // Write schema blob + const blobStr = JSON.stringify(exampleSchema); + blob = { + id: blobId, + blob: stringToHex(blobStr), + }; + await modules.blob.new(blob, dockDID, pair); + + // Properly format a keyDoc to use for signing + keyDoc = getKeyDoc(dockDID, new Ed25519Keypair(firstKeySeed)); + + // Create a resolver for dock DIDs + dockResolver = new DockResolver(modules); + + // Create a valid credential with a schema + validCredential = new VerifiableCredential( + "https://example.com/credentials/123" + ); + validCredential.addContext( + "https://www.w3.org/2018/credentials/examples/v1" + ); + validCredential.addContext(ctx1); + validCredential.addType("AlumniCredential"); + validCredential.addSubject({ + id: String(dockDID), + alumniOf: "Example University", + emailAddress: "john@gmail.com", + }); + validCredential.setSchema( + String(new DockBlobId(blobId)), + "JsonSchemaValidator2018" + ); + await validCredential.sign(keyDoc); + + // Create a valid credential that doesn't follow the schema + invalidCredential = new VerifiableCredential( + "https://example.com/credentials/1234" + ); + invalidCredential.addContext( + "https://www.w3.org/2018/credentials/examples/v1" + ); + invalidCredential.addContext(ctx2); + invalidCredential.addType("AlumniCredential"); + invalidCredential.addSubject({ + id: String(dockDID), + notAlumniOf: "Example University", + emailAddress: "john@gmail.com", + }); + invalidCredential.setSchema( + String(new DockBlobId(blobId)), + "JsonSchemaValidator2018" + ); + await invalidCredential.sign(keyDoc); + }, 90000); + + afterAll(async () => { + await dock.disconnect(); + }, 30000); + + test("Set and get schema", async () => { + const schema = new Schema(); + await schema.setJSONSchema(exampleSchema); + await modules.blob.new(schema.toBlob(), dockDID, pair); + const schemaObj = await Schema.get(blobId, modules.blob); + expect(schemaObj).toMatchObject({ + ...exampleSchema, + id: String(blobId), + author: dockDID.toString(), + }); + }, 20000); + + test("Schema.get throws error when schema not in correct format.", async () => { + await expect(Schema.get(invalidFormatBlobId, modules.blob)).rejects.toThrow( + /Underlying value is not a valid JSON/ + ); + }, 30000); + + test("Schema.get throws error when no blob exists at the given id.", async () => { + await expect(Schema.get(DockBlobId.random(), modules.blob)).rejects.toThrow( + /does not exist/ + ); + }, 30000); + + test("Utility method verifyCredential should pass if the subject is compatible with the schema in credentialSchema.", async () => { + await expect( + verifyCredential(validCredential.toJSON(), { + resolver: dockResolver, + compactProof: true, + }) + ).resolves.toBeDefined(); + }, 30000); + + test("The verify method should pass if the subject is compatible with the schema in credentialSchema.", async () => { + await expect( + validCredential.verify({ + resolver: dockResolver, + compactProof: true, + }) + ).resolves.toBeDefined(); + }, 30000); + + test("Utility method verifyCredential should check if schema is incompatible with the credentialSubject.", async () => { + await expect( + verifyCredential(invalidCredential.toJSON(), { + resolver: null, + compactProof: true, + }) + ).rejects.toThrow(/Unsupported protocol blob:/); + + await expect( + verifyCredential(invalidCredential.toJSON(), { + resolver: dockResolver, + compactProof: true, + }) + ).rejects.toThrow(/Schema validation failed/); + }, 30000); + + test("The verify method should detect a subject with incompatible schema in credentialSchema.", async () => { + await expect( + invalidCredential.verify({ + resolver: dockResolver, + compactProof: true, + }) + ).rejects.toThrow(/Schema validation failed/); + }, 30000); + + test("Utility method verifyPresentation should check if schema is incompatible with the credentialSubject.", async () => { + let vpInvalid = new VerifiablePresentation( + "https://example.com/credentials/12345" + ); + vpInvalid.addCredential(invalidCredential); + vpInvalid.addContext(ctx2); + vpInvalid = await vpInvalid.sign(keyDoc, "some_challenge", "some_domain"); + + await expect( + verifyPresentation(vpInvalid.toJSON(), { + challenge: "some_challenge", + domain: "some_domain", + resolver: null, + compactProof: true, + }) + ).rejects.toThrow(/Unsupported protocol blob:/); + + await expect( + verifyPresentation(vpInvalid.toJSON(), { + challenge: "some_challenge", + domain: "some_domain", + resolver: dockResolver, + compactProof: true, + }) + ).rejects.toThrow(/Schema validation failed/); + }, 90000); + + test("Utility method verifyPresentation should check if schema is compatible with the credentialSubject.", async () => { + let vpValid = new VerifiablePresentation( + "https://example.com/credentials/12345" + ); + vpValid.addCredential(validCredential); + vpValid.addContext(ctx1); + vpValid = await vpValid.sign(keyDoc, "some_challenge", "some_domain"); + + await expect( + verifyPresentation(vpValid.toJSON(), { + challenge: "some_challenge", + domain: "some_domain", + resolver: dockResolver, + compactProof: true, + }) + ).resolves.toBeDefined(); + }, 90000); + + test("VerifiablePresentation's verify should check if the schema is incompatible with the credentialSubject.", async () => { + let vpInvalid = new VerifiablePresentation( + "https://example.com/credentials/12345" + ); + vpInvalid.addCredential(invalidCredential); + vpInvalid.addContext(ctx2); + vpInvalid = await vpInvalid.sign(keyDoc, "some_challenge", "some_domain"); + + await expect( + vpInvalid.verify({ + challenge: "some_challenge", + domain: "some_domain", + resolver: null, + compactProof: true, + }) + ).rejects.toThrow(/Unsupported protocol blob:/); + + await expect( + vpInvalid.verify({ + challenge: "some_challenge", + domain: "some_domain", + resolver: dockResolver, + compactProof: true, + }) + ).rejects.toThrow(/Schema validation failed/); + }, 90000); + + test("VerifiablePresentation's verify should check if the schema is compatible with the credentialSubject.", async () => { + let vpValid = new VerifiablePresentation( + "https://example.com/credentials/12345" + ); + vpValid.addCredential(validCredential); + vpValid.addContext(ctx1); + vpValid = await vpValid.sign(keyDoc, "some_challenge", "some_domain"); + + await expect( + vpValid.verify({ + challenge: "some_challenge", + domain: "some_domain", + resolver: dockResolver, + compactProof: true, + }) + ).resolves.toBeDefined(); + }, 90000); +}); diff --git a/packages/dock-blockchain-modules/tests/integration/status-list-credential-module.test.js b/packages/dock-blockchain-modules/tests/integration/status-list-credential-module.test.js new file mode 100644 index 000000000..a9b554081 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/integration/status-list-credential-module.test.js @@ -0,0 +1,222 @@ +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; + +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import { DockCoreModules } from "../../src"; + +import { + FullNodeEndpoint, + TestKeyringOpts, + TestAccountURI, +} from "../test-constants"; + +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { registerNewDIDUsingPair } from "./helpers"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { StatusList2021Credential } from "@docknetwork/credential-sdk/types/status-list-credential"; + +const expectEqualCreds = (cred1, cred2) => { + expect(cred1.eq(cred2)).toBe(true); + expect(cred1.toJSON()).toEqual(cred2.toJSON()); + expect(StatusList2021Credential.fromJSON(cred1.toJSON())).toEqual( + StatusList2021Credential.fromJSON(cred2.toJSON()) + ); +}; + +describe("StatusListCredential Module", () => { + const dock = new DockAPI(); + const modules = new DockCoreModules(dock); + let pair; + + // Create a random status list id + const statusListCredId = randomAsHex(32); + // Create a random status list id + const multipleControllerstatusListCredID = randomAsHex(32); + + // Create a new owner DID, the DID will be registered on the network and own the status list + const ownerDID = DockDid.random(); + const ownerSeed = randomAsHex(32); + let ownerKey; + + // Create revoke IDs + const revokeId = (Math.random() * 10e3) | 0; + const revokeIds = new Set(); + revokeIds.add(revokeId); + + beforeAll(async () => { + await dock.init({ + keyring: TestKeyringOpts, + address: FullNodeEndpoint, + }); + + ownerKey = getKeyDoc( + ownerDID, + new Ed25519Keypair(ownerSeed), + "Ed25519VerificationKey2018" + ); + + // The keyring should be initialized before any test begins as this suite is testing statusListCredentialModule + const account = dock.keyring.addFromUri(TestAccountURI); + dock.setAccount(account); + + // Thees DIDs should be written before any test begins + pair = new DidKeypair([ownerDID, 1], new Ed25519Keypair(ownerSeed)); + + // The controller is same as the DID + await registerNewDIDUsingPair(dock, ownerDID, pair); + }, 40000); + + afterAll(async () => { + await dock.disconnect(); + }, 10000); + + test("Can create a status list with a OneOf policy", async () => { + const cred = await StatusList2021Credential.create( + ownerKey, + statusListCredId, + {} + ); + await expect( + modules.statusListCredential.createStatusListCredential( + statusListCredId, + cred, + ownerDID, + pair + ) + ).resolves.toBeDefined(); + const fetchedCred = + await modules.statusListCredential.getStatusListCredential( + statusListCredId + ); + expectEqualCreds(cred, fetchedCred); + }, 40000); + + test("Can revoke index from a status list credential", async () => { + const cred = await modules.statusListCredential.getStatusListCredential( + statusListCredId + ); + await cred.update(ownerKey, { revokeIndices: revokeIds }); + await modules.statusListCredential.updateStatusListCredential( + statusListCredId, + cred, + ownerDID, + pair + ); + const fetchedCred = + await modules.statusListCredential.getStatusListCredential( + statusListCredId + ); + expectEqualCreds(cred, fetchedCred); + expect(await fetchedCred.revoked(revokeId)).toBe(true); + }, 40000); + + test("Cant unsuspend from a status list credential with `statusPurpose` = `revocation`", async () => { + const cred = await modules.statusListCredential.getStatusListCredential( + statusListCredId + ); + await expect( + cred.update(ownerKey, { unsuspendIndices: revokeIds }) + ).rejects.toEqual( + new Error( + "Can't unsuspend indices for credential with `statusPurpose` = `revocation`, it's only possible with `statusPurpose` = `suspension`" + ) + ); + await expect( + cred.update(ownerKey, { unsuspendIndices: revokeIds }) + ).rejects.toEqual( + new Error( + "Can't unsuspend indices for credential with `statusPurpose` = `revocation`, it's only possible with `statusPurpose` = `suspension`" + ) + ); + expect(await cred.revokedBatch(revokeIds)).toEqual( + Array.from(revokeIds, () => true) + ); + }, 40000); + + test("Can unsuspend from a status list credential", async () => { + const credential = await StatusList2021Credential.create( + ownerKey, + statusListCredId, + { statusPurpose: "suspension", revokeIndices: revokeIds } + ); + await modules.statusListCredential.updateStatusListCredential( + statusListCredId, + credential, + ownerDID, + pair + ); + let fetchedCred = + await modules.statusListCredential.getStatusListCredential( + statusListCredId + ); + expectEqualCreds(credential, fetchedCred); + await fetchedCred.update(ownerKey, { unsuspendIndices: revokeIds }); + expect(await fetchedCred.revokedBatch(revokeIds)).toEqual( + Array.from(revokeIds, () => false) + ); + await modules.statusListCredential.updateStatusListCredential( + statusListCredId, + fetchedCred, + ownerDID, + pair + ); + + fetchedCred = await modules.statusListCredential.getStatusListCredential( + statusListCredId + ); + expect(await fetchedCred.revoked(revokeId)).toBe(false); + }, 40000); + + test("Can remove a status list", async () => { + await modules.statusListCredential.removeStatusListCredential( + statusListCredId, + ownerDID, + pair + ); + expect( + await modules.statusListCredential.getStatusListCredential( + statusListCredId + ) + ).toBe(null); + }, 40000); + + test("Can create a status list with multiple owners", async () => { + const cred = await StatusList2021Credential.create( + ownerKey, + multipleControllerstatusListCredID, + { statusPurpose: "suspension" } + ); + + await expect( + modules.statusListCredential.createStatusListCredential( + multipleControllerstatusListCredID, + cred, + ownerDID, + pair + ) + ).resolves.toBeDefined(); + const fetchedCred = ( + await dock.api.query.statusListCredential.statusListCredentials( + multipleControllerstatusListCredID + ) + ).unwrap(); + expect(fetchedCred.policy.isOneOf).toBe(true); + + const controllerSet = fetchedCred.policy.asOneOf; + expect(controllerSet.toJSON().length).toBe(1); + + let hasFirstDID = false; + [...controllerSet.entries()] + .flatMap((v) => v) + .map((cnt) => DockDid.from(cnt)) + .forEach((controller) => { + if (controller.toString() === DockDid.from(ownerDID).toString()) { + hasFirstDID = true; + } + }); + expect(hasFirstDID).toBe(true); + }, 40000); +}); diff --git a/tests/integration/status-list-credential.test.js b/packages/dock-blockchain-modules/tests/integration/status-list-credential.test.js similarity index 61% rename from tests/integration/status-list-credential.test.js rename to packages/dock-blockchain-modules/tests/integration/status-list-credential.test.js index be5032945..16f10bb75 100644 --- a/tests/integration/status-list-credential.test.js +++ b/packages/dock-blockchain-modules/tests/integration/status-list-credential.test.js @@ -1,34 +1,39 @@ -import { randomAsHex } from '@polkadot/util-crypto'; +import { randomAsHex } from "@docknetwork/credential-sdk/utils"; import { FullNodeEndpoint, TestKeyringOpts, TestAccountURI, -} from '../test-constants'; -import { DockAPI } from '../../src/index'; -import defaultDocumentLoader from '../../src/utils/vc/document-loader'; +} from "../test-constants"; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; +import defaultDocumentLoader from "@docknetwork/credential-sdk/vc/document-loader"; import { issueCredential, signPresentation, verifyCredential, verifyPresentation, -} from '../../src/utils/vc/index'; +} from "@docknetwork/credential-sdk/vc"; -import { DockResolver } from '../../src/resolver'; -import { createPresentation } from '../create-presentation'; +import { DockResolver } from "@docknetwork/credential-sdk/resolver"; +import { createPresentation } from "../create-presentation"; -import { OneOfPolicy } from '../../src/utils/revocation'; -import { getUnsignedCred, registerNewDIDUsingPair } from './helpers'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import { DockDid, DidKeypair, DockDidOrDidMethodKey } from '../../src/did'; -import StatusList2021Credential from '../../src/status-list-credential/status-list2021-credential'; -import { addStatusList21EntryToCredential } from '../../src/utils/vc/credentials'; +import { DockCoreModules } from "../../src"; +import { getUnsignedCred, registerNewDIDUsingPair } from "./helpers"; +import { getKeyDoc } from "@docknetwork/credential-sdk/vc/helpers"; +import { DockDid } from "@docknetwork/credential-sdk/types"; +import { StatusList2021Credential } from "@docknetwork/credential-sdk/types"; +import { addStatusList21EntryToCredential } from "@docknetwork/credential-sdk/vc/credentials"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; -const credId = 'A large credential id with size > 32 bytes'; +const credId = "A large credential id with size > 32 bytes"; -describe('StatusList2021Credential', () => { +describe("StatusList2021Credential", () => { const dockAPI = new DockAPI(); - const resolver = new DockResolver(dockAPI); + const modules = new DockCoreModules(dockAPI); + const resolver = new DockResolver(modules); // Create a random status list id const statusListCredentialId = randomAsHex(32); @@ -58,64 +63,65 @@ describe('StatusList2021Credential', () => { // Register issuer DID issuerKeyPair = new DidKeypair( - dockAPI.keyring.addFromUri(issuerSeed, null, 'ed25519'), - 1, + [issuerDID, 1], + new Ed25519Keypair(issuerSeed) ); await registerNewDIDUsingPair(dockAPI, issuerDID, issuerKeyPair); // Register holder DID const pair1 = new DidKeypair( - dockAPI.keyring.addFromUri(holderSeed, null, 'ed25519'), - 1, + [holderDID, 1], + new Ed25519Keypair(holderSeed) ); await registerNewDIDUsingPair(dockAPI, holderDID, pair1); // Create a new policy - const policy = new OneOfPolicy(); - policy.addOwner(DockDidOrDidMethodKey.from(issuerDID)); issuerKey = getKeyDoc( issuerDID, issuerKeyPair, - 'Ed25519VerificationKey2018', + "Ed25519VerificationKey2018" ); const statusListCred = await StatusList2021Credential.create( issuerKey, statusListCredentialId, - { statusPurpose: 'suspension' }, + { statusPurpose: "suspension" } ); // Add a new revocation status list with above policy - await dockAPI.statusListCredential.createStatusListCredential( + await modules.statusListCredential.createStatusListCredential( statusListCredentialId, statusListCred, - policy, + issuerDID, + issuerKeyPair ); let unsignedCred = getUnsignedCred(credId, holderDID, [ - 'https://w3id.org/vc/status-list/2021/v1', + "https://w3id.org/vc/status-list/2021/v1", ]); - expect(() => addStatusList21EntryToCredential( - unsignedCred, - statusListCredentialId, - statusListCredentialIndex, - 'wrongPurpose', - )).toThrow(); + expect(() => + addStatusList21EntryToCredential( + unsignedCred, + statusListCredentialId, + statusListCredentialIndex, + "wrongPurpose" + ) + ).toThrow(); // Issuer issues the credential with a given status list id for revocation unsignedCred = addStatusList21EntryToCredential( unsignedCred, statusListCredentialId, statusListCredentialIndex, - 'suspension', + "suspension" ); credential = await issueCredential( issuerKey, unsignedCred, void 0, - defaultDocumentLoader(resolver), + defaultDocumentLoader(resolver) ); }, 60000); @@ -123,7 +129,7 @@ describe('StatusList2021Credential', () => { await dockAPI.disconnect(); }, 10000); - test('Issuer can issue a revocable credential and holder can verify it successfully when it is not revoked else the verification fails', async () => { + test("Issuer can issue a revocable credential and holder can verify it successfully when it is not revoked else the verification fails", async () => { // The credential verification should pass as the credential has not been revoked. const result = await verifyCredential(credential, { resolver, @@ -133,19 +139,19 @@ describe('StatusList2021Credential', () => { expect(result.verified).toBe(true); // Revoke the credential - const fetchedCred = await dockAPI.statusListCredential.fetchStatusList2021Credential( - statusListCredentialId, - ); + const fetchedCred = + await modules.statusListCredential.getStatusListCredential( + statusListCredentialId + ); await fetchedCred.update(issuerKey, { revokeIndices: [statusListCredentialIndex], }); - await dockAPI.statusListCredential.updateStatusListCredentialWithOneOfPolicy( + await modules.statusListCredential.updateStatusListCredential( statusListCredentialId, fetchedCred, issuerDID, - issuerKeyPair, - dockAPI, + issuerKeyPair ); // The credential verification should fail as the credential has been revoked. @@ -156,44 +162,44 @@ describe('StatusList2021Credential', () => { expect(result1.verified).toBe(false); expect(result1.error).toBe( - 'Credential was revoked (or suspended) according to the status list referenced in `credentialStatus`', + "Credential was revoked (or suspended) according to the status list referenced in `credentialStatus`" ); }, 50000); - test('Holder can create a presentation and verifier can verify it successfully when it is not revoked else the verification fails', async () => { + test("Holder can create a presentation and verifier can verify it successfully when it is not revoked else the verification fails", async () => { // The previous test revokes credential so unsuspend it. Its fine if the previous test is not run as unrevoking does not // throw error if the credential is not revoked. - let fetchedCred = await dockAPI.statusListCredential.fetchStatusList2021Credential( - statusListCredentialId, - ); + let fetchedCred = + await modules.statusListCredential.getStatusListCredential( + statusListCredentialId + ); await fetchedCred.update(issuerKey, { unsuspendIndices: [statusListCredentialIndex], }); - await dockAPI.statusListCredential.updateStatusListCredentialWithOneOfPolicy( + await modules.statusListCredential.updateStatusListCredential( statusListCredentialId, fetchedCred, issuerDID, - issuerKeyPair, - dockAPI, + issuerKeyPair ); const holderKey = getKeyDoc( holderDID, - dockAPI.keyring.addFromUri(holderSeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', + new Ed25519Keypair(holderSeed), + "Ed25519VerificationKey2018" ); // Create presentation for unsuspended credential const presId = `https://pres.com/${randomAsHex(32)}`; const chal = randomAsHex(32); - const domain = 'test domain'; + const domain = "test domain"; const presentation = createPresentation(credential, presId); const signedPres = await signPresentation( presentation, holderKey, chal, domain, - resolver, + resolver ); // As the credential is unsuspended, the presentation should verify successfully. @@ -206,19 +212,18 @@ describe('StatusList2021Credential', () => { expect(result.verified).toBe(true); // Revoke credential - fetchedCred = await dockAPI.statusListCredential.fetchStatusList2021Credential( - statusListCredentialId, + fetchedCred = await modules.statusListCredential.getStatusListCredential( + statusListCredentialId ); await fetchedCred.update(issuerKey, { revokeIndices: [statusListCredentialIndex], }); - await dockAPI.statusListCredential.updateStatusListCredentialWithOneOfPolicy( + await modules.statusListCredential.updateStatusListCredential( statusListCredentialId, fetchedCred, issuerDID, - issuerKeyPair, - dockAPI, + issuerKeyPair ); // As the credential is revoked, the presentation should verify successfully. diff --git a/tests/integration/trust-registry-module.test.js b/packages/dock-blockchain-modules/tests/integration/trust-registry-module.test.js similarity index 53% rename from tests/integration/trust-registry-module.test.js rename to packages/dock-blockchain-modules/tests/integration/trust-registry-module.test.js index 0f6778943..aa3108ec9 100644 --- a/tests/integration/trust-registry-module.test.js +++ b/packages/dock-blockchain-modules/tests/integration/trust-registry-module.test.js @@ -1,50 +1,82 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { BTreeSet, BTreeMap } from '@polkadot/types'; -import { u8aToHex, stringToU8a } from '@polkadot/util'; +import { + randomAsHex, + u8aToHex, + stringToU8a, +} from "@docknetwork/credential-sdk/utils/bytes"; -import { DockAPI } from '../../src/index'; +import { DockAPI } from "@docknetwork/dock-blockchain-api"; import { FullNodeEndpoint, TestKeyringOpts, TestAccountURI, DisableTrustRegistryParticipantsTests, -} from '../test-constants'; - -import { DidKeypair, DidMethodKey, DockDid } from '../../src/did'; -import { registerNewDIDUsingPair } from './helpers'; +} from "../test-constants"; -describe('Trust Registry', () => { +import { DidMethodKey, DockDid } from "@docknetwork/credential-sdk/types"; +import { registerNewDIDUsingPair } from "./helpers"; +import { + Ed25519Keypair, + DidKeypair, +} from "@docknetwork/credential-sdk/keypairs"; +import { + IssuersSet, + TrustRegistryInfo, + DockTrustRegistryId, +} from "@docknetwork/credential-sdk/types/trust-registry"; +import { maybeToJSON } from "@docknetwork/credential-sdk/utils"; +import { DockCoreModules } from "../../src"; + +describe("Trust Registry", () => { const dock = new DockAPI(); + const modules = new DockCoreModules(dock); // Create a new convener DID, the DID will be registered on the network and own the trust registry const convenerDID = DockDid.random(); const ownerSeed = randomAsHex(32); - let convenerPair; + const convenerPair = new DidKeypair( + [convenerDID, 1], + new Ed25519Keypair(ownerSeed) + ); const issuerDID = DockDid.random(); const issuerSeed = randomAsHex(32); - let issuerPair; + const issuerPair = new DidKeypair( + [issuerDID, 1], + new Ed25519Keypair(issuerSeed) + ); const issuerDID2 = DockDid.random(); const issuerSeed2 = randomAsHex(32); - let issuerPair2; + const issuerPair2 = new DidKeypair( + [issuerDID2, 1], + new Ed25519Keypair(issuerSeed2) + ); const verifierDID = DockDid.random(); const verifierSeed = randomAsHex(32); - let verifierPair; + const verifierPair = new DidKeypair( + [verifierDID, 1], + new Ed25519Keypair(verifierSeed) + ); const verifierDID2 = DockDid.random(); const verifierSeed2 = randomAsHex(32); - let verifierPair2; + const verifierPair2 = new DidKeypair( + [verifierDID2, 1], + new Ed25519Keypair(verifierSeed2) + ); const verifierDIDMethodKeySeed = randomAsHex(32); - let verifierDIDMethodKeyPair; - let verifierDIDMethodKey; + + const verifierDIDMethodKeyPair = new Ed25519Keypair(verifierDIDMethodKeySeed); + const verifierDIDMethodKey = DidMethodKey.fromKeypair( + verifierDIDMethodKeyPair + ); const createRegistry = async ( - name = 'Test Registry', - govFramework = 'Gov framework', + name = "Test Registry", + govFramework = "Gov framework", convener = [convenerDID, convenerPair], participantDidsWithKeys = [ [issuerDID, issuerPair], @@ -52,49 +84,44 @@ describe('Trust Registry', () => { [verifierDID, verifierPair], [verifierDID2, verifierPair2], [verifierDIDMethodKey, verifierDIDMethodKeyPair], - ], + ] ) => { - const trustRegistryId = randomAsHex(32); + const trustRegistryId = DockTrustRegistryId.random(); expect( (await dock.api.query.trustRegistry.trustRegistriesInfo(trustRegistryId)) - .isNone, + .isNone ).toEqual(true); - await dock.trustRegistry.initOrUpdate( - convener[0], + await modules.trustRegistry.createRegistry( trustRegistryId, - name, - govFramework, - convener[1], - dock, + new TrustRegistryInfo(name, govFramework, convener[0]), + new Map(), + convener[1] ); if (!DisableTrustRegistryParticipantsTests) { - const participants = new BTreeMap( - dock.api.registry, - 'IssuerOrVerifier', - 'AddOrRemoveOrModify', - ); + const participants = new Map(); for (const [did, _] of participantDidsWithKeys) { - participants.set(did, 'Add'); + participants.set(did, "Add"); } const sigs = await Promise.all( - [...participantDidsWithKeys, convener].map(([did, signingKeyRef]) => dock.trustRegistry.signChangeParticipants( - did, - trustRegistryId, - participants, - signingKeyRef, - dock, - )), + [...participantDidsWithKeys, convener].map(([did, signingKeyRef]) => + modules.trustRegistry.dockOnly.signChangeParticipants( + did, + trustRegistryId, + participants, + signingKeyRef + ) + ) ); - await dock.trustRegistry.changeParticipants( + await modules.trustRegistry.dockOnly.changeParticipants( trustRegistryId, participants, - sigs, + sigs ); } @@ -107,43 +134,6 @@ describe('Trust Registry', () => { address: FullNodeEndpoint, }); - convenerPair = DidKeypair.fromApi(dock, { - seed: ownerSeed, - keypairType: 'ed25519', - keyId: 1, - }); - - issuerPair = DidKeypair.fromApi(dock, { - seed: issuerSeed, - keypairType: 'ed25519', - keyId: 1, - }); - - issuerPair2 = DidKeypair.fromApi(dock, { - seed: issuerSeed2, - keypairType: 'ed25519', - keyId: 1, - }); - - verifierPair = DidKeypair.fromApi(dock, { - seed: verifierSeed, - keypairType: 'ed25519', - keyId: 1, - }); - - verifierPair2 = DidKeypair.fromApi(dock, { - seed: verifierSeed2, - keypairType: 'ed25519', - keyId: 1, - }); - - verifierDIDMethodKeyPair = DidKeypair.fromApi(dock, { - seed: verifierDIDMethodKeySeed, - meta: null, - keypairType: 'ed25519', - }); - verifierDIDMethodKey = DidMethodKey.fromKeypair(verifierDIDMethodKeyPair); - // The keyring should be initialized before any test begins as this suite is testing trust registry const account = dock.keyring.addFromUri(TestAccountURI); dock.setAccount(account); @@ -155,225 +145,233 @@ describe('Trust Registry', () => { await registerNewDIDUsingPair(dock, issuerDID2, issuerPair2); await registerNewDIDUsingPair(dock, verifierDID, verifierPair); await registerNewDIDUsingPair(dock, verifierDID2, verifierPair2); - await dock.did.newDidMethodKey(verifierDIDMethodKey.asDidMethodKey); + await modules.did.dockOnly.newDidMethodKey(verifierDIDMethodKey); }, 40000); afterAll(async () => { await dock.disconnect(); }, 10000); - it('Initializes Trust Registry', async () => { + it("Creates, updates trust registry and queries data", async () => { + const trustRegistryId = await createRegistry(); + + const registry = ( + await modules.trustRegistry.getRegistry(trustRegistryId) + ).toJSON(); + expect(registry).toEqual({ + info: { + convener: convenerDID.toJSON(), + name: "Test Registry", + govFramework: "Gov framework", + }, + schemas: [], + }); + + const registries = ( + await modules.trustRegistry.getAllRegistriesByDid(convenerDID) + ).toJSON(); + + expect(registries).toEqual([ + [ + String(trustRegistryId), + { + info: { + convener: convenerDID.toJSON(), + name: "Test Registry", + govFramework: "Gov framework", + }, + schemas: [], + }, + ], + ]); + }); + + it("Initializes Trust Registry", async () => { const trustRegistryId = await createRegistry(); const registryInfo = ( await dock.api.query.trustRegistry.trustRegistriesInfo(trustRegistryId) ).toJSON(); expect(registryInfo).toEqual({ - convener: convenerDID, - name: 'Test Registry', - govFramework: u8aToHex(stringToU8a('Gov framework')), + convener: convenerDID.toJSON(), + name: "Test Registry", + govFramework: u8aToHex(stringToU8a("Gov framework")), }); }); - it('Fetches information about all trust registries/schemas metadata where given issuer/verifier exists', async () => { + it("Fetches information about all trust registries/schemas metadata where given issuer/verifier exists", async () => { const trustRegistryId = await createRegistry(); - const trustRegistryId2 = await createRegistry('Test Registry 2'); + const trustRegistryId2 = await createRegistry("Test Registry 2"); const schemaId = randomAsHex(32); const schemaId2 = randomAsHex(32); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); + const verifiers = new Set(); verifiers.add(verifierDID); verifiers.add(verifierDID2); - const issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 20); - const issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 20); + const issuers = new Map(); + const issuerPrices = new Map(); + issuerPrices.set("A", 20); + const issuer2Prices = new Map(); + issuer2Prices.set("A", 20); issuers.set(issuerDID, issuerPrices); issuers.set(issuerDID2, issuer2Prices); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); + const schemas = new Map(); schemas.set(schemaId, { issuers, verifiers, }); - const schema2Issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const schema2IssuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); + const schema2Issuers = new Map(); + const schema2IssuerPrices = new Map(); - schema2IssuerPrices.set('C', 40); + schema2IssuerPrices.set("C", 40); schema2Issuers.set(issuerDID, schema2IssuerPrices); schemas.set(schemaId2, { issuers: schema2Issuers, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Set: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.verifiersTrustRegistries( - verifierDIDMethodKey, + verifierDIDMethodKey ) - ).toJSON(), + ).toJSON() ).toEqual([]); expect( ( await dock.api.query.trustRegistry.issuersTrustRegistries(issuerDID) - ).toJSON(), - ).toEqual([trustRegistryId]); + ).toJSON() + ).toEqual([trustRegistryId.toJSON()]); expect( ( await dock.api.query.trustRegistry.verifiersTrustRegistries( - verifierDID2, + verifierDID2 ) - ).toJSON(), - ).toEqual([trustRegistryId]); + ).toJSON() + ).toEqual([trustRegistryId.toJSON()]); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId2, { Set: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.verifiersTrustRegistries( - verifierDIDMethodKey, + verifierDIDMethodKey ) - ).toJSON(), + ).toJSON() ).toEqual([]); expect( ( await dock.api.query.trustRegistry.issuersTrustRegistries(issuerDID) - ).toJSON(), - ).toEqual([trustRegistryId, trustRegistryId2].sort()); + ).toJSON() + ).toEqual([trustRegistryId.toJSON(), trustRegistryId2.toJSON()].sort()); expect( ( await dock.api.query.trustRegistry.verifiersTrustRegistries( - verifierDID2, + verifierDID2 ) - ).toJSON(), - ).toEqual([trustRegistryId, trustRegistryId2].sort()); + ).toJSON() + ).toEqual([trustRegistryId.toJSON(), trustRegistryId2.toJSON()].sort()); verifiers.add(verifierDIDMethodKey); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId2, { Set: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.verifiersTrustRegistries( - verifierDIDMethodKey, + verifierDIDMethodKey ) - ).toJSON(), - ).toEqual([trustRegistryId2]); + ).toJSON() + ).toEqual([trustRegistryId2.toJSON()]); const RegInfo = { [trustRegistryId]: { convener: convenerDID.toQualifiedEncodedString(), - name: 'Test Registry', - govFramework: u8aToHex(stringToU8a('Gov framework')), + name: "Test Registry", + govFramework: u8aToHex(stringToU8a("Gov framework")), }, }; const Reg2Info = { - [trustRegistryId2]: { + [trustRegistryId2.toJSON()]: { convener: convenerDID.toQualifiedEncodedString(), - name: 'Test Registry 2', - govFramework: u8aToHex(stringToU8a('Gov framework')), + name: "Test Registry 2", + govFramework: u8aToHex(stringToU8a("Gov framework")), }, }; - const BothRegsInfo = trustRegistryId.localeCompare(trustRegistryId2) >= 0 - ? { ...RegInfo, ...Reg2Info } - : { ...Reg2Info, ...RegInfo }; + const BothRegsInfo = + String(trustRegistryId).localeCompare(String(trustRegistryId2)) >= 0 + ? { ...RegInfo, ...Reg2Info } + : { ...Reg2Info, ...RegInfo }; expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ verifiers: { AnyOf: [verifierDIDMethodKey], }, - }), + }) ).toEqual(Reg2Info); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ issuers: { AnyOf: [verifierDIDMethodKey], }, - }), + }) ).toEqual({}); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ issuersOrVerifiers: { AnyOf: [verifierDIDMethodKey], }, - }), + }) ).toEqual(Reg2Info); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ issuers: { AnyOf: [verifierDIDMethodKey], }, verifiers: { AnyOf: [verifierDIDMethodKey], }, - }), + }) ).toEqual({}); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ schemaIds: { AnyOf: [schemaId] }, - }), + }) ).toEqual(BothRegsInfo); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ schemaIds: { AnyOf: [schemaId], }, verifiers: { AnyOf: [verifierDID], }, - }), + }) ).toEqual(BothRegsInfo); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ schemaIds: { AnyOf: [schemaId], }, @@ -383,208 +381,217 @@ describe('Trust Registry', () => { issuers: { AnyOf: [verifierDID], }, - }), + }) ).toEqual({}); expect( - await dock.trustRegistry.registriesInfo({ + await modules.trustRegistry.dockOnly.registriesInfo({ schemaIds: { AnyOf: [schemaId], }, issuersOrVerifiers: { AnyOf: [verifierDID, issuerDID2], }, - }), + }) ).toEqual(BothRegsInfo); - const schema1MetadataInTrustRegistry1 = dock.trustRegistry.parseSchemaMetadata({ - issuers: [ - [ - issuerDID, - { - delegated: [], - suspended: false, - verificationPrices: { - A: 20, + const schema1MetadataInTrustRegistry1 = + modules.trustRegistry.dockOnly.parseSchemaMetadata({ + issuers: [ + [ + issuerDID, + { + delegated: [], + suspended: false, + verificationPrices: { + A: 20, + }, }, - }, - ], - [ - issuerDID2, - { - delegated: [], - suspended: false, - verificationPrices: { - A: 20, + ], + [ + issuerDID2, + { + delegated: [], + suspended: false, + verificationPrices: { + A: 20, + }, }, - }, + ], ], - ], - verifiers: [verifierDID, verifierDID2], - }); - const schema1MetadataInTrustRegistry2 = dock.trustRegistry.parseSchemaMetadata({ - issuers: [ - [ - issuerDID, - { - delegated: [], - suspended: false, - verificationPrices: { - A: 20, + verifiers: [verifierDID, verifierDID2], + }); + const schema1MetadataInTrustRegistry2 = + modules.trustRegistry.dockOnly.parseSchemaMetadata({ + issuers: [ + [ + issuerDID, + { + delegated: [], + suspended: false, + verificationPrices: { + A: 20, + }, }, - }, - ], - [ - issuerDID2, - { - delegated: [], - suspended: false, - verificationPrices: { - A: 20, + ], + [ + issuerDID2, + { + delegated: [], + suspended: false, + verificationPrices: { + A: 20, + }, }, - }, + ], ], - ], - verifiers: [verifierDID, verifierDID2, verifierDIDMethodKey], - }); - const schema2MetadataInTrustRegistry1 = dock.trustRegistry.parseSchemaMetadata({ - issuers: [ - [ - issuerDID, - { - delegated: [], - suspended: false, - verificationPrices: { - C: 40, + verifiers: [verifierDID, verifierDID2, verifierDIDMethodKey], + }); + const schema2MetadataInTrustRegistry1 = + modules.trustRegistry.dockOnly.parseSchemaMetadata({ + issuers: [ + [ + issuerDID, + { + delegated: [], + suspended: false, + verificationPrices: { + C: 40, + }, }, - }, + ], ], - ], - verifiers: [], - }); + verifiers: [], + }); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { verifiers: { AnyOf: [verifierDIDMethodKey] }, }, - trustRegistryId2, - ), + trustRegistryId2 + ) ).toEqual({ [schemaId]: schema1MetadataInTrustRegistry2 }); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { issuersOrVerifiers: { AnyOf: [verifierDIDMethodKey] }, }, - trustRegistryId2, - ), + trustRegistryId2 + ) ).toEqual({ [schemaId]: schema1MetadataInTrustRegistry2 }); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { issuers: { AnyOf: [verifierDIDMethodKey] }, }, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual({}); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { issuers: { AnyOf: [verifierDIDMethodKey, issuerDID], }, }, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual({ [schemaId]: schema1MetadataInTrustRegistry1, [schemaId2]: schema2MetadataInTrustRegistry1, }); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { issuersOrVerifiers: { AnyOf: [verifierDIDMethodKey] }, }, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual({}); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { issuers: { AnyOf: [issuerDID] }, verifiers: { AnyOf: [verifierDIDMethodKey] }, }, - trustRegistryId2, - ), + trustRegistryId2 + ) ).toEqual({ [schemaId]: schema1MetadataInTrustRegistry2 }); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { schemaIds: [schemaId], }, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual({ [schemaId]: schema1MetadataInTrustRegistry1 }); expect( - await dock.trustRegistry.registrySchemasMetadata( + await modules.trustRegistry.dockOnly.registrySchemasMetadata( { issuers: { AnyOf: [issuerDID, issuerDID2], }, schemaIds: [schemaId], }, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual({ [schemaId]: schema1MetadataInTrustRegistry1 }); expect( - await dock.trustRegistry.registrySchemasMetadata({ + await modules.trustRegistry.dockOnly.registrySchemasMetadata({ issuers: { AnyOf: [verifierDID] }, schemaIds: [schemaId2], - }), + }) ).toEqual({}); expect( - await dock.trustRegistry.schemaMetadataInRegistry( + await modules.trustRegistry.dockOnly.schemaMetadataInRegistry( schemaId, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual(schema1MetadataInTrustRegistry1); expect( - await dock.trustRegistry.schemaIssuersInRegistry( + await modules.trustRegistry.dockOnly.schemaIssuersInRegistry( schemaId, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual(schema1MetadataInTrustRegistry1.issuers); expect( - await dock.trustRegistry.schemaVerifiersInRegistry( + await modules.trustRegistry.dockOnly.schemaVerifiersInRegistry( schemaId, - trustRegistryId, - ), + trustRegistryId + ) ).toEqual(schema1MetadataInTrustRegistry1.verifiers); - expect(await dock.trustRegistry.schemaMetadata(schemaId)).toEqual( - dock.trustRegistry.parseMapEntries( + expect( + await modules.trustRegistry.dockOnly.schemaMetadata(schemaId) + ).toEqual( + modules.trustRegistry.dockOnly.parseMapEntries( String, - dock.trustRegistry.parseSchemaMetadata, + modules.trustRegistry.dockOnly.parseSchemaMetadata, new Map([ [trustRegistryId, schema1MetadataInTrustRegistry1], [trustRegistryId2, schema1MetadataInTrustRegistry2], - ]), - ), + ]) + ) ); - expect(await dock.trustRegistry.schemaVerifiers(schemaId)).toEqual( - dock.trustRegistry.parseMapEntries( + expect( + await modules.trustRegistry.dockOnly.schemaVerifiers(schemaId) + ).toEqual( + modules.trustRegistry.dockOnly.parseMapEntries( String, - dock.trustRegistry.parseSchemaVerifiers, + modules.trustRegistry.dockOnly.parseSchemaVerifiers, new Map([ [trustRegistryId, [verifierDID, verifierDID2]], [trustRegistryId2, [verifierDID, verifierDID2, verifierDIDMethodKey]], - ]), - ), + ]) + ) ); - expect(await dock.trustRegistry.schemaIssuers(schemaId)).toEqual( - dock.trustRegistry.parseMapEntries( + expect( + await modules.trustRegistry.dockOnly.schemaIssuers(schemaId) + ).toEqual( + modules.trustRegistry.dockOnly.parseMapEntries( String, - dock.trustRegistry.parseSchemaIssuers, + modules.trustRegistry.dockOnly.parseSchemaIssuers, new Map([ [ trustRegistryId, @@ -636,47 +643,31 @@ describe('Trust Registry', () => { ], ], ], - ]), - ), + ]) + ) ); }); - it('Adds schemas metadata to the existing Trust Registry', async () => { + it("Adds schemas metadata to the existing Trust Registry", async () => { const trustRegistryId = await createRegistry(); const schemaId = randomAsHex(32); const otherSchemaId = randomAsHex(32); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); + const verifiers = new Set(); verifiers.add(verifierDID); verifiers.add(verifierDID2); verifiers.add(verifierDIDMethodKey); - const issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 20); - const issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 20); + const issuers = new Map(); + const issuerPrices = new Map(); + issuerPrices.set("A", 20); + const issuer2Prices = new Map(); + issuer2Prices.set("A", 20); issuers.set(issuerDID, issuerPrices); issuers.set(issuerDID2, issuer2Prices); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); + const schemas = new Map(); schemas.set(schemaId, { Set: { issuers, @@ -689,21 +680,20 @@ describe('Trust Registry', () => { }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), verifiers: expectedFormattedVerifiers(verifiers), @@ -712,53 +702,35 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( otherSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), - verifiers: expectedFormattedVerifiers( - new BTreeSet(dock.api.registry, 'Verifier'), - ), + verifiers: expectedFormattedVerifiers(new Set()), }); }); - it('Removes schemas metadata from the Trust Registry', async () => { + it("Removes schemas metadata from the Trust Registry", async () => { const trustRegistryId = await createRegistry(); const schemaId = randomAsHex(32); const otherSchemaId = randomAsHex(32); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); + const verifiers = new Set(); verifiers.add(verifierDID); verifiers.add(verifierDID2); verifiers.add(verifierDIDMethodKey); - const issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 20); - const issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 20); + const issuers = new Map(); + const issuerPrices = new Map(); + issuerPrices.set("A", 20); + const issuer2Prices = new Map(); + issuer2Prices.set("A", 20); issuers.set(issuerDID, issuerPrices); issuers.set(issuerDID2, issuer2Prices); - let schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); + let schemas = new Map(); schemas.set(schemaId, { Add: { issuers, @@ -771,21 +743,20 @@ describe('Trust Registry', () => { }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), verifiers: expectedFormattedVerifiers(verifiers), @@ -794,51 +765,44 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( otherSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), - verifiers: expectedFormattedVerifiers( - new BTreeSet(dock.api.registry, 'Verifier'), - ), + verifiers: expectedFormattedVerifiers(new Set()), }); - schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); - schemas.set(schemaId, 'Remove'); - schemas.set(otherSchemaId, 'Remove'); + schemas = new Map(); + schemas.set(schemaId, "Remove"); + schemas.set(otherSchemaId, "Remove"); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual(null); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( otherSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual(null); }); - it('Changes participant information', async () => { + it("Changes participant information", async () => { if (DisableTrustRegistryParticipantsTests) { return; } @@ -847,80 +811,67 @@ describe('Trust Registry', () => { const participant = issuerDID; expect( - await dock.trustRegistry.registryParticipantsInfo(trustRegistryId, [ - participant, - ]), + await modules.trustRegistry.dockOnly.registryParticipantsInfo( + trustRegistryId, + [participant] + ) ).toEqual({ [participant]: null }); const information = { - orgName: 'Org Name', - logo: 'Logo', - description: 'Description', + orgName: "Org Name", + logo: "Logo", + description: "Description", }; const sigs = await Promise.all( [ [issuerDID, issuerPair], [convenerDID, convenerPair], - ].map(([did, signingKeyRef]) => dock.trustRegistry.signSetParticipantInformation( - did, - trustRegistryId, - participant, - information, - signingKeyRef, - dock, - )), + ].map(([did, signingKeyRef]) => + modules.trustRegistry.dockOnly.signSetParticipantInformation( + did, + trustRegistryId, + participant, + information, + signingKeyRef + ) + ) ); - await dock.trustRegistry.setParticipantInformation( + await modules.trustRegistry.dockOnly.setParticipantInformation( trustRegistryId, participant, information, - sigs, + sigs ); expect( - await dock.trustRegistry.registryParticipantsInfo(trustRegistryId, [ - participant, - ]), + await modules.trustRegistry.dockOnly.registryParticipantsInfo( + trustRegistryId, + [participant] + ) ).toEqual({ [participant]: information }); }); - it('Changes issuer information', async () => { + it("Changes issuer information", async () => { const trustRegistryId = await createRegistry(); const schemaId = randomAsHex(32); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); + const verifiers = new Set(); verifiers.add(verifierDID); verifiers.add(verifierDID2); verifiers.add(verifierDIDMethodKey); - const issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 20); - const issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 20); + const issuers = new Map(); + const issuerPrices = new Map(); + issuerPrices.set("A", 20); + const issuer2Prices = new Map(); + issuer2Prices.set("A", 20); issuers.set(issuerDID, issuerPrices); issuers.set(issuerDID2, issuer2Prices); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); + const schemas = new Map(); schemas.set(schemaId, { Set: { issuers, @@ -928,20 +879,18 @@ describe('Trust Registry', () => { }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemas }, - convenerPair, - dock, + convenerPair ); - await dock.trustRegistry.suspendIssuers( + await modules.trustRegistry.dockOnly.suspendIssuers( convenerDID, trustRegistryId, [issuerDID, issuerDID2], - convenerPair, - dock, + convenerPair ); for (const issuer of [issuerDID, issuerDID2]) { @@ -949,21 +898,20 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistryIssuerConfigurations( trustRegistryId, - issuer, + issuer ) - ).toJSON(), + ).toJSON() ).toEqual({ suspended: true, delegated: [], }); } - await dock.trustRegistry.unsuspendIssuers( + await modules.trustRegistry.dockOnly.unsuspendIssuers( convenerDID, trustRegistryId, [issuerDID], - convenerPair, - dock, + convenerPair ); for (const issuer of [issuerDID]) { @@ -971,9 +919,9 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistryIssuerConfigurations( trustRegistryId, - issuer, + issuer ) - ).toJSON(), + ).toJSON() ).toEqual({ suspended: false, delegated: [], @@ -985,9 +933,9 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistryIssuerConfigurations( trustRegistryId, - issuer, + issuer ) - ).toJSON(), + ).toJSON() ).toEqual({ suspended: true, delegated: [], @@ -995,125 +943,91 @@ describe('Trust Registry', () => { } }); - it('Updates delegated issuers', async () => { + it("Updates delegated issuers", async () => { const trustRegistryId = await createRegistry(); const schemaId = randomAsHex(32); - const schemaIssuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const schemaIssuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - schemaIssuerPrices.set('A', 20); + const schemaIssuers = new Map(); + const schemaIssuerPrices = new Map(); + schemaIssuerPrices.set("A", 20); schemaIssuers.set(issuerDID, schemaIssuerPrices); schemaIssuers.set(issuerDID2, schemaIssuerPrices); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); + const schemas = new Map(); schemas.set(schemaId, { Set: { issuers: schemaIssuers, }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistryIssuerConfigurations( trustRegistryId, - issuerDID, + issuerDID ) - ).toJSON(), + ).toJSON() ).toEqual({ suspended: false, delegated: [], }); - const issuers = new BTreeSet(dock.api.registry, 'Issuer'); + const issuers = new IssuersSet(); issuers.add(issuerDID2); - await dock.trustRegistry.updateDelegatedIssuers( + await modules.trustRegistry.dockOnly.updateDelegatedIssuers( issuerDID, trustRegistryId, { Set: issuers }, - issuerPair, - dock, + issuerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistryIssuerConfigurations( trustRegistryId, - issuerDID, + issuerDID ) - ).toJSON(), + ).toJSON() ).toEqual({ suspended: false, - delegated: [issuerDID2], + delegated: [issuerDID2.toJSON()], }); }); - it('Updates schemas metadata', async () => { + it("Updates schemas metadata", async () => { const trustRegistryId = await createRegistry(); const schemaId = randomAsHex(32); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); + const verifiers = new Set(); verifiers.add(verifierDID); verifiers.add(verifierDID2); verifiers.add(verifierDIDMethodKey); - let issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - let issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 20); - let issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 20); + let issuers = new Map(); + let issuerPrices = new Map(); + issuerPrices.set("A", 20); + let issuer2Prices = new Map(); + issuer2Prices.set("A", 20); issuers.set(issuerDID, issuerPrices); issuers.set(issuerDID2, issuer2Prices); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); + const schemas = new Map(); schemas.set(schemaId, { issuers, verifiers, }); - let schemasUpdate = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); + let schemasUpdate = new Map(); schemasUpdate.set(schemaId, { Add: { issuers, @@ -1121,45 +1035,32 @@ describe('Trust Registry', () => { }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemasUpdate }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), verifiers: expectedFormattedVerifiers(verifiers), }); - schemasUpdate = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); + schemasUpdate = new Map(); - issuers = new BTreeMap(dock.api.registry, 'Issuer', 'VerificationPrices'); - issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 65); - issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 75); + issuers = new Map(); + issuerPrices = new Map(); + issuerPrices.set("A", 65); + issuer2Prices = new Map(); + issuer2Prices.set("A", 75); issuers.set(issuerDID, issuerPrices); issuers.set(issuerDID2, issuer2Prices); @@ -1172,54 +1073,37 @@ describe('Trust Registry', () => { }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Modify: schemasUpdate }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), verifiers: expectedFormattedVerifiers(verifiers), }); - schemasUpdate = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); + schemasUpdate = new Map(); - const issuer2PricesUpdate = new BTreeMap( - dock.api.registry, - 'String', - 'SetOrAddOrRemoveOrModifyVerificationPrice', - ); - issuer2PricesUpdate.set('C', { Add: 25 }); - issuer2PricesUpdate.set('B', { Set: 36 }); - issuer2PricesUpdate.set('A', 'Remove'); - - issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('C', 25); - issuer2Prices.set('B', 36); + const issuer2PricesUpdate = new Map(); + issuer2PricesUpdate.set("C", { Add: 25 }); + issuer2PricesUpdate.set("B", { Set: 36 }); + issuer2PricesUpdate.set("A", "Remove"); - const issuersUpdate = new BTreeMap( - dock.api.registry, - 'Issuer', - 'SetOrAddOrRemoveOrModifyVerificationPrices', - ); + issuer2Prices = new Map(); + issuer2Prices.set("C", 25); + issuer2Prices.set("B", 36); + + const issuersUpdate = new Map(); issuersUpdate.set(issuerDID2, { Modify: issuer2PricesUpdate, }); @@ -1232,7 +1116,7 @@ describe('Trust Registry', () => { }, }); - issuers = new BTreeMap(dock.api.registry, 'Issuer', 'VerificationPrices'); + issuers = new Map(); issuers.set(issuerDID2, issuer2Prices); issuers.set(issuerDID, issuerPrices); schemas.set(schemaId, { @@ -1240,37 +1124,28 @@ describe('Trust Registry', () => { verifiers: schemas.get(schemaId).verifiers, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( issuerDID2, trustRegistryId, { Modify: schemasUpdate }, - issuerPair2, - dock, + issuerPair2 ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), verifiers: expectedFormattedVerifiers(verifiers), }); - schemasUpdate = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ); - const verifiersUpdate = new BTreeMap( - dock.api.registry, - 'Verifier', - 'AddOrRemoveOrModify', - ); - verifiersUpdate.set(verifierDIDMethodKey, 'Remove'); + schemasUpdate = new Map(); + const verifiersUpdate = new Map(); + verifiersUpdate.set(verifierDIDMethodKey, "Remove"); schemasUpdate.set(schemaId, { Modify: { @@ -1280,12 +1155,11 @@ describe('Trust Registry', () => { }, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( verifierDIDMethodKey, trustRegistryId, { Modify: schemasUpdate }, - verifierDIDMethodKeyPair, - dock, + verifierDIDMethodKeyPair ); verifiers.delete(verifierDIDMethodKey); @@ -1294,92 +1168,67 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(issuers), verifiers: expectedFormattedVerifiers(verifiers), }); }); - it('Overrides Trust Registry', async () => { + it("Overrides Trust Registry", async () => { const trustRegistryId = await createRegistry(); const schemaId = randomAsHex(32); const secondSchemaId = randomAsHex(32); const thirdSchemaId = randomAsHex(32); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); + const verifiers = new Set(); verifiers.add(verifierDID); verifiers.add(verifierDID2); verifiers.add(verifierDIDMethodKey); - let issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - let issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 20); - let issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 20); + let issuers = new Map(); + let issuerPrices = new Map(); + issuerPrices.set("A", 20); + let issuer2Prices = new Map(); + issuer2Prices.set("A", 20); const issuerDIDHex = issuerDID; issuers.set(issuerDIDHex, issuerPrices); issuers.set(issuerDID2, issuer2Prices); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); + const schemas = new Map(); schemas.set(schemaId, { issuers, verifiers, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Set: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(schemas.get(schemaId).issuers), verifiers: expectedFormattedVerifiers(schemas.get(schemaId).verifiers), }); schemas.get(schemaId).issuers.delete(issuerDIDHex); - issuers = new BTreeMap(dock.api.registry, 'Issuer', 'VerificationPrices'); - issuerPrices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices.set('A', 65); - issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('A', 75); + issuers = new Map(); + issuerPrices = new Map(); + issuerPrices.set("A", 65); + issuer2Prices = new Map(); + issuer2Prices.set("A", 75); issuers.set(issuerDIDHex, issuerPrices); issuers.set(issuerDID2, issuer2Prices); @@ -1389,21 +1238,20 @@ describe('Trust Registry', () => { verifiers, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Set: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(schemas.get(schemaId).issuers), verifiers: expectedFormattedVerifiers(schemas.get(schemaId).verifiers), @@ -1413,33 +1261,29 @@ describe('Trust Registry', () => { ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( secondSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(schemas.get(secondSchemaId).issuers), verifiers: expectedFormattedVerifiers( - schemas.get(secondSchemaId).verifiers, + schemas.get(secondSchemaId).verifiers ), }); expect( ( await dock.api.query.trustRegistry.trustRegistriesStoredSchemas( - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual([schemaId, secondSchemaId].sort()); schemas.delete(schemaId); - issuer2Prices = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuer2Prices.set('C', 25); - issuer2Prices.set('B', 36); + issuer2Prices = new Map(); + issuer2Prices.set("C", 25); + issuer2Prices.set("B", 36); - issuers = new BTreeMap(dock.api.registry, 'Issuer', 'VerificationPrices'); + issuers = new Map(); issuers.set(issuerDID2, issuer2Prices); issuers.set(issuerDIDHex, issuerPrices); schemas.set(thirdSchemaId, { @@ -1447,103 +1291,97 @@ describe('Trust Registry', () => { verifiers: schemas.get(secondSchemaId).verifiers, }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { Set: schemas }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistriesStoredSchemas( - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual([secondSchemaId, thirdSchemaId].sort()); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual(null); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( secondSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(schemas.get(secondSchemaId).issuers), verifiers: expectedFormattedVerifiers( - schemas.get(secondSchemaId).verifiers, + schemas.get(secondSchemaId).verifiers ), }); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( thirdSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual({ issuers: expectedFormattedIssuers(schemas.get(thirdSchemaId).issuers), verifiers: expectedFormattedVerifiers( - schemas.get(thirdSchemaId).verifiers, + schemas.get(thirdSchemaId).verifiers ), }); - await dock.trustRegistry.setSchemasMetadata( + await modules.trustRegistry.dockOnly.setSchemasMetadata( convenerDID, trustRegistryId, { - Set: new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'SetOrAddOrRemoveOrModify', - ), + Set: new Map(), }, - convenerPair, - dock, + convenerPair ); expect( ( await dock.api.query.trustRegistry.trustRegistriesStoredSchemas( - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual([]); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( schemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual(null); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( secondSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual(null); expect( ( await dock.api.query.trustRegistry.trustRegistrySchemasMetadata( thirdSchemaId, - trustRegistryId, + trustRegistryId ) - ).toJSON(), + ).toJSON() ).toEqual(null); }); }); @@ -1551,20 +1389,14 @@ describe('Trust Registry', () => { function expectedFormattedIssuers(issuers) { return Object.fromEntries( [...issuers.entries()].map(([issuer, prices]) => [ - JSON.stringify( - issuer.isDid - ? { did: issuer.asDid } - : { didMethodKey: issuer.asDidMethodKey }, - ), + JSON.stringify(maybeToJSON(issuer)), Object.fromEntries([...prices.entries()]), - ]), + ]) ); } function expectedFormattedVerifiers(verifiers) { return [...verifiers.values()] - .map((verifier) => (verifier.isDid - ? { did: verifier.asDid } - : { didMethodKey: verifier.asDidMethodKey })) + .map(maybeToJSON) .sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b))); } diff --git a/tests/mocks/fetch.js b/packages/dock-blockchain-modules/tests/mocks/fetch.js similarity index 87% rename from tests/mocks/fetch.js rename to packages/dock-blockchain-modules/tests/mocks/fetch.js index 2c34f21f5..2e6e976c4 100644 --- a/tests/mocks/fetch.js +++ b/packages/dock-blockchain-modules/tests/mocks/fetch.js @@ -1,4 +1,4 @@ -import networkCache from '../network-cache'; +import networkCache from "../network-cache"; // Mock the global fetch function global.fetch = jest.fn(); @@ -8,7 +8,7 @@ const mockFetchResponse = (status, data) => { const response = new Response(JSON.stringify(data), { status, headers: { - 'Content-type': 'application/json', + "Content-type": "application/json", }, }); return Promise.resolve(response); diff --git a/packages/dock-blockchain-modules/tests/network-cache.js b/packages/dock-blockchain-modules/tests/network-cache.js new file mode 100644 index 000000000..fa670fe97 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/network-cache.js @@ -0,0 +1,55 @@ +export default { + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw": + { + id: "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw", + type: "EcdsaSecp256k1VerificationKey2019", + publicKeyBase58: "222iuczftmixHLkW6wszwyeAfYCZA7bzQMhkEXpeNVJrk", + "@context": "https://w3id.org/security/v2", + controller: + "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw", + }, + "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw": + { + "@context": "https://w3id.org/security/v2", + id: "https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw", + assertionMethod: [ + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw", + ], + authentication: [ + "https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw", + ], + }, + + "urn:EcdsaSecp256k1VerificationKey2019#keys-1": { + id: "urn:EcdsaSecp256k1VerificationKey2019#keys-1", + type: "EcdsaSecp256k1VerificationKey2019", + publicKeyBase58: "222iuczftmixHLkW6wszwyeAfYCZA7bzQMhkEXpeNVJrk", + "@context": "https://w3id.org/security/v2", + controller: "urn:EcdsaSecp256k1VerificationKey2019", + }, + "urn:EcdsaSecp256k1VerificationKey2019": { + "@context": "https://w3id.org/security/v2", + id: "urn:EcdsaSecp256k1VerificationKey2019", + assertionMethod: ["urn:EcdsaSecp256k1VerificationKey2019#keys-1"], + authentication: ["urn:EcdsaSecp256k1VerificationKey2019#keys-1"], + }, + + "urn:JsonWebKey2020": { + "@context": "https://w3id.org/security/v2", + id: "urn:JsonWebKey2020", + assertionMethod: ["urn:JsonWebKey2020#keys-1"], + authentication: ["urn:JsonWebKey2020#keys-1"], + }, + "urn:JsonWebKey2020#keys-1": { + "@context": "https://w3id.org/security/suites/jws-2020/v1", + id: "urn:JsonWebKey2020#keys-1", + controller: "urn:JsonWebKey2020", + type: "JsonWebKey2020", + publicKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + }, + }, +}; diff --git a/packages/dock-blockchain-modules/tests/setup-test-env.js b/packages/dock-blockchain-modules/tests/setup-test-env.js new file mode 100644 index 000000000..32651f5d8 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/setup-test-env.js @@ -0,0 +1,2 @@ +import "core-js/stable"; +import "regenerator-runtime/runtime"; diff --git a/tests/test-constants.js b/packages/dock-blockchain-modules/tests/test-constants.js similarity index 50% rename from tests/test-constants.js rename to packages/dock-blockchain-modules/tests/test-constants.js index 272c21ae7..fcc0848a1 100644 --- a/tests/test-constants.js +++ b/packages/dock-blockchain-modules/tests/test-constants.js @@ -18,32 +18,30 @@ import { BBDT16KeypairG1, BBDT16Mac, BBDT16MacParams, -} from '@docknetwork/crypto-wasm-ts'; -import dotenv from 'dotenv'; -import BBSModule from '../src/modules/bbs'; -import BBSPlusModule from '../src/modules/bbs-plus'; -import PSModule from '../src/modules/ps'; -import Presentation from '../src/presentation'; -import Bls12381PSSignatureProofDock2023 from '../src/utils/vc/crypto/Bls12381PSSignatureProofDock2023'; -import Bls12381BBSSignatureProofDock2023 from '../src/utils/vc/crypto/Bls12381BBSSignatureProofDock2023'; -import Bls12381BBSSignatureProofDock2022 from '../src/utils/vc/crypto/Bls12381BBSSignatureProofDock2022'; -import Bls12381BBSKeyPairDock2023 from '../src/utils/vc/crypto/Bls12381BBSKeyPairDock2023'; -import Bls12381G2KeyPairDock2022 from '../src/utils/vc/crypto/Bls12381G2KeyPairDock2022'; -import Bls12381PSKeyPairDock2023 from '../src/utils/vc/crypto/Bls12381PSKeyPairDock2023'; -import Bls12381BBDT16KeyPairDock2024 from '../src/utils/vc/crypto/Bls12381BBDT16KeyPairDock2024'; -import Bls12381BBDT16MACProofDock2024 from '../src/utils/vc/crypto/Bls12381BBDT16MACProofDock2024'; +} from "@docknetwork/credential-sdk/crypto"; +import dotenv from "dotenv"; +import { DockBBSModule, DockBBSPlusModule, DockPSModule } from "../src"; +import Presentation from "@docknetwork/credential-sdk/vc/presentation"; +import Bls12381PSSignatureProofDock2023 from "@docknetwork/credential-sdk/vc/crypto/Bls12381PSSignatureProofDock2023"; +import Bls12381BBSSignatureProofDock2023 from "@docknetwork/credential-sdk/vc/crypto/Bls12381BBSSignatureProofDock2023"; +import Bls12381BBSSignatureProofDock2022 from "@docknetwork/credential-sdk/vc/crypto/Bls12381BBSSignatureProofDock2022"; +import Bls12381BBSKeyPairDock2023 from "@docknetwork/credential-sdk/vc/crypto/Bls12381BBSKeyPairDock2023"; +import Bls12381G2KeyPairDock2022 from "@docknetwork/credential-sdk/vc/crypto/Bls12381G2KeyPairDock2022"; +import Bls12381PSKeyPairDock2023 from "@docknetwork/credential-sdk/vc/crypto/Bls12381PSKeyPairDock2023"; +import Bls12381BBDT16KeyPairDock2024 from "@docknetwork/credential-sdk/vc/crypto/Bls12381BBDT16KeyPairDock2024"; +import Bls12381BBDT16MACProofDock2024 from "@docknetwork/credential-sdk/vc/crypto/Bls12381BBDT16MACProofDock2024"; dotenv.config(); -const DefaultFullNodeEndpoint = 'ws://127.0.0.1:9944'; -const DefaultFullNodeTCPEndpoint = 'http://127.0.0.1:9933'; -const DefaultTestKeyringType = 'sr25519'; -const DefaultTestAccountURI = '//Alice'; -const DefaultTestAccountCouncilMemberURI = '//Charlie'; +const DefaultFullNodeEndpoint = "ws://127.0.0.1:9944"; +const DefaultFullNodeTCPEndpoint = "http://127.0.0.1:9933"; +const DefaultTestKeyringType = "sr25519"; +const DefaultTestAccountURI = "//Alice"; +const DefaultTestAccountCouncilMemberURI = "//Charlie"; const DefaultMinGasPrice = 50; const DefaultMaxGas = 429496729; -const DefaultTestSchemes = 'BBS,BBSPlus,PS,BBDT16'; +const DefaultTestSchemes = "BBS,BBSPlus,PS,BBDT16"; -const boolEnv = (value) => value === 'true' || !!+value; +const boolEnv = (value) => value === "true" || !!+value; /** * Read variable from environment or use the default value @@ -62,103 +60,109 @@ function fromEnv(varName, defaultVal) { } export const FullNodeEndpoint = fromEnv( - 'FullNodeEndpoint', - DefaultFullNodeEndpoint, + "FullNodeEndpoint", + DefaultFullNodeEndpoint ); export const FullNodeTCPEndpoint = fromEnv( - 'FullNodeTCPEndpoint', - DefaultFullNodeTCPEndpoint, + "FullNodeTCPEndpoint", + DefaultFullNodeTCPEndpoint ); export const TestKeyringOpts = { - type: fromEnv('TestKeyringType', DefaultTestKeyringType), + type: fromEnv("TestKeyringType", DefaultTestKeyringType), }; -export const TestAccountURI = fromEnv('TestAccountURI', DefaultTestAccountURI); +export const TestAccountURI = fromEnv("TestAccountURI", DefaultTestAccountURI); export const TestAccountCouncilMemberURI = fromEnv( - 'TestAccountCouncilMemberURI', - DefaultTestAccountCouncilMemberURI, + "TestAccountCouncilMemberURI", + DefaultTestAccountCouncilMemberURI ); -export const MinGasPrice = fromEnv('MinGasPrice', DefaultMinGasPrice); -export const MaxGas = fromEnv('MaxGas', DefaultMaxGas); -export const TestSchemes = fromEnv('TestSchemes', DefaultTestSchemes); +export const MinGasPrice = fromEnv("MinGasPrice", DefaultMinGasPrice); +export const MaxGas = fromEnv("MaxGas", DefaultMaxGas); +export const TestSchemes = fromEnv("TestSchemes", DefaultTestSchemes); export const DisableTrustRegistryParticipantsTests = boolEnv( - fromEnv('DisableTrustRegistryParticipantsTests', 'false'), + fromEnv("DisableTrustRegistryParticipantsTests", "false") ); export const BBS = { - Name: 'BBS', - Module: BBSModule, + Name: "BBS", + Module: DockBBSModule, PublicKey: BBSPublicKey, Presentation, buildProverStatement: Statement.bbsSignatureProver, buildVerifierStatement: Statement.bbsSignatureVerifier, buildWitness: Witness.bbsSignature, - getModule: (dock) => dock.bbs, + getModule: (dock) => new DockBBSModule(dock), SignatureParams: BBSSignatureParams, Signature: BBSSignature, KeyPair: BBSKeypair, CryptoKeyPair: Bls12381BBSKeyPairDock2023, derivedToAnoncredsPresentation: Bls12381BBSSignatureProofDock2023.derivedToAnoncredsPresentation.bind( - Bls12381BBSSignatureProofDock2023, + Bls12381BBSSignatureProofDock2023 ), - SigType: 'Bls12381BBSSignatureDock2023', - Context: 'https://ld.dock.io/security/bbs23/v1', - VerKey: 'Bls12381BBSVerificationKeyDock2023', + SigType: "Bls12381BBSSignatureDock2023", + Context: "https://ld.dock.io/security/bbs23/v1", + VerKey: "Bls12381BBSVerificationKeyDock2023", getParamsByDid: (api, did) => api.rpc.core_mods.bbsParamsByDid(did), - getPublicKeyWithParamsByStorageKey: (api, storageKey) => api.rpc.core_mods.bbsPublicKeyWithParams(storageKey), - getPublicKeysByDid: (api, did) => api.rpc.core_mods.bbsPublicKeysByDid(did.asDid), + getPublicKeyWithParamsByStorageKey: (api, storageKey) => + api.rpc.core_mods.bbsPublicKeyWithParams(storageKey), + getPublicKeysByDid: (api, did) => + api.rpc.core_mods.bbsPublicKeysByDid(did.asDid), }; export const BBSPlus = { - Name: 'BBS+', - Module: BBSPlusModule, + Name: "BBS+", + Module: DockBBSPlusModule, PublicKey: BBSPlusPublicKeyG2, Presentation, buildProverStatement: Statement.bbsPlusSignatureProver, buildVerifierStatement: Statement.bbsPlusSignatureVerifier, buildWitness: Witness.bbsPlusSignature, - getModule: (dock) => dock.bbsPlus, + getModule: (dock) => new DockBBSPlusModule(dock), SignatureParams: BBSPlusSignatureParamsG1, Signature: BBSPlusSignatureG1, KeyPair: BBSPlusKeypairG2, CryptoKeyPair: Bls12381G2KeyPairDock2022, derivedToAnoncredsPresentation: Bls12381BBSSignatureProofDock2022.derivedToAnoncredsPresentation.bind( - Bls12381BBSSignatureProofDock2022, + Bls12381BBSSignatureProofDock2022 ), - Context: 'https://ld.dock.io/security/bbs/v1', - VerKey: 'Bls12381G2VerificationKeyDock2022', - SigType: 'Bls12381BBS+SignatureDock2022', + Context: "https://ld.dock.io/security/bbs/v1", + VerKey: "Bls12381G2VerificationKeyDock2022", + SigType: "Bls12381BBS+SignatureDock2022", getParamsByDid: (api, did) => api.rpc.core_mods.bbsPlusParamsByDid(did), - getPublicKeyWithParamsByStorageKey: (api, storageKey) => api.rpc.core_mods.bbsPlusPublicKeyWithParams(storageKey), - getPublicKeysByDid: (api, did) => api.rpc.core_mods.bbsPlusPublicKeysByDid(did.asDid), + getPublicKeyWithParamsByStorageKey: (api, storageKey) => + api.rpc.core_mods.bbsPlusPublicKeyWithParams(storageKey), + getPublicKeysByDid: (api, did) => + api.rpc.core_mods.bbsPlusPublicKeysByDid(did.asDid), }; export const PS = { - Name: 'PS', - Module: PSModule, + Name: "PS", + Module: DockPSModule, PublicKey: PSPublicKey, Presentation, buildProverStatement: Statement.psSignature, buildVerifierStatement: Statement.psSignature, buildWitness: Witness.psSignature, - getModule: (dock) => dock.ps, + getModule: (dock) => new DockPSModule(dock), SignatureParams: PSSignatureParams, Signature: PSSignature, KeyPair: PSKeypair, CryptoKeyPair: Bls12381PSKeyPairDock2023, derivedToAnoncredsPresentation: Bls12381PSSignatureProofDock2023.derivedToAnoncredsPresentation.bind( - Bls12381PSSignatureProofDock2023, + Bls12381PSSignatureProofDock2023 ), - SigType: 'Bls12381PSSignatureDock2023', - Context: 'https://ld.dock.io/security/ps/v1', - VerKey: 'Bls12381PSVerificationKeyDock2023', + SigType: "Bls12381PSSignatureDock2023", + Context: "https://ld.dock.io/security/ps/v1", + VerKey: "Bls12381PSVerificationKeyDock2023", getParamsByDid: (api, did) => api.rpc.core_mods.psParamsByDid(did), - getPublicKeyWithParamsByStorageKey: (api, storageKey) => api.rpc.core_mods.psPublicKeyWithParams(storageKey), - getPublicKeysByDid: (api, did) => api.rpc.core_mods.psPublicKeysByDid(did.asDid), + getPublicKeyWithParamsByStorageKey: (api, storageKey) => + api.rpc.core_mods.psPublicKeyWithParams(storageKey), + getPublicKeysByDid: (api, did) => + api.rpc.core_mods.psPublicKeysByDid(did.asDid), }; export const BBDT16 = { - Name: 'BBDT16', + Name: "BBDT16", Module: undefined, PublicKey: undefined, Presentation, @@ -172,10 +176,10 @@ export const BBDT16 = { CryptoKeyPair: Bls12381BBDT16KeyPairDock2024, derivedToAnoncredsPresentation: Bls12381BBDT16MACProofDock2024.derivedToAnoncredsPresentation.bind( - Bls12381BBDT16MACProofDock2024, + Bls12381BBDT16MACProofDock2024 ), - SigType: 'Bls12381BBDT16MACDock2024', - Context: 'https://ld.dock.io/security/bbdt16/v1', + SigType: "Bls12381BBDT16MACDock2024", + Context: "https://ld.dock.io/security/bbdt16/v1", VerKey: undefined, getParamsByDid: (_, __) => undefined, getPublicKeyWithParamsByStorageKey: (_, __) => undefined, @@ -189,10 +193,10 @@ export const AllSchemes = Object.setPrototypeOf( PS, BBDT16, }, - null, + null ); -export const Schemes = TestSchemes.split(',').map((key) => { +export const Schemes = TestSchemes.split(",").map((key) => { if (AllSchemes[key] == null) { throw new Error(`Invalid scheme ${key} provided in \`${TestSchemes}\` `); } else { diff --git a/packages/dock-blockchain-modules/tests/test-environment.js b/packages/dock-blockchain-modules/tests/test-environment.js new file mode 100644 index 000000000..fc1df2438 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/test-environment.js @@ -0,0 +1,27 @@ +import { TestEnvironment as NodeEnvironment } from "jest-environment-node"; + +class TestEnvironment extends NodeEnvironment { + constructor(config, context) { + super( + { + ...config, + globals: { + ...config.globals, + Uint32Array, + Uint8Array, + ArrayBuffer, + TextDecoder, + TextEncoder, + Buffer, + }, + }, + context + ); + } + + async setup() {} + + async teardown() {} +} + +export default TestEnvironment; diff --git a/packages/dock-blockchain-modules/tests/test-keys.js b/packages/dock-blockchain-modules/tests/test-keys.js new file mode 100644 index 000000000..cf85d2019 --- /dev/null +++ b/packages/dock-blockchain-modules/tests/test-keys.js @@ -0,0 +1,44 @@ +import { + generateEcdsaSecp256k1Keypair, + getPublicKeyFromKeyringPair, +} from "../src/utils/misc"; + +const keypairEcdsaSecp256k1 = generateEcdsaSecp256k1Keypair( + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" +); + +// TODO: add more testing keys (ed25519 etc) +export default [ + { + sigType: "JsonWebSignature2020", + keyDocument: { + "@context": "https://w3id.org/security/suites/jws-2020/v1", + id: "urn:JsonWebKey2020#keys-1", + controller: "urn:JsonWebKey2020", + type: "JsonWebKey2020", + publicKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + }, + privateKeyJwk: { + kty: "EC", + crv: "P-384", + x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", + y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", + d: "Wq5_KgqjvYh_EGvBDYtSs_0ufJJP0y0tkAXl6GqxHMkY0QP8vmD76mniXD-BWhd_", + }, + }, + }, + { + sigType: "EcdsaSecp256k1Signature2019", + keyDocument: { + id: "urn:EcdsaSecp256k1VerificationKey2019#keys-1", + controller: "urn:EcdsaSecp256k1VerificationKey2019", + type: "EcdsaSecp256k1VerificationKey2019", + keypair: keypairEcdsaSecp256k1, + publicKey: getPublicKeyFromKeyringPair(keypairEcdsaSecp256k1), + }, + }, +]; diff --git a/rollup.config.mjs b/rollup.config.mjs deleted file mode 100644 index 42a19de55..000000000 --- a/rollup.config.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import json from '@rollup/plugin-json'; -import multiInput from 'rollup-plugin-multi-input'; -import commonjs from '@rollup/plugin-commonjs'; -import { terser } from 'rollup-plugin-terser'; -// import { wasm } from '@rollup/plugin-wasm'; -// import pkg from './package.json'; - -export default async function() { - return [{ - plugins: [ - multiInput.default(), - json(), - terser(), - commonjs(), - // Temporarily disabled, not sure if required - // since rify is a node module doesnt seem to work - // but would be nice to try embed it - // wasm({ - // sync: ['*.wasm'], - // }), - ], - input: ['src/**/*.js'], - output: [ - { - dir: 'dist', - format: 'esm', - entryFileNames: '[name].js' - }, - { - dir: 'dist', - format: 'cjs', - entryFileNames: '[name].cjs' - } - ] - }]; -}; diff --git a/rollup.scripts.config.mjs b/rollup.scripts.config.mjs deleted file mode 100644 index 7a7974e1d..000000000 --- a/rollup.scripts.config.mjs +++ /dev/null @@ -1,152 +0,0 @@ -import json from "@rollup/plugin-json"; -import commonjs from "@rollup/plugin-commonjs"; -import resolve from "@rollup/plugin-node-resolve"; -import multiInput from "rollup-plugin-multi-input"; -import { wasm } from "@rollup/plugin-wasm"; -import path from "path"; -import pluginAlias from "@rollup/plugin-alias"; - -function expand(prefix, all) { - return all.map((p) => (p ? `${prefix}-${p}` : prefix)); -} - -const baseEntries = [ - ...expand("api", ["augment", "base", "derive"]), - ...expand("rpc", ["augment", "core", "provider"]), - ...expand("types", [ - ...expand("augment", ["", "lookup", "registry"]), - "codec", - "create", - "helpers", - "known", - ]), -].reduce( - (all, p) => ({ - ...all, - [`@polkadot/${p}`]: path.resolve( - process.cwd(), - `node_modules/@polkadot/${p}` - ), - }), - { - // we point to a specific file for these (default augmentations) - "@polkadot/rpc-core/types/jsonrpc": path.resolve( - process.cwd(), - "node_modules/@polkadot/rpc-core/types/jsonrpc.js" - ), - "@polkadot/types-codec/types/registry": path.resolve( - process.cwd(), - "node_modules/@polkadot/types-codec/types/registry.js" - ), - } -); - -const entries = [ - "hw-ledger-transports", - "networks", - "x-bigint", - "x-fetch", - "x-global", - "x-randomvalues", - "x-textdecoder", - "x-textencoder", - "x-ws", - "wasm-crypto-init", -].reduce( - (all, p) => ({ - ...all, - [`@polkadot/${p}`]: path.resolve( - process.cwd(), - `node_modules/@polkadot/${p}` - ), - }), - baseEntries -); - -const overrides = { - "@polkadot/hw-ledger": { - // these are all in the un-shakable and unused hdDerivation stuff from the Zondax libs, ignore - entries: { - "bip32-ed25519": path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/empty.js" - ), - bip39: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/empty.js" - ), - blakejs: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/empty.js" - ), - bs58: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/empty.js" - ), - events: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/empty.js" - ), - "hash.js": path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/empty.js" - ), - }, - }, - "@polkadot/util-crypto": { - entries: { - "@polkadot/wasm-crypto": path.resolve( - process.cwd(), - "node_modules/@polkadot/wasm-crypto/bundle.js" - ), - "bn.js": path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/bn.cjs" - ), - buffer: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/buffer.js" - ), - crypto: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/crypto.js" - ), - }, - inject: { - Buffer: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/buffer.js" - ), - crypto: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/crypto.js" - ), - inherits: path.resolve( - process.cwd(), - "node_modules/@polkadot/x-bundle/build/inherits.js" - ), - }, - polyfill: false, - }, -}; - -export default { - external: [], - plugins: [ - multiInput, - pluginAlias({ entries }), - json(), - commonjs(), - resolve({ preferBuiltins: false }), - wasm({ - sync: ["*.wasm"], - }), - ], - input: ["scripts/staking_payouts.js"], - output: { - manualChunks: {}, - dir: "build", - format: "cjs", - entryFileNames: "[name].js", - }, -}; diff --git a/scripts/cheqd_config.toml b/scripts/cheqd_config.toml new file mode 100644 index 000000000..05bcd9762 --- /dev/null +++ b/scripts/cheqd_config.toml @@ -0,0 +1,498 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or +# relative to the home directory (e.g. "data"). The home directory is +# "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable +# or --home cmd flag. + +####################################################################### +### Main Base Config Options ### +####################################################################### + +# TCP or UNIX socket address of the ABCI application, +# or the name of an ABCI application compiled in with the CometBFT binary +proxy_app = "tcp://127.0.0.1:26658" + +# A custom human readable name for this node +moniker = "cheqd-dev" + +# If this node is many blocks behind the tip of the chain, BlockSync +# allows them to catchup quickly by downloading blocks in parallel +# and verifying their commits +# +# Deprecated: this key will be removed and BlockSync will be enabled +# unconditionally in the next major release. +block_sync = true + +# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb +# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) +# - pure go +# - stable +# * cleveldb (uses levigo wrapper) +# - fast +# - requires gcc +# - use cleveldb build tag (go build -tags cleveldb) +# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) +# - EXPERIMENTAL +# - may be faster is some use-cases (random reads - indexer) +# - use boltdb build tag (go build -tags boltdb) +# * rocksdb (uses github.com/tecbot/gorocksdb) +# - EXPERIMENTAL +# - requires gcc +# - use rocksdb build tag (go build -tags rocksdb) +# * badgerdb (uses github.com/dgraph-io/badger) +# - EXPERIMENTAL +# - use badgerdb build tag (go build -tags badgerdb) +db_backend = "goleveldb" + +# Database directory +db_dir = "data" + +# Output level for logging, including package level options +log_level = "error" + +# Output format: 'plain' (colored text) or 'json' +log_format = "json" + +##### additional base config options ##### + +# Path to the JSON file containing the initial validator set and other meta data +genesis_file = "config/genesis.json" + +# Path to the JSON file containing the private key to use as a validator in the consensus protocol +priv_validator_key_file = "config/priv_validator_key.json" + +# Path to the JSON file containing the last sign state of a validator +priv_validator_state_file = "data/priv_validator_state.json" + +# TCP or UNIX socket address for CometBFT to listen on for +# connections from an external PrivValidator process +priv_validator_laddr = "" + +# Path to the JSON file containing the private key to use for node authentication in the p2p protocol +node_key_file = "config/node_key.json" + +# Mechanism to connect to the ABCI application: socket | grpc +abci = "socket" + +# If true, query the ABCI app on connecting to a new peer +# so the app can decide if we should keep the connection or not +filter_peers = false + + +####################################################################### +### Advanced Configuration Options ### +####################################################################### + +####################################################### +### RPC Server Configuration Options ### +####################################################### +[rpc] + +# TCP or UNIX socket address for the RPC server to listen on +laddr = "tcp://0.0.0.0:26657" + +# A list of origins a cross-domain request can be executed from +# Default value '[]' disables cors support +# Use '["*"]' to allow any origin +cors_allowed_origins = [] + +# A list of methods the client is allowed to use with cross-domain requests +cors_allowed_methods = ["HEAD", "GET", "POST"] + +# A list of non simple headers the client is allowed to use with cross-domain requests +cors_allowed_headers = [ + "Origin", + "Accept", + "Content-Type", + "X-Requested-With", + "X-Server-Time", +] + +# TCP or UNIX socket address for the gRPC server to listen on +# NOTE: This server only supports /broadcast_tx_commit +grpc_laddr = "" + +# Maximum number of simultaneous connections. +# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +grpc_max_open_connections = 900 + +# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool +unsafe = false + +# Maximum number of simultaneous connections (including WebSocket). +# Does not include gRPC connections. See grpc_max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +max_open_connections = 900 + +# Maximum number of unique clientIDs that can /subscribe +# If you're using /broadcast_tx_commit, set to the estimated maximum number +# of broadcast_tx_commit calls per block. +max_subscription_clients = 100 + +# Maximum number of unique queries a given client can /subscribe to +# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to +# the estimated # maximum number of broadcast_tx_commit calls per block. +max_subscriptions_per_client = 5 + +# Experimental parameter to specify the maximum number of events a node will +# buffer, per subscription, before returning an error and closing the +# subscription. Must be set to at least 100, but higher values will accommodate +# higher event throughput rates (and will use more memory). +experimental_subscription_buffer_size = 200 + +# Experimental parameter to specify the maximum number of RPC responses that +# can be buffered per WebSocket client. If clients cannot read from the +# WebSocket endpoint fast enough, they will be disconnected, so increasing this +# parameter may reduce the chances of them being disconnected (but will cause +# the node to use more memory). +# +# Must be at least the same as "experimental_subscription_buffer_size", +# otherwise connections could be dropped unnecessarily. This value should +# ideally be somewhat higher than "experimental_subscription_buffer_size" to +# accommodate non-subscription-related RPC responses. +experimental_websocket_write_buffer_size = 200 + +# If a WebSocket client cannot read fast enough, at present we may +# silently drop events instead of generating an error or disconnecting the +# client. +# +# Enabling this experimental parameter will cause the WebSocket connection to +# be closed instead if it cannot read fast enough, allowing for greater +# predictability in subscription behavior. +experimental_close_on_slow_client = false + +# How long to wait for a tx to be committed during /broadcast_tx_commit. +# WARNING: Using a value larger than 10s will result in increasing the +# global HTTP write timeout, which applies to all connections and endpoints. +# See https://github.com/tendermint/tendermint/issues/3435 +timeout_broadcast_tx_commit = "10s" + +# Maximum size of request body, in bytes +max_body_bytes = 1000000 + +# Maximum size of request header, in bytes +max_header_bytes = 1048576 + +# The path to a file containing certificate that is used to create the HTTPS server. +# Might be either absolute path or path related to CometBFT's config directory. +# If the certificate is signed by a certificate authority, +# the certFile should be the concatenation of the server's certificate, any intermediates, +# and the CA's certificate. +# NOTE: both tls_cert_file and tls_key_file must be present for CometBFT to create HTTPS server. +# Otherwise, HTTP server is run. +tls_cert_file = "" + +# The path to a file containing matching private key that is used to create the HTTPS server. +# Might be either absolute path or path related to CometBFT's config directory. +# NOTE: both tls-cert-file and tls-key-file must be present for CometBFT to create HTTPS server. +# Otherwise, HTTP server is run. +tls_key_file = "" + +# pprof listen address (https://golang.org/pkg/net/http/pprof) +pprof_laddr = "localhost:6060" + +####################################################### +### P2P Configuration Options ### +####################################################### +[p2p] + +# Address to listen for incoming connections +laddr = "tcp://0.0.0.0:26656" + +# Address to advertise to peers for them to dial. If empty, will use the same +# port as the laddr, and will introspect on the listener to figure out the +# address. IP and port are required. Example: 159.89.10.97:26656 +external_address = "" + +# Comma separated list of seed nodes to connect to +seeds = "" + +# Comma separated list of nodes to keep persistent connections to +persistent_peers = "" + +# Path to address book +addr_book_file = "config/addrbook.json" + +# Set true for strict address routability rules +# Set false for private or local networks +addr_book_strict = true + +# Maximum number of inbound peers +max_num_inbound_peers = 40 + +# Maximum number of outbound peers to connect to, excluding persistent peers +max_num_outbound_peers = 10 + +# List of node IDs, to which a connection will be (re)established ignoring any existing limits +unconditional_peer_ids = "" + +# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) +persistent_peers_max_dial_period = "0s" + +# Time to wait before flushing messages out on the connection +flush_throttle_timeout = "100ms" + +# Maximum size of a message packet payload, in bytes +max_packet_msg_payload_size = 10240 + +# Rate at which packets can be sent, in bytes/second +send_rate = 20000000 + +# Rate at which packets can be received, in bytes/second +recv_rate = 20000000 + +# Set true to enable the peer-exchange reactor +pex = true + +# Seed mode, in which node constantly crawls the network and looks for +# peers. If another node asks it for addresses, it responds and disconnects. +# +# Does not work if the peer-exchange reactor is disabled. +seed_mode = false + +# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) +private_peer_ids = "" + +# Toggle to disable guard against peers connecting from the same ip. +allow_duplicate_ip = false + +# Peer connection configuration. +handshake_timeout = "20s" +dial_timeout = "3s" + +####################################################### +### Mempool Configuration Option ### +####################################################### +[mempool] + +# Mempool version to use: +# 1) "v0" - (default) FIFO mempool. +# 2) "v1" - prioritized mempool (deprecated; will be removed in the next release). +version = "v0" + +# The type of mempool for this node to use. +# +# Possible types: +# - "flood" : concurrent linked list mempool with flooding gossip protocol +# (default) +# - "nop" : nop-mempool (short for no operation; the ABCI app is responsible +# for storing, disseminating and proposing txs). "create_empty_blocks=false" is +# not supported. +type = "flood" + +recheck = true +broadcast = true +wal_dir = "" + +# Maximum number of transactions in the mempool +size = 5000 + +# Limit the total size of all txs in the mempool. +# This only accounts for raw transactions (e.g. given 1MB transactions and +# max_txs_bytes=5MB, mempool will only accept 5 transactions). +max_txs_bytes = 1073741824 + +# Size of the cache (used to filter transactions we saw earlier) in transactions +cache_size = 10000 + +# Do not remove invalid transactions from the cache (default: false) +# Set to true if it's not possible for any invalid transaction to become valid +# again in the future. +keep-invalid-txs-in-cache = false + +# Maximum size of a single transaction. +# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. +max_tx_bytes = 1048576 + +# Maximum size of a batch of transactions to send to a peer +# Including space needed by encoding (one varint per transaction). +# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 +max_batch_bytes = 0 + +# ttl-duration, if non-zero, defines the maximum amount of time a transaction +# can exist for in the mempool. +# +# Note, if ttl-num-blocks is also defined, a transaction will be removed if it +# has existed in the mempool at least ttl-num-blocks number of blocks or if it's +# insertion time into the mempool is beyond ttl-duration. +ttl-duration = "0s" + +# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction +# can exist for in the mempool. +# +# Note, if ttl-duration is also defined, a transaction will be removed if it +# has existed in the mempool at least ttl-num-blocks number of blocks or if +# it's insertion time into the mempool is beyond ttl-duration. +ttl-num-blocks = 0 + +# Experimental parameters to limit gossiping txs to up to the specified number of peers. +# This feature is only available for the default mempool (version config set to "v0"). +# We use two independent upper values for persistent and non-persistent peers. +# Unconditional peers are not affected by this feature. +# If we are connected to more than the specified number of persistent peers, only send txs to +# ExperimentalMaxGossipConnectionsToPersistentPeers of them. If one of those +# persistent peers disconnects, activate another persistent peer. +# Similarly for non-persistent peers, with an upper limit of +# ExperimentalMaxGossipConnectionsToNonPersistentPeers. +# If set to 0, the feature is disabled for the corresponding group of peers, that is, the +# number of active connections to that group of peers is not bounded. +# For non-persistent peers, if enabled, a value of 10 is recommended based on experimental +# performance results using the default P2P configuration. +experimental_max_gossip_connections_to_persistent_peers = 0 +experimental_max_gossip_connections_to_non_persistent_peers = 0 + +####################################################### +### State Sync Configuration Options ### +####################################################### +[statesync] +# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine +# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in +# the network to take and serve state machine snapshots. State sync is not attempted if the node +# has any local state (LastBlockHeight > 0). The node will have a truncated block history, +# starting from the height of the snapshot. +enable = false + +# RPC servers (comma-separated) for light client verification of the synced state machine and +# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding +# header hash obtained from a trusted source, and a period during which validators can be trusted. +# +# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 +# weeks) during which they can be financially punished (slashed) for misbehavior. +rpc_servers = "" +trust_height = 0 +trust_hash = "" +trust_period = "168h0m0s" + +# Time to spend discovering snapshots before initiating a restore. +discovery_time = "15s" + +# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). +# Will create a new, randomly named directory within, and remove it when done. +temp_dir = "" + +# The timeout duration before re-requesting a chunk, possibly from a different +# peer (default: 1 minute). +chunk_request_timeout = "10s" + +# The number of concurrent chunk fetchers to run (default: 1). +chunk_fetchers = "4" + +####################################################### +### Block Sync Configuration Options ### +####################################################### +[blocksync] + +# Block Sync version to use: +# +# In v0.37, v1 and v2 of the block sync protocols were deprecated. +# Please use v0 instead. +# +# 1) "v0" - the default block sync implementation +version = "v0" + +####################################################### +### Consensus Configuration Options ### +####################################################### +[consensus] + +wal_file = "data/cs.wal/wal" + +# How long we wait for a proposal block before prevoting nil +timeout_propose = "3s" +# How much timeout_propose increases with each round +timeout_propose_delta = "500ms" +# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) +timeout_prevote = "1s" +# How much the timeout_prevote increases with each round +timeout_prevote_delta = "500ms" +# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) +timeout_precommit = "1s" +# How much the timeout_precommit increases with each round +timeout_precommit_delta = "500ms" +# How long we wait after committing a block, before starting on the new +# height (this gives us a chance to receive some more precommits, even +# though we already have +2/3). +timeout_commit = "5s" + +# How many blocks to look back to check existence of the node's consensus votes before joining consensus +# When non-zero, the node will panic upon restart +# if the same consensus key was used to sign {double_sign_check_height} last blocks. +# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. +double_sign_check_height = 0 + +# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) +skip_timeout_commit = false + +# EmptyBlocks mode and possible interval between empty blocks +create_empty_blocks = false +create_empty_blocks_interval = "0s" + +# Reactor sleep duration parameters +peer_gossip_sleep_duration = "100ms" +peer_query_maj23_sleep_duration = "2s" + +####################################################### +### Storage Configuration Options ### +####################################################### +[storage] + +# Set to true to discard ABCI responses from the state store, which can save a +# considerable amount of disk space. Set to false to ensure ABCI responses are +# persisted. ABCI responses are required for /block_results RPC queries, and to +# reindex events in the command-line tool. +discard_abci_responses = false + +####################################################### +### Transaction Indexer Configuration Options ### +####################################################### +[tx_index] + +# What indexer to use for transactions +# +# The application will set which txs to index. In some cases a node operator will be able +# to decide which txs to index based on configuration set in the application. +# +# Options: +# 1) "null" +# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). +# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. +# 3) "psql" - the indexer services backed by PostgreSQL. +# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. +indexer = "kv" + +# The PostgreSQL connection configuration, the connection format: +# postgresql://:@:/? +psql-conn = "" + +####################################################### +### Instrumentation Configuration Options ### +####################################################### +[instrumentation] + +# When true, Prometheus metrics are served under /metrics on +# PrometheusListenAddr. +# Check out the documentation for the list of available metrics. +prometheus = false + +# Address to listen for Prometheus collector(s) connections +prometheus_listen_addr = ":26660" + +# Maximum number of simultaneous connections. +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +max_open_connections = 3 + +# Instrumentation namespace +namespace = "cometbft" diff --git a/scripts/cheqd_entrypoint b/scripts/cheqd_entrypoint new file mode 100755 index 000000000..812c952d6 --- /dev/null +++ b/scripts/cheqd_entrypoint @@ -0,0 +1,57 @@ +#!/bin/bash + +# Variables (you can modify these) +CHAIN_ID="/tmp/cheqd-dev" +NODE_NAME="cheqd-dev" +KEY_NAME="my-key" +MONIKER="local-node" +STAKE_DENOM="stake" +CHAIN_DIR="$HOME/.testnode" +GENESIS_AMOUNT="100000000000000000000000000000ncheq,8246428745600000$STAKE_DENOM" # Very large amount +STAKE_AMOUNT="8246428745600000$STAKE_DENOM" # Ensure this is >= DefaultPowerReduction +COMMAND="cheqd-noded" + +# Install Cosmos SDK if not installed (replace this with your specific chain's SDK) +# Uncomment if you need to install the SDK +# echo "Installing Cosmos SDK..." +# git clone https://github.com/cosmos/cosmos-sdk +# cd cosmos-sdk +# make install +# +rm -rf $CHAIN_DIR + +# Step 1: Initialize the chain +echo "Initializing chain..." +$COMMAND init $NODE_NAME --chain-id $CHAIN_ID --home $CHAIN_DIR + +# Step 2: Generate a keypair (if it doesn't exist already) +if [ -z "$CHEQD_MNEMONIC" ]; then + echo "Creating key for node..." + $COMMAND keys add $KEY_NAME --keyring-backend test --home $CHAIN_DIR +else + echo "Recovering key from mnemonic..." + printf "%s\n" "$CHEQD_MNEMONIC" | $COMMAND keys add $KEY_NAME --recover --keyring-backend test --home $CHAIN_DIR +fi + +# Step 3: Add the generated key as a genesis account +echo "Adding genesis account..." +$COMMAND genesis add-genesis-account $($COMMAND keys show $KEY_NAME -a --keyring-backend test --home $CHAIN_DIR) $GENESIS_AMOUNT --home $CHAIN_DIR + +# Step 4: Generate a genesis transaction +echo "Generating genesis transaction..." +$COMMAND genesis gentx $KEY_NAME $STAKE_AMOUNT --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_DIR + +# Step 5: Collect genesis transactions into the genesis file +echo "Collecting genesis transactions..." +$COMMAND genesis collect-gentxs --home $CHAIN_DIR + +# Step 6: Validate the genesis file +echo "Validating genesis file..." +$COMMAND genesis validate-genesis --home $CHAIN_DIR + +# Step 7: Copy custom configuration +cp /tmp/cheqd_config.toml $CHAIN_DIR/config/config.toml + +# Step 8: Starting the node +echo "Starting Cosmos node..." +$COMMAND start --home $CHAIN_DIR --moniker $MONIKER --log_level info diff --git a/scripts/eth/bytecodes-and-abis.js b/scripts/eth/bytecodes-and-abis.js deleted file mode 100644 index de43fb820..000000000 --- a/scripts/eth/bytecodes-and-abis.js +++ /dev/null @@ -1,558 +0,0 @@ -// Contract is ERC20.sol -export const ERC20_BYTECODE = '0x608060405234801561001057600080fd5b5060405160208061064383398101604090815290516002819055336000908152602081905291909120556105fa806100496000396000f3006080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461009d578063095ea7b31461012757806318160ddd1461015f57806323b872dd14610186578063313ce567146101b057806370a08231146101db57806395d89b41146101fc578063a9059cbb14610211578063dd62ed3e14610235575b600080fd5b3480156100a957600080fd5b506100b261025c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100ec5781810151838201526020016100d4565b50505050905090810190601f1680156101195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013357600080fd5b5061014b600160a060020a0360043516602435610293565b604080519115158252519081900360200190f35b34801561016b57600080fd5b506101746102f9565b60408051918252519081900360200190f35b34801561019257600080fd5b5061014b600160a060020a03600435811690602435166044356102ff565b3480156101bc57600080fd5b506101c561045a565b6040805160ff9092168252519081900360200190f35b3480156101e757600080fd5b50610174600160a060020a036004351661045f565b34801561020857600080fd5b506100b261047a565b34801561021d57600080fd5b5061014b600160a060020a03600435166024356104b1565b34801561024157600080fd5b50610174600160a060020a036004358116906024351661057b565b60408051808201909152600a81527f4552433230426173696300000000000000000000000000000000000000000000602082015281565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561032457600080fd5b600160a060020a038416600090815260016020908152604080832033845290915290205482111561035457600080fd5b600160a060020a03841660009081526020819052604090205461037d908363ffffffff6105a616565b600160a060020a0385166000908152602081815260408083209390935560018152828220338352905220546103b8908363ffffffff6105a616565b600160a060020a03808616600090815260016020908152604080832033845282528083209490945591861681529081905220546103fb908363ffffffff6105b816565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b601281565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600381527f4253430000000000000000000000000000000000000000000000000000000000602082015281565b336000908152602081905260408120548211156104cd57600080fd5b336000908152602081905260409020546104ed908363ffffffff6105a616565b3360009081526020819052604080822092909255600160a060020a0385168152205461051f908363ffffffff6105b816565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b6000828211156105b257fe5b50900390565b6000828201838110156105c757fe5b93925050505600a165627a7a723058208b433dca186d93c36f5f1faf8177cf393794bf9a16db68df7d493e7ddb832c2b0029'; -export const ERC20_ABI = [ - { - constant: true, - inputs: [], - name: 'name', - outputs: [{ name: '', type: 'string' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: 'delegate', type: 'address' }, - { name: 'numTokens', type: 'uint256' }, - ], - name: 'approve', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: 'owner', type: 'address' }, - { name: 'buyer', type: 'address' }, - { name: 'numTokens', type: 'uint256' }, - ], - name: 'transferFrom', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [{ name: '', type: 'uint8' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [{ name: 'tokenOwner', type: 'address' }], - name: 'balanceOf', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [{ name: '', type: 'string' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: 'receiver', type: 'address' }, - { name: 'numTokens', type: 'uint256' }, - ], - name: 'transfer', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { name: 'owner', type: 'address' }, - { name: 'delegate', type: 'address' }, - ], - name: 'allowance', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ name: 'total', type: 'uint256' }], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { indexed: true, name: 'tokenOwner', type: 'address' }, - { indexed: true, name: 'spender', type: 'address' }, - { indexed: false, name: 'tokens', type: 'uint256' }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: true, name: 'from', type: 'address' }, - { indexed: true, name: 'to', type: 'address' }, - { indexed: false, name: 'tokens', type: 'uint256' }, - ], - name: 'Transfer', - type: 'event', - }, -]; - -// Contract is DummyAggregator -export const DUMMY_AGGREGATOR_BYTECODE = '0x608060405234801561001057600080fd5b506040516102e73803806102e7833981810160405260a081101561003357600080fd5b5080516020820151604083015160608401516080909401519293919290919061006885858585856001600160e01b0361007216565b50505050506100af565b600080546001600160501b039687166001600160501b03199182161790915560019490945560029290925560035560048054919093169116179055565b610229806100be6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638cd221c91161005b5780638cd221c9146100e8578063c22c24991461010c578063f21f537d14610114578063feaf968c1461011c5761007d565b80636444bd16146100825780637519ab50146100c657806385bb7d69146100e0575b600080fd5b6100c4600480360360a081101561009857600080fd5b506001600160501b03813581169160208101359160408201359160608101359160809091013516610160565b005b6100ce6101a0565b60408051918252519081900360200190f35b6100ce6101a6565b6100f06101ac565b604080516001600160501b039092168252519081900360200190f35b6100f06101bb565b6100ce6101ca565b6101246101d0565b604080516001600160501b0396871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b600080546001600160501b0396871669ffffffffffffffffffff199182161790915560019490945560029290925560035560048054919093169116179055565b60035481565b60015481565b6000546001600160501b031681565b6004546001600160501b031681565b60025481565b6000546001546002546003546004546001600160501b039485169416909192939456fea2646970667358221220739aa4f0c3ea9e475a476da24e7b66931c23a245f6542d41d7b936cd62e75e1264736f6c63430006050033'; -export const DUMMY_AGGREGATOR_ABI = [ - { - inputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: '_answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: '_startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '_updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: '_answeredInRound', - type: 'uint80', - }, - ], - name: 'setData', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: '_answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: '_startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '_updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: '_answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [], - name: 'answer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'answeredInRound', - outputs: [ - { - internalType: 'uint80', - name: '', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRoundData', - outputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: '_answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: '_startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '_updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: '_answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'roundId', - outputs: [ - { - internalType: 'uint80', - name: '', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'startedAt', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'updatedAt', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -export const PALLET_STORAGE_ACCESSOR_ABI = [ - { - inputs: [ - { - internalType: 'bytes', - name: 'key', - type: 'bytes', - }, - ], - name: 'getStorageRaw', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'string', - name: 'pallet', - type: 'string', - }, - { - internalType: 'string', - name: 'member', - type: 'string', - }, - { - internalType: 'enum PalletStorageAccessor.KeyType', - name: 'keyType', - type: 'uint8', - }, - { - internalType: 'bytes', - name: 'firstKey', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'secondKey', - type: 'bytes', - }, - ], - name: 'getStorage', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'string', - name: 'pallet', - type: 'string', - }, - { - internalType: 'string', - name: 'member', - type: 'string', - }, - { - internalType: 'enum PalletStorageAccessor.KeyType', - name: 'keyType', - type: 'uint8', - }, - { - internalType: 'bytes', - name: 'firstKey', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'secondKey', - type: 'bytes', - }, - { - internalType: 'uint32', - name: 'offset', - type: 'uint32', - }, - ], - name: 'getStorageWithOffset', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'string', - name: 'pallet', - type: 'string', - }, - { - internalType: 'string', - name: 'member', - type: 'string', - }, - { - internalType: 'enum PalletStorageAccessor.KeyType', - name: 'keyType', - type: 'uint8', - }, - { - internalType: 'bytes', - name: 'firstKey', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'secondKey', - type: 'bytes', - }, - { - internalType: 'uint32', - name: 'len', - type: 'uint32', - }, - ], - name: 'getStorageWithLen', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'string', - name: 'pallet', - type: 'string', - }, - { - internalType: 'string', - name: 'member', - type: 'string', - }, - { - internalType: 'enum PalletStorageAccessor.KeyType', - name: 'keyType', - type: 'uint8', - }, - { - internalType: 'bytes', - name: 'firstKey', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'secondKey', - type: 'bytes', - }, - { - internalType: 'uint32', - name: 'offset', - type: 'uint32', - }, - { - internalType: 'uint32', - name: 'len', - type: 'uint32', - }, - ], - name: 'getStorageWithOffsetLen', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, -]; -export const PALLET_STORAGE_ACCESSOR_BYTECODE = '0x608060405234801561001057600080fd5b50611643806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806341af69231461005c57806342c60d781461008d578063721b15c6146100be578063baa6a4e6146100ef578063f0f980ce14610120575b600080fd5b61007660048036038101906100719190610c64565b610151565b604051610084929190611367565b60405180910390f35b6100a760048036038101906100a29190610d4c565b6102b8565b6040516100b5929190611367565b60405180910390f35b6100d860048036038101906100d39190610c1f565b610430565b6040516100e6929190611367565b60405180910390f35b61010960048036038101906101049190610d4c565b6104df565b604051610117929190611367565b60405180910390f35b61013a60048036038101906101359190610e48565b610657565b604051610148929190611367565b60405180910390f35b600060606000600e9050600061016a89898989896107e0565b905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff1661021f8351610a59565b8361022a8451610a59565b84876000604051602001610243969594939291906110f2565b60405160208183030381529060405260405161025f91906110a4565b6000604051808303816000865af19150503d806000811461029c576040519150601f19603f3d011682016040523d82523d6000602084013e6102a1565b606091505b509550955050505050995099975050505050505050565b600060606000600e905060006102d18a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166103868351610a59565b836103918451610a59565b848760026103a48e63ffffffff16610a59565b6040516020016103ba979695949392919061114e565b6040516020818303038152906040526040516103d691906110a4565b6000604051808303816000865af19150503d8060008114610413576040519150601f19603f3d011682016040523d82523d6000602084013e610418565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600f90508073ffffffffffffffffffffffffffffffffffffffff1661045d86869050610a59565b8686600060405160200161047494939291906110bb565b60405160208183030381529060405260405161049091906110a4565b6000604051808303816000865af19150503d80600081146104cd576040519150601f19603f3d011682016040523d82523d6000602084013e6104d2565b606091505b5092509250509250929050565b600060606000600e905060006104f88a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166105ad8351610a59565b836105b88451610a59565b848760016105cb8e63ffffffff16610a59565b6040516020016105e1979695949392919061114e565b6040516020818303038152906040526040516105fd91906110a4565b6000604051808303816000865af19150503d806000811461063a576040519150601f19603f3d011682016040523d82523d6000602084013e61063f565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600e905060006106708b8b8b8b8b6107e0565b905060008f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166107258351610a59565b836107308451610a59565b848760036107438f63ffffffff16610a59565b6107528f63ffffffff16610a59565b6040516020016107699897969594939291906111b7565b60405160208183030381529060405260405161078591906110a4565b6000604051808303816000865af19150503d80600081146107c2576040519150601f19603f3d011682016040523d82523d6000602084013e6107c7565b606091505b5095509550505050509b509b9950505050505050505050565b6060806000600281111561081d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610856577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561090f578660405160200161086d919061122d565b6040516020818303038152906040529050600086869050146108c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bb906113b7565b60405180910390fd5b6000848490501461090a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090190611397565b60405180910390fd5b610a4c565b60016002811115610949577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610982577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610a06578661099587879050610a59565b87876040516020016109aa9493929190611248565b604051602081830303815290604052905060008484905014610a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f890611397565b60405180910390fd5b610a4b565b86610a1387879050610a59565b8787610a2188889050610a59565b8888604051602001610a39979695949392919061127f565b60405160208183030381529060405290505b5b8091505095945050505050565b60606040821015610a925760028260ff16901b604051602001610a7c91906112d2565b6040516020818303038152906040529050610b5c565b614000821015610ad357600160028360ff16901b17600683901c604051602001610abd9291906112ed565b6040516020818303038152906040529050610b5c565b6340000000821015610b21576002808360ff16901b17600683901c600e84901c601685901c604051602001610b0b9493929190611319565b6040516020818303038152906040529050610b5c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b53906113d7565b60405180910390fd5b919050565b60008083601f840112610b7357600080fd5b8235905067ffffffffffffffff811115610b8c57600080fd5b602083019150836001820283011115610ba457600080fd5b9250929050565b600081359050610bba816115e6565b92915050565b60008083601f840112610bd257600080fd5b8235905067ffffffffffffffff811115610beb57600080fd5b602083019150836001820283011115610c0357600080fd5b9250929050565b600081359050610c19816115f6565b92915050565b60008060208385031215610c3257600080fd5b600083013567ffffffffffffffff811115610c4c57600080fd5b610c5885828601610b61565b92509250509250929050565b600080600080600080600080600060a08a8c031215610c8257600080fd5b60008a013567ffffffffffffffff811115610c9c57600080fd5b610ca88c828d01610bc0565b995099505060208a013567ffffffffffffffff811115610cc757600080fd5b610cd38c828d01610bc0565b97509750506040610ce68c828d01610bab565b95505060608a013567ffffffffffffffff811115610d0357600080fd5b610d0f8c828d01610b61565b945094505060808a013567ffffffffffffffff811115610d2e57600080fd5b610d3a8c828d01610b61565b92509250509295985092959850929598565b60008060008060008060008060008060c08b8d031215610d6b57600080fd5b60008b013567ffffffffffffffff811115610d8557600080fd5b610d918d828e01610bc0565b9a509a505060208b013567ffffffffffffffff811115610db057600080fd5b610dbc8d828e01610bc0565b98509850506040610dcf8d828e01610bab565b96505060608b013567ffffffffffffffff811115610dec57600080fd5b610df88d828e01610b61565b955095505060808b013567ffffffffffffffff811115610e1757600080fd5b610e238d828e01610b61565b935093505060a0610e368d828e01610c0a565b9150509295989b9194979a5092959850565b600080600080600080600080600080600060e08c8e031215610e6957600080fd5b60008c013567ffffffffffffffff811115610e8357600080fd5b610e8f8e828f01610bc0565b9b509b505060208c013567ffffffffffffffff811115610eae57600080fd5b610eba8e828f01610bc0565b99509950506040610ecd8e828f01610bab565b97505060608c013567ffffffffffffffff811115610eea57600080fd5b610ef68e828f01610b61565b965096505060808c013567ffffffffffffffff811115610f1557600080fd5b610f218e828f01610b61565b945094505060a0610f348e828f01610c0a565b92505060c0610f458e828f01610c0a565b9150509295989b509295989b9093969950565b610f618161142f565b82525050565b6000610f738385611413565b9350610f808385846114a2565b82840190509392505050565b6000610f97826113f7565b610fa18185611402565b9350610fb18185602086016114b1565b610fba81611525565b840191505092915050565b6000610fd0826113f7565b610fda8185611413565b9350610fea8185602086016114b1565b80840191505092915050565b6110076110028261147e565b6114e4565b82525050565b61101e61101982611490565b6114e4565b82525050565b600061103160188361141e565b915061103c82611543565b602082019050919050565b600061105460178361141e565b915061105f8261156c565b602082019050919050565b6000611077600d8361141e565b915061108282611595565b602082019050919050565b61109e61109982611471565b6114e4565b82525050565b60006110b08284610fc5565b915081905092915050565b60006110c78287610fc5565b91506110d4828587610f67565b91506110e0828461100d565b60018201915081905095945050505050565b60006110fe8289610fc5565b915061110a8288610fc5565b91506111168287610fc5565b91506111228286610fc5565b915061112e8285610fc5565b915061113a828461100d565b600182019150819050979650505050505050565b600061115a828a610fc5565b91506111668289610fc5565b91506111728288610fc5565b915061117e8287610fc5565b915061118a8286610fc5565b9150611196828561100d565b6001820191506111a68284610fc5565b915081905098975050505050505050565b60006111c3828b610fc5565b91506111cf828a610fc5565b91506111db8289610fc5565b91506111e78288610fc5565b91506111f38287610fc5565b91506111ff828661100d565b60018201915061120f8285610fc5565b915061121b8284610fc5565b91508190509998505050505050505050565b60006112398284610ff6565b60018201915081905092915050565b60006112548287610ff6565b6001820191506112648286610fc5565b9150611271828486610f67565b915081905095945050505050565b600061128b828a610ff6565b60018201915061129b8289610fc5565b91506112a8828789610f67565b91506112b48286610fc5565b91506112c1828486610f67565b915081905098975050505050505050565b60006112de828461108d565b60018201915081905092915050565b60006112f9828561108d565b600182019150611309828461108d565b6001820191508190509392505050565b6000611325828761108d565b600182019150611335828661108d565b600182019150611345828561108d565b600182019150611355828461108d565b60018201915081905095945050505050565b600060408201905061137c6000830185610f58565b818103602083015261138e8184610f8c565b90509392505050565b600060208201905081810360008301526113b081611024565b9050919050565b600060208201905081810360008301526113d081611047565b9050919050565b600060208201905081810360008301526113f08161106a565b9050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60008115159050919050565b6000819050611449826115be565b919050565b600081905061145c826115d2565b919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006114898261143b565b9050919050565b600061149b8261144e565b9050919050565b82818337600083830152505050565b60005b838110156114cf5780820151818401526020810190506114b4565b838111156114de576000848401525b50505050565b60006114ef82611536565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000601f19601f8301169050919050565b60008160f81b9050919050565b7f5365636f6e64206b6579206d75737420626520656d7074790000000000000000600082015250565b7f4669727374206b6579206d75737420626520656d707479000000000000000000600082015250565b7f556e696d706c656d656e74656400000000000000000000000000000000000000600082015250565b600381106115cf576115ce6114f6565b5b50565b600481106115e3576115e26114f6565b5b50565b600381106115f357600080fd5b50565b6115ff81611461565b811461160a57600080fd5b5056fea264697066735822122045902a2eca70e23c359f9ddaa922914d3d322f9636b96c5735a8d848a4fbb19264736f6c63430008020033'; -export const PALLET_STORAGE_ACCESSOR_DEPLOYED_BYTECODE = '0x608060405234801561001057600080fd5b50600436106100575760003560e01c806341af69231461005c57806342c60d781461008d578063721b15c6146100be578063baa6a4e6146100ef578063f0f980ce14610120575b600080fd5b61007660048036038101906100719190610c64565b610151565b604051610084929190611367565b60405180910390f35b6100a760048036038101906100a29190610d4c565b6102b8565b6040516100b5929190611367565b60405180910390f35b6100d860048036038101906100d39190610c1f565b610430565b6040516100e6929190611367565b60405180910390f35b61010960048036038101906101049190610d4c565b6104df565b604051610117929190611367565b60405180910390f35b61013a60048036038101906101359190610e48565b610657565b604051610148929190611367565b60405180910390f35b600060606000600e9050600061016a89898989896107e0565b905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff1661021f8351610a59565b8361022a8451610a59565b84876000604051602001610243969594939291906110f2565b60405160208183030381529060405260405161025f91906110a4565b6000604051808303816000865af19150503d806000811461029c576040519150601f19603f3d011682016040523d82523d6000602084013e6102a1565b606091505b509550955050505050995099975050505050505050565b600060606000600e905060006102d18a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166103868351610a59565b836103918451610a59565b848760026103a48e63ffffffff16610a59565b6040516020016103ba979695949392919061114e565b6040516020818303038152906040526040516103d691906110a4565b6000604051808303816000865af19150503d8060008114610413576040519150601f19603f3d011682016040523d82523d6000602084013e610418565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600f90508073ffffffffffffffffffffffffffffffffffffffff1661045d86869050610a59565b8686600060405160200161047494939291906110bb565b60405160208183030381529060405260405161049091906110a4565b6000604051808303816000865af19150503d80600081146104cd576040519150601f19603f3d011682016040523d82523d6000602084013e6104d2565b606091505b5092509250509250929050565b600060606000600e905060006104f88a8a8a8a8a6107e0565b905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166105ad8351610a59565b836105b88451610a59565b848760016105cb8e63ffffffff16610a59565b6040516020016105e1979695949392919061114e565b6040516020818303038152906040526040516105fd91906110a4565b6000604051808303816000865af19150503d806000811461063a576040519150601f19603f3d011682016040523d82523d6000602084013e61063f565b606091505b5095509550505050509a509a98505050505050505050565b600060606000600e905060006106708b8b8b8b8b6107e0565b905060008f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505090508373ffffffffffffffffffffffffffffffffffffffff166107258351610a59565b836107308451610a59565b848760036107438f63ffffffff16610a59565b6107528f63ffffffff16610a59565b6040516020016107699897969594939291906111b7565b60405160208183030381529060405260405161078591906110a4565b6000604051808303816000865af19150503d80600081146107c2576040519150601f19603f3d011682016040523d82523d6000602084013e6107c7565b606091505b5095509550505050509b509b9950505050505050505050565b6060806000600281111561081d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610856577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561090f578660405160200161086d919061122d565b6040516020818303038152906040529050600086869050146108c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bb906113b7565b60405180910390fd5b6000848490501461090a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090190611397565b60405180910390fd5b610a4c565b60016002811115610949577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b876002811115610982577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610a06578661099587879050610a59565b87876040516020016109aa9493929190611248565b604051602081830303815290604052905060008484905014610a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f890611397565b60405180910390fd5b610a4b565b86610a1387879050610a59565b8787610a2188889050610a59565b8888604051602001610a39979695949392919061127f565b60405160208183030381529060405290505b5b8091505095945050505050565b60606040821015610a925760028260ff16901b604051602001610a7c91906112d2565b6040516020818303038152906040529050610b5c565b614000821015610ad357600160028360ff16901b17600683901c604051602001610abd9291906112ed565b6040516020818303038152906040529050610b5c565b6340000000821015610b21576002808360ff16901b17600683901c600e84901c601685901c604051602001610b0b9493929190611319565b6040516020818303038152906040529050610b5c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b53906113d7565b60405180910390fd5b919050565b60008083601f840112610b7357600080fd5b8235905067ffffffffffffffff811115610b8c57600080fd5b602083019150836001820283011115610ba457600080fd5b9250929050565b600081359050610bba816115e6565b92915050565b60008083601f840112610bd257600080fd5b8235905067ffffffffffffffff811115610beb57600080fd5b602083019150836001820283011115610c0357600080fd5b9250929050565b600081359050610c19816115f6565b92915050565b60008060208385031215610c3257600080fd5b600083013567ffffffffffffffff811115610c4c57600080fd5b610c5885828601610b61565b92509250509250929050565b600080600080600080600080600060a08a8c031215610c8257600080fd5b60008a013567ffffffffffffffff811115610c9c57600080fd5b610ca88c828d01610bc0565b995099505060208a013567ffffffffffffffff811115610cc757600080fd5b610cd38c828d01610bc0565b97509750506040610ce68c828d01610bab565b95505060608a013567ffffffffffffffff811115610d0357600080fd5b610d0f8c828d01610b61565b945094505060808a013567ffffffffffffffff811115610d2e57600080fd5b610d3a8c828d01610b61565b92509250509295985092959850929598565b60008060008060008060008060008060c08b8d031215610d6b57600080fd5b60008b013567ffffffffffffffff811115610d8557600080fd5b610d918d828e01610bc0565b9a509a505060208b013567ffffffffffffffff811115610db057600080fd5b610dbc8d828e01610bc0565b98509850506040610dcf8d828e01610bab565b96505060608b013567ffffffffffffffff811115610dec57600080fd5b610df88d828e01610b61565b955095505060808b013567ffffffffffffffff811115610e1757600080fd5b610e238d828e01610b61565b935093505060a0610e368d828e01610c0a565b9150509295989b9194979a5092959850565b600080600080600080600080600080600060e08c8e031215610e6957600080fd5b60008c013567ffffffffffffffff811115610e8357600080fd5b610e8f8e828f01610bc0565b9b509b505060208c013567ffffffffffffffff811115610eae57600080fd5b610eba8e828f01610bc0565b99509950506040610ecd8e828f01610bab565b97505060608c013567ffffffffffffffff811115610eea57600080fd5b610ef68e828f01610b61565b965096505060808c013567ffffffffffffffff811115610f1557600080fd5b610f218e828f01610b61565b945094505060a0610f348e828f01610c0a565b92505060c0610f458e828f01610c0a565b9150509295989b509295989b9093969950565b610f618161142f565b82525050565b6000610f738385611413565b9350610f808385846114a2565b82840190509392505050565b6000610f97826113f7565b610fa18185611402565b9350610fb18185602086016114b1565b610fba81611525565b840191505092915050565b6000610fd0826113f7565b610fda8185611413565b9350610fea8185602086016114b1565b80840191505092915050565b6110076110028261147e565b6114e4565b82525050565b61101e61101982611490565b6114e4565b82525050565b600061103160188361141e565b915061103c82611543565b602082019050919050565b600061105460178361141e565b915061105f8261156c565b602082019050919050565b6000611077600d8361141e565b915061108282611595565b602082019050919050565b61109e61109982611471565b6114e4565b82525050565b60006110b08284610fc5565b915081905092915050565b60006110c78287610fc5565b91506110d4828587610f67565b91506110e0828461100d565b60018201915081905095945050505050565b60006110fe8289610fc5565b915061110a8288610fc5565b91506111168287610fc5565b91506111228286610fc5565b915061112e8285610fc5565b915061113a828461100d565b600182019150819050979650505050505050565b600061115a828a610fc5565b91506111668289610fc5565b91506111728288610fc5565b915061117e8287610fc5565b915061118a8286610fc5565b9150611196828561100d565b6001820191506111a68284610fc5565b915081905098975050505050505050565b60006111c3828b610fc5565b91506111cf828a610fc5565b91506111db8289610fc5565b91506111e78288610fc5565b91506111f38287610fc5565b91506111ff828661100d565b60018201915061120f8285610fc5565b915061121b8284610fc5565b91508190509998505050505050505050565b60006112398284610ff6565b60018201915081905092915050565b60006112548287610ff6565b6001820191506112648286610fc5565b9150611271828486610f67565b915081905095945050505050565b600061128b828a610ff6565b60018201915061129b8289610fc5565b91506112a8828789610f67565b91506112b48286610fc5565b91506112c1828486610f67565b915081905098975050505050505050565b60006112de828461108d565b60018201915081905092915050565b60006112f9828561108d565b600182019150611309828461108d565b6001820191508190509392505050565b6000611325828761108d565b600182019150611335828661108d565b600182019150611345828561108d565b600182019150611355828461108d565b60018201915081905095945050505050565b600060408201905061137c6000830185610f58565b818103602083015261138e8184610f8c565b90509392505050565b600060208201905081810360008301526113b081611024565b9050919050565b600060208201905081810360008301526113d081611047565b9050919050565b600060208201905081810360008301526113f08161106a565b9050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60008115159050919050565b6000819050611449826115be565b919050565b600081905061145c826115d2565b919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006114898261143b565b9050919050565b600061149b8261144e565b9050919050565b82818337600083830152505050565b60005b838110156114cf5780820151818401526020810190506114b4565b838111156114de576000848401525b50505050565b60006114ef82611536565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000601f19601f8301169050919050565b60008160f81b9050919050565b7f5365636f6e64206b6579206d75737420626520656d7074790000000000000000600082015250565b7f4669727374206b6579206d75737420626520656d707479000000000000000000600082015250565b7f556e696d706c656d656e74656400000000000000000000000000000000000000600082015250565b600381106115cf576115ce6114f6565b5b50565b600481106115e3576115e26114f6565b5b50565b600381106115f357600080fd5b50565b6115ff81611461565b811461160a57600080fd5b5056fea264697066735822122045902a2eca70e23c359f9ddaa922914d3d322f9636b96c5735a8d848a4fbb19264736f6c63430008020033'; - -// Contract is DummyAggregatorProxy -export const DUMMY_PROXY_BYTECODE = '0x608060405234801561001057600080fd5b506040516101493803806101498339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b031990921691909117905560e5806100646000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063245a7bfc146037578063f9120af6146059575b600080fd5b603d607e565b604080516001600160a01b039092168252519081900360200190f35b607c60048036036020811015606d57600080fd5b50356001600160a01b0316608d565b005b6000546001600160a01b031690565b600080546001600160a01b0319166001600160a01b039290921691909117905556fea2646970667358221220e6ea90ae509c1e97b506e2a0f0a3696b49e7b564a2723832159db0e2ec54c73564736f6c63430006050033'; -export const DUMMY_PROXY_ABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_aggregator', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [], - name: 'aggregator', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_aggregator', - type: 'address', - }, - ], - name: 'setAggregator', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; diff --git a/scripts/eth/chainlink/access-controlled-aggregator-proxy.js b/scripts/eth/chainlink/access-controlled-aggregator-proxy.js deleted file mode 100644 index 305fe406d..000000000 --- a/scripts/eth/chainlink/access-controlled-aggregator-proxy.js +++ /dev/null @@ -1,96 +0,0 @@ -import { - deployContract, getTestEVMAccountsFromWeb3, getWeb3, endowEVMAddressWithDefault, sendEVMTxn, -} from '../helpers'; -import { - AccessControlledAggregatorByteCode, - AccessControlledAggregatorABI, - EACAggregatorProxyByteCode, - EACAggregatorProxyABI, - DeviationFlaggingValidatorABI, - FlagsABI, -} from './bytecodes-and-abis'; -import { addOracles, fund } from './helpers'; - -async function deployAggregator(web3, signer, linkTokenAddr, paymentAmount, timeout, validator, minSubmissionValue, maxSubmissionValue, decimals, description) { - console.log('Deploying AccessControlledAggregator'); - const argsABI = web3.eth.abi.encodeParameters(['address', 'uint128', 'uint32', 'address', 'int256', 'int256', 'uint8', 'string'], [linkTokenAddr, paymentAmount, timeout, validator, minSubmissionValue, maxSubmissionValue, decimals, description]); - const contractBytecode = AccessControlledAggregatorByteCode + argsABI.slice(2); - return deployContract(web3, signer, contractBytecode); -} - -async function deployProxy(web3, signer, aggregatorAddr) { - console.log('Deploying EACAggregatorProxy'); - // The aggregator contract extends the access controller as well, thus both arguments are same. - const contractBytecode = EACAggregatorProxyByteCode + web3.eth.abi.encodeParameters(['address', 'address'], [aggregatorAddr, aggregatorAddr]).slice(2); - return deployContract(web3, signer, contractBytecode); -} - -async function main() { - const web3 = getWeb3(); - - const [alice, bob, carol] = getTestEVMAccountsFromWeb3(web3); - await endowEVMAddressWithDefault(alice.address); - await endowEVMAddressWithDefault(bob.address); - await endowEVMAddressWithDefault(carol.address); - - // Link token contract address - const linkTokenAddr = '0xa8F3e277740b7c40Ab684cB1b69F69159EF592f6'; - const paymentAmount = 10; - const timeout = 600; - // Deviation flagging validator, check script deviation-flag-validator.js - const validatorAddr = '0xF4F1d669D0D9Ccb14eF2463fB22cB998F4D8FC12'; - const minSubmissionValue = 0; - const maxSubmissionValue = 10000; - const decimals = 3; - const description = 'AccessControlledAggregator for Dock USD price feed'; - - const aggregatorAddr = await deployAggregator(web3, alice, linkTokenAddr, paymentAmount, timeout, validatorAddr, minSubmissionValue, maxSubmissionValue, decimals, description); - const aggregator = new web3.eth.Contract(AccessControlledAggregatorABI, aggregatorAddr); - - // Fund the aggregator - await fund(web3, alice, linkTokenAddr, aggregatorAddr, aggregator); - - // Add 2 oracles - await addOracles(web3, alice, aggregatorAddr, aggregator, bob, carol); - - // Adding an address for testing that access control works. Not needed in real deployment. - await sendEVMTxn(web3, alice, aggregatorAddr, aggregator.methods.addAccess('0x0000000000000000000000000000000000000000').encodeABI()); - - const proxyAddr = await deployProxy(web3, alice, aggregatorAddr); - const proxy = new web3.eth.Contract(EACAggregatorProxyABI, proxyAddr); - - // Fetch current aggregator address from proxy - const aggrFromProxyAddr = await proxy.methods.aggregator().call(); - const aggrFromProxyContract = new web3.eth.Contract(AccessControlledAggregatorABI, aggrFromProxyAddr); - - console.log((await aggrFromProxyContract.methods.hasAccess('0x0000000000000000000000000000000000000000', []).call())); - console.log((await aggrFromProxyContract.methods.hasAccess('0x0000000000000000000000000000000000000001', []).call())); - console.log((await aggrFromProxyContract.methods.hasAccess(alice.address, []).call())); - - // Load Flags contract - const validator = new web3.eth.Contract(DeviationFlaggingValidatorABI, validatorAddr); - const flagsAddr = await validator.methods.flags().call(); - const flagsContract = new web3.eth.Contract(FlagsABI, flagsAddr); - - // Oracle's round state above should decide the round number - const submitCall1 = aggrFromProxyContract.methods.submit(1, 50).encodeABI(); - await sendEVMTxn(web3, bob, aggrFromProxyAddr, submitCall1); - - // There would be no flags raised for the aggregator - console.log((await flagsContract.methods.getFlag(aggrFromProxyAddr).call())); - - console.log((await aggrFromProxyContract.methods.latestRoundData().call())); - - // Need to wait for timeout. - // const submitCall2 = aggrFromProxyContract.methods.submit(2, 60).encodeABI(); - // await sendEVMTxn(web3, carol, aggrFromProxyAddr, submitCall2); - // - // // There would be a flag raised - // console.log((await flagsContract.methods.getFlag(aggrFromProxyAddr).call())); - - process.exit(0); -} - -main().catch((err) => { - console.log('Error', err); -}); diff --git a/scripts/eth/chainlink/bytecodes-and-abis.js b/scripts/eth/chainlink/bytecodes-and-abis.js deleted file mode 100644 index c0bbd9264..000000000 --- a/scripts/eth/chainlink/bytecodes-and-abis.js +++ /dev/null @@ -1,4190 +0,0 @@ -export const LinkTokenByteCode = '0x60806040523480156200001157600080fd5b50604080518082018252600f81526e21b430b4b72634b735902a37b5b2b760891b6020808301918252835180850190945260048452634c494e4b60e01b908401528151919291620000659160039162000246565b5080516200007b90600490602084019062000246565b50506005805460ff19166012179055506200009e6001600160e01b03620000a416565b620002eb565b620000c5336b033b2e3c9fd0803ce80000006001600160e01b03620000c716565b565b6001600160a01b03821662000123576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200013a600083836001600160e01b03620001df16565b6200015681600254620001e460201b6200091c1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620001899183906200091c620001e4821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b6000828201838110156200023f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028957805160ff1916838001178555620002b9565b82800160010185558215620002b9579182015b82811115620002b95782518255916020019190600101906200029c565b50620002c7929150620002cb565b5090565b620002e891905b80821115620002c75760008155600101620002d2565b90565b610e1980620002fb6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063661884631161008c578063a457c2d711610066578063a457c2d71461035b578063a9059cbb14610387578063d73dd623146103b3578063dd62ed3e146103df576100ea565b8063661884631461030157806370a082311461032d57806395d89b4114610353576100ea565b806323b872dd116100c857806323b872dd146101c6578063313ce567146101fc578063395093511461021a5780634000aea014610246576100ea565b806306fdde03146100ef578063095ea7b31461016c57806318160ddd146101ac575b600080fd5b6100f761040d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610131578181015183820152602001610119565b50505050905090810190601f16801561015e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101986004803603604081101561018257600080fd5b506001600160a01b0381351690602001356104a3565b604080519115158252519081900360200190f35b6101b46104c0565b60408051918252519081900360200190f35b610198600480360360608110156101dc57600080fd5b506001600160a01b038135811691602081013590911690604001356104c6565b610204610553565b6040805160ff9092168252519081900360200190f35b6101986004803603604081101561023057600080fd5b506001600160a01b03813516906020013561055c565b6101986004803603606081101561025c57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561028c57600080fd5b82018360208201111561029e57600080fd5b803590602001918460018302840111640100000000831117156102c057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105b0945050505050565b6101986004803603604081101561031757600080fd5b506001600160a01b03813516906020013561068b565b6101b46004803603602081101561034357600080fd5b50356001600160a01b031661069e565b6100f76106b9565b6101986004803603604081101561037157600080fd5b506001600160a01b03813516906020013561071a565b6101986004803603604081101561039d57600080fd5b506001600160a01b038135169060200135610788565b610198600480360360408110156103c957600080fd5b506001600160a01b03813516906020013561079c565b6101b4600480360360408110156103f557600080fd5b506001600160a01b03813581169160200135166107a8565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104995780601f1061046e57610100808354040283529160200191610499565b820191906000526020600020905b81548152906001019060200180831161047c57829003601f168201915b5050505050905090565b60006104b76104b06107d3565b84846107d7565b50600192915050565b60025490565b60006104d3848484610831565b610549846104df6107d3565b61054485604051806060016040528060288152602001610d4e602891396001600160a01b038a1660009081526001602052604081209061051d6107d3565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61088516565b6107d7565b5060019392505050565b60055460ff1690565b60006104b76105696107d3565b84610544856001600061057a6107d3565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61091c16565b60006105bc8484610788565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561063757818101518382015260200161061f565b50505050905090810190601f1680156106645780820380516001836020036101000a031916815260200191505b50935050505060405180910390a361067b84610976565b156105495761054984848461097c565b6000610697838361071a565b9392505050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104995780601f1061046e57610100808354040283529160200191610499565b60006104b76107276107d3565b8461054485604051806060016040528060258152602001610dbf60259139600160006107516107d3565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61088516565b60006104b76107956107d3565b8484610831565b6000610697838361055c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b816001600160a01b0381163014156108205760405162461bcd60e51b8152600401808060200182810382526034815260200180610cf46034913960400191505060405180910390fd5b61082b848484610a56565b50505050565b816001600160a01b03811630141561087a5760405162461bcd60e51b8152600401808060200182810382526034815260200180610cf46034913960400191505060405180910390fd5b61082b848484610b42565b600081848411156109145760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108d95781810151838201526020016108c1565b50505050905090810190601f1680156109065780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610697576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3b151590565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b838110156109ea5781810151838201526020016109d2565b50505050905090810190601f168015610a175780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610a3857600080fd5b505af1158015610a4c573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316610a9b5760405162461bcd60e51b8152600401808060200182810382526024815260200180610d9b6024913960400191505060405180910390fd5b6001600160a01b038216610ae05760405162461bcd60e51b8152600401808060200182810382526022815260200180610cd26022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b875760405162461bcd60e51b8152600401808060200182810382526025815260200180610d766025913960400191505060405180910390fd5b6001600160a01b038216610bcc5760405162461bcd60e51b8152600401808060200182810382526023815260200180610caf6023913960400191505060405180910390fd5b610bd7838383610ca9565b610c1a81604051806060016040528060268152602001610d28602691396001600160a01b038616600090815260208190526040902054919063ffffffff61088516565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610c4f908263ffffffff61091c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734c696e6b546f6b656e3a207472616e736665722f617070726f766520746f207468697320636f6e7472616374206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d29b8450660138e9996b73f57f08237acc3fab524eaedef2e93620fef7e5de6464736f6c63430006050033'; -export const LinkTokenABI = [ - { - inputs: [], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'subtractedValue', - type: 'uint256', - }, - ], - name: 'decreaseAllowance', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'subtractedValue', - type: 'uint256', - }, - ], - name: 'decreaseApproval', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'addedValue', - type: 'uint256', - }, - ], - name: 'increaseAllowance', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'addedValue', - type: 'uint256', - }, - ], - name: 'increaseApproval', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'name', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'symbol', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'totalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_to', - type: 'address', - }, - { - internalType: 'uint256', - name: '_value', - type: 'uint256', - }, - { - internalType: 'bytes', - name: '_data', - type: 'bytes', - }, - ], - name: 'transferAndCall', - outputs: [ - { - internalType: 'bool', - name: 'success', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - internalType: 'address', - name: 'recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -export const OracleByteCode = '0x6080604052600160045534801561001557600080fd5b506040516113363803806113368339818101604052602081101561003857600080fd5b5051600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600180546001600160a01b0319166001600160a01b0392909216919091179055611284806100b26000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80637fcd56db1161008c578063a4c0ed3611610066578063a4c0ed36146102a6578063d3e9c31414610361578063f2fde38b14610387578063f3fef3a3146103ad576100cf565b80637fcd56db146102685780638da5cb5b146102965780638f32d59b1461029e576100cf565b8063165d35e1146100d457806340429946146100f85780634ab0d190146101ab5780634b6022821461020d57806350188301146102275780636ee4d5531461022f575b600080fd5b6100dc6103d9565b604080516001600160a01b039092168252519081900360200190f35b6101a9600480360361010081101561010f57600080fd5b6001600160a01b038235811692602081013592604082013592606083013516916001600160e01b03196080820135169160a08201359160c081013591810190610100810160e082013564010000000081111561016a57600080fd5b82018360208201111561017c57600080fd5b8035906020019184600183028401116401000000008311171561019e57600080fd5b5090925090506103e8565b005b6101f9600480360360c08110156101c157600080fd5b508035906020810135906001600160a01b03604082013516906001600160e01b03196060820135169060808101359060a001356106be565b604080519115158252519081900360200190f35b6102156109b8565b60408051918252519081900360200190f35b6102156109be565b6101a96004803603608081101561024557600080fd5b508035906020810135906001600160e01b03196040820135169060600135610a20565b6101a96004803603604081101561027e57600080fd5b506001600160a01b0381351690602001351515610bda565b6100dc610c4c565b6101f9610c5b565b6101a9600480360360608110156102bc57600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156102ec57600080fd5b8201836020820111156102fe57600080fd5b8035906020019184600183028401116401000000008311171561032057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610c6c945050505050565b6101f96004803603602081101561037757600080fd5b50356001600160a01b0316610e99565b6101a96004803603602081101561039d57600080fd5b50356001600160a01b0316610eb7565b6101a9600480360360408110156103c357600080fd5b506001600160a01b038135169060200135610f0a565b6001546001600160a01b031690565b6103f06103d9565b6001600160a01b0316336001600160a01b03161461044b576040805162461bcd60e51b815260206004820152601360248201527226bab9ba103ab9b2902624a725903a37b5b2b760691b604482015290519081900360640190fd5b60015486906001600160a01b03808316911614156104b0576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f742063616c6c6261636b20746f204c494e4b000000000000000000604482015290519081900360640190fd5b604080516bffffffffffffffffffffffff1960608d901b166020808301919091526034808301899052835180840390910181526054909201835281519181019190912060008181526002909252919020541561054a576040805162461bcd60e51b8152602060048201526014602482015273135d5cdd081d5cd94818481d5b9a5c5d5948125160621b604482015290519081900360640190fd5b600061055e4261012c63ffffffff61104b16565b90508a89898360405160200180858152602001846001600160a01b03166001600160a01b031660601b8152601401836001600160e01b0319166001600160e01b0319168152600401828152602001945050505050604051602081830303815290604052805190602001206002600084815260200190815260200160002081905550897fd8d7ecc4800d25fa53ce0372f13a416d98907a7ef3d8d3bdd79cf4fe75529c658d848e8d8d878d8d8d604051808a6001600160a01b03166001600160a01b03168152602001898152602001888152602001876001600160a01b03166001600160a01b03168152602001866001600160e01b0319166001600160e01b0319168152602001858152602001848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039c50909a5050505050505050505050a2505050505050505050505050565b3360009081526003602052604081205460ff16806106f457506106df610c4c565b6001600160a01b0316336001600160a01b0316145b61072f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611205602a913960400191505060405180910390fd5b6000878152600260205260409020548790610791576040805162461bcd60e51b815260206004820152601b60248201527f4d757374206861766520612076616c6964207265717565737449640000000000604482015290519081900360640190fd5b6040805160208082018a90526bffffffffffffffffffffffff1960608a901b16828401526001600160e01b0319881660548301526058808301889052835180840390910181526078909201835281519181019190912060008b81526002909252919020548114610848576040805162461bcd60e51b815260206004820152601e60248201527f506172616d7320646f206e6f74206d6174636820726571756573742049440000604482015290519081900360640190fd5b60045461085b908963ffffffff61104b16565b60045560008981526002602052604081205562061a805a10156108c5576040805162461bcd60e51b815260206004820181905260248201527f4d7573742070726f7669646520636f6e73756d657220656e6f75676820676173604482015290519081900360640190fd5b60408051602481018b9052604480820187905282518083039091018152606490910182526020810180516001600160e01b03166001600160e01b03198a16178152915181516000936001600160a01b038c169392918291908083835b602083106109405780518252601f199092019160209182019101610921565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146109a2576040519150601f19603f3d011682016040523d82523d6000602084013e6109a7565b606091505b50909b9a5050505050505050505050565b61012c81565b60006109c8610c5b565b610a07576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b600454610a1b90600163ffffffff6110ac16565b905090565b6040805160208082018690523360601b828401526001600160e01b0319851660548301526058808301859052835180840390910181526078909201835281519181019190912060008781526002909252919020548114610ac7576040805162461bcd60e51b815260206004820152601e60248201527f506172616d7320646f206e6f74206d6174636820726571756573742049440000604482015290519081900360640190fd5b42821115610b15576040805162461bcd60e51b815260206004820152601660248201527514995c5d595cdd081a5cc81b9bdd08195e1c1a5c995960521b604482015290519081900360640190fd5b6000858152600260205260408082208290555186917fa7842b9ec549398102c0d91b1b9919b2f20558aefdadf57528a95c6cd3292e9391a26001546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610ba157600080fd5b505af1158015610bb5573d6000803e3d6000fd5b505050506040513d6020811015610bcb57600080fd5b5051610bd357fe5b5050505050565b610be2610c5b565b610c21576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b610c746103d9565b6001600160a01b0316336001600160a01b031614610ccf576040805162461bcd60e51b815260206004820152601360248201527226bab9ba103ab9b2902624a725903a37b5b2b760691b604482015290519081900360640190fd5b8051819060441115610d21576040805162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840e4cae2eacae6e840d8cadccee8d60531b604482015290519081900360640190fd5b602082015182906001600160e01b031981166320214ca360e11b14610d8d576040805162461bcd60e51b815260206004820152601e60248201527f4d757374207573652077686974656c69737465642066756e6374696f6e730000604482015290519081900360640190fd5b8560248501528460448501526000306001600160a01b0316856040518082805190602001908083835b60208310610dd55780518252601f199092019160209182019101610db6565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610e35576040519150601f19603f3d011682016040523d82523d6000602084013e610e3a565b606091505b5050905080610e90576040805162461bcd60e51b815260206004820152601860248201527f556e61626c6520746f2063726561746520726571756573740000000000000000604482015290519081900360640190fd5b50505050505050565b6001600160a01b031660009081526003602052604090205460ff1690565b610ebf610c5b565b610efe576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b610f0781611109565b50565b610f12610c5b565b610f51576040805162461bcd60e51b8152602060048201819052602482015260008051602061122f833981519152604482015290519081900360640190fd5b80610f6381600163ffffffff61104b16565b6004541015610fa35760405162461bcd60e51b81526004018080602001828103825260358152602001806111d06035913960400191505060405180910390fd5b600454610fb6908363ffffffff6110ac16565b60049081556001546040805163a9059cbb60e01b81526001600160a01b0387811694820194909452602481018690529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561101457600080fd5b505af1158015611028573d6000803e3d6000fd5b505050506040513d602081101561103e57600080fd5b505161104657fe5b505050565b6000828201838110156110a5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600082821115611103576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b03811661114e5760405162461bcd60e51b81526004018080602001828103825260268152602001806111aa6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416d6f756e74207265717565737465642069732067726561746572207468616e20776974686472617761626c652062616c616e63654e6f7420616e20617574686f72697a6564206e6f646520746f2066756c66696c6c2072657175657374734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220880df1259ed41873ae139626f0469321944ef17f2f300986604e5bb00a6f353a64736f6c63430006050033'; -export const OracleABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_link', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'requestId', - type: 'bytes32', - }, - ], - name: 'CancelOracleRequest', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'specId', - type: 'bytes32', - }, - { - indexed: false, - internalType: 'address', - name: 'requester', - type: 'address', - }, - { - indexed: false, - internalType: 'bytes32', - name: 'requestId', - type: 'bytes32', - }, - { - indexed: false, - internalType: 'uint256', - name: 'payment', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'callbackAddr', - type: 'address', - }, - { - indexed: false, - internalType: 'bytes4', - name: 'callbackFunctionId', - type: 'bytes4', - }, - { - indexed: false, - internalType: 'uint256', - name: 'cancelExpiration', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'dataVersion', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'OracleRequest', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - inputs: [], - name: 'EXPIRY_TIME', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_requestId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: '_payment', - type: 'uint256', - }, - { - internalType: 'bytes4', - name: '_callbackFunc', - type: 'bytes4', - }, - { - internalType: 'uint256', - name: '_expiration', - type: 'uint256', - }, - ], - name: 'cancelOracleRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_requestId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: '_payment', - type: 'uint256', - }, - { - internalType: 'address', - name: '_callbackAddress', - type: 'address', - }, - { - internalType: 'bytes4', - name: '_callbackFunctionId', - type: 'bytes4', - }, - { - internalType: 'uint256', - name: '_expiration', - type: 'uint256', - }, - { - internalType: 'bytes32', - name: '_data', - type: 'bytes32', - }, - ], - name: 'fulfillOracleRequest', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_node', - type: 'address', - }, - ], - name: 'getAuthorizationStatus', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getChainlinkToken', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'isOwner', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_sender', - type: 'address', - }, - { - internalType: 'uint256', - name: '_amount', - type: 'uint256', - }, - { - internalType: 'bytes', - name: '_data', - type: 'bytes', - }, - ], - name: 'onTokenTransfer', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_sender', - type: 'address', - }, - { - internalType: 'uint256', - name: '_payment', - type: 'uint256', - }, - { - internalType: 'bytes32', - name: '_specId', - type: 'bytes32', - }, - { - internalType: 'address', - name: '_callbackAddress', - type: 'address', - }, - { - internalType: 'bytes4', - name: '_callbackFunctionId', - type: 'bytes4', - }, - { - internalType: 'uint256', - name: '_nonce', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '_dataVersion', - type: 'uint256', - }, - { - internalType: 'bytes', - name: '_data', - type: 'bytes', - }, - ], - name: 'oracleRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_node', - type: 'address', - }, - { - internalType: 'bool', - name: '_allowed', - type: 'bool', - }, - ], - name: 'setFulfillmentPermission', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: '_amount', - type: 'uint256', - }, - ], - name: 'withdraw', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'withdrawable', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -export const FluxAggregatorByteCode = '0x60c06040523480156200001157600080fd5b5060405162004ad438038062004ad483398181016040526101008110156200003857600080fd5b815160208301516040808501516060860151608087015160a088015160c089015160e08a0180519651989a9799959894979396929591949391820192846401000000008211156200008857600080fd5b9083019060208201858111156200009e57600080fd5b8251640100000000811182820188101715620000b957600080fd5b82525081516020918201929091019080838360005b83811015620000e8578181015183820152602001620000ce565b50505050905090810190601f168015620001165780820380516001836020036101000a031916815260200191505b50604052505060008054336001600160a01b0319918216178255600280549091166001600160a01b038c16179055620001559150889080808a6200021f565b62000169856001600160e01b03620005fd16565b608084905260a08390526005805460ff191660ff8416179055805162000197906006906020840190620007e1565b50620001b88663ffffffff1642620006c760201b62002ef91790919060201c565b6000805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6c80546001600160401b03929092166801000000000000000002600160401b600160801b031990921691909117905550620008839650505050505050565b6000546001600160a01b031633146200027f576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6000620002946001600160e01b036200072a16565b60ff1690508463ffffffff168463ffffffff161015620002fb576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff1610156200035d576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff811615806200037c57508263ffffffff168163ffffffff16115b620003ce576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b620003eb6001600160801b0387166001600160e01b036200073116565b600d546001600160801b031610156200044b576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b6000620004606001600160e01b036200072a16565b60ff161115620004c65760008563ffffffff1611620004c6576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b031633146200065d576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6003546001600160a01b039081169082168114620006c357600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b6000828211156200071f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600c545b90565b600062000724600262000768620007506001600160e01b036200072a16565b60ff16856200077c60201b620037221790919060201c565b6200077c60201b620037221790919060201c565b6000826200078d5750600062000724565b828202828482816200079b57fe5b0414620007da5760405162461bcd60e51b815260040180806020018281038252602181526020018062004ab36021913960400191505060405180910390fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200082457805160ff191683800117855562000854565b8280016001018555821562000854579182015b828111156200085457825182559160200191906001019062000837565b506200086292915062000866565b5090565b6200072e91905b808211156200086257600081556001016200086d565b60805160a051614202620008b160003980610a845280610d08525080610a0f528061190052506142026000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c8063668a0f0211610146578063a4c0ed36116100c3578063c937450011610087578063c9374500146108b7578063d4cc54e4146108bf578063e2e40317146108c7578063e9ee6eeb146108ed578063f2fde38b1461091b578063feaf968c1461094157610253565b8063a4c0ed36146107c6578063b5ab58dc14610849578063b633620c14610866578063c107532914610883578063c35905c6146108af57610253565b80638205bf6a1161010a5780638205bf6a1461069557806388aa80e71461069d5780638da5cb5b1461072f57806398e5b12a146107375780639a6fc8f51461075e57610253565b8063668a0f02146105f857806370dea79a146106005780637284e4161461060857806379ba5097146106855780637c2b0b211461068d57610253565b806340884c52116101d457806357970e931161019857806357970e931461059457806358609e441461059c578063613d8fcc146105a4578063628806ef146105ac57806364efb22b146105d257610253565b806340884c521461050057806346fcff4c146105585780634f8fc3b51461057c57806350d25bcd1461058457806354fd4d501461058c57610253565b8063357ebb021161021b578063357ebb021461031557806338aa4c72146103365780633969c20f146103805780633a5381b5146104a65780633d3d7714146104ca57610253565b80631327d3d814610258578063202ee0ed1461028057806320ed0275146102a357806323ca2903146102dd578063313ce567146102f7575b600080fd5b61027e6004803603602081101561026e57600080fd5b50356001600160a01b0316610949565b005b61027e6004803603604081101561029657600080fd5b50803590602001356109ff565b61027e600480360360608110156102b957600080fd5b5080356001600160a01b03169060208101351515906040013563ffffffff16610bd1565b6102e5610d06565b60408051918252519081900360200190f35b6102ff610d2a565b6040805160ff9092168252519081900360200190f35b61031d610d33565b6040805163ffffffff9092168252519081900360200190f35b61027e600480360360a081101561034c57600080fd5b506001600160801b038135169063ffffffff6020820135811691604081013582169160608201358116916080013516610d46565b61027e600480360360c081101561039657600080fd5b810190602081018135600160201b8111156103b057600080fd5b8201836020820111156103c257600080fd5b803590602001918460208302840111600160201b831117156103e357600080fd5b919390929091602081019035600160201b81111561040057600080fd5b82018360208201111561041257600080fd5b803590602001918460208302840111600160201b8311171561043357600080fd5b919390929091602081019035600160201b81111561045057600080fd5b82018360208201111561046257600080fd5b803590602001918460208302840111600160201b8311171561048357600080fd5b919350915063ffffffff81358116916020810135821691604090910135166110e9565b6104ae6112b1565b604080516001600160a01b039092168252519081900360200190f35b61027e600480360360608110156104e057600080fd5b506001600160a01b038135811691602081013590911690604001356112c0565b6105086114b3565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561054457818101518382015260200161052c565b505050509050019250505060405180910390f35b610560611516565b604080516001600160801b039092168252519081900360200190f35b61027e611525565b6102e561163c565b6102e561165e565b6104ae611663565b61031d611672565b6102ff611685565b61027e600480360360208110156105c257600080fd5b50356001600160a01b031661168b565b6104ae600480360360208110156105e857600080fd5b50356001600160a01b0316611771565b6102e561179b565b61031d6117ae565b6106106117c1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561064a578181015183820152602001610632565b50505050905090810190601f1680156106775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61027e61184f565b6102e56118fe565b6102e5611922565b6106cf600480360360408110156106b357600080fd5b5080356001600160a01b0316906020013563ffffffff16611957565b60408051981515895263ffffffff9097166020890152878701959095526001600160401b0393841660608801529190921660808601526001600160801b0391821660a086015260ff1660c08501521660e083015251908190036101000190f35b6104ae611ab7565b61073f611ac6565b6040805169ffffffffffffffffffff9092168252519081900360200190f35b6107876004803603602081101561077457600080fd5b503569ffffffffffffffffffff16611be5565b6040805169ffffffffffffffffffff96871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b61027e600480360360608110156107dc57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561080b57600080fd5b82018360208201111561081d57600080fd5b803590602001918460018302840111600160201b8311171561083e57600080fd5b509092509050611d1f565b6102e56004803603602081101561085f57600080fd5b5035611d80565b6102e56004803603602081101561087c57600080fd5b5035611db4565b61027e6004803603604081101561089957600080fd5b506001600160a01b038135169060200135611df3565b610560611f95565b61031d611fa4565b610560611fb7565b6102e5600480360360208110156108dd57600080fd5b50356001600160a01b0316611fcd565b61027e6004803603604081101561090357600080fd5b506001600160a01b0381358116916020013516611ff1565b61027e6004803603602081101561093157600080fd5b50356001600160a01b03166120d4565b610787612172565b6000546001600160a01b03163314610996576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b6003546001600160a01b0390811690821681146109fb57600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b6060610a0b33846121ac565b90507f0000000000000000000000000000000000000000000000000000000000000000821215610a82576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652062656c6f77206d696e5375626d697373696f6e56616c75650000604482015290519081900360640190fd5b7f0000000000000000000000000000000000000000000000000000000000000000821315610af7576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652061626f7665206d61785375626d697373696f6e56616c75650000604482015290519081900360640190fd5b8051819015610b845760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b49578181015183820152602001610b31565b50505050905090810190601f168015610b765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50610b8e8361244f565b610b9882846124e3565b600080610ba4856125bc565b91509150610bb185612714565b610bba85612857565b8115610bca57610bca85826128b6565b5050505050565b6000546001600160a01b03163314610c1e576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b6001600160a01b0383166000908152600b602052604090205460ff1615158215151415610c4a57610d01565b8115610c8d576001600160a01b0383166000908152600b60205260409020805460ff19168315151764ffffffff00191661010063ffffffff841602179055610cb6565b6001600160a01b0383166000908152600b60205260409020805468ffffffffffffffffff191690555b60408051831515815263ffffffff8316602082015281516001600160a01b038616927fc3df5a754e002718f2e10804b99e6605e7c701d95cec9552c7680ca2b6f2820a928290030190a25b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60055460ff1681565b600454600160c01b900463ffffffff1681565b6000546001600160a01b03163314610d93576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b6000610d9d611685565b60ff1690508463ffffffff168463ffffffff161015610e03576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff161015610e64576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff81161580610e8257508263ffffffff168163ffffffff16115b610ed3576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b610ee5866001600160801b03166129af565b600d546001600160801b03161015610f44576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b6000610f4e611685565b60ff161115610fb25760008563ffffffff1611610fb2576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b03163314611136576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b60005b8881101561116d576111658a8a8381811061115057fe5b905060200201356001600160a01b03166129dd565b600101611139565b508584146111c2576040805162461bcd60e51b815260206004820181905260248201527f6e6565642073616d65206f7261636c6520616e642061646d696e20636f756e74604482015290519081900360640190fd5b604d6111df876111d0611685565b60ff169063ffffffff612bab16565b1115611228576040805162461bcd60e51b81526020600482015260136024820152721b585e081bdc9858db195cc8185b1b1bddd959606a1b604482015290519081900360640190fd5b60005b8681101561127b5761127388888381811061124257fe5b905060200201356001600160a01b031687878481811061125e57fe5b905060200201356001600160a01b0316612bfa565b60010161122b565b506004546112a6906001600160801b03811690859085908590600160e01b900463ffffffff16610d46565b505050505050505050565b6003546001600160a01b031681565b6001600160a01b03838116600090815260086020526040902060020154620100009004163314611330576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b03831660009081526008602052604090205481906001600160801b039081169082168110156113ad576040805162461bcd60e51b815260206004820152601f60248201527f696e73756666696369656e7420776974686472617761626c652066756e647300604482015290519081900360640190fd5b6113c66001600160801b0382168363ffffffff612e8a16565b6001600160a01b038616600090815260086020526040902080546001600160801b0319166001600160801b03928316179055600d5461140e91600160801b9091041683612e8a565b600d80546001600160801b03928316600160801b029083161790556002546040805163a9059cbb60e01b81526001600160a01b03888116600483015293861660248201529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561148157600080fd5b505af1158015611495573d6000803e3d6000fd5b505050506040513d60208110156114ab57600080fd5b5051610bca57fe5b6060600c80548060200260200160405190810160405280929190818152602001828054801561150b57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116114ed575b505050505090505b90565b600d546001600160801b031690565b61152d61405b565b50604080518082018252600d546001600160801b038082168352600160801b90910416602080830182905260025484516370a0823160e01b8152306004820152945193946000946115de94936001600160a01b03909316926370a082319260248082019391829003018186803b1580156115a657600080fd5b505afa1580156115ba573d6000803e3d6000fd5b505050506040513d60208110156115d057600080fd5b50519063ffffffff612ef916565b82519091506001600160801b031681146109fb57600d80546001600160801b0319166001600160801b03831617905560405181907ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f90600090a25050565b600754600160201b900463ffffffff1660009081526009602052604090205490565b600381565b6002546001600160a01b031681565b600454600160801b900463ffffffff1681565b600c5490565b6001600160a01b038181166000908152600860205260409020600301541633146116fc576040805162461bcd60e51b815260206004820152601e60248201527f6f6e6c792063616c6c61626c652062792070656e64696e672061646d696e0000604482015290519081900360640190fd5b6001600160a01b0381166000818152600860205260408082206003810180546001600160a01b0319169055600201805462010000600160b01b031916336201000081029190911790915590519092917f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90491a350565b6001600160a01b03808216600090815260086020526040902060020154620100009004165b919050565b600754600160201b900463ffffffff1690565b600454600160e01b900463ffffffff1681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156118475780601f1061181c57610100808354040283529160200191611847565b820191906000526020600020905b81548152906001019060200180831161182a57829003601f168201915b505050505081565b6001546001600160a01b031633146118a7576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b7f000000000000000000000000000000000000000000000000000000000000000081565b600754600160201b900463ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031690565b6000808080808080803332146119ad576040805162461bcd60e51b81526020600482015260166024820152756f66662d636861696e2072656164696e67206f6e6c7960501b604482015290519081900360640190fd5b63ffffffff891615611a905763ffffffff89166000908152600960209081526040808320600a9092529091206119e38c8c612f50565b6001600160a01b038d1660009081526008602052604090206001908101548482015491840154600d548f936001600160401b031691600160401b900463ffffffff16906001600160801b0316611a37611685565b60018901546001600160401b0316611a5a576004546001600160801b0316611a70565b6001880154600160601b90046001600160801b03165b8363ffffffff169350995099509950995099509950995099505050611aaa565b611a998a612fa5565b975097509750975097509750975097505b9295985092959890939650565b6000546001600160a01b031681565b336000908152600b602052604081205460ff16611b2a576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617574686f72697a6564207265717565737465720000000000000000604482015290519081900360640190fd5b60075463ffffffff16600081815260096020526040902060010154600160401b90046001600160401b0316151580611b665750611b6681613170565b611bb7576040805162461bcd60e51b815260206004820152601f60248201527f7072657620726f756e64206d75737420626520737570657273656461626c6500604482015290519081900360640190fd5b6000611bce63ffffffff808416906001906131fb16565b9050611bd98161324c565b63ffffffff1691505090565b6000806000806000611bf5614072565b5063ffffffff8087166000908152600960209081526040918290208251608081018452815481526001909101546001600160401b0380821693830193909352600160401b810490921692810192909252600160801b90049091166060820181905215801590611c745750611c748769ffffffffffffffffffff1661331a565b6040518060400160405280600f81526020016e139bc819185d18481c1c995cd95b9d608a1b81525090611ce85760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610b49578181015183820152602001610b31565b50805160208201516040830151606090930151989991986001600160401b0391821698509216955063ffffffff9091169350915050565b8015611d72576040805162461bcd60e51b815260206004820181905260248201527f7472616e7366657220646f65736e2774206163636570742063616c6c64617461604482015290519081900360640190fd5b611d7a611525565b50505050565b6000611d8b8261331a565b15611dac575063ffffffff8116600090815260096020526040902054611796565b506000919050565b6000611dbf8261331a565b15611dac575063ffffffff8116600090815260096020526040902060010154600160401b90046001600160401b0316611796565b6000546001600160a01b03163314611e40576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b600d546004546001600160801b03918216918391611e6f91611e6291166129af565b839063ffffffff612ef916565b1015611ec2576040805162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420726573657276652066756e6473000000000000604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611f1857600080fd5b505af1158015611f2c573d6000803e3d6000fd5b505050506040513d6020811015611f4257600080fd5b5051611f8d576040805162461bcd60e51b81526020600482015260156024820152741d1bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604482015290519081900360640190fd5b610d01611525565b6004546001600160801b031681565b600454600160a01b900463ffffffff1681565b600d54600160801b90046001600160801b031690565b6001600160a01b03166000908152600860205260409020546001600160801b031690565b6001600160a01b03828116600090815260086020526040902060020154620100009004163314612061576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b0382811660008181526008602090815260409182902060030180546001600160a01b0319169486169485179055815133815290810193909352805191927fb79bf2e89c2d70dde91d2991fb1ea69b7e478061ad7c04ed5b02b96bc52b8104929081900390910190a25050565b6000546001600160a01b03163314612121576040805162461bcd60e51b815260206004820152601660248201526000805160206141ad833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080600080600061219b600760049054906101000a900463ffffffff1663ffffffff16611be5565b945094509450945094509091929394565b6001600160a01b03821660009081526008602052604090205460075460609163ffffffff600160801b909104811691168161221557604051806040016040528060128152602001716e6f7420656e61626c6564206f7261636c6560701b81525092505050612449565b8363ffffffff168263ffffffff16111561226157604051806040016040528060168152602001756e6f742079657420656e61626c6564206f7261636c6560501b81525092505050612449565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160a01b9092041610156122d0576040518060400160405280601881526020017f6e6f206c6f6e67657220616c6c6f776564206f7261636c65000000000000000081525092505050612449565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160c01b909204161061233e576040518060400160405280602081526020017f63616e6e6f74207265706f7274206f6e2070726576696f757320726f756e647381525092505050612449565b8063ffffffff168463ffffffff161415801561237a575061236a63ffffffff808316906001906131fb16565b63ffffffff168463ffffffff1614155b801561238d575061238b8482613324565b155b156123d1576040518060400160405280601781526020017f696e76616c696420726f756e6420746f207265706f727400000000000000000081525092505050612449565b8363ffffffff1660011415801561240257506124006123fb63ffffffff8087169060019061338416565b6133e7565b155b15612446576040518060400160405280601f81526020017f70726576696f757320726f756e64206e6f7420737570657273656461626c650081525092505050612449565b50505b92915050565b61245881613421565b612461576124e0565b3360009081526008602052604090205460045463ffffffff600160e01b909204821691600160c01b90910481168201908316118015906124a057508015155b156124ab57506124e0565b6124b482613452565b5033600090815260086020526040902080546001600160e01b0316600160e01b63ffffffff8416021790555b50565b6124ec81613605565b61253d576040805162461bcd60e51b815260206004820152601f60248201527f726f756e64206e6f7420616363657074696e67207375626d697373696f6e7300604482015290519081900360640190fd5b63ffffffff81166000818152600a6020908152604080832080546001808201835591855283852001879055338085526008909352818420805463ffffffff60c01b1916600160c01b8702178155018690555190929185917f92e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68c9190a45050565b63ffffffff8082166000908152600a602052604081206001810154905491928392600160201b9092041611156125f75750600090508061270f565b63ffffffff83166000908152600a60209081526040808320805482518185028101850190935280835261265d9383018282801561265357602002820191906000526020600020905b81548152602001906001019080831161263f575b5050505050613625565b63ffffffff8516600081815260096020908152604091829020848155600101805467ffffffffffffffff60401b1916600160401b426001600160401b038116919091029190911763ffffffff60801b1916600160801b8602179091556007805467ffffffff000000001916600160201b860217905582519081529151939450919284927f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f928290030190a36001925090505b915091565b63ffffffff81166000908152600a6020526040902060010154600160601b90046001600160801b031661274561405b565b5060408051808201909152600d546001600160801b03808216808452600160801b90920416602083015261277f908363ffffffff612e8a16565b6001600160801b03908116825260208201516127a291168363ffffffff6136ce16565b6001600160801b0390811660208084018290528351600d8054600160801b9094029185166001600160801b031990941693909317841617909155336000908152600890915260409020546127fd91168363ffffffff6136ce16565b3360009081526008602052604080822080546001600160801b0319166001600160801b03948516179055835190519216917ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f9190a2505050565b63ffffffff8082166000908152600a602052604090206001810154905491161115612881576124e0565b63ffffffff81166000908152600a60205260408120906128a18282614099565b5060010180546001600160e01b031916905550565b6003546001600160a01b0316806128cd57506109fb565b60006128e463ffffffff8086169060019061338416565b63ffffffff808216600090815260096020908152604080832060018101549054825163beed9b5160e01b8152600160801b90920486166004830181905260248301829052958b166044830152606482018a90529151959650939490936001600160a01b0388169363beed9b5193620186a093608480850194929391928390030190829088803b15801561297657600080fd5b5087f19350505050801561299c57506040513d602081101561299757600080fd5b505160015b6129a5576129a7565b505b505050505050565b600061244960026129d16129c1611685565b859060ff1663ffffffff61372216565b9063ffffffff61372216565b6129e68161377b565b612a2c576040805162461bcd60e51b81526020600482015260126024820152711bdc9858db19481b9bdd08195b98589b195960721b604482015290519081900360640190fd5b600754612a459063ffffffff908116906001906131fb16565b6001600160a01b0382166000908152600860205260408120805463ffffffff93909316600160a01b0263ffffffff60a01b1990931692909217909155600c612a9f6001612a90611685565b60ff169063ffffffff612ef916565b81548110612aa957fe5b6000918252602080832091909101546001600160a01b0385811680855260089093526040808520600290810180549390941680875291862001805461ffff90931661ffff199384168117909155939094528154169055600c8054929350909183919083908110612b1557fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600c805480612b4e57fe5b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038516907f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e908390a3505050565b600082820183811015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b9392505050565b612c038261377b565b15612c4e576040805162461bcd60e51b81526020600482015260166024820152751bdc9858db1948185b1c9958591e48195b98589b195960521b604482015290519081900360640190fd5b6001600160a01b038116612ca1576040805162461bcd60e51b8152602060048201526015602482015274063616e6e6f74207365742061646d696e20746f203605c1b604482015290519081900360640190fd5b6001600160a01b03828116600090815260086020526040902060020154620100009004161580612cf657506001600160a01b038281166000908152600860205260409020600201546201000090048116908216145b612d47576040805162461bcd60e51b815260206004820152601c60248201527f6f776e65722063616e6e6f74206f76657277726974652061646d696e00000000604482015290519081900360640190fd5b612d50826137a6565b6001600160a01b03808416600081815260086020526040808220805463ffffffff60a01b1963ffffffff97909716600160801b0263ffffffff60801b19909116179590951663ffffffff60a01b178555600c80546002909601805461ffff90971661ffff19909716969096178655805460018181019092557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b031916851790558383528554948716620100000262010000600160b01b0319909516949094179094559251919290917f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e9190a3806001600160a01b0316826001600160a01b03167f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90460405160405180910390a35050565b6000826001600160801b0316826001600160801b03161115612ef3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082821115612ef3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b63ffffffff81166000908152600960205260408120600101546001600160401b031615612f9b57612f8082613605565b8015612f945750612f9183836121ac565b51155b9050612449565b612f808383613809565b6001600160a01b0381166000908152600860205260408120600754815483928392839283928392839283927fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b929091849163ffffffff908116600160c01b90920416148061302257506007546130209063ffffffff16613605565b155b6007549091506130379063ffffffff166133e7565b80156130405750805b156130995760075461305e9063ffffffff908116906001906131fb16565b63ffffffff81166000908152600960205260409020600454919b506001600160801b03909116945092506130928c8b613809565b9a506130e3565b60075463ffffffff166000818152600960209081526040808320600a90925290912060010154919b50600160601b9091046001600160801b0316945092506130e08a613605565b9a505b6130ed8c8b6121ac565b51156130f85760009a505b6001808301548482015463ffffffff808e166000908152600a6020526040902090930154600d548f948f94936001600160401b031692600160401b900416906001600160801b0316613148611685565b8a8363ffffffff1693509a509a509a509a509a509a509a509a50505050919395975091939597565b63ffffffff8082166000908152600960209081526040808320600190810154600a909352908320015491926001600160401b0390911691600160401b90041681158015906131c4575060008163ffffffff16115b80156131f35750426131e86001600160401b03841663ffffffff8085169061385316565b6001600160401b0316105b949350505050565b600082820163ffffffff8085169082161015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b61325581613421565b61325e576124e0565b336000908152600b602052604090205463ffffffff6501000000000082048116916101009004811682019083161180613295575080155b6132dc576040805162461bcd60e51b81526020600482015260136024820152726d7573742064656c617920726571756573747360681b604482015290519081900360640190fd5b6132e582613452565b50336000908152600b60205260409020805463ffffffff8316650100000000000268ffffffff00000000001990911617905550565b63ffffffff101590565b60008163ffffffff1661334760018563ffffffff166131fb90919063ffffffff16565b63ffffffff16148015612bf357505063ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031615919050565b60008263ffffffff168263ffffffff161115612ef3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b63ffffffff8116600090815260096020526040812060010154600160401b90046001600160401b0316151580612449575061244982613170565b60075460009061343d9063ffffffff908116906001906131fb16565b63ffffffff168263ffffffff16149050919050565b61346f61346a63ffffffff8084169060019061338416565b6138a7565b6007805463ffffffff191663ffffffff831617905561348c6140b7565b5060408051600060a0820181815260c083018452825260045463ffffffff600160801b82048116602080860191909152600160a01b8304821685870152600160e01b8304821660608601526001600160801b03909216608085015285168252600a8152929020815180519293849361350792849201906140e5565b5060208281015160019283018054604080870151606088015160809098015163ffffffff1990931663ffffffff9586161767ffffffff000000001916600160201b91861691909102176bffffffff00000000000000001916600160401b97851697909702969096176fffffffffffffffffffffffffffffffff60601b1916600160601b6001600160801b03909216919091021790558516600081815260098352849020909201805467ffffffffffffffff1916426001600160401b039081169190911791829055845191168152925133937f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac6027192908290030190a35050565b63ffffffff9081166000908152600a602052604090206001015416151590565b60008151600010613676576040805162461bcd60e51b81526020600482015260166024820152756c697374206d757374206e6f7420626520656d70747960501b604482015290519081900360640190fd5b815160028104600182166136b55760008061369b866000600187036001870387613969565b90925090506136aa8282613a47565b945050505050611796565b6136c58460006001850384613ab5565b92505050611796565b60008282016001600160801b038085169082161015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b60008261373157506000612449565b8282028284828161373e57fe5b0414612bf35760405162461bcd60e51b815260040180806020018281038252602181526020018061418c6021913960400191505060405180910390fd5b6001600160a01b031660009081526008602052604090205463ffffffff600160a01b90910481161490565b60075460009063ffffffff1680158015906137e857506001600160a01b03831660009081526008602052604090205463ffffffff828116600160a01b90920416145b156137f4579050611796565b612bf363ffffffff808316906001906131fb16565b6001600160a01b03821660009081526008602052604081205460045463ffffffff600160e01b909204821691600160c01b9091048116820190841611806131f35750159392505050565b60008282016001600160401b038085169082161015612bf3576040805162461bcd60e51b815260206004820152601b602482015260008051602061416c833981519152604482015290519081900360640190fd5b6138b081613170565b6138b9576124e0565b60006138d063ffffffff8084169060019061338416565b63ffffffff8181166000908152600960209081526040808320805488861685528285209081556001918201549101805463ffffffff60801b1916600160801b928390049096169091029490941767ffffffffffffffff60401b1916600160401b426001600160401b03160217909355600a90529081209192506139538282614099565b5060010180546001600160e01b03191690555050565b60008082841061397857600080fd5b8386111580156139885750848411155b61399157600080fd5b8286111580156139a15750848311155b6139aa57600080fd5b600786860310156139cb576139c28787878787613b46565b91509150613a3d565b60006139d8888888613f19565b90508084116139e957809550613a37565b848110156139fc57806001019650613a37565b808511158015613a0b57508381105b613a1157fe5b613a1d88888388613ab5565b9250613a2e88826001018887613ab5565b9150613a3d9050565b506139aa565b9550959350505050565b60008083128015613a585750600082135b80613a6e5750600083138015613a6e5750600082125b15613a8e576002613a7f8484613ff6565b81613a8657fe5b059050612449565b60006002808507818507010590506131f3613aaf6002860560028605613ff6565b82613ff6565b600081841115613ac457600080fd5b82821115613ad157600080fd5b82841015613b285760078484031015613afd576000613af38686868687613b46565b5091506131f39050565b6000613b0a868686613f19565b9050808311613b1b57809350613b22565b8060010194505b50613ad1565b848481518110613b3457fe5b60200260200101519050949350505050565b600080600086866001010390506000888860000181518110613b6457fe5b60200260200101519050600082600110613b85576001600160ff1b03613b9d565b898960010181518110613b9457fe5b60200260200101515b9050600083600210613bb6576001600160ff1b03613bce565b8a8a60020181518110613bc557fe5b60200260200101515b9050600084600310613be7576001600160ff1b03613bff565b8b8b60030181518110613bf657fe5b60200260200101515b9050600085600410613c18576001600160ff1b03613c30565b8c8c60040181518110613c2757fe5b60200260200101515b9050600086600510613c49576001600160ff1b03613c61565b8d8d60050181518110613c5857fe5b60200260200101515b9050600087600610613c7a576001600160ff1b03613c92565b8e8e60060181518110613c8957fe5b60200260200101515b905085871315613ca0579495945b83851315613cac579293925b81831315613cb8579091905b84871315613cc4579395935b83861315613cd0579294925b80831315613cda57915b84861315613ce6579394935b80821315613cf057905b82871315613cfc579195915b81861315613d08579094905b80851315613d1257935b82861315613d1e579194915b80841315613d2857925b82851315613d34579193915b81841315613d40579092905b82841315613d4c579192915b8d8c0380613d5c57879a50613e02565b8060011415613d6d57869a50613e02565b8060021415613d7e57859a50613e02565b8060031415613d8f57849a50613e02565b8060041415613da057839a50613e02565b8060051415613db157829a50613e02565b8060061415613dc257819a50613e02565b6040805162461bcd60e51b815260206004820152601060248201526f6b31206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b8e8c038d8d1415613e2057508a9950613a3d98505050505050505050565b80613e375750969850613a3d975050505050505050565b8060011415613e525750959850613a3d975050505050505050565b8060021415613e6d5750949850613a3d975050505050505050565b8060031415613e885750939850613a3d975050505050505050565b8060041415613ea35750929850613a3d975050505050505050565b8060051415613ebe5750919850613a3d975050505050505050565b8060061415613ed95750909850613a3d975050505050505050565b6040805162461bcd60e51b815260206004820152601060248201526f6b32206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b6000808460028585010481518110613f2d57fe5b602002602001015190506001840393506001830192505b60018401935080858581518110613f5757fe5b602002602001015112613f44575b60018303925080858481518110613f7857fe5b602002602001015113613f655782841015613fe857848381518110613f9957fe5b6020026020010151858581518110613fad57fe5b6020026020010151868681518110613fc157fe5b60200260200101878681518110613fd457fe5b602090810291909101019190915252613ff1565b82915050612bf3565b613f44565b600082820181831280159061400b5750838112155b80614020575060008312801561402057508381125b612bf35760405162461bcd60e51b815260040180806020018281038252602181526020018061414b6021913960400191505060405180910390fd5b604080518082019091526000808252602082015290565b60408051608081018252600080825260208201819052918101829052606081019190915290565b50805460008255906000526020600020908101906124e09190614130565b6040805160a08101825260608082526000602083018190529282018390528101829052608081019190915290565b828054828255906000526020600020908101928215614120579160200282015b82811115614120578251825591602001919060010190614105565b5061412c929150614130565b5090565b61151391905b8082111561412c576000815560010161413656fe5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f77536166654d6174683a206164646974696f6e206f766572666c6f770000000000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f6e6c792063616c6c61626c65206279206f776e657200000000000000000000a26469706673582212205752ce9095ae9e6129196eea73dac92cb2a25f52fb262c93f35ce9dcb1b3f25764736f6c63430006050033536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77'; -export const FluxAggregatorABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_link', - type: 'address', - }, - { - internalType: 'uint128', - name: '_paymentAmount', - type: 'uint128', - }, - { - internalType: 'uint32', - name: '_timeout', - type: 'uint32', - }, - { - internalType: 'address', - name: '_validator', - type: 'address', - }, - { - internalType: 'int256', - name: '_minSubmissionValue', - type: 'int256', - }, - { - internalType: 'int256', - name: '_maxSubmissionValue', - type: 'int256', - }, - { - internalType: 'uint8', - name: '_decimals', - type: 'uint8', - }, - { - internalType: 'string', - name: '_description', - type: 'string', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'int256', - name: 'current', - type: 'int256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - ], - name: 'AnswerUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'AvailableFundsUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256', - }, - { - indexed: true, - internalType: 'address', - name: 'startedBy', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - ], - name: 'NewRound', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'admin', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'newAdmin', - type: 'address', - }, - ], - name: 'OracleAdminUpdateRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newAdmin', - type: 'address', - }, - ], - name: 'OracleAdminUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - { - indexed: true, - internalType: 'bool', - name: 'whitelisted', - type: 'bool', - }, - ], - name: 'OraclePermissionsUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'requester', - type: 'address', - }, - { - indexed: false, - internalType: 'bool', - name: 'authorized', - type: 'bool', - }, - { - indexed: false, - internalType: 'uint32', - name: 'delay', - type: 'uint32', - }, - ], - name: 'RequesterPermissionsSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint128', - name: 'paymentAmount', - type: 'uint128', - }, - { - indexed: true, - internalType: 'uint32', - name: 'minSubmissionCount', - type: 'uint32', - }, - { - indexed: true, - internalType: 'uint32', - name: 'maxSubmissionCount', - type: 'uint32', - }, - { - indexed: false, - internalType: 'uint32', - name: 'restartDelay', - type: 'uint32', - }, - { - indexed: false, - internalType: 'uint32', - name: 'timeout', - type: 'uint32', - }, - ], - name: 'RoundDetailsUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'int256', - name: 'submission', - type: 'int256', - }, - { - indexed: true, - internalType: 'uint32', - name: 'round', - type: 'uint32', - }, - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - ], - name: 'SubmissionReceived', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previous', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'current', - type: 'address', - }, - ], - name: 'ValidatorUpdated', - type: 'event', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - ], - name: 'acceptAdmin', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'allocatedFunds', - outputs: [ - { - internalType: 'uint128', - name: '', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'availableFunds', - outputs: [ - { - internalType: 'uint128', - name: '', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address[]', - name: '_removed', - type: 'address[]', - }, - { - internalType: 'address[]', - name: '_added', - type: 'address[]', - }, - { - internalType: 'address[]', - name: '_addedAdmins', - type: 'address[]', - }, - { - internalType: 'uint32', - name: '_minSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_maxSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_restartDelay', - type: 'uint32', - }, - ], - name: 'changeOracles', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'description', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - ], - name: 'getAdmin', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - ], - name: 'getAnswer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getOracles', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - ], - name: 'getRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - ], - name: 'getTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestAnswer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRound', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'linkToken', - outputs: [ - { - internalType: 'contract LinkTokenInterface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'maxSubmissionCount', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'maxSubmissionValue', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'minSubmissionCount', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'minSubmissionValue', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'bytes', - name: '_data', - type: 'bytes', - }, - ], - name: 'onTokenTransfer', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'oracleCount', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'uint32', - name: '_queriedRoundId', - type: 'uint32', - }, - ], - name: 'oracleRoundState', - outputs: [ - { - internalType: 'bool', - name: '_eligibleToSubmit', - type: 'bool', - }, - { - internalType: 'uint32', - name: '_roundId', - type: 'uint32', - }, - { - internalType: 'int256', - name: '_latestSubmission', - type: 'int256', - }, - { - internalType: 'uint64', - name: '_startedAt', - type: 'uint64', - }, - { - internalType: 'uint64', - name: '_timeout', - type: 'uint64', - }, - { - internalType: 'uint128', - name: '_availableFunds', - type: 'uint128', - }, - { - internalType: 'uint8', - name: '_oracleCount', - type: 'uint8', - }, - { - internalType: 'uint128', - name: '_paymentAmount', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'paymentAmount', - outputs: [ - { - internalType: 'uint128', - name: '', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'requestNewRound', - outputs: [ - { - internalType: 'uint80', - name: '', - type: 'uint80', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'restartDelay', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_requester', - type: 'address', - }, - { - internalType: 'bool', - name: '_authorized', - type: 'bool', - }, - { - internalType: 'uint32', - name: '_delay', - type: 'uint32', - }, - ], - name: 'setRequesterPermissions', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_newValidator', - type: 'address', - }, - ], - name: 'setValidator', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - { - internalType: 'int256', - name: '_submission', - type: 'int256', - }, - ], - name: 'submit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'timeout', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'address', - name: '_newAdmin', - type: 'address', - }, - ], - name: 'transferAdmin', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_to', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'updateAvailableFunds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint128', - name: '_paymentAmount', - type: 'uint128', - }, - { - internalType: 'uint32', - name: '_minSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_maxSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_restartDelay', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_timeout', - type: 'uint32', - }, - ], - name: 'updateFutureRounds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'validator', - outputs: [ - { - internalType: 'contract AggregatorValidatorInterface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'version', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: '_amount', - type: 'uint256', - }, - ], - name: 'withdrawFunds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'address', - name: '_recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: '_amount', - type: 'uint256', - }, - ], - name: 'withdrawPayment', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - ], - name: 'withdrawablePayment', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -export const AccessControlledAggregatorByteCode = '0x60c06040523480156200001157600080fd5b50604051620053523803806200535283398181016040526101008110156200003857600080fd5b815160208301516040808501516060860151608087015160a088015160c089015160e08a0180519651989a9799959894979396929591949391820192846401000000008211156200008857600080fd5b9083019060208201858111156200009e57600080fd5b8251640100000000811182820188101715620000b957600080fd5b82525081516020918201929091019080838360005b83811015620000e8578181015183820152602001620000ce565b50505050905090810190601f168015620001165780820380516001836020036101000a031916815260200191505b50604052505060008054336001600160a01b0319918216178255600280549091166001600160a01b038c1617905589915088908890889088908890889088906200016590889080808a62000244565b62000179856001600160e01b036200062216565b608084905260a08390526005805460ff191660ff84161790558051620001a790600690602084019062000806565b50620001c88663ffffffff1642620006ec60201b620034db1790919060201c565b6000805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6c80546001600160401b03929092166801000000000000000002600160401b600160801b03199092169190911790555050600e805460ff1916600117905550620008a89c50505050505050505050505050565b6000546001600160a01b03163314620002a4576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6000620002b96001600160e01b036200074f16565b60ff1690508463ffffffff168463ffffffff16101562000320576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff16101562000382576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff81161580620003a157508263ffffffff168163ffffffff16115b620003f3576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b620004106001600160801b0387166001600160e01b036200075616565b600d546001600160801b0316101562000470576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b6000620004856001600160e01b036200074f16565b60ff161115620004eb5760008563ffffffff1611620004eb576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b0316331462000682576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6003546001600160a01b039081169082168114620006e857600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b60008282111562000744576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600c545b90565b60006200074960026200078d620007756001600160e01b036200074f16565b60ff1685620007a160201b62003f6a1790919060201c565b620007a160201b62003f6a1790919060201c565b600082620007b25750600062000749565b82820282848281620007c057fe5b0414620007ff5760405162461bcd60e51b8152600401808060200182810382526021815260200180620053316021913960400191505060405180910390fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200084957805160ff191683800117855562000879565b8280016001018555821562000879579182015b82811115620008795782518255916020019190600101906200085c565b50620008879291506200088b565b5090565b6200075391905b8082111562000887576000815560010162000892565b60805160a051614a5b620008d660003980610c805280610f04525080610c0b5280611c045250614a5b6000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c806370dea79a11610167578063a4c0ed36116100ce578063d4cc54e411610087578063d4cc54e414610a25578063dc7f012414610a2d578063e2e4031714610a35578063e9ee6eeb14610a5b578063f2fde38b14610a89578063feaf968c14610aaf57610295565b8063a4c0ed361461092c578063b5ab58dc146109af578063b633620c146109cc578063c1075329146109e9578063c35905c614610a15578063c937450014610a1d57610295565b80638823da6c116101205780638823da6c146107b757806388aa80e7146107dd5780638da5cb5b1461086f57806398e5b12a146108775780639a6fc8f51461089e578063a118f2491461090657610295565b806370dea79a146107125780637284e4161461071a57806379ba5097146107975780637c2b0b211461079f5780638038e4a1146107a75780638205bf6a146107af57610295565b806340884c521161020b57806358609e44116101c457806358609e44146105e6578063613d8fcc146105ee578063628806ef146105f657806364efb22b1461061c578063668a0f02146106425780636b14daf81461064a57610295565b806340884c521461054a57806346fcff4c146105a25780634f8fc3b5146105c657806350d25bcd146105ce57806354fd4d50146105d657806357970e93146105de57610295565b8063313ce5671161025d578063313ce56714610341578063357ebb021461035f57806338aa4c72146103805780633969c20f146103ca5780633a5381b5146104f05780633d3d77141461051457610295565b80630a7569831461029a5780631327d3d8146102a4578063202ee0ed146102ca57806320ed0275146102ed57806323ca290314610327575b600080fd5b6102a2610ab7565b005b6102a2600480360360208110156102ba57600080fd5b50356001600160a01b0316610b45565b6102a2600480360360408110156102e057600080fd5b5080359060200135610bfb565b6102a26004803603606081101561030357600080fd5b5080356001600160a01b03169060208101351515906040013563ffffffff16610dcd565b61032f610f02565b60408051918252519081900360200190f35b610349610f26565b6040805160ff9092168252519081900360200190f35b610367610f2f565b6040805163ffffffff9092168252519081900360200190f35b6102a2600480360360a081101561039657600080fd5b506001600160801b038135169063ffffffff6020820135811691604081013582169160608201358116916080013516610f42565b6102a2600480360360c08110156103e057600080fd5b810190602081018135600160201b8111156103fa57600080fd5b82018360208201111561040c57600080fd5b803590602001918460208302840111600160201b8311171561042d57600080fd5b919390929091602081019035600160201b81111561044a57600080fd5b82018360208201111561045c57600080fd5b803590602001918460208302840111600160201b8311171561047d57600080fd5b919390929091602081019035600160201b81111561049a57600080fd5b8201836020820111156104ac57600080fd5b803590602001918460208302840111600160201b831117156104cd57600080fd5b919350915063ffffffff81358116916020810135821691604090910135166112e5565b6104f86114ad565b604080516001600160a01b039092168252519081900360200190f35b6102a26004803603606081101561052a57600080fd5b506001600160a01b038135811691602081013590911690604001356114bc565b6105526116af565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561058e578181015183820152602001610576565b505050509050019250505060405180910390f35b6105aa611712565b604080516001600160801b039092168252519081900360200190f35b6102a2611721565b61032f611838565b61032f6118c5565b6104f86118ca565b6103676118d9565b6103496118ec565b6102a26004803603602081101561060c57600080fd5b50356001600160a01b03166118f2565b6104f86004803603602081101561063257600080fd5b50356001600160a01b03166119d8565b61032f611a02565b6106fe6004803603604081101561066057600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460018302840111600160201b831117156106bd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611a8a945050505050565b604080519115158252519081900360200190f35b610367611ab2565b610722611ac5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561075c578181015183820152602001610744565b50505050905090810190601f1680156107895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102a2611b53565b61032f611c02565b6102a2611c26565b61032f611cb5565b6102a2600480360360208110156107cd57600080fd5b50356001600160a01b0316611d3d565b61080f600480360360408110156107f357600080fd5b5080356001600160a01b0316906020013563ffffffff16611e04565b60408051981515895263ffffffff9097166020890152878701959095526001600160401b0393841660608801529190921660808601526001600160801b0391821660a086015260ff1660c08501521660e083015251908190036101000190f35b6104f8611f64565b61087f611f73565b6040805169ffffffffffffffffffff9092168252519081900360200190f35b6108c7600480360360208110156108b457600080fd5b503569ffffffffffffffffffff16612092565b6040805169ffffffffffffffffffff96871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b6102a26004803603602081101561091c57600080fd5b50356001600160a01b0316612133565b6102a26004803603606081101561094257600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561097157600080fd5b82018360208201111561098357600080fd5b803590602001918460018302840111600160201b831117156109a457600080fd5b5090925090506121fb565b61032f600480360360208110156109c557600080fd5b503561225c565b61032f600480360360208110156109e257600080fd5b50356122e5565b6102a2600480360360408110156109ff57600080fd5b506001600160a01b03813516906020013561236e565b6105aa612510565b61036761251f565b6105aa612532565b6106fe612548565b61032f60048036036020811015610a4b57600080fd5b50356001600160a01b0316612551565b6102a260048036036040811015610a7157600080fd5b506001600160a01b0381358116916020013516612575565b6102a260048036036020811015610a9f57600080fd5b50356001600160a01b0316612658565b6108c76126f6565b6000546001600160a01b03163314610b04576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600e5460ff1615610b4357600e805460ff191690556040517f3be8a977a014527b50ae38adda80b56911c267328965c98ddc385d248f53963890600090a15b565b6000546001600160a01b03163314610b92576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6003546001600160a01b039081169082168114610bf757600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fcfac5dc75b8d9a7e074162f59d9adcd33da59f0fe8dfb21580db298fc0fdad0d90600090a35b5050565b6060610c073384612795565b90507f0000000000000000000000000000000000000000000000000000000000000000821215610c7e576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652062656c6f77206d696e5375626d697373696f6e56616c75650000604482015290519081900360640190fd5b7f0000000000000000000000000000000000000000000000000000000000000000821315610cf3576040805162461bcd60e51b815260206004820152601e60248201527f76616c75652061626f7665206d61785375626d697373696f6e56616c75650000604482015290519081900360640190fd5b8051819015610d805760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d45578181015183820152602001610d2d565b50505050905090810190601f168015610d725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50610d8a83612a37565b610d948284612acc565b600080610da085612ba5565b91509150610dad85612cfd565b610db685612e40565b8115610dc657610dc68582612e9f565b5050505050565b6000546001600160a01b03163314610e1a576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6001600160a01b0383166000908152600b602052604090205460ff1615158215151415610e4657610efd565b8115610e89576001600160a01b0383166000908152600b60205260409020805460ff19168315151764ffffffff00191661010063ffffffff841602179055610eb2565b6001600160a01b0383166000908152600b60205260409020805468ffffffffffffffffff191690555b60408051831515815263ffffffff8316602082015281516001600160a01b038616927fc3df5a754e002718f2e10804b99e6605e7c701d95cec9552c7680ca2b6f2820a928290030190a25b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60055460ff1681565b600454600160c01b900463ffffffff1681565b6000546001600160a01b03163314610f8f576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6000610f996118ec565b60ff1690508463ffffffff168463ffffffff161015610fff576040805162461bcd60e51b815260206004820152601960248201527f6d6178206d75737420657175616c2f657863656564206d696e00000000000000604482015290519081900360640190fd5b8363ffffffff168163ffffffff161015611060576040805162461bcd60e51b815260206004820152601760248201527f6d61782063616e6e6f742065786365656420746f74616c000000000000000000604482015290519081900360640190fd5b63ffffffff8116158061107e57508263ffffffff168163ffffffff16115b6110cf576040805162461bcd60e51b815260206004820152601960248201527f64656c61792063616e6e6f742065786365656420746f74616c00000000000000604482015290519081900360640190fd5b6110e1866001600160801b0316612f98565b600d546001600160801b03161015611140576040805162461bcd60e51b815260206004820152601e60248201527f696e73756666696369656e742066756e647320666f72207061796d656e740000604482015290519081900360640190fd5b600061114a6118ec565b60ff1611156111ae5760008563ffffffff16116111ae576040805162461bcd60e51b815260206004820152601a60248201527f6d696e206d7573742062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b85600460006101000a8154816001600160801b0302191690836001600160801b0316021790555084600460146101000a81548163ffffffff021916908363ffffffff16021790555083600460106101000a81548163ffffffff021916908363ffffffff16021790555082600460186101000a81548163ffffffff021916908363ffffffff160217905550816004601c6101000a81548163ffffffff021916908363ffffffff1602179055508363ffffffff168563ffffffff16600460009054906101000a90046001600160801b03166001600160801b03167f56800c9d1ed723511246614d15e58cfcde15b6a33c245b5c961b689c1890fd8f8686604051808363ffffffff1663ffffffff1681526020018263ffffffff1663ffffffff1681526020019250505060405180910390a4505050505050565b6000546001600160a01b03163314611332576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b60005b88811015611369576113618a8a8381811061134c57fe5b905060200201356001600160a01b0316612fc6565b600101611335565b508584146113be576040805162461bcd60e51b815260206004820181905260248201527f6e6565642073616d65206f7261636c6520616e642061646d696e20636f756e74604482015290519081900360640190fd5b604d6113db876113cc6118ec565b60ff169063ffffffff61319416565b1115611424576040805162461bcd60e51b81526020600482015260136024820152721b585e081bdc9858db195cc8185b1b1bddd959606a1b604482015290519081900360640190fd5b60005b868110156114775761146f88888381811061143e57fe5b905060200201356001600160a01b031687878481811061145a57fe5b905060200201356001600160a01b03166131dc565b600101611427565b506004546114a2906001600160801b03811690859085908590600160e01b900463ffffffff16610f42565b505050505050505050565b6003546001600160a01b031681565b6001600160a01b0383811660009081526008602052604090206002015462010000900416331461152c576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b03831660009081526008602052604090205481906001600160801b039081169082168110156115a9576040805162461bcd60e51b815260206004820152601f60248201527f696e73756666696369656e7420776974686472617761626c652066756e647300604482015290519081900360640190fd5b6115c26001600160801b0382168363ffffffff61346c16565b6001600160a01b038616600090815260086020526040902080546001600160801b0319166001600160801b03928316179055600d5461160a91600160801b909104168361346c565b600d80546001600160801b03928316600160801b029083161790556002546040805163a9059cbb60e01b81526001600160a01b03888116600483015293861660248201529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561167d57600080fd5b505af1158015611691573d6000803e3d6000fd5b505050506040513d60208110156116a757600080fd5b5051610dc657fe5b6060600c80548060200260200160405190810160405280929190818152602001828054801561170757602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116116e9575b505050505090505b90565b600d546001600160801b031690565b6117296148b4565b50604080518082018252600d546001600160801b038082168352600160801b90910416602080830182905260025484516370a0823160e01b8152306004820152945193946000946117da94936001600160a01b03909316926370a082319260248082019391829003018186803b1580156117a257600080fd5b505afa1580156117b6573d6000803e3d6000fd5b505050506040513d60208110156117cc57600080fd5b50519063ffffffff6134db16565b82519091506001600160801b03168114610bf757600d80546001600160801b0319166001600160801b03831617905560405181907ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f90600090a25050565b600061187b336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b6118b8576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6118c0613532565b905090565b600381565b6002546001600160a01b031681565b600454600160801b900463ffffffff1681565b600c5490565b6001600160a01b03818116600090815260086020526040902060030154163314611963576040805162461bcd60e51b815260206004820152601e60248201527f6f6e6c792063616c6c61626c652062792070656e64696e672061646d696e0000604482015290519081900360640190fd5b6001600160a01b0381166000818152600860205260408082206003810180546001600160a01b0319169055600201805462010000600160b01b031916336201000081029190911790915590519092917f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90491a350565b6001600160a01b03808216600090815260086020526040902060020154620100009004165b919050565b6000611a45336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b611a82576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6118c0613554565b6000611a968383613567565b80611aa957506001600160a01b03831632145b90505b92915050565b600454600160e01b900463ffffffff1681565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015611b4b5780601f10611b2057610100808354040283529160200191611b4b565b820191906000526020600020905b815481529060010190602001808311611b2e57829003601f168201915b505050505081565b6001546001600160a01b03163314611bab576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b03163314611c73576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600e5460ff16610b4357600e805460ff191660011790556040517faebf329500988c6488a0074e5a0a9ff304561fc5c6fc877aeb1d59c8282c348090600090a1565b6000611cf8336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b611d35576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6118c0613597565b6000546001600160a01b03163314611d8a576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152600f602052604090205460ff1615611e01576001600160a01b0381166000818152600f6020908152604091829020805460ff19169055815192835290517f3d68a6fce901d20453d1a7aa06bf3950302a735948037deb182a8db66df2a0d19281900390910190a15b50565b600080808080808080333214611e5a576040805162461bcd60e51b81526020600482015260166024820152756f66662d636861696e2072656164696e67206f6e6c7960501b604482015290519081900360640190fd5b63ffffffff891615611f3d5763ffffffff89166000908152600960209081526040808320600a909252909120611e908c8c6135cc565b6001600160a01b038d1660009081526008602052604090206001908101548482015491840154600d548f936001600160401b031691600160401b900463ffffffff16906001600160801b0316611ee46118ec565b60018901546001600160401b0316611f07576004546001600160801b0316611f1d565b6001880154600160601b90046001600160801b03165b8363ffffffff169350995099509950995099509950995099505050611f57565b611f468a613621565b975097509750975097509750975097505b9295985092959890939650565b6000546001600160a01b031681565b336000908152600b602052604081205460ff16611fd7576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420617574686f72697a6564207265717565737465720000000000000000604482015290519081900360640190fd5b60075463ffffffff16600081815260096020526040902060010154600160401b90046001600160401b03161515806120135750612013816137ec565b612064576040805162461bcd60e51b815260206004820152601f60248201527f7072657620726f756e64206d75737420626520737570657273656461626c6500604482015290519081900360640190fd5b600061207b63ffffffff8084169060019061387716565b9050612086816138c8565b63ffffffff1691505090565b60008060008060006120db336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b612118576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61212186613996565b939a9299509097509550909350915050565b6000546001600160a01b03163314612180576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152600f602052604090205460ff16611e01576001600160a01b0381166000818152600f6020908152604091829020805460ff19166001179055815192835290517f87286ad1f399c8e82bf0c4ef4fcdc570ea2e1e92176e5c848b6413545b885db49281900390910190a150565b801561224e576040805162461bcd60e51b815260206004820181905260248201527f7472616e7366657220646f65736e2774206163636570742063616c6c64617461604482015290519081900360640190fd5b612256611721565b50505050565b600061229f336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b6122dc576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b611aac82613ad0565b6000612328336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b612365576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b611aac82613b04565b6000546001600160a01b031633146123bb576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600d546004546001600160801b039182169183916123ea916123dd9116612f98565b839063ffffffff6134db16565b101561243d576040805162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420726573657276652066756e6473000000000000604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561249357600080fd5b505af11580156124a7573d6000803e3d6000fd5b505050506040513d60208110156124bd57600080fd5b5051612508576040805162461bcd60e51b81526020600482015260156024820152741d1bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604482015290519081900360640190fd5b610efd611721565b6004546001600160801b031681565b600454600160a01b900463ffffffff1681565b600d54600160801b90046001600160801b031690565b600e5460ff1681565b6001600160a01b03166000908152600860205260409020546001600160801b031690565b6001600160a01b038281166000908152600860205260409020600201546201000090041633146125e5576040805162461bcd60e51b815260206004820152601660248201527537b7363c9031b0b63630b1363290313c9030b236b4b760511b604482015290519081900360640190fd5b6001600160a01b0382811660008181526008602090815260409182902060030180546001600160a01b0319169486169485179055815133815290810193909352805191927fb79bf2e89c2d70dde91d2991fb1ea69b7e478061ad7c04ed5b02b96bc52b8104929081900390910190a25050565b6000546001600160a01b031633146126a5576040805162461bcd60e51b81526020600482015260166024820152600080516020614a06833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080600080600061273f336000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a8a92505050565b61277c576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b612784613b43565b945094509450945094509091929394565b6001600160a01b03821660009081526008602052604090205460075460609163ffffffff600160801b90910481169116816127fe57604051806040016040528060128152602001716e6f7420656e61626c6564206f7261636c6560701b81525092505050611aac565b8363ffffffff168263ffffffff16111561284a57604051806040016040528060168152602001756e6f742079657420656e61626c6564206f7261636c6560501b81525092505050611aac565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160a01b9092041610156128b9576040518060400160405280601881526020017f6e6f206c6f6e67657220616c6c6f776564206f7261636c65000000000000000081525092505050611aac565b6001600160a01b03851660009081526008602052604090205463ffffffff808616600160c01b9092041610612927576040518060400160405280602081526020017f63616e6e6f74207265706f7274206f6e2070726576696f757320726f756e647381525092505050611aac565b8063ffffffff168463ffffffff1614158015612963575061295363ffffffff8083169060019061387716565b63ffffffff168463ffffffff1614155b801561297657506129748482613b6c565b155b156129ba576040518060400160405280601781526020017f696e76616c696420726f756e6420746f207265706f727400000000000000000081525092505050611aac565b8363ffffffff166001141580156129eb57506129e96129e463ffffffff80871690600190613bcc16565b613c2f565b155b15612a2f576040518060400160405280601f81526020017f70726576696f757320726f756e64206e6f7420737570657273656461626c650081525092505050611aac565b505092915050565b612a4081613c69565b612a4957611e01565b3360009081526008602052604090205460045463ffffffff600160e01b909204821691600160c01b9091048116820190831611801590612a8857508015155b15612a935750611e01565b612a9c82613c9a565b50336000908152600860205260409020805463ffffffff8316600160e01b026001600160e01b0390911617905550565b612ad581613e4d565b612b26576040805162461bcd60e51b815260206004820152601f60248201527f726f756e64206e6f7420616363657074696e67207375626d697373696f6e7300604482015290519081900360640190fd5b63ffffffff81166000818152600a6020908152604080832080546001808201835591855283852001879055338085526008909352818420805463ffffffff60c01b1916600160c01b8702178155018690555190929185917f92e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68c9190a45050565b63ffffffff8082166000908152600a602052604081206001810154905491928392600160201b909204161115612be057506000905080612cf8565b63ffffffff83166000908152600a602090815260408083208054825181850281018501909352808352612c4693830182828015612c3c57602002820191906000526020600020905b815481526020019060010190808311612c28575b5050505050613e6d565b63ffffffff8516600081815260096020908152604091829020848155600101805467ffffffffffffffff60401b1916600160401b426001600160401b038116919091029190911763ffffffff60801b1916600160801b8602179091556007805467ffffffff000000001916600160201b860217905582519081529151939450919284927f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f928290030190a36001925090505b915091565b63ffffffff81166000908152600a6020526040902060010154600160601b90046001600160801b0316612d2e6148b4565b5060408051808201909152600d546001600160801b03808216808452600160801b909204166020830152612d68908363ffffffff61346c16565b6001600160801b0390811682526020820151612d8b91168363ffffffff613f1616565b6001600160801b0390811660208084018290528351600d8054600160801b9094029185166001600160801b03199094169390931784161790915533600090815260089091526040902054612de691168363ffffffff613f1616565b3360009081526008602052604080822080546001600160801b0319166001600160801b03948516179055835190519216917ffe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f9190a2505050565b63ffffffff8082166000908152600a602052604090206001810154905491161115612e6a57611e01565b63ffffffff81166000908152600a6020526040812090612e8a82826148cb565b5060010180546001600160e01b031916905550565b6003546001600160a01b031680612eb65750610bf7565b6000612ecd63ffffffff80861690600190613bcc16565b63ffffffff808216600090815260096020908152604080832060018101549054825163beed9b5160e01b8152600160801b90920486166004830181905260248301829052958b166044830152606482018a90529151959650939490936001600160a01b0388169363beed9b5193620186a093608480850194929391928390030190829088803b158015612f5f57600080fd5b5087f193505050508015612f8557506040513d6020811015612f8057600080fd5b505160015b612f8e57612f90565b505b505050505050565b6000611aac6002612fba612faa6118ec565b859060ff1663ffffffff613f6a16565b9063ffffffff613f6a16565b612fcf81613fc3565b613015576040805162461bcd60e51b81526020600482015260126024820152711bdc9858db19481b9bdd08195b98589b195960721b604482015290519081900360640190fd5b60075461302e9063ffffffff9081169060019061387716565b6001600160a01b0382166000908152600860205260408120805463ffffffff93909316600160a01b0263ffffffff60a01b1990931692909217909155600c61308860016130796118ec565b60ff169063ffffffff6134db16565b8154811061309257fe5b6000918252602080832091909101546001600160a01b0385811680855260089093526040808520600290810180549390941680875291862001805461ffff90931661ffff199384168117909155939094528154169055600c80549293509091839190839081106130fe57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600c80548061313757fe5b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038516907f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e908390a3505050565b600082820183811015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b6131e582613fc3565b15613230576040805162461bcd60e51b81526020600482015260166024820152751bdc9858db1948185b1c9958591e48195b98589b195960521b604482015290519081900360640190fd5b6001600160a01b038116613283576040805162461bcd60e51b8152602060048201526015602482015274063616e6e6f74207365742061646d696e20746f203605c1b604482015290519081900360640190fd5b6001600160a01b038281166000908152600860205260409020600201546201000090041615806132d857506001600160a01b038281166000908152600860205260409020600201546201000090048116908216145b613329576040805162461bcd60e51b815260206004820152601c60248201527f6f776e65722063616e6e6f74206f76657277726974652061646d696e00000000604482015290519081900360640190fd5b61333282613fee565b6001600160a01b03808416600081815260086020526040808220805463ffffffff60a01b1963ffffffff97909716600160801b0263ffffffff60801b19909116179590951663ffffffff60a01b178555600c80546002909601805461ffff90971661ffff19909716969096178655805460018181019092557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b031916851790558383528554948716620100000262010000600160b01b0319909516949094179094559251919290917f18dd09695e4fbdae8d1a5edb11221eb04564269c29a089b9753a6535c54ba92e9190a3806001600160a01b0316826001600160a01b03167f0c5055390645c15a4be9a21b3f8d019153dcb4a0c125685da6eb84048e2fe90460405160405180910390a35050565b6000826001600160801b0316826001600160801b031611156134d5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828211156134d5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b600754600160201b900463ffffffff1660009081526009602052604090205490565b600754600160201b900463ffffffff1690565b6001600160a01b0382166000908152600f602052604081205460ff1680611aa9575050600e5460ff161592915050565b600754600160201b900463ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031690565b63ffffffff81166000908152600960205260408120600101546001600160401b031615613617576135fc82613e4d565b8015613610575061360d8383612795565b51155b9050611aac565b6135fc8383614058565b6001600160a01b0381166000908152600860205260408120600754815483928392839283928392839283927fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b929091849163ffffffff908116600160c01b90920416148061369e575060075461369c9063ffffffff16613e4d565b155b6007549091506136b39063ffffffff16613c2f565b80156136bc5750805b15613715576007546136da9063ffffffff9081169060019061387716565b63ffffffff81166000908152600960205260409020600454919b506001600160801b039091169450925061370e8c8b614058565b9a5061375f565b60075463ffffffff166000818152600960209081526040808320600a90925290912060010154919b50600160601b9091046001600160801b03169450925061375c8a613e4d565b9a505b6137698c8b612795565b51156137745760009a505b6001808301548482015463ffffffff808e166000908152600a6020526040902090930154600d548f948f94936001600160401b031692600160401b900416906001600160801b03166137c46118ec565b8a8363ffffffff1693509a509a509a509a509a509a509a509a50505050919395975091939597565b63ffffffff8082166000908152600960209081526040808320600190810154600a909352908320015491926001600160401b0390911691600160401b9004168115801590613840575060008163ffffffff16115b801561386f5750426138646001600160401b03841663ffffffff808516906140a216565b6001600160401b0316105b949350505050565b600082820163ffffffff8085169082161015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b6138d181613c69565b6138da57611e01565b336000908152600b602052604090205463ffffffff6501000000000082048116916101009004811682019083161180613911575080155b613958576040805162461bcd60e51b81526020600482015260136024820152726d7573742064656c617920726571756573747360681b604482015290519081900360640190fd5b61396182613c9a565b50336000908152600b60205260409020805463ffffffff8316650100000000000268ffffffff00000000001990911617905550565b60008060008060006139a66148e9565b5063ffffffff8087166000908152600960209081526040918290208251608081018452815481526001909101546001600160401b0380821693830193909352600160401b810490921692810192909252600160801b90049091166060820181905215801590613a255750613a258769ffffffffffffffffffff166140f6565b6040518060400160405280600f81526020016e139bc819185d18481c1c995cd95b9d608a1b81525090613a995760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d45578181015183820152602001610d2d565b50805160208201516040830151606090930151989991986001600160401b0391821698509216955063ffffffff9091169350915050565b6000613adb826140f6565b15613afc575063ffffffff81166000908152600960205260409020546119fd565b506000919050565b6000613b0f826140f6565b15613afc575063ffffffff8116600090815260096020526040902060010154600160401b90046001600160401b03166119fd565b6000806000806000612784600760049054906101000a900463ffffffff1663ffffffff16612092565b60008163ffffffff16613b8f60018563ffffffff1661387790919063ffffffff16565b63ffffffff16148015611aa957505063ffffffff16600090815260096020526040902060010154600160401b90046001600160401b031615919050565b60008263ffffffff168263ffffffff1611156134d5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b63ffffffff8116600090815260096020526040812060010154600160401b90046001600160401b0316151580611aac5750611aac826137ec565b600754600090613c859063ffffffff9081169060019061387716565b63ffffffff168263ffffffff16149050919050565b613cb7613cb263ffffffff80841690600190613bcc16565b614100565b6007805463ffffffff191663ffffffff8316179055613cd4614910565b5060408051600060a0820181815260c083018452825260045463ffffffff600160801b82048116602080860191909152600160a01b8304821685870152600160e01b8304821660608601526001600160801b03909216608085015285168252600a81529290208151805192938493613d4f928492019061493e565b5060208281015160019283018054604080870151606088015160809098015163ffffffff1990931663ffffffff9586161767ffffffff000000001916600160201b91861691909102176bffffffff00000000000000001916600160401b97851697909702969096176fffffffffffffffffffffffffffffffff60601b1916600160601b6001600160801b03909216919091021790558516600081815260098352849020909201805467ffffffffffffffff1916426001600160401b039081169190911791829055845191168152925133937f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac6027192908290030190a35050565b63ffffffff9081166000908152600a602052604090206001015416151590565b60008151600010613ebe576040805162461bcd60e51b81526020600482015260166024820152756c697374206d757374206e6f7420626520656d70747960501b604482015290519081900360640190fd5b81516002810460018216613efd57600080613ee38660006001870360018703876141c2565b9092509050613ef282826142a0565b9450505050506119fd565b613f0d846000600185038461430e565b925050506119fd565b60008282016001600160801b038085169082161015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b600082613f7957506000611aac565b82820282848281613f8657fe5b0414611aa95760405162461bcd60e51b81526004018080602001828103825260218152602001806149e56021913960400191505060405180910390fd5b6001600160a01b031660009081526008602052604090205463ffffffff600160a01b90910481161490565b60075460009063ffffffff16801580159061403057506001600160a01b03831660009081526008602052604090205463ffffffff828116600160a01b90920416145b1561403c5790506119fd565b61405163ffffffff8083169060019061387716565b9392505050565b6001600160a01b03821660009081526008602052604081205460045463ffffffff600160e01b909204821691600160c01b90910481168201908416118061386f5750159392505050565b60008282016001600160401b038085169082161015611aa9576040805162461bcd60e51b815260206004820152601b60248201526000805160206149c5833981519152604482015290519081900360640190fd5b63ffffffff101590565b614109816137ec565b61411257611e01565b600061412963ffffffff80841690600190613bcc16565b63ffffffff8181166000908152600960209081526040808320805488861685528285209081556001918201549101805463ffffffff60801b1916600160801b928390049096169091029490941767ffffffffffffffff60401b1916600160401b426001600160401b03160217909355600a90529081209192506141ac82826148cb565b5060010180546001600160e01b03191690555050565b6000808284106141d157600080fd5b8386111580156141e15750848411155b6141ea57600080fd5b8286111580156141fa5750848311155b61420357600080fd5b600786860310156142245761421b878787878761439f565b91509150614296565b6000614231888888614772565b905080841161424257809550614290565b8481101561425557806001019650614290565b80851115801561426457508381105b61426a57fe5b6142768888838861430e565b92506142878882600101888761430e565b91506142969050565b50614203565b9550959350505050565b600080831280156142b15750600082135b806142c757506000831380156142c75750600082125b156142e75760026142d8848461484f565b816142df57fe5b059050611aac565b600060028085078185070105905061386f614308600286056002860561484f565b8261484f565b60008184111561431d57600080fd5b8282111561432a57600080fd5b82841015614381576007848403101561435657600061434c868686868761439f565b50915061386f9050565b6000614363868686614772565b90508083116143745780935061437b565b8060010194505b5061432a565b84848151811061438d57fe5b60200260200101519050949350505050565b6000806000868660010103905060008888600001815181106143bd57fe5b602002602001015190506000826001106143de576001600160ff1b036143f6565b8989600101815181106143ed57fe5b60200260200101515b905060008360021061440f576001600160ff1b03614427565b8a8a6002018151811061441e57fe5b60200260200101515b9050600084600310614440576001600160ff1b03614458565b8b8b6003018151811061444f57fe5b60200260200101515b9050600085600410614471576001600160ff1b03614489565b8c8c6004018151811061448057fe5b60200260200101515b90506000866005106144a2576001600160ff1b036144ba565b8d8d600501815181106144b157fe5b60200260200101515b90506000876006106144d3576001600160ff1b036144eb565b8e8e600601815181106144e257fe5b60200260200101515b9050858713156144f9579495945b83851315614505579293925b81831315614511579091905b8487131561451d579395935b83861315614529579294925b8083131561453357915b8486131561453f579394935b8082131561454957905b82871315614555579195915b81861315614561579094905b8085131561456b57935b82861315614577579194915b8084131561458157925b8285131561458d579193915b81841315614599579092905b828413156145a5579192915b8d8c03806145b557879a5061465b565b80600114156145c657869a5061465b565b80600214156145d757859a5061465b565b80600314156145e857849a5061465b565b80600414156145f957839a5061465b565b806005141561460a57829a5061465b565b806006141561461b57819a5061465b565b6040805162461bcd60e51b815260206004820152601060248201526f6b31206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b8e8c038d8d141561467957508a995061429698505050505050505050565b806146905750969850614296975050505050505050565b80600114156146ab5750959850614296975050505050505050565b80600214156146c65750949850614296975050505050505050565b80600314156146e15750939850614296975050505050505050565b80600414156146fc5750929850614296975050505050505050565b80600514156147175750919850614296975050505050505050565b80600614156147325750909850614296975050505050505050565b6040805162461bcd60e51b815260206004820152601060248201526f6b32206f7574206f6620626f756e647360801b604482015290519081900360640190fd5b600080846002858501048151811061478657fe5b602002602001015190506001840393506001830192505b600184019350808585815181106147b057fe5b60200260200101511261479d575b600183039250808584815181106147d157fe5b6020026020010151136147be5782841015614841578483815181106147f257fe5b602002602001015185858151811061480657fe5b602002602001015186868151811061481a57fe5b6020026020010187868151811061482d57fe5b60209081029190910101919091525261484a565b82915050614051565b61479d565b60008282018183128015906148645750838112155b80614879575060008312801561487957508381125b611aa95760405162461bcd60e51b81526004018080602001828103825260218152602001806149a46021913960400191505060405180910390fd5b604080518082019091526000808252602082015290565b5080546000825590600052602060002090810190611e019190614989565b60408051608081018252600080825260208201819052918101829052606081019190915290565b6040805160a08101825260608082526000602083018190529282018390528101829052608081019190915290565b828054828255906000526020600020908101928215614979579160200282015b8281111561497957825182559160200191906001019061495e565b50614985929150614989565b5090565b61170f91905b80821115614985576000815560010161498f56fe5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f77536166654d6174683a206164646974696f6e206f766572666c6f770000000000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f6e6c792063616c6c61626c65206279206f776e657200000000000000000000a2646970667358221220adbe637a18154d5b9bb2754ed3c4577d8d26d4f0111ea8aa5549703dec6e796e64736f6c63430006050033536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77'; -export const AccessControlledAggregatorABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_link', - type: 'address', - }, - { - internalType: 'uint128', - name: '_paymentAmount', - type: 'uint128', - }, - { - internalType: 'uint32', - name: '_timeout', - type: 'uint32', - }, - { - internalType: 'address', - name: '_validator', - type: 'address', - }, - { - internalType: 'int256', - name: '_minSubmissionValue', - type: 'int256', - }, - { - internalType: 'int256', - name: '_maxSubmissionValue', - type: 'int256', - }, - { - internalType: 'uint8', - name: '_decimals', - type: 'uint8', - }, - { - internalType: 'string', - name: '_description', - type: 'string', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'AddedAccess', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'int256', - name: 'current', - type: 'int256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - ], - name: 'AnswerUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'AvailableFundsUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [], - name: 'CheckAccessDisabled', - type: 'event', - }, - { - anonymous: false, - inputs: [], - name: 'CheckAccessEnabled', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256', - }, - { - indexed: true, - internalType: 'address', - name: 'startedBy', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - ], - name: 'NewRound', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'admin', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'newAdmin', - type: 'address', - }, - ], - name: 'OracleAdminUpdateRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newAdmin', - type: 'address', - }, - ], - name: 'OracleAdminUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - { - indexed: true, - internalType: 'bool', - name: 'whitelisted', - type: 'bool', - }, - ], - name: 'OraclePermissionsUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'RemovedAccess', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'requester', - type: 'address', - }, - { - indexed: false, - internalType: 'bool', - name: 'authorized', - type: 'bool', - }, - { - indexed: false, - internalType: 'uint32', - name: 'delay', - type: 'uint32', - }, - ], - name: 'RequesterPermissionsSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint128', - name: 'paymentAmount', - type: 'uint128', - }, - { - indexed: true, - internalType: 'uint32', - name: 'minSubmissionCount', - type: 'uint32', - }, - { - indexed: true, - internalType: 'uint32', - name: 'maxSubmissionCount', - type: 'uint32', - }, - { - indexed: false, - internalType: 'uint32', - name: 'restartDelay', - type: 'uint32', - }, - { - indexed: false, - internalType: 'uint32', - name: 'timeout', - type: 'uint32', - }, - ], - name: 'RoundDetailsUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'int256', - name: 'submission', - type: 'int256', - }, - { - indexed: true, - internalType: 'uint32', - name: 'round', - type: 'uint32', - }, - { - indexed: true, - internalType: 'address', - name: 'oracle', - type: 'address', - }, - ], - name: 'SubmissionReceived', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previous', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'current', - type: 'address', - }, - ], - name: 'ValidatorUpdated', - type: 'event', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - ], - name: 'acceptAdmin', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_user', - type: 'address', - }, - ], - name: 'addAccess', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'allocatedFunds', - outputs: [ - { - internalType: 'uint128', - name: '', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'availableFunds', - outputs: [ - { - internalType: 'uint128', - name: '', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address[]', - name: '_removed', - type: 'address[]', - }, - { - internalType: 'address[]', - name: '_added', - type: 'address[]', - }, - { - internalType: 'address[]', - name: '_addedAdmins', - type: 'address[]', - }, - { - internalType: 'uint32', - name: '_minSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_maxSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_restartDelay', - type: 'uint32', - }, - ], - name: 'changeOracles', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'checkEnabled', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'description', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'disableAccessCheck', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'enableAccessCheck', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - ], - name: 'getAdmin', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - ], - name: 'getAnswer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getOracles', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - ], - name: 'getRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - ], - name: 'getTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_user', - type: 'address', - }, - { - internalType: 'bytes', - name: '_calldata', - type: 'bytes', - }, - ], - name: 'hasAccess', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestAnswer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRound', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'linkToken', - outputs: [ - { - internalType: 'contract LinkTokenInterface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'maxSubmissionCount', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'maxSubmissionValue', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'minSubmissionCount', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'minSubmissionValue', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'bytes', - name: '_data', - type: 'bytes', - }, - ], - name: 'onTokenTransfer', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'oracleCount', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'uint32', - name: '_queriedRoundId', - type: 'uint32', - }, - ], - name: 'oracleRoundState', - outputs: [ - { - internalType: 'bool', - name: '_eligibleToSubmit', - type: 'bool', - }, - { - internalType: 'uint32', - name: '_roundId', - type: 'uint32', - }, - { - internalType: 'int256', - name: '_latestSubmission', - type: 'int256', - }, - { - internalType: 'uint64', - name: '_startedAt', - type: 'uint64', - }, - { - internalType: 'uint64', - name: '_timeout', - type: 'uint64', - }, - { - internalType: 'uint128', - name: '_availableFunds', - type: 'uint128', - }, - { - internalType: 'uint8', - name: '_oracleCount', - type: 'uint8', - }, - { - internalType: 'uint128', - name: '_paymentAmount', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'paymentAmount', - outputs: [ - { - internalType: 'uint128', - name: '', - type: 'uint128', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_user', - type: 'address', - }, - ], - name: 'removeAccess', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'requestNewRound', - outputs: [ - { - internalType: 'uint80', - name: '', - type: 'uint80', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'restartDelay', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_requester', - type: 'address', - }, - { - internalType: 'bool', - name: '_authorized', - type: 'bool', - }, - { - internalType: 'uint32', - name: '_delay', - type: 'uint32', - }, - ], - name: 'setRequesterPermissions', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_newValidator', - type: 'address', - }, - ], - name: 'setValidator', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - { - internalType: 'int256', - name: '_submission', - type: 'int256', - }, - ], - name: 'submit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'timeout', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'address', - name: '_newAdmin', - type: 'address', - }, - ], - name: 'transferAdmin', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_to', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'updateAvailableFunds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint128', - name: '_paymentAmount', - type: 'uint128', - }, - { - internalType: 'uint32', - name: '_minSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_maxSubmissions', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_restartDelay', - type: 'uint32', - }, - { - internalType: 'uint32', - name: '_timeout', - type: 'uint32', - }, - ], - name: 'updateFutureRounds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'validator', - outputs: [ - { - internalType: 'contract AggregatorValidatorInterface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'version', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: '_amount', - type: 'uint256', - }, - ], - name: 'withdrawFunds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'address', - name: '_recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: '_amount', - type: 'uint256', - }, - ], - name: 'withdrawPayment', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - ], - name: 'withdrawablePayment', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -export const EACAggregatorProxyByteCode = '0x608060405234801561001057600080fd5b5060405162001d0638038062001d068339818101604052604081101561003557600080fd5b508051602090910151600080546001600160a01b0319163317905581610063816001600160e01b0361007d16565b50610076816001600160e01b036100ec16565b505061016d565b60028054604080518082018252600161ffff80851691909101168082526001600160a01b0395909516602091820181905261ffff19909316851762010000600160b01b0319166201000084021790935560009384526004909252912080546001600160a01b0319169091179055565b6000546001600160a01b0316331461014b576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611b89806200017d6000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80638f6b4d91116100c3578063bc43cbaf1161007c578063bc43cbaf1461038a578063c159730414610392578063e8c4be30146103b3578063f2fde38b146103bb578063f8a2abd3146103e1578063feaf968c146104075761014d565b80638f6b4d91146102d657806392eefe9b146102de5780639a6fc8f514610304578063a928c0961461032a578063b5ab58dc14610350578063b633620c1461036d5761014d565b80636001ac53116101155780636001ac53146101d5578063668a0f02146102375780637284e4161461023f57806379ba5097146102bc5780638205bf6a146102c65780638da5cb5b146102ce5761014d565b8063245a7bfc14610152578063313ce5671461017657806350d25bcd1461019457806354fd4d50146101ae57806358303b10146101b6575b600080fd5b61015a61040f565b604080516001600160a01b039092168252519081900360200190f35b61017e610424565b6040805160ff9092168252519081900360200190f35b61019c6104a8565b60408051918252519081900360200190f35b61019c6105b0565b6101be610603565b6040805161ffff9092168252519081900360200190f35b6101fb600480360360208110156101eb57600080fd5b50356001600160501b031661060d565b604080516001600160501b0396871681526020810195909552848101939093526060840191909152909216608082015290519081900360a00190f35b61019c610776565b610247610878565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610281578181015183820152602001610269565b50505050905090810190601f1680156102ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c46109bd565b005b61019c610a6c565b61015a610b6e565b6101fb610b7d565b6102c4600480360360208110156102f457600080fd5b50356001600160a01b0316610ce4565b6101fb6004803603602081101561031a57600080fd5b50356001600160501b0316610d5e565b6102c46004803603602081101561034057600080fd5b50356001600160a01b0316610e69565b61019c6004803603602081101561036657600080fd5b5035610f3f565b61019c6004803603602081101561038357600080fd5b5035611049565b61015a61114c565b61015a600480360360208110156103a857600080fd5b503561ffff1661115b565b61015a611176565b6102c4600480360360208110156103d157600080fd5b50356001600160a01b0316611185565b6102c4600480360360208110156103f757600080fd5b50356001600160a01b031661122e565b6101fb6112a8565b6002546201000090046001600160a01b031690565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b505afa15801561048b573d6000803e3d6000fd5b505050506040513d60208110156104a157600080fd5b5051905090565b6005546000906001600160a01b0316801580610565575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561053857600080fd5b505afa15801561054c573d6000803e3d6000fd5b505050506040513d602081101561056257600080fd5b50515b6105a2576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105aa6113b2565b91505090565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b60025461ffff1690565b60055460009081908190819081906001600160a01b03168015806106d2575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b1580156106a557600080fd5b505afa1580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b50515b61070f576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6003546001600160a01b031661075a576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b61076387611405565b939b929a50909850965090945092505050565b6005546000906001600160a01b0316801580610833575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561080657600080fd5b505afa15801561081a573d6000803e3d6000fd5b505050506040513d602081101561083057600080fd5b50515b610870576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105aa611502565b6060600260000160029054906101000a90046001600160a01b03166001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b1580156108cb57600080fd5b505afa1580156108df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561090857600080fd5b810190808051604051939291908464010000000082111561092857600080fd5b90830190602082018581111561093d57600080fd5b825164010000000081118282018810171561095757600080fd5b82525081516020918201929091019080838360005b8381101561098457818101518382015260200161096c565b50505050905090810190601f1680156109b15780820380516001836020036101000a031916815260200191505b50604052505050905090565b6001546001600160a01b03163314610a15576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6005546000906001600160a01b0316801580610b29575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610afc57600080fd5b505afa158015610b10573d6000803e3d6000fd5b505050506040513d6020811015610b2657600080fd5b50515b610b66576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105aa6115b0565b6000546001600160a01b031681565b60055460009081908190819081906001600160a01b0316801580610c42575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610c1557600080fd5b505afa158015610c29573d6000803e3d6000fd5b505050506040513d6020811015610c3f57600080fd5b50515b610c7f576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6003546001600160a01b0316610cca576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b610cd2611603565b95509550955095509550509091929394565b6000546001600160a01b03163314610d3c576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60055460009081908190819081906001600160a01b0316801580610e23575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610df657600080fd5b505afa158015610e0a573d6000803e3d6000fd5b505050506040513d6020811015610e2057600080fd5b50515b610e60576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610763876116f9565b6000546001600160a01b03163314610ec1576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6003546001600160a01b03828116911614610f23576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c69642070726f706f7365642061676772656761746f720000000000604482015290519081900360640190fd5b600380546001600160a01b0319169055610f3c816117f5565b50565b6005546000906001600160a01b0316801580610ffc575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610fcf57600080fd5b505afa158015610fe3573d6000803e3d6000fd5b505050506040513d6020811015610ff957600080fd5b50515b611039576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61104283611864565b9392505050565b6005546000906001600160a01b0316801580611106575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b1580156110d957600080fd5b505afa1580156110ed573d6000803e3d6000fd5b505050506040513d602081101561110357600080fd5b50515b611143576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61104283611941565b6005546001600160a01b031681565b6004602052600090815260409020546001600160a01b031681565b6003546001600160a01b031681565b6000546001600160a01b031633146111dd576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6000546001600160a01b03163314611286576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60055460009081908190819081906001600160a01b031680158061136d575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561134057600080fd5b505afa158015611354573d6000803e3d6000fd5b505050506040513d602081101561136a57600080fd5b50515b6113aa576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610cd26119e7565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b60035460009081908190819081906001600160a01b031661145b576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b60035460408051639a6fc8f560e01b81526001600160501b038916600482015290516001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b1580156114af57600080fd5b505afa1580156114c3573d6000803e3d6000fd5b505050506040513d60a08110156114d957600080fd5b508051602082015160408301516060840151608090940151929a91995097509195509350915050565b600061150c611b1c565b5060408051808201825260025461ffff8116808352620100009091046001600160a01b031660208084018290528451633345078160e11b8152945193946115a19463668a0f0292600480840193919291829003018186803b15801561157057600080fd5b505afa158015611584573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b5051611abe565b6001600160501b031691505090565b6000600260000160029054906101000a90046001600160a01b03166001600160a01b0316638205bf6a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561047757600080fd5b60035460009081908190819081906001600160a01b0316611659576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b34833981519152604482015290519081900360640190fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156116a757600080fd5b505afa1580156116bb573d6000803e3d6000fd5b505050506040513d60a08110156116d157600080fd5b5080516020820151604083015160608401516080909401519299919850965091945092509050565b6000806000806000806000611716886001600160501b0316611ade565b61ffff8216600090815260046020819052604091829020548251639a6fc8f560e01b815267ffffffffffffffff85169281019290925291519395509193506001600160a01b031691639a6fc8f59160248082019260a092909190829003018186803b15801561178457600080fd5b505afa158015611798573d6000803e3d6000fd5b505050506040513d60a08110156117ae57600080fd5b508051602082015160408301516060840151608090940151929a50909850965090945092506117e1878787878787611ae6565b939c929b5090995097509095509350505050565b60028054604080518082018252600161ffff80851691909101168082526001600160a01b0395909516602091820181905261ffff19909316851762010000600160b01b0319166201000084021790935560009384526004909252912080546001600160a01b0319169091179055565b60006001600160501b0382111561187d5750600061193c565b60008061188984611ade565b61ffff821660009081526004602052604090205491935091506001600160a01b0316806118bc576000935050505061193c565b806001600160a01b031663b5ab58dc836040518263ffffffff1660e01b8152600401808267ffffffffffffffff16815260200191505060206040518083038186803b15801561190a57600080fd5b505afa15801561191e573d6000803e3d6000fd5b505050506040513d602081101561193457600080fd5b505193505050505b919050565b60006001600160501b0382111561195a5750600061193c565b60008061196684611ade565b61ffff821660009081526004602052604090205491935091506001600160a01b031680611999576000935050505061193c565b806001600160a01b031663b633620c836040518263ffffffff1660e01b8152600401808267ffffffffffffffff16815260200191505060206040518083038186803b15801561190a57600080fd5b60008060008060006119f7611b1c565b5060408051808201825260025461ffff811682526201000090046001600160a01b0316602082018190528251633fabe5a360e21b815292519192909163feaf968c9160048082019260a092909190829003018186803b158015611a5957600080fd5b505afa158015611a6d573d6000803e3d6000fd5b505050506040513d60a0811015611a8357600080fd5b5080516020820151604083015160608401516080909401518551939a509198509650919450909250610cd29087908790879087908790611ae6565b67ffffffffffffffff1660409190911b69ffff0000000000000000161790565b604081901c91565b6000806000806000611af8868c611abe565b8a8a8a611b058a8c611abe565b939f929e50909c509a509098509650505050505050565b60408051808201909152600080825260208201529056fe4e6f2070726f706f7365642061676772656761746f722070726573656e740000a2646970667358221220660c1d21c40a09a3e59afd423b6352da87c5862bdce313c2da1d582fcd2655fa64736f6c63430006050033'; -export const EACAggregatorProxyABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_aggregator', - type: 'address', - }, - { - internalType: 'address', - name: '_accessController', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'int256', - name: 'current', - type: 'int256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - ], - name: 'AnswerUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256', - }, - { - indexed: true, - internalType: 'address', - name: 'startedBy', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - ], - name: 'NewRound', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'accessController', - outputs: [ - { - internalType: 'contract AccessControllerInterface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'aggregator', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_aggregator', - type: 'address', - }, - ], - name: 'confirmAggregator', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'description', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - ], - name: 'getAnswer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - ], - name: 'getRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - ], - name: 'getTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestAnswer', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRound', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'latestTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint16', - name: '', - type: 'uint16', - }, - ], - name: 'phaseAggregators', - outputs: [ - { - internalType: 'contract AggregatorV2V3Interface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'phaseId', - outputs: [ - { - internalType: 'uint16', - name: '', - type: 'uint16', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_aggregator', - type: 'address', - }, - ], - name: 'proposeAggregator', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'proposedAggregator', - outputs: [ - { - internalType: 'contract AggregatorV2V3Interface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint80', - name: '_roundId', - type: 'uint80', - }, - ], - name: 'proposedGetRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'proposedLatestRoundData', - outputs: [ - { - internalType: 'uint80', - name: 'roundId', - type: 'uint80', - }, - { - internalType: 'int256', - name: 'answer', - type: 'int256', - }, - { - internalType: 'uint256', - name: 'startedAt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'updatedAt', - type: 'uint256', - }, - { - internalType: 'uint80', - name: 'answeredInRound', - type: 'uint80', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_accessController', - type: 'address', - }, - ], - name: 'setController', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_to', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'version', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -export const WriteAccessControllerByteCode = '0x608060405234801561001057600080fd5b50600080546001600160a01b031916331790556001805460ff60a01b1916600160a01b1790556106ee806100456000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638823da6c116100665780638823da6c1461017c5780638da5cb5b146101a2578063a118f249146101c6578063dc7f0124146101ec578063f2fde38b146101f457610093565b80630a756983146100985780636b14daf8146100a257806379ba50971461016c5780638038e4a114610174575b600080fd5b6100a061021a565b005b610158600480360360408110156100b857600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100e357600080fd5b8201836020820111156100f557600080fd5b8035906020019184600183028401116401000000008311171561011757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102bd945050505050565b604080519115158252519081900360200190f35b6100a06102f5565b6100a06103a4565b6100a06004803603602081101561019257600080fd5b50356001600160a01b031661044b565b6101aa61051d565b604080516001600160a01b039092168252519081900360200190f35b6100a0600480360360208110156101dc57600080fd5b50356001600160a01b031661052c565b6101586105ff565b6100a06004803603602081101561020a57600080fd5b50356001600160a01b031661060f565b6000546001600160a01b03163314610272576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600154600160a01b900460ff16156102bb576001805460ff60a01b191690556040517f3be8a977a014527b50ae38adda80b56911c267328965c98ddc385d248f53963890600090a15b565b6001600160a01b03821660009081526002602052604081205460ff16806102ee5750600154600160a01b900460ff16155b9392505050565b6001546001600160a01b0316331461034d576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6000546001600160a01b031633146103fc576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600154600160a01b900460ff166102bb576001805460ff60a01b1916600160a01b1790556040517faebf329500988c6488a0074e5a0a9ff304561fc5c6fc877aeb1d59c8282c348090600090a1565b6000546001600160a01b031633146104a3576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161561051a576001600160a01b038116600081815260026020908152604091829020805460ff19169055815192835290517f3d68a6fce901d20453d1a7aa06bf3950302a735948037deb182a8db66df2a0d19281900390910190a15b50565b6000546001600160a01b031681565b6000546001600160a01b03163314610584576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff1661051a576001600160a01b038116600081815260026020908152604091829020805460ff19166001179055815192835290517f87286ad1f399c8e82bf0c4ef4fcdc570ea2e1e92176e5c848b6413545b885db49281900390910190a150565b600154600160a01b900460ff1681565b6000546001600160a01b03163314610667576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a35056fea264697066735822122059998b07b9fd02348799dd40e9f8ee7cb93de830b92715d68b41e1993b35698664736f6c63430006050033'; -export const WriteAccessControllerABI = [{ inputs: [], stateMutability: 'nonpayable', type: 'constructor' }, { - anonymous: false, - inputs: [{ - indexed: false, internalType: 'address', name: 'user', type: 'address', - }], - name: 'AddedAccess', - type: 'event', -}, { - anonymous: false, inputs: [], name: 'CheckAccessDisabled', type: 'event', -}, { - anonymous: false, inputs: [], name: 'CheckAccessEnabled', type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'from', type: 'address', - }, { - indexed: true, internalType: 'address', name: 'to', type: 'address', - }], - name: 'OwnershipTransferRequested', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'from', type: 'address', - }, { - indexed: true, internalType: 'address', name: 'to', type: 'address', - }], - name: 'OwnershipTransferred', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: false, internalType: 'address', name: 'user', type: 'address', - }], - name: 'RemovedAccess', - type: 'event', -}, { - inputs: [], name: 'acceptOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_user', type: 'address' }], - name: 'addAccess', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [], - name: 'checkEnabled', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [], name: 'disableAccessCheck', outputs: [], stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [], name: 'enableAccessCheck', outputs: [], stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_user', type: 'address' }, { internalType: 'bytes', name: '', type: 'bytes' }], - name: 'hasAccess', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [], - name: 'owner', - outputs: [{ internalType: 'address', name: '', type: 'address' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_user', type: 'address' }], - name: 'removeAccess', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_to', type: 'address' }], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}]; - -export const FlagsByteCode = '0x608060405234801561001057600080fd5b506040516110833803806110838339818101604052602081101561003357600080fd5b5051600080546001600160a01b031916331790556001805460ff60a01b1916600160a01b17905561006c816001600160e01b0361007216565b5061013a565b6000546001600160a01b031633146100d1576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6003546001600160a01b03908116908216811461013657600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fbaf9ea078655a4fffefd08f9435677bbc91e457a6d015fe7de1d0e68b8802cac90600090a35b5050565b610f3a806101496000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80637d723cac11610097578063a118f24911610066578063a118f2491461041f578063d74af26314610445578063dc7f01241461046b578063f2fde38b1461047357610100565b80637d723cac1461032b5780638038e4a1146103e95780638823da6c146103f15780638da5cb5b1461041757610100565b8063517e89fe116100d3578063517e89fe146101db5780636b14daf814610201578063760bc82d146102b557806379ba50971461032357610100565b80630a75698314610105578063282865961461010f5780632e1d859c1461017d578063357e47fe146101a1575b600080fd5b61010d610499565b005b61010d6004803603602081101561012557600080fd5b810190602081018135600160201b81111561013f57600080fd5b82018360208201111561015157600080fd5b803590602001918460208302840111600160201b8311171561017257600080fd5b509092509050610531565b61018561061b565b604080516001600160a01b039092168252519081900360200190f35b6101c7600480360360208110156101b757600080fd5b50356001600160a01b031661062a565b604080519115158252519081900360200190f35b61010d600480360360208110156101f157600080fd5b50356001600160a01b03166106c9565b6101c76004803603604081101561021757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561024157600080fd5b82018360208201111561025357600080fd5b803590602001918460018302840111600160201b8311171561027457600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061077f945050505050565b61010d600480360360208110156102cb57600080fd5b810190602081018135600160201b8111156102e557600080fd5b8201836020820111156102f757600080fd5b803590602001918460208302840111600160201b8311171561031857600080fd5b5090925090506107a5565b61010d610835565b6103996004803603602081101561034157600080fd5b810190602081018135600160201b81111561035b57600080fd5b82018360208201111561036d57600080fd5b803590602001918460208302840111600160201b8311171561038e57600080fd5b5090925090506108e4565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103d55781810151838201526020016103bd565b505050509050019250505060405180910390f35b61010d610a2f565b61010d6004803603602081101561040757600080fd5b50356001600160a01b0316610acb565b610185610b92565b61010d6004803603602081101561043557600080fd5b50356001600160a01b0316610ba1565b61010d6004803603602081101561045b57600080fd5b50356001600160a01b0316610c69565b6101c7610ccb565b61010d6004803603602081101561048957600080fd5b50356001600160a01b0316610cdb565b6000546001600160a01b031633146104e6576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b600154600160a01b900460ff161561052f576001805460ff60a01b191690556040517f3be8a977a014527b50ae38adda80b56911c267328965c98ddc385d248f53963890600090a15b565b6000546001600160a01b0316331461057e576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b60005b8181101561061657600083838381811061059757fe5b602090810292909201356001600160a01b0316600081815260049093526040909220549192505060ff161561060d576001600160a01b038116600081815260046020526040808220805460ff19169055517fd86728e2e5cbaa28c1d357b5fbccc9c1ab0add09950eb7cac42df9acb24c4bc89190a25b50600101610581565b505050565b6003546001600160a01b031681565b600061066d336000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061077f92505050565b6106aa576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b506001600160a01b031660009081526004602052604090205460ff1690565b6000546001600160a01b03163314610716576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b6003546001600160a01b03908116908216811461077b57600380546001600160a01b0319166001600160a01b0384811691821790925560405190918316907fbaf9ea078655a4fffefd08f9435677bbc91e457a6d015fe7de1d0e68b8802cac90600090a35b5050565b600061078b8383610d79565b8061079e57506001600160a01b03831632145b9392505050565b6107ad610db0565b6107fe576040805162461bcd60e51b815260206004820152601a60248201527f4e6f7420616c6c6f77656420746f20726169736520666c616773000000000000604482015290519081900360640190fd5b60005b818110156106165761082d83838381811061081857fe5b905060200201356001600160a01b0316610e78565b600101610801565b6001546001600160a01b0316331461088d576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6060610927336000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061077f92505050565b610964576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b60608267ffffffffffffffff8111801561097d57600080fd5b506040519080825280602002602001820160405280156109a7578160200160208202803683370190505b50905060005b83811015610a2757600460008686848181106109c557fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff16828281518110610a0f57fe5b911515602092830291909101909101526001016109ad565b509392505050565b6000546001600160a01b03163314610a7c576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b600154600160a01b900460ff1661052f576001805460ff60a01b1916600160a01b1790556040517faebf329500988c6488a0074e5a0a9ff304561fc5c6fc877aeb1d59c8282c348090600090a1565b6000546001600160a01b03163314610b18576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff1615610b8f576001600160a01b038116600081815260026020908152604091829020805460ff19169055815192835290517f3d68a6fce901d20453d1a7aa06bf3950302a735948037deb182a8db66df2a0d19281900390910190a15b50565b6000546001600160a01b031681565b6000546001600160a01b03163314610bee576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16610b8f576001600160a01b038116600081815260026020908152604091829020805460ff19166001179055815192835290517f87286ad1f399c8e82bf0c4ef4fcdc570ea2e1e92176e5c848b6413545b885db49281900390910190a150565b610c71610db0565b610cc2576040805162461bcd60e51b815260206004820152601a60248201527f4e6f7420616c6c6f77656420746f20726169736520666c616773000000000000604482015290519081900360640190fd5b610b8f81610e78565b600154600160a01b900460ff1681565b6000546001600160a01b03163314610d28576040805162461bcd60e51b81526020600482015260166024820152600080516020610ee5833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6001600160a01b03821660009081526002602052604081205460ff168061079e575050600154600160a01b900460ff161592915050565b600080546001600160a01b0316331480610e73575060035460408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b0390951694636b14daf894929360009391929190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610e4657600080fd5b505afa158015610e5a573d6000803e3d6000fd5b505050506040513d6020811015610e7057600080fd5b50515b905090565b6001600160a01b03811660009081526004602052604090205460ff16610b8f576001600160a01b038116600081815260046020526040808220805460ff19166001179055517f881febd4cd194dd4ace637642862aef1fb59a65c7e5551a5d9208f268d11c0069190a25056fe4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000a2646970667358221220c8c9690e43178ab9f5c0b8787595506fa81d810eae23e7476ac23fa3e268d98e64736f6c63430006050033'; -export const FlagsABI = [{ - inputs: [{ internalType: 'address', name: 'racAddress', type: 'address' }], - stateMutability: 'nonpayable', - type: 'constructor', -}, { - anonymous: false, - inputs: [{ - indexed: false, internalType: 'address', name: 'user', type: 'address', - }], - name: 'AddedAccess', - type: 'event', -}, { - anonymous: false, inputs: [], name: 'CheckAccessDisabled', type: 'event', -}, { - anonymous: false, inputs: [], name: 'CheckAccessEnabled', type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'subject', type: 'address', - }], - name: 'FlagLowered', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'subject', type: 'address', - }], - name: 'FlagRaised', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'from', type: 'address', - }, { - indexed: true, internalType: 'address', name: 'to', type: 'address', - }], - name: 'OwnershipTransferRequested', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'from', type: 'address', - }, { - indexed: true, internalType: 'address', name: 'to', type: 'address', - }], - name: 'OwnershipTransferred', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: true, internalType: 'address', name: 'previous', type: 'address', - }, { - indexed: true, internalType: 'address', name: 'current', type: 'address', - }], - name: 'RaisingAccessControllerUpdated', - type: 'event', -}, { - anonymous: false, - inputs: [{ - indexed: false, internalType: 'address', name: 'user', type: 'address', - }], - name: 'RemovedAccess', - type: 'event', -}, { - inputs: [], name: 'acceptOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_user', type: 'address' }], - name: 'addAccess', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [], - name: 'checkEnabled', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [], name: 'disableAccessCheck', outputs: [], stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [], name: 'enableAccessCheck', outputs: [], stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [{ internalType: 'address', name: 'subject', type: 'address' }], - name: 'getFlag', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [{ internalType: 'address[]', name: 'subjects', type: 'address[]' }], - name: 'getFlags', - outputs: [{ internalType: 'bool[]', name: '', type: 'bool[]' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_user', type: 'address' }, { - internalType: 'bytes', - name: '_calldata', - type: 'bytes', - }], - name: 'hasAccess', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [{ internalType: 'address[]', name: 'subjects', type: 'address[]' }], - name: 'lowerFlags', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [], - name: 'owner', - outputs: [{ internalType: 'address', name: '', type: 'address' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: 'subject', type: 'address' }], - name: 'raiseFlag', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [{ internalType: 'address[]', name: 'subjects', type: 'address[]' }], - name: 'raiseFlags', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [], - name: 'raisingAccessController', - outputs: [{ internalType: 'contract AccessControllerInterface', name: '', type: 'address' }], - stateMutability: 'view', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_user', type: 'address' }], - name: 'removeAccess', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: 'racAddress', type: 'address' }], - name: 'setRaisingAccessController', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}, { - inputs: [{ internalType: 'address', name: '_to', type: 'address' }], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', -}]; - -export const DeviationFlaggingValidatorByteCode = '0x608060405234801561001057600080fd5b506040516109be3803806109be8339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b03191633179055610060826001600160e01b0361007916565b610072816001600160e01b0361014116565b5050610215565b6000546001600160a01b031633146100d8576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b6002546001600160a01b03908116908216811461013d57600280546001600160a01b0319166001600160a01b0384811691821790925560405190918316907f900aa01828592ab069e4d44e7a36c70ebd476e35f567c7db6a691e503b8029d890600090a35b5050565b6000546001600160a01b031633146101a0576040805162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b600154600160a01b900463ffffffff81169062ffffff83811691161461013d576001805463ffffffff60a01b191662ffffff848116600160a01b81029290921790925560405190918316907f985b87e809fd5992ec257eac36f25777ce308055dd9249a0182123d7b5d6633a90600090a35050565b61079a806102246000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063eed8a1de11610066578063eed8a1de1461013d578063f19876951461015f578063f2c0ea9214610185578063f2fde38b1461018d578063ffd93670146101b35761009e565b80630910ce4a146100a357806364cc4aa5146100c457806379ba5097146100e85780638da5cb5b146100f2578063beed9b51146100fa575b600080fd5b6100ab6101e2565b6040805163ffffffff9092168252519081900360200190f35b6100cc6101f5565b604080516001600160a01b039092168252519081900360200190f35b6100f0610204565b005b6100cc6102b3565b6101296004803603608081101561011057600080fd5b50803590602081013590604081013590606001356102c2565b604080519115158252519081900360200190f35b6100f06004803603602081101561015357600080fd5b503562ffffff1661034d565b6100f06004803603602081101561017557600080fd5b50356001600160a01b031661041b565b6100ab6104db565b6100f0600480360360208110156101a357600080fd5b50356001600160a01b03166104e2565b610129600480360360808110156101c957600080fd5b508035906020810135906040810135906060013561058b565b600154600160a01b900463ffffffff1681565b6002546001600160a01b031681565b6001546001600160a01b0316331461025c576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6000546001600160a01b031681565b60006102d08585858561058b565b610341576002546040805163d74af26360e01b815233600482015290516001600160a01b039092169163d74af2639160248082019260009290919082900301818387803b15801561032057600080fd5b505af1158015610334573d6000803e3d6000fd5b5050505060009050610345565b5060015b949350505050565b6000546001600160a01b031633146103a5576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600154600160a01b900463ffffffff81169062ffffff838116911614610417576001805463ffffffff60a01b191662ffffff848116600160a01b81029290921790925560405190918316907f985b87e809fd5992ec257eac36f25777ce308055dd9249a0182123d7b5d6633a90600090a35b5050565b6000546001600160a01b03163314610473576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b6002546001600160a01b03908116908216811461041757600280546001600160a01b0319166001600160a01b0384811691821790925560405190918316907f900aa01828592ab069e4d44e7a36c70ebd476e35f567c7db6a691e503b8029d890600090a35050565b620186a081565b6000546001600160a01b0316331461053a576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60008361059a57506001610345565b6000806105ad868563ffffffff61063616565b90925090506000806105c284620186a0610681565b90925090506000806105da848b63ffffffff6106d916565b915091506000806105ea84610728565b915091508680156105f85750845b80156106015750825b801561060a5750805b80156106255750600154600160a01b900463ffffffff168211155b9d9c50505050505050505050505050565b600080828403818412801561064b5750848113155b8061066157506000841215801561066157508481135b1561067357506000915081905061067a565b9150600190505b9250929050565b60008083610695575060009050600161067a565b836000191480156106a95750600160ff1b83145b156106b95750600090508061067a565b838302838582816106c657fe5b051461067357506000915081905061067a565b600080826106ec5750600090508061067a565b826000191480156107005750600160ff1b84145b156107105750600090508061067a565b600083858161071b57fe5b0595600195509350505050565b6000806000831261073e5750819050600161075f565b600160ff1b8314156107555750600090508061075f565b5050600081900360015b91509156fea2646970667358221220638e67a73b124d57864726f9c892db65957043b890b8cc7b1ec604abde16d29064736f6c63430006050033'; -export const DeviationFlaggingValidatorABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_flags', - type: 'address', - }, - { - internalType: 'uint24', - name: '_flaggingThreshold', - type: 'uint24', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint24', - name: 'previous', - type: 'uint24', - }, - { - indexed: true, - internalType: 'uint24', - name: 'current', - type: 'uint24', - }, - ], - name: 'FlaggingThresholdUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previous', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'current', - type: 'address', - }, - ], - name: 'FlagsAddressUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - inputs: [], - name: 'THRESHOLD_MULTIPLIER', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'flaggingThreshold', - outputs: [ - { - internalType: 'uint32', - name: '', - type: 'uint32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'flags', - outputs: [ - { - internalType: 'contract FlagsInterface', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'int256', - name: '_previousAnswer', - type: 'int256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'int256', - name: '_answer', - type: 'int256', - }, - ], - name: 'isValid', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint24', - name: '_flaggingThreshold', - type: 'uint24', - }, - ], - name: 'setFlaggingThreshold', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_flags', - type: 'address', - }, - ], - name: 'setFlagsAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_to', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_previousRoundId', - type: 'uint256', - }, - { - internalType: 'int256', - name: '_previousAnswer', - type: 'int256', - }, - { - internalType: 'uint256', - name: '_roundId', - type: 'uint256', - }, - { - internalType: 'int256', - name: '_answer', - type: 'int256', - }, - ], - name: 'validate', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -export const PriceQueryBytecode = '0x6080604052600160045534801561001557600080fd5b50604051610f83380380610f838339818101604052606081101561003857600080fd5b508051602082015160409092015190919061005b836001600160e01b0361007816565b61006d826001600160e01b0361009a16565b600655506100bc9050565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b610eb8806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80635591a6081161005b5780635591a608146100f05780638dc654a2146101385780639d1b464a14610140578063e8d5359d1461015a5761007d565b8063042f2b651461008257806339a287d6146100a757806350f65a30146100d3575b600080fd5b6100a56004803603604081101561009857600080fd5b5080359060200135610186565b005b6100a5600480360360408110156100bd57600080fd5b50803590602001356001600160a01b0316610254565b6100a5600480360360208110156100e957600080fd5b503561035d565b6100a5600480360360a081101561010657600080fd5b506001600160a01b03813516906020810135906040810135906001600160e01b0319606082013516906080013561036a565b6100a56103f3565b61014861053d565b60408051918252519081900360200190f35b6100a56004803603604081101561017057600080fd5b506001600160a01b038135169060200135610543565b60008281526005602052604090205482906001600160a01b031633146101dd5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e5b6028913960400191505060405180910390fd5b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a2604051829084907f0c2366233f634048c0f0458060d1228fab36d00f7c0ecf6bdf2d9c458503631190600090a35060075550565b61025c610da8565b600654610271908363042f2b6560e01b610551565b90506102b96040518060400160405280600381526020016219d95d60ea1b815250604051806060016040528060408152602001610e1b6040913983919063ffffffff61057c16565b604080516001808252818301909252606091816020015b60608152602001906001900390816102d0579050509050604051806040016040528060038152602001621554d160ea1b8152508160008151811061031057fe5b602002602001018190525061034c604051806040016040528060048152602001630e0c2e8d60e31b81525082846105ab9092919063ffffffff16565b6103568285610619565b5050505050565b6103678130610254565b50565b60408051636ee4d55360e01b815260048101869052602481018590526001600160e01b03198416604482015260648101839052905186916001600160a01b03831691636ee4d5539160848082019260009290919082900301818387803b1580156103d357600080fd5b505af11580156103e7573d6000803e3d6000fd5b50505050505050505050565b60006103fd61063c565b604080516370a0823160e01b815230600482015290519192506001600160a01b0383169163a9059cbb91339184916370a08231916024808301926020929190829003018186803b15801561045057600080fd5b505afa158015610464573d6000803e3d6000fd5b505050506040513d602081101561047a57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b1580156104cb57600080fd5b505af11580156104df573d6000803e3d6000fd5b505050506040513d60208110156104f557600080fd5b5051610367576040805162461bcd60e51b81526020600482015260126024820152712ab730b13632903a37903a3930b739b332b960711b604482015290519081900360640190fd5b60075481565b61054d828261064b565b5050565b610559610da8565b610561610da8565b6105738186868663ffffffff6106e616565b95945050505050565b6080830151610591908363ffffffff61072316565b60808301516105a6908263ffffffff61072316565b505050565b60808301516105c0908363ffffffff61072316565b6105cd8360800151610740565b60005b815181101561060b576106038282815181106105e857fe5b6020026020010151856080015161072390919063ffffffff16565b6001016105d0565b506105a6836080015161074b565b600354600090610633906001600160a01b03168484610756565b90505b92915050565b6002546001600160a01b031690565b60008181526005602052604090205481906001600160a01b0316156106b7576040805162461bcd60e51b815260206004820152601a60248201527f5265717565737420697320616c72656164792070656e64696e67000000000000604482015290519081900360640190fd5b50600090815260056020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6106ee610da8565b6106fe856080015161010061092d565b50509183526001600160a01b031660208301526001600160e01b031916604082015290565b6107308260038351610967565b6105a6828263ffffffff610a7716565b610367816004610a91565b610367816007610a91565b6004546040805130606090811b60208084019190915260348084018690528451808503909101815260549093018452825192810192909220908601939093526000838152600590915281812080546001600160a01b0319166001600160a01b038816179055905182917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af991a26002546001600160a01b0316634000aea085846107fe87610aac565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610868578181015183820152602001610850565b50505050905090810190601f1680156108955780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156108b657600080fd5b505af11580156108ca573d6000803e3d6000fd5b505050506040513d60208110156108e057600080fd5b505161091d5760405162461bcd60e51b8152600401808060200182810382526023815260200180610df86023913960400191505060405180910390fd5b6004805460010190559392505050565b610935610ddd565b602082061561094a5760208206602003820191505b506020828101829052604080518085526000815290920101905290565b6017811161098e576109888360e0600585901b16831763ffffffff610bec16565b506105a6565b60ff81116109c4576109b1836018611fe0600586901b161763ffffffff610bec16565b506109888382600163ffffffff610c0416565b61ffff81116109fb576109e8836019611fe0600586901b161763ffffffff610bec16565b506109888382600263ffffffff610c0416565b63ffffffff8111610a3457610a2183601a611fe0600586901b161763ffffffff610bec16565b506109888382600463ffffffff610c0416565b67ffffffffffffffff81116105a657610a5e83601b611fe0600586901b161763ffffffff610bec16565b50610a718382600863ffffffff610c0416565b50505050565b610a7f610ddd565b61063383846000015151848551610c25565b6105a682601f611fe0600585901b161763ffffffff610bec16565b6060634042994660e01b6000808460000151856020015186604001518760600151600189608001516000015160405160240180896001600160a01b03166001600160a01b03168152602001888152602001878152602001866001600160a01b03166001600160a01b03168152602001856001600160e01b0319166001600160e01b031916815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610b7a578181015183820152602001610b62565b50505050905090810190601f168015610ba75780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909d169c909c17909b5250989950505050505050505050919050565b610bf4610ddd565b6106338384600001515184610cd1565b610c0c610ddd565b610c1d848560000151518585610d1c565b949350505050565b610c2d610ddd565b8251821115610c3b57600080fd5b84602001518285011115610c6557610c6585610c5d8760200151878601610d7a565b600202610d91565b600080865180518760208301019350808887011115610c845787860182525b505050602084015b60208410610cab5780518252601f199093019260209182019101610c8c565b51815160001960208690036101000a019081169019919091161790525083949350505050565b610cd9610ddd565b83602001518310610cf557610cf5848560200151600202610d91565b835180516020858301018481535080851415610d12576001810182525b5093949350505050565b610d24610ddd565b84602001518483011115610d4157610d4185858401600202610d91565b60006001836101000a039050855183868201018583198251161781525080518487011115610d6f5783860181525b509495945050505050565b600081831115610d8b575081610636565b50919050565b8151610d9d838361092d565b50610a718382610a77565b6040805160a081018252600080825260208201819052918101829052606081019190915260808101610dd8610ddd565b905290565b60405180604001604052806060815260200160008152509056fe756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261636c6568747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d444f434b267473796d733d555344536f75726365206d75737420626520746865206f7261636c65206f66207468652072657175657374a2646970667358221220ce8ae44d9a449cd38a5357ce261afb19ea4dbfc887cc655dd667b0f4b276871464736f6c63430006050033'; -export const PriceQueryABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_link', - type: 'address', - }, - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'bytes32', - name: '_specId', - type: 'bytes32', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'id', - type: 'bytes32', - }, - ], - name: 'ChainlinkCancelled', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'id', - type: 'bytes32', - }, - ], - name: 'ChainlinkFulfilled', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'id', - type: 'bytes32', - }, - ], - name: 'ChainlinkRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'requestId', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'bytes32', - name: 'price', - type: 'bytes32', - }, - ], - name: 'RequestFulfilled', - type: 'event', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'bytes32', - name: '_requestId', - type: 'bytes32', - }, - ], - name: 'addExternalRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '_oracle', - type: 'address', - }, - { - internalType: 'bytes32', - name: '_requestId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: '_payment', - type: 'uint256', - }, - { - internalType: 'bytes4', - name: '_callbackFunctionId', - type: 'bytes4', - }, - { - internalType: 'uint256', - name: '_expiration', - type: 'uint256', - }, - ], - name: 'cancelRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'currentPrice', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_requestId', - type: 'bytes32', - }, - { - internalType: 'bytes32', - name: '_price', - type: 'bytes32', - }, - ], - name: 'fulfill', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_payment', - type: 'uint256', - }, - { - internalType: 'address', - name: '_callback', - type: 'address', - }, - ], - name: 'requestDockUSDByCallback', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_payment', - type: 'uint256', - }, - ], - name: 'requestDockUSDPrice', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'withdrawLink', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; diff --git a/scripts/eth/chainlink/deviation-flag-validator.js b/scripts/eth/chainlink/deviation-flag-validator.js deleted file mode 100644 index 8fbcc7a0e..000000000 --- a/scripts/eth/chainlink/deviation-flag-validator.js +++ /dev/null @@ -1,34 +0,0 @@ -import { - deployContract, getTestEVMAccountsFromWeb3, getWeb3, sendEVMTxn, -} from '../helpers'; -import { - WriteAccessControllerByteCode, - WriteAccessControllerABI, - FlagsByteCode, - DeviationFlaggingValidatorByteCode, -} from './bytecodes-and-abis'; - -async function main() { - const web3 = getWeb3(); - - const [alice] = getTestEVMAccountsFromWeb3(web3); - - console.log('Deploying WriteAccessController contract to track who can raise flags'); - const wacAddr = await deployContract(web3, alice, WriteAccessControllerByteCode); - const wacContract = new web3.eth.Contract(WriteAccessControllerABI, wacAddr); - - console.log('Deploying Flags contract which will allow validator to raise flags'); - const flagsInitBytecode = FlagsByteCode + web3.eth.abi.encodeParameters(['address'], [wacAddr]).slice(2); - const flagsAddr = await deployContract(web3, alice, flagsInitBytecode); - - console.log('Deploying DeviationFlaggingValidator contract to raise a flag on deviation above threshold'); - // Setting the value of 100,000 is equivalent to tolerating a 100% change compared to the previous price. - const flaggingThreshold = 10000; // 10% - const validatorInitBytecode = DeviationFlaggingValidatorByteCode + web3.eth.abi.encodeParameters(['address', 'uint24'], [flagsAddr, flaggingThreshold]).slice(2); - const validatorAddr = await deployContract(web3, alice, validatorInitBytecode); - await sendEVMTxn(web3, alice, wacAddr, wacContract.methods.addAccess(validatorAddr).encodeABI()); -} - -main().catch((err) => { - console.log('Error', err); -}); diff --git a/scripts/eth/chainlink/flux-aggegator.js b/scripts/eth/chainlink/flux-aggegator.js deleted file mode 100644 index 09f4aed33..000000000 --- a/scripts/eth/chainlink/flux-aggegator.js +++ /dev/null @@ -1,72 +0,0 @@ -// Script used by Chainlink to deploy its FluxAggregator contract. - -import { FluxAggregatorABI, FluxAggregatorByteCode } from './bytecodes-and-abis'; - -import { - deployContract, endowEVMAddressWithDefault, - getTestEVMAccountsFromWeb3, getWeb3, sendEVMTxn, -} from '../helpers'; -import { addOracles, fund } from './helpers'; - -async function deploy(web3, signer, linkTokenAddr, paymentAmount, timeout, validator, minSubmissionValue, maxSubmissionValue, decimals, description) { - console.log('Deploying FluxAggregator'); - const argsABI = web3.eth.abi.encodeParameters(['address', 'uint128', 'uint32', 'address', 'int256', 'int256', 'uint8', 'string'], [linkTokenAddr, paymentAmount, timeout, validator, minSubmissionValue, maxSubmissionValue, decimals, description]); - const contractBytecode = FluxAggregatorByteCode + argsABI.slice(2); - - return deployContract(web3, signer, contractBytecode); -} - -async function main() { - const web3 = getWeb3(); - - const [alice, bob, carol] = getTestEVMAccountsFromWeb3(web3); - await endowEVMAddressWithDefault(alice.address); - await endowEVMAddressWithDefault(bob.address); - await endowEVMAddressWithDefault(carol.address); - - // Link token contract address - const linkTokenAddr = '0x8cB6497CDB9D44E168C076B414e4a675ebCC8683'; - const paymentAmount = 10; - const timeout = 2100; - const validator = '0x0000000000000000000000000000000000000000'; - const minSubmissionValue = 0; - const maxSubmissionValue = 1000; - const decimals = 3; - const description = 'FluxAggregator for Dock USD price feed'; - - const contractAddr = await deploy(web3, alice, linkTokenAddr, paymentAmount, timeout, validator, minSubmissionValue, maxSubmissionValue, decimals, description); - - const contract = new web3.eth.Contract(FluxAggregatorABI, contractAddr); - console.log(`Oracles: ${(await contract.methods.getOracles().call())}`); - - // Fund the aggregator - await fund(web3, alice, linkTokenAddr, contractAddr, contract); - - // Add 2 oracles - await addOracles(web3, alice, contractAddr, contract, bob, carol); - - console.log('Latest round data'); - console.log((await contract.methods.latestRoundData().call())); - - console.log('Round state for Bob'); - console.log((await contract.methods.oracleRoundState(bob.address, 0).call())); - - // Oracle's round state above should decide the round number - const submitCall1 = contract.methods.submit(1, 40).encodeABI(); - await sendEVMTxn(web3, bob, contractAddr, submitCall1); - - console.log('Round state for Carol'); - console.log((await contract.methods.oracleRoundState(carol.address, 0).call())); - - // Oracle's round state above should decide the round number - const submitCall2 = contract.methods.submit(1, 90).encodeABI(); - await sendEVMTxn(web3, carol, contractAddr, submitCall2); - - console.log('Latest round data'); - console.log((await contract.methods.latestRoundData().call())); - process.exit(0); -} - -main().catch((err) => { - console.log('Error', err); -}); diff --git a/scripts/eth/chainlink/helpers.js b/scripts/eth/chainlink/helpers.js deleted file mode 100644 index 414a87e6b..000000000 --- a/scripts/eth/chainlink/helpers.js +++ /dev/null @@ -1,26 +0,0 @@ -import { getTokenBalance, sendEVMTxn, sendTokens } from '../helpers'; -import { LinkTokenABI } from './bytecodes-and-abis'; - -export async function fund(web3, signer, linkTokenAddr, contractAddr, contract) { - // Send Link to Aggregator - console.log(`Aggregator's token balance: ${(await getTokenBalance(web3, linkTokenAddr, LinkTokenABI, contractAddr))}`); - await sendTokens(web3, signer, linkTokenAddr, LinkTokenABI, contractAddr, web3.utils.toBN(1000000)); - console.log(`Aggregator's token balance: ${(await getTokenBalance(web3, linkTokenAddr, LinkTokenABI, contractAddr))}`); - - // Let Aggregator update its state to reflect the transferred ether - const updateFundsCode = contract.methods.updateAvailableFunds().encodeABI(); - await sendEVMTxn(web3, signer, contractAddr, updateFundsCode); -} - -export async function addOracles(web3, signer, contractAddr, contract, oracle1, oracle2) { - // Add oracles - // Keeping the admin same as oracle node as its an example - - const addOracle1Code = contract.methods.changeOracles([], [oracle1.address], [oracle1.address], 1, 1, 0).encodeABI(); - await sendEVMTxn(web3, signer, contractAddr, addOracle1Code); - console.log(`Oracles: ${(await contract.methods.getOracles().call())}`); - - const addOracle2Code = contract.methods.changeOracles([], [oracle2.address], [oracle2.address], 1, 2, 0).encodeABI(); - await sendEVMTxn(web3, signer, contractAddr, addOracle2Code); - console.log(`Oracles: ${(await contract.methods.getOracles().call())}`); -} diff --git a/scripts/eth/chainlink/link-token.js b/scripts/eth/chainlink/link-token.js deleted file mode 100644 index a20c6e7fb..000000000 --- a/scripts/eth/chainlink/link-token.js +++ /dev/null @@ -1,40 +0,0 @@ -import { LinkTokenABI, LinkTokenByteCode } from './bytecodes-and-abis'; - -import { - deployContract, endowEVMAddressWithDefault, - getTestEVMAccountsFromWeb3, getTokenBalance, getWeb3, sendTokens, -} from '../helpers'; - -async function main() { - const web3 = getWeb3(); - - const [alice, bob] = getTestEVMAccountsFromWeb3(web3); - await endowEVMAddressWithDefault(alice.address); - await endowEVMAddressWithDefault(bob.address); - - console.log(`Generated accounts ${alice.address}, ${bob.address}`); - - const decimals = web3.utils.toBN(18); - const amount = web3.utils.toBN(100); - const value = amount.mul(web3.utils.toBN(10).pow(decimals)); - - console.log(`Alice's balance using web3 ${(await web3.eth.getBalance(alice.address))}`); - - const contractAddr = await deployContract(web3, alice, LinkTokenByteCode); - - console.log(`Alice's balance using web3 ${(await web3.eth.getBalance(alice.address))}`); - console.log(`Alice's ERC-20 token balance ${(await getTokenBalance(web3, contractAddr, LinkTokenABI, alice.address))}`); - console.log(`Bob's ERC-20 token balance ${(await getTokenBalance(web3, contractAddr, LinkTokenABI, bob.address))}`); - - const receipt = await sendTokens(web3, alice, contractAddr, LinkTokenABI, bob.address, value); - console.log(receipt); - - console.log(`Alice's balance using web3 ${(await web3.eth.getBalance(alice.address))}`); - console.log(`Alice's ERC-20 token balance ${(await getTokenBalance(web3, contractAddr, LinkTokenABI, alice.address))}`); - console.log(`Bob's ERC-20 token balance ${(await getTokenBalance(web3, contractAddr, LinkTokenABI, bob.address))}`); - process.exit(0); -} - -main().catch((err) => { - console.log('Error', err); -}); diff --git a/scripts/eth/dao/bytecodes-and-abis.js b/scripts/eth/dao/bytecodes-and-abis.js deleted file mode 100644 index 6ffe9c9ec..000000000 --- a/scripts/eth/dao/bytecodes-and-abis.js +++ /dev/null @@ -1,1533 +0,0 @@ -export const MiniMeTokenBytecode = '0x60c0604052600760808190527f4d4d545f302e310000000000000000000000000000000000000000000000000060a090815262000040916004919062000147565b503480156200004e57600080fd5b5060405162001b1b38038062001b1b8339810160409081528151602080840151928401516060850151608086015160a087015160c088015160008054600160a060020a03191633179055600b8054600160a060020a0389166101000261010060a860020a031990911617905592880180519698949690959294919091019291620000de9160019187019062000147565b506002805460ff191660ff851617905581516200010390600390602085019062000147565b5060058054600160a060020a031916600160a060020a039790971696909617909555505050600655600b805460ff19169115159190911790555043600755620001ec565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018a57805160ff1916838001178555620001ba565b82800160010185558215620001ba579182015b82811115620001ba5782518255916020019190600101906200019d565b50620001c8929150620001cc565b5090565b620001e991905b80821115620001c85760008155600101620001d3565b90565b61191f80620001fc6000396000f30060806040526004361061012f5763ffffffff60e060020a60003504166306fdde0381146101f2578063095ea7b31461027c57806317634514146102b457806318160ddd146102db57806323b872dd146102f0578063313ce5671461031a5780633cebb823146103455780634ee2cd7e1461036657806354fd4d501461038a5780636638c0871461039f57806370a082311461046257806380a5400114610483578063827f32c01461049857806395d89b41146104bc578063981b24d0146104d1578063a9059cbb146104e9578063bef97c871461050d578063c5bcc4f114610522578063cae9ca5114610537578063d3ce77fe146105a0578063dd62ed3e146105c4578063df8de3e7146105eb578063e77772fe1461060c578063f41e60c514610621578063f77c47911461063b575b60005461014490600160a060020a0316610650565b151561014f57600080fd5b600054604080517ff48c30540000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a039092169163f48c3054913491602480830192602092919082900301818588803b1580156101b557600080fd5b505af11580156101c9573d6000803e3d6000fd5b50505050506040513d60208110156101e057600080fd5b505115156001146101f057600080fd5b005b3480156101fe57600080fd5b5061020761067d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610241578181015183820152602001610229565b50505050905090810190601f16801561026e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028857600080fd5b506102a0600160a060020a036004351660243561070a565b604080519115158252519081900360200190f35b3480156102c057600080fd5b506102c961088b565b60408051918252519081900360200190f35b3480156102e757600080fd5b506102c9610891565b3480156102fc57600080fd5b506102a0600160a060020a03600435811690602435166044356108a2565b34801561032657600080fd5b5061032f610939565b6040805160ff9092168252519081900360200190f35b34801561035157600080fd5b506101f0600160a060020a0360043516610942565b34801561037257600080fd5b506102c9600160a060020a0360043516602435610988565b34801561039657600080fd5b50610207610ad5565b3480156103ab57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261044694369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b60ff8b35169b909a909994019750919550918201935091508190840183828082843750949750508435955050505050602001351515610b30565b60408051600160a060020a039092168252519081900360200190f35b34801561046e57600080fd5b506102c9600160a060020a0360043516610d96565b34801561048f57600080fd5b50610446610daa565b3480156104a457600080fd5b506102a0600160a060020a0360043516602435610db9565b3480156104c857600080fd5b50610207610e85565b3480156104dd57600080fd5b506102c9600435610ee0565b3480156104f557600080fd5b506102a0600160a060020a0360043516602435610fd4565b34801561051957600080fd5b506102a0610ff3565b34801561052e57600080fd5b506102c9610ffc565b34801561054357600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102a0948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506110029650505050505050565b3480156105ac57600080fd5b506102a0600160a060020a036004351660243561111d565b3480156105d057600080fd5b506102c9600160a060020a03600435811690602435166111e5565b3480156105f757600080fd5b506101f0600160a060020a0360043516611210565b34801561061857600080fd5b506104466113f7565b34801561062d57600080fd5b506101f0600435151561140b565b34801561064757600080fd5b50610446611435565b600080600160a060020a038316151561066c5760009150610677565b823b90506000811191505b50919050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107025780601f106106d757610100808354040283529160200191610702565b820191906000526020600020905b8154815290600101906020018083116106e557829003601f168201915b505050505081565b600b5460009060ff16151561071e57600080fd5b81158061074c5750336000908152600960209081526040808320600160a060020a0387168452909152902054155b151561075757600080fd5b60005461076c90600160a060020a0316610650565b156108235760008054604080517fda682aeb000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038781166024830152604482018790529151919092169263da682aeb92606480820193602093909283900390910190829087803b1580156107e957600080fd5b505af11580156107fd573d6000803e3d6000fd5b505050506040513d602081101561081357600080fd5b5051151560011461082357600080fd5b336000818152600960209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60075481565b600061089c43610ee0565b90505b90565b60008054600160a060020a0316331461092457600b5460ff1615156108c657600080fd5b600160a060020a03841660009081526009602090815260408083203384529091529020548211156108f957506000610932565b600160a060020a03841660009081526009602090815260408083203384529091529020805483900390555b61092f848484611444565b90505b9392505050565b60025460ff1681565b600054600160a060020a0316331461095957600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03821660009081526008602052604081205415806109e45750600160a060020a0383166000908152600860205260408120805484929081106109cd57fe5b6000918252602090912001546001608060020a0316115b15610aac57600554600160a060020a031615610aa457600554600654600160a060020a0390911690634ee2cd7e908590610a1f908690611639565b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610a7157600080fd5b505af1158015610a85573d6000803e3d6000fd5b505050506040513d6020811015610a9b57600080fd5b50519050610885565b506000610885565b600160a060020a0383166000908152600860205260409020610ace908361164f565b9050610885565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107025780601f106106d757610100808354040283529160200191610702565b600080808415610b405784610b45565b600143035b600b546040517f5b7b72c100000000000000000000000000000000000000000000000000000000815230600482018181526024830185905260ff8c16606484015288151560a484015260c0604484019081528d5160c48501528d51959750610100909404600160a060020a031694635b7b72c194929388938f938f938f938e9391608482019160e40190602089019080838360005b83811015610bf2578181015183820152602001610bda565b50505050905090810190601f168015610c1f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610c52578181015183820152602001610c3a565b50505050905090810190601f168015610c7f5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b158015610ca457600080fd5b505af1158015610cb8573d6000803e3d6000fd5b505050506040513d6020811015610cce57600080fd5b5051604080517f3cebb8230000000000000000000000000000000000000000000000000000000081523360048201529051919250600160a060020a03831691633cebb8239160248082019260009290919082900301818387803b158015610d3457600080fd5b505af1158015610d48573d6000803e3d6000fd5b5050604080518581529051600160a060020a03851693507f086c875b377f900b07ce03575813022f05dd10ed7640b5282cf6d3c3fc352ade92509081900360200190a2979650505050505050565b6000610da28243610988565b90505b919050565b600554600160a060020a031681565b6000805481908190600160a060020a03163314610dd557600080fd5b610ddd610891565b9150838201821115610dee57600080fd5b610df785610d96565b9050838101811115610e0857600080fd5b610e15600a8584016117ae565b600160a060020a0385166000908152600860205260409020610e39908286016117ae565b604080518581529051600160a060020a038716916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001949350505050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107025780601f106106d757610100808354040283529160200191610702565b600a546000901580610f15575081600a6000815481101515610efe57fe5b6000918252602090912001546001608060020a0316115b15610fc257600554600160a060020a031615610fba57600554600654600160a060020a039091169063981b24d090610f4e908590611639565b6040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015610f8757600080fd5b505af1158015610f9b573d6000803e3d6000fd5b505050506040513d6020811015610fb157600080fd5b50519050610da5565b506000610da5565b610fcd600a8361164f565b9050610da5565b600b5460009060ff161515610fe857600080fd5b610932338484611444565b600b5460ff1681565b60065481565b600061100e848461070a565b151561101957600080fd5b6040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b838110156110ac578181015183820152602001611094565b50505050905090810190601f1680156110d95780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156110fb57600080fd5b505af115801561110f573d6000803e3d6000fd5b506001979650505050505050565b6000805481908190600160a060020a0316331461113957600080fd5b611141610891565b91508382101561115057600080fd5b61115985610d96565b90508381101561116857600080fd5b611175600a8584036117ae565b600160a060020a0385166000908152600860205260409020611199908583036117ae565b604080518581529051600091600160a060020a038816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001949350505050565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b600080548190600160a060020a0316331461122a57600080fd5b600160a060020a038316151561127b5760008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015611275573d6000803e3d6000fd5b506113f2565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b1580156112df57600080fd5b505af11580156112f3573d6000803e3d6000fd5b505050506040513d602081101561130957600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519394509085169263a9059cbb92604480840193602093929083900390910190829087803b15801561137f57600080fd5b505af1158015611393573d6000803e3d6000fd5b505050506040513d60208110156113a957600080fd5b5050600054604080518381529051600160a060020a03928316928616917ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c919081900360200190a35b505050565b600b546101009004600160a060020a031681565b600054600160a060020a0316331461142257600080fd5b600b805460ff1916911515919091179055565b600054600160a060020a031681565b600080808315156114585760019250611630565b600654431161146657600080fd5b600160a060020a038516158015906114875750600160a060020a0385163014155b151561149257600080fd5b61149c8643610988565b9150838210156114af5760009250611630565b6000546114c490600160a060020a0316610650565b1561157d5760008054604080517f4a393149000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015289811660248301526044820189905291519190921692634a39314992606480820193602093909283900390910190829087803b15801561154357600080fd5b505af1158015611557573d6000803e3d6000fd5b505050506040513d602081101561156d57600080fd5b5051151560011461157d57600080fd5b600160a060020a03861660009081526008602052604090206115a1908584036117ae565b6115ab8543610988565b90508381018111156115bc57600080fd5b600160a060020a03851660009081526008602052604090206115e0908286016117ae565b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600192505b50509392505050565b60008183106116485781610932565b5090919050565b60008060008085805490506000141561166b57600093506117a5565b85548690600019810190811061167d57fe5b6000918252602090912001546001608060020a031685106116da578554869060001981019081106116aa57fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a031693506117a5565b8560008154811015156116e957fe5b6000918252602090912001546001608060020a031685101561170e57600093506117a5565b8554600093506000190191505b8282111561176b57600260018385010104905084868281548110151561173d57fe5b6000918252602090912001546001608060020a03161161175f57809250611766565b6001810391505b61171b565b858381548110151561177957fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a031693505b50505092915050565b6000806001608060020a038311156117c557600080fd5b835415806117f9575083544390859060001981019081106117e257fe5b6000918252602090912001546001608060020a0316105b1561186b578354849061180f82600183016118b6565b8154811061181957fe5b600091825260209091200180546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff19909316929092171617815591506118b0565b83548490600019810190811061187d57fe5b600091825260209091200180546001608060020a0380861670010000000000000000000000000000000002911617815590505b50505050565b8154818355818111156113f2576000838152602090206113f291810190830161089f91905b808211156118ef57600081556001016118db565b50905600a165627a7a72305820023a7e1d47802836a2437cc2852cc6c8edcfbe38ca35a34f9551d81b48884f5f0029'; -export const MiniMeTokenABI = [ - { - constant: true, - inputs: [], - name: 'name', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_spender', - type: 'address', - }, - { - name: '_amount', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'creationBlock', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address', - }, - { - name: '_to', - type: 'address', - }, - { - name: '_amount', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [ - { - name: '', - type: 'uint8', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_newController', - type: 'address', - }, - ], - name: 'changeController', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_blockNumber', - type: 'uint256', - }, - ], - name: 'balanceOfAt', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'version', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_cloneTokenName', - type: 'string', - }, - { - name: '_cloneDecimalUnits', - type: 'uint8', - }, - { - name: '_cloneTokenSymbol', - type: 'string', - }, - { - name: '_snapshotBlock', - type: 'uint256', - }, - { - name: '_transfersEnabled', - type: 'bool', - }, - ], - name: 'createCloneToken', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'parentToken', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_amount', - type: 'uint256', - }, - ], - name: 'generateTokens', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_blockNumber', - type: 'uint256', - }, - ], - name: 'totalSupplyAt', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_to', - type: 'address', - }, - { - name: '_amount', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'transfersEnabled', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'parentSnapShotBlock', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_spender', - type: 'address', - }, - { - name: '_amount', - type: 'uint256', - }, - { - name: '_extraData', - type: 'bytes', - }, - ], - name: 'approveAndCall', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_amount', - type: 'uint256', - }, - ], - name: 'destroyTokens', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_spender', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - name: 'remaining', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_token', - type: 'address', - }, - ], - name: 'claimTokens', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'tokenFactory', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_transfersEnabled', - type: 'bool', - }, - ], - name: 'enableTransfers', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'controller', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - name: '_tokenFactory', - type: 'address', - }, - { - name: '_parentToken', - type: 'address', - }, - { - name: '_parentSnapShotBlock', - type: 'uint256', - }, - { - name: '_tokenName', - type: 'string', - }, - { - name: '_decimalUnits', - type: 'uint8', - }, - { - name: '_tokenSymbol', - type: 'string', - }, - { - name: '_transfersEnabled', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - payable: true, - stateMutability: 'payable', - type: 'fallback', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_token', - type: 'address', - }, - { - indexed: true, - name: '_controller', - type: 'address', - }, - { - indexed: false, - name: '_amount', - type: 'uint256', - }, - ], - name: 'ClaimedTokens', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_from', - type: 'address', - }, - { - indexed: true, - name: '_to', - type: 'address', - }, - { - indexed: false, - name: '_amount', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_cloneToken', - type: 'address', - }, - { - indexed: false, - name: '_snapshotBlock', - type: 'uint256', - }, - ], - name: 'NewCloneToken', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_owner', - type: 'address', - }, - { - indexed: true, - name: '_spender', - type: 'address', - }, - { - indexed: false, - name: '_amount', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, -]; - -export const VotingDAOBytecode = '0x6080604052620000176401000000006200001d810204565b6200023b565b6200003064010000000062000125810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a45440000000000000000602082015290156200010c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620000d0578181015183820152602001620000b6565b50505050905090810190601f168015620000fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506200012360001964010000000062000154810204565b565b60006200014f6000805160206200386983398151915264010000000062001fd16200023382021704565b905090565b6200016764010000000062000125810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152901562000206576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252838181518152602001915080519060200190808383600083811015620000d0578181015183820152602001620000b6565b5062000230600080516020620038698339815191528264010000000062002db36200023782021704565b50565b5490565b9055565b61361e806200024b6000396000f3006080604052600436106101925763ffffffff60e060020a6000350416630803fac081146101975780632914b9bd146101c057806332f0a3b5146102355780633c624c751461024a5780634b12311c146102715780635a55c1f0146102b95780635eb24332146103e057806362de7e5a146104045780637c1d0b87146104195780637e7db6e11461043b57806380afdea81461045c5780638b3dd749146104715780639d4941d814610486578063a1658fad146104a7578063a479e5081461050e578063bcf93dd614610523578063be2c64d414610555578063c0774df31461056a578063cc63604a146105d1578063cdb2867b146105e9578063d4aae0c41461060d578063d5db2c8014610622578063d948d4681461064e578063dc474b1a146106a7578063de4796ed146106bc578063de4f6347146106d1578063df133bca146106e6578063df3d330514610708578063f4b0051314610742578063f98a4eca14610778578063fad167ab14610790578063fc0c546a146107a5578063fc157cb4146107ba578063fd64eccb146107cf575b600080fd5b3480156101a357600080fd5b506101ac6107e4565b604080519115158252519081900360200190f35b3480156101cc57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261021994369492936024939284019190819084018382808284375094975061080e9650505050505050565b60408051600160a060020a039092168252519081900360200190f35b34801561024157600080fd5b506102196108f4565b34801561025657600080fd5b5061025f61096d565b60408051918252519081900360200190f35b34801561027d57600080fd5b50610295600435600160a060020a03602435166109a2565b604051808260028111156102a557fe5b60ff16815260200191505060405180910390f35b3480156102c557600080fd5b506102d1600435610a8e565b604051808b1515151581526020018a1515151581526020018967ffffffffffffffff1667ffffffffffffffff1681526020018867ffffffffffffffff1667ffffffffffffffff1681526020018767ffffffffffffffff1667ffffffffffffffff1681526020018667ffffffffffffffff1667ffffffffffffffff16815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561039c578181015183820152602001610384565b50505050905090810190601f1680156103c95780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390f35b3480156103ec57600080fd5b5061040267ffffffffffffffff60043516610c7b565b005b34801561041057600080fd5b5061025f610e3f565b34801561042557600080fd5b5061040267ffffffffffffffff60043516610e74565b34801561044757600080fd5b506101ac600160a060020a03600435166110ed565b34801561046857600080fd5b5061025f6110f3565b34801561047d57600080fd5b5061025f611123565b34801561049257600080fd5b50610402600160a060020a036004351661114e565b3480156104b357600080fd5b5060408051602060046044358181013583810280860185019096528085526101ac958335600160a060020a03169560248035963696956064959394920192918291850190849080828437509497506113dd9650505050505050565b34801561051a57600080fd5b5061021961152d565b34801561052f57600080fd5b506105386115e2565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561056157600080fd5b5061025f6115fe565b34801561057657600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101ac958335600160a060020a03169536956044949193909101919081908401838280828437509497506116219650505050505050565b3480156105dd57600080fd5b506101ac60043561165f565b3480156105f557600080fd5b506101ac600435600160a060020a03602435166116ee565b34801561061957600080fd5b5061021961177d565b34801561062e57600080fd5b5061025f60246004803582810192908201359181359182019101356117a8565b34801561065a57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104029436949293602493928401919081908401838280828437509497506118d09650505050505050565b3480156106b357600080fd5b50610538611982565b3480156106c857600080fd5b506101ac611992565b3480156106dd57600080fd5b5061025f6119a5565b3480156106f257600080fd5b50610402600435602435151560443515156119ab565b34801561071457600080fd5b50610402600160a060020a036004351667ffffffffffffffff60243581169060443581169060643516611ac7565b34801561074e57600080fd5b5061025f602460048035828101929082013591813591820191013560443515156064351515611d2b565b34801561078457600080fd5b50610402600435611e52565b34801561079c57600080fd5b50610538611ed4565b3480156107b157600080fd5b50610219611eeb565b3480156107c657600080fd5b50610538611efa565b3480156107db57600080fd5b506101ac611f06565b6000806107ef611123565b90508015801590610807575080610804611f0b565b10155b91505b5090565b600061081861152d565b600160a060020a03166304bf2a7f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561087657818101518382015260200161085e565b50505050905090810190601f1680156108a35780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156108c257600080fd5b505af11580156108d6573d6000803e3d6000fd5b505050506040513d60208110156108ec57600080fd5b505192915050565b60006108fe61177d565b600160a060020a03166332f0a3b56040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561093b57600080fd5b505af115801561094f573d6000803e3d6000fd5b505050506040513d602081101561096557600080fd5b505190505b90565b604080517f4d4f444946595f51554f52554d5f524f4c4500000000000000000000000000008152905190819003601201902081565b60035460408051808201909152600e81526000805160206135b383398151915260208201526000918491908210610a5a5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a1f578181015183820152602001610a07565b50505050905090810190601f168015610a4c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000848152600260209081526040808320600160a060020a038716845260060190915290205460ff1691505b5092915050565b6000806000806000806000806000606060008b60035481106040805190810160405280600e81526020016000805160206135b3833981519152815250901515610b1c5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060008d81526002602052604090209150610b3682611f0f565b9b508160000160009054906101000a900460ff169a508160000160019054906101000a900467ffffffffffffffff1699508160000160099054906101000a900467ffffffffffffffff1698508160000160119054906101000a900467ffffffffffffffff1697508160010160009054906101000a900467ffffffffffffffff169650816002015495508160030154945081600401549350816005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c655780601f10610c3a57610100808354040283529160200191610c65565b820191906000526020600020905b815481529060010190602001808311610c4857829003601f168201915b5050505050925050509193959799509193959799565b604080517f4d4f444946595f51554f52554d5f524f4c45000000000000000000000000000081529051908190036012019020600154610cc79067ffffffffffffffff8085169116611f76565b610cd23383836113dd565b60408051808201909152600f81526000805160206135938339815191526020820152901515610d465760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060005460408051808201909152601981527f564f54494e475f4348414e47455f51554f52554d5f504354530000000000000060208201529067ffffffffffffffff60a060020a90910481169085161115610de65760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506001805467ffffffffffffffff851667ffffffffffffffff19909116811790915560408051918252517f3172f2e9273c729c2a47cc8bf7e7f18506e3e3035126d562602bd2155bc78a509181900360200190a1505050565b604080517f4d4f444946595f535550504f52545f524f4c45000000000000000000000000008152905190819003601301902081565b604080517f4d4f444946595f535550504f52545f524f4c450000000000000000000000000081529051908190036013019020600054610ec79067ffffffffffffffff8085169160a060020a900416611f76565b610ed23383836113dd565b60408051808201909152600f81526000805160206135938339815191526020820152901515610f465760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060015460408051808201909152601a81527f564f54494e475f4348414e47455f535550504f52545f5043545300000000000060208201529067ffffffffffffffff80861691161115610fde5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060408051808201909152601a81527f564f54494e475f4348414e47455f535550505f544f4f5f4249470000000000006020820152670de0b6b3a764000067ffffffffffffffff8516106110775760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506000805467ffffffffffffffff851660a060020a81027bffffffffffffffff0000000000000000000000000000000000000000199092169190911790915560408051918252517f903b617f7f36eb047a29b89d1bf7885fdae31d250c3320fccf11d045c11b396e9181900360200190a1505050565b50600190565b600061111e7fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b611fd1565b905090565b600061111e7febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e611fd1565b600080600061115c846110ed565b60408051808201909152601281527f5245434f5645525f444953414c4c4f574544000000000000000000000000000060208201529015156111e25760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506111eb6108f4565b92506111f683611fd9565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e5452414354000000000000602082015290151561127c5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50600160a060020a03841615156112cd5760405130319250600160a060020a0384169083156108fc029084906000818181858888f193505050501580156112c7573d6000803e3d6000fd5b5061138c565b50826112e8600160a060020a0382163063ffffffff611fff16565b9150611304600160a060020a038216848463ffffffff6120ff16565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c4544000000602082015290151561138a5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b6000806113e86107e4565b15156113f75760009150611525565b6113ff61177d565b9050600160a060020a038116151561141a5760009150611525565b80600160a060020a031663fdef910686308761143588612175565b60405160e060020a63ffffffff8716028152600160a060020a03808616600483019081529085166024830152604482018490526080606483019081528351608484015283519192909160a490910190602085019080838360005b838110156114a757818101518382015260200161148f565b50505050905090810190601f1680156114d45780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156114f657600080fd5b505af115801561150a573d6000803e3d6000fd5b505050506040513d602081101561152057600080fd5b505191505b509392505050565b60008061153861177d565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527fd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb60048201527fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd6160248201529051600160a060020a03929092169163be00bbd8916044808201926020929091908290030181600087803b1580156108c257600080fd5b60015468010000000000000000900467ffffffffffffffff1681565b604080516000805160206135d38339815191528152905190819003601101902081565b60006116588360405180806000805160206135d38339815191528152506011019050604051809103902061165361217f565b6113dd565b9392505050565b60035460408051808201909152600e81526000805160206135b3833981519152602082015260009183919082106116db5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506116e583612191565b91505b50919050565b60035460408051808201909152600e81526000805160206135b38339815191526020820152600091849190821061176a5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061177584846122aa565b949350505050565b600061111e7f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b611fd1565b604080516000805160206135d383398151915281528151908190036011018120600080835260208301909352906117e59033908390855b506113dd565b60408051808201909152600f815260008051602061359383398151915260208201529015156118595760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506118c686868080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f8c018190048102820181019092528a815294508a93508992508291508401838280828437820191505050505050600180612384565b9695505050505050565b6118da3382611621565b60408051808201909152601681527f564f54494e475f43414e5f4e4f545f464f52574152440000000000000000000060208201529015156119605760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061197e816020604051908101604052806000815250600180612384565b5050565b60015467ffffffffffffffff1681565b600060001961199f611123565b14905090565b60035481565b60035460408051808201909152600e81526000805160206135b3833981519152602082015284918210611a235760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611a2e84336122aa565b60408051808201909152601381527f564f54494e475f43414e5f4e4f545f564f5445000000000000000000000000006020820152901515611ab45760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611ac18484338561267a565b50505050565b611acf611123565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529015611b545760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611b5d6128b6565b60408051808201909152601081527f564f54494e475f494e49545f5043545300000000000000000000000000000000602082015267ffffffffffffffff8085169084161115611bf15760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5060408051808201909152601b81527f564f54494e475f494e49545f535550504f52545f544f4f5f42494700000000006020820152670de0b6b3a764000067ffffffffffffffff851610611c8a5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0395909516949094177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a67ffffffffffffffff94851602179093556001805467ffffffffffffffff1916918316919091176fffffffffffffffff00000000000000001916680100000000000000009390921692909202179055565b604080516000805160206135d38339815191528152815190819003601101812060008083526020830190935290611d669033908390856117df565b60408051808201909152600f81526000805160206135938339815191526020820152901515611dda5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50611e4688888080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f8e018190048102820181019092528c815294508c93508b925082915084018382808284378201915050505050508686612384565b98975050505050505050565b60035460408051808201909152600e81526000805160206135b3833981519152602082015282918210611eca5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061197e8261297e565b60005460a060020a900467ffffffffffffffff1681565b600054600160a060020a031681565b670de0b6b3a764000081565b600190565b4390565b6001548154600091611f4591610100900467ffffffffffffffff908116916801000000000000000090041663ffffffff612a1a16565b67ffffffffffffffff16611f57612ab5565b67ffffffffffffffff16108015611f705750815460ff16155b92915050565b604080516002808252606080830184529260208301908038833901905050905082816000815181101515611fa657fe5b602090810290910101528051829082906001908110611fc157fe5b6020908102909101015292915050565b5490565b5490565b600080600160a060020a0383161515611ff557600091506116e8565b50506000903b1190565b60408051600160a060020a038316602480830191909152825180830390910181526044909101909152602081018051600160e060020a03167f70a0823100000000000000000000000000000000000000000000000000000000179052600090818061206a8684612ac7565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f524556455254454400000000602082015291935091508215156120f55760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5095945050505050565b60408051600160a060020a03841660248201526044808201849052825180830390910181526064909101909152602081018051600160e060020a03167fa9059cbb0000000000000000000000000000000000000000000000000000000017905260009061216c8582612af8565b95945050505050565b8051602002815290565b60408051600081526020810190915290565b60008181526002602052604081208054829060ff16156121b457600092506122a3565b6002820154600483015483546121ea92919071010000000000000000000000000000000000900467ffffffffffffffff16612b46565b156121f857600192506122a3565b61220182611f0f565b1561220f57600092506122a3565b600382015460028301546122289163ffffffff612b8816565b6002830154835491925061225c91839071010000000000000000000000000000000000900467ffffffffffffffff16612b46565b151561226b57600092506122a3565b60028201546004830154600184015461228f92919067ffffffffffffffff16612b46565b151561229e57600092506122a3565b600192505b5050919050565b60008281526002602052604081206122c181611f0f565b80156117755750600080548254604080517f4ee2cd7e000000000000000000000000000000000000000000000000000000008152600160a060020a038881166004830152690100000000000000000090930467ffffffffffffffff16602482015290519190921691634ee2cd7e91604480830192602092919082900301818787803b15801561234f57600080fd5b505af1158015612363573d6000803e3d6000fd5b505050506040513d602081101561237957600080fd5b505111949350505050565b6000806000806001612394612c16565b60008054604080517f981b24d00000000000000000000000000000000000000000000000000000000081529490930367ffffffffffffffff811660048601529251929650600160a060020a03169263981b24d09260248083019360209383900390910190829087803b15801561240957600080fd5b505af115801561241d573d6000803e3d6000fd5b505050506040513d602081101561243357600080fd5b505160408051808201909152601681527f564f54494e475f4e4f5f564f54494e475f504f574552000000000000000000006020820152909250600083116124bf5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5050600380546001810190915560008181526002602052604090209093506124e5612ab5565b815468ffffffffffffffff00191661010067ffffffffffffffff928316021770ffffffffffffffff00000000000000000019166901000000000000000000858316021780835560005478ffffffffffffffff00000000000000000000000000000000001990911660a060020a909104821671010000000000000000000000000000000000021782556001805490830180549190921667ffffffffffffffff199091161790556004810182905587516125a690600583019060208b0190613504565b5033600160a060020a0316847f4d72fe0577a3a3f7da968d7b892779dde102519c25527b29cf7054f245c791b9896040518080602001828103825283818151815260200191508051906020019080838360005b838110156126115781810151838201526020016125f9565b50505050905090810190601f16801561263e5780820380516001836020036101000a031916815260200191505b509250505060405180910390a385801561265d575061265d84336122aa565b1561266f5761266f846001338861267a565b505050949350505050565b60008481526002602090815260408083208354815483517f4ee2cd7e000000000000000000000000000000000000000000000000000000008152600160a060020a038981166004830152690100000000000000000090920467ffffffffffffffff166024820152935192959485949190921692634ee2cd7e9260448084019391929182900301818787803b15801561271157600080fd5b505af1158015612725573d6000803e3d6000fd5b505050506040513d602081101561273b57600080fd5b5051600160a060020a038616600090815260068501602052604090205490925060ff169050600181600281111561276e57fe5b1415612793576002830154612789908363ffffffff612c2316565b60028401556127c2565b60028160028111156127a157fe5b14156127c25760038301546127bc908363ffffffff612c2316565b60038401555b85156127e75760028301546127dd908363ffffffff612b8816565b6002840155612802565b60038301546127fc908363ffffffff612b8816565b60038401555b8561280e576002612811565b60015b600160a060020a03861660009081526006850160205260409020805460ff1916600183600281111561283f57fe5b0217905550604080518715158152602081018490528151600160a060020a038816928a927fb34ee265e3d4f5ec4e8b52d59b2a9be8fceca2f274ebc080d8fba797fea9391f929081900390910190a383801561289f575061289f87612191565b156128ad576128ad87612cb7565b50505050505050565b6128be611123565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a45440000000000000000602082015290156129435760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5061297c61294f611f0b565b7febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e9063ffffffff612db316565b565b61298781612191565b60408051808201909152601681527f564f54494e475f43414e5f4e4f545f45584543555445000000000000000000006020820152901515612a0d5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50612a1781612cb7565b50565b60408051808201909152601381527f4d41544836345f4144445f4f564552464c4f570000000000000000000000000060208201526000908383019067ffffffffffffffff80861690831610156115255760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b600061111e612ac2612db7565b612dbb565b6000806000806040516020818751602089018a5afa92506000831115612aec57805191505b50909590945092505050565b6000806040516020818551602087016000895af16000811115612b3c573d8015612b295760208114612b3257612b3a565b60019350612b3a565b600183511493505b505b5090949350505050565b600080831515612b595760009150611525565b83612b7286670de0b6b3a764000063ffffffff612e5416565b811515612b7b57fe5b0492909211949350505050565b60408051808201909152601181527f4d4154485f4144445f4f564552464c4f57000000000000000000000000000000602082015260009083830190848210156115255760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b600061111e612ac2611f0b565b60408051808201909152601281527f4d4154485f5355425f554e444552464c4f5700000000000000000000000000006020820152600090819084841115612caf5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b505050900390565b6000818152600260208181526040808420805460ff191660019081178255825195865260058201805491821615610100026000190190911694909404601f81018490048402860183018352928501838152909493612d82939192909190850182828015612d655780601f10612d3a57610100808354040283529160200191612d65565b820191906000526020600020905b815481529060010190602001808311612d4857829003601f168201915b50506040805160008152602081019091528693509150612eff9050565b5060405183907fbf8e2b108bb7c980e08903a8a46527699d5e84905a082d56dacb4150725c8cab90600090a2505050565b9055565b4290565b60408051808201909152601581527f55494e5436345f4e554d4245525f544f4f5f4249470000000000000000000000602082015260009067ffffffffffffffff831115612e4d5760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b5090919050565b600080831515612e675760009150610a87565b50828202828482811515612e7757fe5b60408051808201909152601181527f4d4154485f4d554c5f4f564552464c4f57000000000000000000000000000000602082015292919004146115255760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b6060600080606080612f0f6107e4565b60408051808201909152601481527f494e49545f4e4f545f494e495449414c495a45440000000000000000000000006020820152901515612f955760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50600080612fa161177d565b9150612fab6110f3565b9050612fb68a61080e565b60408051808201909152601b81527f45564d52554e5f4558454355544f525f554e415641494c41424c4500000000006020820152909650600160a060020a03871615156130485760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b506040516060602482019081528b5160848301528b517f279cea3500000000000000000000000000000000000000000000000000000000975087928d928d928d9282916044820191606481019160a490910190602089019080838360005b838110156130be5781810151838201526020016130a6565b50505050905090810190601f1680156130eb5780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b8381101561311e578181015183820152602001613106565b50505050905090810190601f16801561314b5780820380516001836020036101000a031916815260200191505b508481038252855181528551602091820191808801910280838360005b83811015613180578181015183820152602001613168565b50505050905001965050505050505060405160208183030381529060405290600160e060020a031916602082018051600160e060020a0383818316178352505050509350600080855160208701895af4604051935080801561324457603f3d1180156131f95760203d03806020883e860160405261323e565b60e560020a62461bcd02865260206004870152601e60248701527f45564d52554e5f4558454355544f525f494e56414c49445f52455455524e00006044870152606486fd5b5061324d565b3d6000863e3d85fd5b505085600160a060020a03167f5229a5dba83a54ae8cb5b51bdd6de9474cacbe9dd332f5185f3a4f4f2e3f4ad98b8b8660405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156132c25781810151838201526020016132aa565b50505050905090810190601f1680156132ef5780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b8381101561332257818101518382015260200161330a565b50505050905090810190601f16801561334f5780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b8381101561338257818101518382015260200161336a565b50505050905090810190601f1680156133af5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a282965081600160a060020a03166133d561177d565b600160a060020a0316146040805190810160405280601f81526020017f45564d52554e5f50524f5445435445445f53544154455f4d4f444946494544008152509015156134675760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b50806134716110f3565b60408051808201909152601f81527f45564d52554e5f50524f5445435445445f53544154455f4d4f44494649454400602082015291146134f65760405160e560020a62461bcd02815260040180806020018281038252838181518152602001915080519060200190808383600083811015610a1f578181015183820152602001610a07565b505050505050509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061354557805160ff1916838001178555613572565b82800160010185558215613572579182015b82811115613572578251825591602001919060010190613557565b5061080a9261096a9250905b8082111561080a576000815560010161357e56004150505f415554485f4641494c45440000000000000000000000000000000000564f54494e475f4e4f5f564f54450000000000000000000000000000000000004352454154455f564f5445535f524f4c45000000000000000000000000000000a165627a7a72305820e6a06a964692f26a22a2e85cfd6610dcd8fe0cf5277b551cf6d61484be71e7b90029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e'; -export const VotingDAOABI = [ - { - constant: true, - inputs: [], - name: 'hasInitialized', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_script', - type: 'bytes', - }, - ], - name: 'getEVMScriptExecutor', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getRecoveryVault', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'MODIFY_QUORUM_ROLE', - outputs: [ - { - name: '', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_voteId', - type: 'uint256', - }, - { - name: '_voter', - type: 'address', - }, - ], - name: 'getVoterState', - outputs: [ - { - name: '', - type: 'uint8', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_voteId', - type: 'uint256', - }, - ], - name: 'getVote', - outputs: [ - { - name: 'open', - type: 'bool', - }, - { - name: 'executed', - type: 'bool', - }, - { - name: 'startDate', - type: 'uint64', - }, - { - name: 'snapshotBlock', - type: 'uint64', - }, - { - name: 'supportRequired', - type: 'uint64', - }, - { - name: 'minAcceptQuorum', - type: 'uint64', - }, - { - name: 'yea', - type: 'uint256', - }, - { - name: 'nay', - type: 'uint256', - }, - { - name: 'votingPower', - type: 'uint256', - }, - { - name: 'script', - type: 'bytes', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_minAcceptQuorumPct', - type: 'uint64', - }, - ], - name: 'changeMinAcceptQuorumPct', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'MODIFY_SUPPORT_ROLE', - outputs: [ - { - name: '', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_supportRequiredPct', - type: 'uint64', - }, - ], - name: 'changeSupportRequiredPct', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'token', - type: 'address', - }, - ], - name: 'allowRecoverability', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'appId', - outputs: [ - { - name: '', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getInitializationBlock', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_token', - type: 'address', - }, - ], - name: 'transferToVault', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_sender', - type: 'address', - }, - { - name: '_role', - type: 'bytes32', - }, - { - name: '_params', - type: 'uint256[]', - }, - ], - name: 'canPerform', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getEVMScriptRegistry', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'voteTime', - outputs: [ - { - name: '', - type: 'uint64', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'CREATE_VOTES_ROLE', - outputs: [ - { - name: '', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_sender', - type: 'address', - }, - { - name: '', - type: 'bytes', - }, - ], - name: 'canForward', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_voteId', - type: 'uint256', - }, - ], - name: 'canExecute', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_voteId', - type: 'uint256', - }, - { - name: '_voter', - type: 'address', - }, - ], - name: 'canVote', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'kernel', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_executionScript', - type: 'bytes', - }, - { - name: '_metadata', - type: 'string', - }, - ], - name: 'newVote', - outputs: [ - { - name: 'voteId', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_evmScript', - type: 'bytes', - }, - ], - name: 'forward', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'minAcceptQuorumPct', - outputs: [ - { - name: '', - type: 'uint64', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'isPetrified', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'votesLength', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_voteId', - type: 'uint256', - }, - { - name: '_supports', - type: 'bool', - }, - { - name: '_executesIfDecided', - type: 'bool', - }, - ], - name: 'vote', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_token', - type: 'address', - }, - { - name: '_supportRequiredPct', - type: 'uint64', - }, - { - name: '_minAcceptQuorumPct', - type: 'uint64', - }, - { - name: '_voteTime', - type: 'uint64', - }, - ], - name: 'initialize', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_executionScript', - type: 'bytes', - }, - { - name: '_metadata', - type: 'string', - }, - { - name: '_castVote', - type: 'bool', - }, - { - name: '_executesIfDecided', - type: 'bool', - }, - ], - name: 'newVote', - outputs: [ - { - name: 'voteId', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_voteId', - type: 'uint256', - }, - ], - name: 'executeVote', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'supportRequiredPct', - outputs: [ - { - name: '', - type: 'uint64', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'token', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'PCT_BASE', - outputs: [ - { - name: '', - type: 'uint64', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'isForwarder', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'voteId', - type: 'uint256', - }, - { - indexed: true, - name: 'creator', - type: 'address', - }, - { - indexed: false, - name: 'metadata', - type: 'string', - }, - ], - name: 'StartVote', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'voteId', - type: 'uint256', - }, - { - indexed: true, - name: 'voter', - type: 'address', - }, - { - indexed: false, - name: 'supports', - type: 'bool', - }, - { - indexed: false, - name: 'stake', - type: 'uint256', - }, - ], - name: 'CastVote', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'voteId', - type: 'uint256', - }, - ], - name: 'ExecuteVote', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - name: 'supportRequiredPct', - type: 'uint64', - }, - ], - name: 'ChangeSupportRequired', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - name: 'minAcceptQuorumPct', - type: 'uint64', - }, - ], - name: 'ChangeMinQuorum', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'executor', - type: 'address', - }, - { - indexed: false, - name: 'script', - type: 'bytes', - }, - { - indexed: false, - name: 'input', - type: 'bytes', - }, - { - indexed: false, - name: 'returnData', - type: 'bytes', - }, - ], - name: 'ScriptResult', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'vault', - type: 'address', - }, - { - indexed: true, - name: 'token', - type: 'address', - }, - { - indexed: false, - name: 'amount', - type: 'uint256', - }, - ], - name: 'RecoverToVault', - type: 'event', - }, -]; - -export const InitializableBytecode = '0x608060405234801561001057600080fd5b5061011d806100206000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630803fac08114604d5780638b3dd749146073575b600080fd5b348015605857600080fd5b50605f6097565b604080519115158252519081900360200190f35b348015607e57600080fd5b50608560bb565b60408051918252519081900360200190f35b60008060a060bb565b9050801580159060b557508060b260e9565b10155b91505090565b600060e47febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e60ed565b905090565b4390565b54905600a165627a7a723058201206f9a7b03e1a2b5d8568cd87c86c45b564552e04d8f731b4451cbe4310384e0029'; -export const InitializableABI = [{ - constant: true, inputs: [], name: 'hasInitialized', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'getInitializationBlock', outputs: [{ name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function', -}]; - -export const KernelBytecode = '0x60806040523480156200001157600080fd5b5060405160208062002cc7833981016040525180156200003e576200003e64010000000062000045810204565b5062000263565b620000586401000000006200014d810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152901562000134576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620000f8578181015183820152602001620000de565b50505050905090810190601f168015620001265780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506200014b6000196401000000006200017c810204565b565b60006200017760008051602062002ca7833981519152640100000000620018a56200025b82021704565b905090565b6200018f6401000000006200014d810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a45440000000000000000602082015290156200022e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252838181518152602001915080519060200190808383600083811015620000f8578181015183820152602001620000de565b506200025860008051602062002ca78339815191528264010000000062001ad36200025f82021704565b50565b5490565b9055565b612a3480620002736000396000f300608060405260043610620001865763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630803fac081146200018b5780631113ed0d14620001b7578063178e607914620001e157806332f0a3b514620001f9578063397edd41146200022d5780634558850c146200029d578063485cc95514620002bb578063756f604914620002e75780637e7db6e114620002ff57806380cd5ac3146200032357806386070cfe146200034a5780638b3dd74914620003625780638c61757d146200037a5780638ea8dc9d1462000395578063958fde8214620003ad5780639d4941d814620003d4578063ae5b254014620003f8578063be00bbd81462000422578063c050a7a61462000440578063d162f8b014620004b0578063db8a61d4146200051c578063de2873591462000534578063de4796ed146200054c578063e156a8f31462000564578063e8187ff0146200058b578063ede658b014620005a3578063fdef9106146200060f578063ff289fc51462000681575b600080fd5b3480156200019857600080fd5b50620001a3620006a8565b604080519115158252519081900360200190f35b348015620001c457600080fd5b50620001cf620006d6565b60408051918252519081900360200190f35b348015620001ee57600080fd5b50620001cf620006fa565b3480156200020657600080fd5b50620002116200070d565b60408051600160a060020a039092168252519081900360200190f35b3480156200023a57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452620002119482359460248035600160a060020a0316953695946064949201919081908401838280828437509497505050509135151592506200074a915050565b348015620002aa57600080fd5b50620002116004356024356200089d565b348015620002c857600080fd5b50620002e5600160a060020a0360043581169060243516620008c0565b005b348015620002f457600080fd5b50620001cf62000a8c565b3480156200030c57600080fd5b50620001a3600160a060020a036004351662000ab0565b3480156200033057600080fd5b5062000211600435600160a060020a036024351662000ab6565b3480156200035757600080fd5b50620001cf62000b96565b3480156200036f57600080fd5b50620001cf62000b9c565b3480156200038757600080fd5b50620002e560043562000bce565b348015620003a257600080fd5b50620001cf62000c8b565b348015620003ba57600080fd5b5062000211600435600160a060020a036024351662000c9e565b348015620003e157600080fd5b50620002e5600160a060020a036004351662000d75565b3480156200040557600080fd5b50620002e5600435602435600160a060020a03604435166200101a565b3480156200042f57600080fd5b5062000211600435602435620010d5565b3480156200044d57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452620002119482359460248035600160a060020a031695369594606494920191908190840183828082843750949750505050913515159250620010f9915050565b348015620004bd57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845262000211948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750620011d59650505050505050565b3480156200052957600080fd5b50620001cf620012e0565b3480156200054157600080fd5b5062000211620012f3565b3480156200055957600080fd5b50620001a36200131f565b3480156200057157600080fd5b5062000211600160a060020a036004351660243562001334565b3480156200059857600080fd5b50620001cf6200135a565b348015620005b057600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845262000211948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506200136d9650505050505050565b3480156200061c57600080fd5b50604080516020601f606435600481810135928301849004840285018401909552818452620001a394600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750620014789650505050505050565b3480156200068e57600080fd5b5062000211600160a060020a0360043516602435620015bb565b600080620006b562000b9c565b90508015801590620006d0575080620006cd620015da565b10155b91505090565b7f3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c90565b600080516020620029e983398151915290565b60015460009081527f9e3eae70920eeef6013879bf9155b985893698c145361c31365929723678b2576020526040902054600160a060020a031690565b600060008051602062002969833981519152620007776000805160206200298983398151915287620015de565b6200078f3330846200078985620015ec565b62001478565b6040805180820190915260128152600080516020620029c98339815191526020820152901515620008445760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562000808578181015183820152602001620007ee565b50505050905090810190601f168015620008365780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5062000861600080516020620029898339815191528888620015f6565b6200086e3088876200136d565b92508315620008935762000893600080516020620029e983398151915288856200101a565b5050949350505050565b6000602081815292815260408082209093529081522054600160a060020a031681565b6000620008cc62000b9c565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529015620009545760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506200095f620016c5565b6200098a60008051602062002989833981519152600080516020620029a98339815191528562001796565b620009a530600080516020620029a983398151915262001334565b905080600160a060020a031663c4d66de8836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15801562000a1c57600080fd5b505af115801562000a31573d6000803e3d6000fd5b5062000a639250600080516020620029e98339815191529150600080516020620029a983398151915290508362001796565b50507f7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d160015550565b7fc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f890565b50600190565b60006000805160206200296983398151915262000ae36000805160206200298983398151915285620015de565b62000af53330846200078985620015ec565b6040805180820190915260128152600080516020620029c9833981519152602082015290151562000b6d5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506040805160008082526020820190925262000b8d91879187916200074a565b95945050505050565b60015481565b600062000bc97febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e620018a5565b905090565b6000805160206200296983398151915262000bf9600080516020620029e983398151915283620015de565b62000c0b3330846200078985620015ec565b6040805180820190915260128152600080516020620029c9833981519152602082015290151562000c835760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b505050600155565b6000805160206200296983398151915281565b60006000805160206200296983398151915262000ccb6000805160206200298983398151915285620015de565b62000cdd3330846200078985620015ec565b6040805180820190915260128152600080516020620029c9833981519152602082015290151562000d555760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506040805160008082526020820190925262000b8d9187918791620010f9565b600080600062000d858462000ab0565b60408051808201909152601281527f5245434f5645525f444953414c4c4f5745440000000000000000000000000000602082015290151562000e0e5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b5062000e196200070d565b925062000e2683620018a9565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e5452414354000000000000602082015290151562000eaf5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50600160a060020a038416151562000f035760405130319250600160a060020a0384169083156108fc029084906000818181858888f1935050505015801562000efc573d6000803e3d6000fd5b5062000fc9565b508262000f20600160a060020a0382163063ffffffff620018d816565b915062000f3e600160a060020a038216848463ffffffff620019f216565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c4544000000602082015290151562000fc75760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b60008051602062002969833981519152620010368484620015de565b620010483330846200078985620015ec565b6040805180820190915260128152600080516020620029c98339815191526020820152901515620010c05760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50620010ce85858562001796565b5050505050565b600091825260208281526040808420928452919052902054600160a060020a031690565b600060008051602062002969833981519152620011266000805160206200298983398151915287620015de565b620011383330846200078985620015ec565b6040805180820190915260128152600080516020620029c98339815191526020820152901515620011b05760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50620011cd600080516020620029898339815191528888620015f6565b6200086e3088875b600080848484620011e562001b5c565b600160a060020a038416815260208082018490526060604083018181528451918401919091528351909160808401919085019080838360005b83811015620012385781810151838201526020016200121e565b50505050905090810190601f168015620012665780820380516001836020036101000a031916815260200191505b50945050505050604051809103906000f0801580156200128a573d6000803e3d6000fd5b5060408051600160a060020a03831681526000602082015280820187905290519192507fd880e726dced8808d727f02dd0e6fdd3a945b24bfee77e13367bcbe61ddbaf47919081900360600190a1949350505050565b6000805160206200298983398151915290565b600062000bc9600080516020620029e9833981519152600080516020620029a9833981519152620010d5565b60006000196200132e62000b9c565b14905090565b604080516000808252602082019092526200135390849084906200136d565b9392505050565b600080516020620029a983398151915290565b6000808484846200137d62001b6d565b600160a060020a038416815260208082018490526060604083018181528451918401919091528351909160808401919085019080838360005b83811015620013d0578181015183820152602001620013b6565b50505050905090810190601f168015620013fe5780820380516001836020036101000a031916815260200191505b50945050505050604051809103906000f08015801562001422573d6000803e3d6000fd5b5060408051600160a060020a03831681526001602082015280820187905290519192507fd880e726dced8808d727f02dd0e6fdd3a945b24bfee77e13367bcbe61ddbaf47919081900360600190a1949350505050565b60008062001485620012f3565b9050600160a060020a03811615801590620015b157506040517ffdef9106000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483019081528782166024840152604483018790526080606484019081528651608485015286519285169363fdef9106938b938b938b938b9360a490910190602085019080838360005b838110156200153157818101518382015260200162001517565b50505050905090810190601f1680156200155f5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156200158257600080fd5b505af115801562001597573d6000803e3d6000fd5b505050506040513d6020811015620015ae57600080fd5b50515b9695505050505050565b60408051600080825260208201909252620013539084908490620011d5565b4390565b606062001353838362001a76565b8051602002815290565b6000620016048484620010d5565b9050600160a060020a03811615620016b25760408051808201909152601981527f4b45524e454c5f494e56414c49445f4150505f4348414e4745000000000000006020820152600160a060020a0382811690841614620016ab5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50620016bf565b620016bf84848462001796565b50505050565b620016cf62000b9c565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529015620017575760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b506200179462001766620015da565b7febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e9063ffffffff62001ad316565b565b620017a181620018a9565b60408051808201909152601781527f4b45524e454c5f4150505f4e4f545f434f4e545241435400000000000000000060208201529015156200182a5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b50600083815260208181526040808320858452825291829020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03851690811790915582519081529151849286927f2ec1ae0a449b7ae354b9dacfb3ade6b6332ba26b7fcbb935835fa39dd7263b2392918290030190a3505050565b5490565b600080600160a060020a0383161515620018c75760009150620018d2565b823b90506000811191505b50919050565b60408051600160a060020a0383166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a082310000000000000000000000000000000000000000000000000000000017905260009081806200195a868462001ad7565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f52455645525445440000000060208201529193509150821515620019e85760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101562000808578181015183820152602001620007ee565b5095945050505050565b60408051600160a060020a038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905260009062000b8d858262001b09565b60408051600280825260608083018452926020830190803883390190505090508281600081518110151562001aa757fe5b60209081029091010152805182908290600190811062001ac357fe5b6020908102909101015292915050565b9055565b6000806000806040516020818751602089018a5afa9250600083111562001afd57805191505b50909590945092505050565b6000806040516020818551602087016000895af1600081111562001b52573d801562001b3e576020811462001b485762001b50565b6001935062001b50565b600183511493505b505b5090949350505050565b6040516106fd8062001b7f83390190565b6040516106ed806200227c833901905600608060405234801561001057600080fd5b506040516106fd3803806106fd8339810160409081528151602083015191830151909201828282600061004b8464010000000061017a810204565b61005d836401000000006101a2810204565b61006f836401000000006101d9810204565b90506000825111156101185761008d816401000000006102a9810204565b151561009857600080fd5b80600160a060020a03168260405180828051906020019080838360005b838110156100cd5781810151838201526020016100b5565b50505050905090810190601f1680156100fa5780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af4915050151561011857600080fd5b50505050610145610137836101d9640100000000026401000000009004565b6401000000006102d6810204565b6101676101596401000000006102fb810204565b6401000000006102a9810204565b151561017257600080fd5b505050610354565b61019f6000805160206106bd8339815191528264010000000061032661032682021704565b50565b61019f7fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b8264010000000061032661032682021704565b60006101ec64010000000061032a810204565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527ff1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f6004820152602481018590529051600160a060020a03929092169163be00bbd8916044808201926020929091908290030181600087803b15801561027757600080fd5b505af115801561028b573d6000803e3d6000fd5b505050506040513d60208110156102a157600080fd5b505192915050565b600080600160a060020a03831615156102c557600091506102d0565b823b90506000811191505b50919050565b61019f6000805160206106dd8339815191528264010000000061032661032682021704565b60006103216000805160206106dd83398151915264010000000061031e61035082021704565b905090565b9055565b60006103216000805160206106bd83398151915264010000000061031e61035082021704565b5490565b61035a806103636000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634555d5c9811461012b57806348a0c8dd146101525780635c60da1b1461017b57806380afdea8146101b9578063d4aae0c4146101ce575b6127107f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea6000825a10156100e15760003411361583541616156100dc576040513381523460208201527f15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1604082a1005b600080fd5b6100e96101e3565b9050610126816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506101f2945050505050565b505050005b34801561013757600080fd5b50610140610233565b60408051918252519081900360200190f35b34801561015e57600080fd5b50610167610238565b604080519115158252519081900360200190f35b34801561018757600080fd5b506101906101e3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101c557600080fd5b50610140610263565b3480156101da57600080fd5b5061019061028e565b60006101ed6102b9565b905090565b60006101fd836102e4565b151561020857600080fd5b612710905060008083516020850186855a03f43d604051816000823e82801561022f578282f35b8282fd5b600190565b60006101ed7f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea61031e565b60006101ed7fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b61031e565b60006101ed7f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b61031e565b60006101ed7fdee64df20d65e53d7f51cb6ab6d921a0a6a638a91e942e1d8d02df28e31c038e61031e565b60008073ffffffffffffffffffffffffffffffffffffffff8316151561030d5760009150610318565b823b90506000811191505b50919050565b5490565b5490565b9055565b90555600a165627a7a723058200a44fcb163e95c6029f007b585c5b1f4a19791176e8b69350961b028fadd9b8800294172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137bdee64df20d65e53d7f51cb6ab6d921a0a6a638a91e942e1d8d02df28e31c038e608060405234801561001057600080fd5b506040516106ed3803806106ed8339810160409081528151602083015191830151909201828282600061004b84640100000000610124810204565b61005d8364010000000061014c810204565b61006f83640100000000610183810204565b90506000825111156101185761008d81640100000000610253810204565b151561009857600080fd5b80600160a060020a03168260405180828051906020019080838360005b838110156100cd5781810151838201526020016100b5565b50505050905090810190601f1680156100fa5780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af4915050151561011857600080fd5b505050505050506102b3565b6101496000805160206106cd833981519152826401000000006103d761028082021704565b50565b6101497fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b826401000000006103d761028082021704565b6000610196640100000000610284810204565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527ff1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f6004820152602481018590529051600160a060020a03929092169163be00bbd8916044808201926020929091908290030181600087803b15801561022157600080fd5b505af1158015610235573d6000803e3d6000fd5b505050506040513d602081101561024b57600080fd5b505192915050565b600080600160a060020a038316151561026f576000915061027a565b823b90506000811191505b50919050565b9055565b60006102aa6000805160206106cd8339815191526401000000006103cf6102af82021704565b905090565b5490565b61040b806102c26000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634555d5c9811461012b57806348a0c8dd146101525780635c60da1b1461017b57806380afdea8146101b9578063d4aae0c4146101ce575b6127107f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea6000825a10156100e15760003411361583541616156100dc576040513381523460208201527f15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1604082a1005b600080fd5b6100e96101e3565b9050610126816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506101fa945050505050565b505050005b34801561013757600080fd5b5061014061023b565b60408051918252519081900360200190f35b34801561015e57600080fd5b50610167610240565b604080519115158252519081900360200190f35b34801561018757600080fd5b506101906101e3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101c557600080fd5b5061014061026b565b3480156101da57600080fd5b50610190610296565b60006101f56101f061026b565b6102c1565b905090565b600061020583610395565b151561021057600080fd5b612710905060008083516020850186855a03f43d604051816000823e828015610237578282f35b8282fd5b600290565b60006101f57f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea6103cf565b60006101f57fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b6103cf565b60006101f57f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b6103cf565b60006102cb610296565b604080517fbe00bbd80000000000000000000000000000000000000000000000000000000081527ff1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f600482015260248101859052905173ffffffffffffffffffffffffffffffffffffffff929092169163be00bbd8916044808201926020929091908290030181600087803b15801561036357600080fd5b505af1158015610377573d6000803e3d6000fd5b505050506040513d602081101561038d57600080fd5b505192915050565b60008073ffffffffffffffffffffffffffffffffffffffff831615156103be57600091506103c9565b823b90506000811191505b50919050565b5490565b5490565b9055565b90555600a165627a7a723058207342d5b39040c05b6485068ac1f0654ea21ac187a3954631eeb55545f938aed100294172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137bb6d92708f3d4817afc106147d969e229ced5c46e65e0a5002a0d391287762bd0f1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0fe3262375f45a6e2026b7e7b18c2b807434f2508fe1a2a3dfb493c7df8f4aad6a4b45524e454c5f415554485f4641494c45440000000000000000000000000000d6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fba165627a7a72305820c3d67a3fbc23ba7a388714030f1747db37b527f814bfe115c1938a4b5ecf1e840029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e'; -export const KernelABI = [{ - constant: true, inputs: [], name: 'hasInitialized', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'KERNEL_APP_ID', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'pure', type: 'function', -}, { - constant: true, inputs: [], name: 'APP_ADDR_NAMESPACE', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'pure', type: 'function', -}, { - constant: true, inputs: [], name: 'getRecoveryVault', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_appId', type: 'bytes32' }, { name: '_appBase', type: 'address' }, { name: '_initializePayload', type: 'bytes' }, { name: '_setDefault', type: 'bool' }], name: 'newAppInstance', outputs: [{ name: 'appProxy', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '', type: 'bytes32' }, { name: '', type: 'bytes32' }], name: 'apps', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_baseAcl', type: 'address' }, { name: '_permissionsCreator', type: 'address' }], name: 'initialize', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'CORE_NAMESPACE', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'pure', type: 'function', -}, { - constant: true, inputs: [{ name: 'token', type: 'address' }], name: 'allowRecoverability', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_appId', type: 'bytes32' }, { name: '_appBase', type: 'address' }], name: 'newAppInstance', outputs: [{ name: 'appProxy', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'recoveryVaultAppId', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'getInitializationBlock', outputs: [{ name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_recoveryVaultAppId', type: 'bytes32' }], name: 'setRecoveryVaultAppId', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'APP_MANAGER_ROLE', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_appId', type: 'bytes32' }, { name: '_appBase', type: 'address' }], name: 'newPinnedAppInstance', outputs: [{ name: 'appProxy', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_token', type: 'address' }], name: 'transferToVault', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_namespace', type: 'bytes32' }, { name: '_appId', type: 'bytes32' }, { name: '_app', type: 'address' }], name: 'setApp', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '_namespace', type: 'bytes32' }, { name: '_appId', type: 'bytes32' }], name: 'getApp', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_appId', type: 'bytes32' }, { name: '_appBase', type: 'address' }, { name: '_initializePayload', type: 'bytes' }, { name: '_setDefault', type: 'bool' }], name: 'newPinnedAppInstance', outputs: [{ name: 'appProxy', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_kernel', type: 'address' }, { name: '_appId', type: 'bytes32' }, { name: '_initializePayload', type: 'bytes' }], name: 'newAppProxyPinned', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'APP_BASES_NAMESPACE', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'pure', type: 'function', -}, { - constant: true, inputs: [], name: 'acl', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'isPetrified', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_kernel', type: 'address' }, { name: '_appId', type: 'bytes32' }], name: 'newAppProxy', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'DEFAULT_ACL_APP_ID', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'pure', type: 'function', -}, { - constant: false, inputs: [{ name: '_kernel', type: 'address' }, { name: '_appId', type: 'bytes32' }, { name: '_initializePayload', type: 'bytes' }], name: 'newAppProxy', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '_who', type: 'address' }, { name: '_where', type: 'address' }, { name: '_what', type: 'bytes32' }, { name: '_how', type: 'bytes' }], name: 'hasPermission', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_kernel', type: 'address' }, { name: '_appId', type: 'bytes32' }], name: 'newAppProxyPinned', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - inputs: [{ name: '_shouldPetrify', type: 'bool' }], payable: false, stateMutability: 'nonpayable', type: 'constructor', -}, { - anonymous: false, inputs: [{ indexed: false, name: 'proxy', type: 'address' }, { indexed: false, name: 'isUpgradeable', type: 'bool' }, { indexed: false, name: 'appId', type: 'bytes32' }], name: 'NewAppProxy', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'vault', type: 'address' }, { indexed: true, name: 'token', type: 'address' }, { indexed: false, name: 'amount', type: 'uint256' }], name: 'RecoverToVault', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'namespace', type: 'bytes32' }, { indexed: true, name: 'appId', type: 'bytes32' }, { indexed: false, name: 'app', type: 'address' }], name: 'SetApp', type: 'event', -}]; - -export const ACLBytecode = '0x6080604052620000176401000000006200001d810204565b6200024a565b6200003064010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200010d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016020808201828103835283518152835183929182019185019080838360005b83811015620000d1578181015183820152602001620000b7565b50505050905090810190601f168015620000ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50620001246000196401000000006200015b810204565b565b6000620001568119600160008051602062002df38339815191520216640100000000620021fa6200024282021704565b905090565b6200016e64010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160208082018281038352835181528351839291820191850190808383600083811015620000d1578181015183820152602001620000b7565b506200023f600019600160008051602062002df383398151915202168264010000000062002ac36200024682021704565b50565b5490565b9055565b612b99806200025a6000396000f3006080604052600436106101875763ffffffff60e060020a60003504166301ffc9a7811461018c5780630803fac0146101c55780630808343e146101da57806309699ff5146102075780630a8ed3db1461023257806315949ed7146102685780631b5e75be146102b15780631d63ff2b146103365780632914b9bd1461036657806332f0a3b5146103f05780633d6ab68f146104055780636815c9921461041a5780636d6712d8146104955780637e7db6e1146104cb57806380afdea8146104ec5780638b3dd749146105015780639d0effdb146105165780639d4941d81461054c578063a03c58321461056d578063a1658fad146105ea578063a479e5081461065e578063a5ed8bf814610673578063a885508a14610688578063afd925df146106b3578063b1905727146106e9578063be03847814610714578063c4d66de814610750578063c513f66e14610771578063d4aae0c414610786578063de4796ed1461079b578063f516bc0e146107b0578063f520b58d146107c5578063fdef910614610840575b600080fd5b34801561019857600080fd5b506101ae600160e060020a0319600435166108c2565b604080519115151515825251602090910181900390f35b3480156101d157600080fd5b506101ae6108fb565b3480156101e657600080fd5b5061020560048035600160a060020a0316906020013560001916610926565b005b34801561021357600080fd5b5061020560048035600160a060020a0316906020013560001916610ae8565b34801561023e57600080fd5b50610205600160a060020a0360048035821691602091820180359091169160001991013516610b8e565b34801561027457600080fd5b5061029e600160a060020a0360048035821691602091820180359091169160001991013516610bca565b6040805191825251602090910181900390f35b3480156102bd57600080fd5b5060408051602060048181018083018084018085018035850180358088028089018a01909a528089526101ae99600019883581169a600160a060020a03983589169a973590981698953516963686900386019694850194909381019291829185019084908082843750949750610c199650505050505050565b34801561034257600080fd5b5061034b610c5f565b60408051600019928316909216825251602090910181900390f35b34801561037257600080fd5b506103c8600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949750610c679650505050505050565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b3480156103fc57600080fd5b506103c8610d4d565b34801561041157600080fd5b5061034b610dc5565b34801561042657600080fd5b5060408051600460208181018082018083018035850180358086028087018901909952808852610205988735600160a060020a0390811699963516979435600019169636869003860196948101949381019291829185019084908082843750949750610dda9650505050505050565b3480156104a157600080fd5b506101ae600160a060020a0360048035821691602091820180359091169160001991013516610eb0565b3480156104d757600080fd5b506101ae600160a060020a0360043516610ef9565b3480156104f857600080fd5b5061034b610eff565b34801561050d57600080fd5b5061029e610f36565b34801561052257600080fd5b50610205600160a060020a0360048035821691602091820180359091169160001991013516610f68565b34801561055857600080fd5b50610205600160a060020a036004351661100c565b34801561057957600080fd5b506105a860048035600160a060020a0390811691602090810180359092169181018035600019169101356112a9565b604051808460ff1660ff1681526020018360ff1660ff16815260200182600160f060020a0316600160f060020a03168152602001935050505060405180910390f35b3480156105f657600080fd5b50604080516004602081810180820180358401803580850280860188019098528087526101ae978635600160a060020a0316979435600019169636819003810196909594810194938101929182918501908490808284375094975061133c9650505050505050565b34801561066a57600080fd5b506103c86114b0565b34801561067f57600080fd5b506103c8611561565b34801561069457600080fd5b5061020560048035600160a060020a0316906020013560001916611567565b3480156106bf57600080fd5b50610205600160a060020a0360048035821691602091820180359091169160001991013516611607565b3480156106f557600080fd5b506103c860048035600160a060020a03169060200135600019166116a6565b34801561072057600080fd5b5061020560048035600160a060020a039081169160209081018035831692908201803560001916920135166116e8565b34801561075c57600080fd5b50610205600160a060020a0360043516611866565b34801561077d57600080fd5b5061034b6119bf565b34801561079257600080fd5b506103c86119d4565b3480156107a757600080fd5b506101ae611a06565b3480156107bc57600080fd5b506103c8611a19565b3480156107d157600080fd5b50604080516004602081810180820180830180358501803580860280870189019099528088526101ae988735600160a060020a0390811699963516979435600019169636869003860196948101949381019291829185019084908082843750949750611a1e9650505050505050565b34801561084c57600080fd5b50604080516020601f60048281018084018085018035840180359586018790048702870188019098528487526101ae97600160a060020a0385358116989435169660001993359390931695368690038601959492840193918201918190840183828082843750949750611ae89650505050505050565b60006108cd82611afe565b806108f557506354053e6c60e060020a02600160e060020a03191682600160e060020a031916145b92915050565b600080610906610f36565b90508060001415801561092057508061091d611b1b565b10155b91505090565b600080516020612b2e83398151915260010261096e33826000604051908082528060200260200182016040528015610968578160200160208202803883390190505b5061133c565b60408051808201909152600f81527f4150505f415554485f4641494c454400000000000000000000000000000000006020820152901515610a2d5760405160e560020a62461bcd0281526004016020808201828103835283518152835183929182019185019080838360005b838110156109f25781810151838201526020016109da565b50505050905090810190601f168015610a1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082826000600160a060020a0316610a4583836116a6565b600160a060020a0316146040805190810160405280601481526020017f41434c5f4558495354454e545f4d414e41474552000000000000000000000000815250901515610ad45760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ae160018686611b1f565b5050505050565b8181610af482826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e833981519152815250901515610b7b5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610b8860018585611b1f565b50505050565b610bc58383836000604051908082528060200260200182016040528015610bbf578160200160208202803883390190505b50610dda565b505050565b600060016000806000610bde888888611bb2565b6000191660001916815260200190815260200160002054600019166000191681526020019081526020016000208054905090505b9392505050565b6000600080516020612b0e8339815191526001026000191686600019161415610c4457506001610c56565b610c5386600087878787611cba565b90505b95945050505050565b600060010281565b6000610c716114b0565b600160a060020a03166304bf2a7f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ccf578181015183820152602001610cb7565b50505050905090810190601f168015610cfc5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b505050506040513d6020811015610d4557600080fd5b505192915050565b6000610d576119d4565b600160a060020a03166332f0a3b56040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610d9457600080fd5b505af1158015610da8573d6000803e3d6000fd5b505050506040513d6020811015610dbe57600080fd5b5051905090565b600080516020612b2e83398151915260010281565b60008383610de882826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e833981519152815250901515610e6f5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506000845111610e9057600080516020612b0e833981519152600102610e99565b610e9984611f07565b9250610ea7878787866120d5565b50505050505050565b600060606000604051908082528060200260200182016040528015610edf578160200160208202803883390190505b509050610eee85858584611a1e565b91505b509392505050565b50600190565b6000610f317fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b600102600019166121fa565b905090565b6000610f317febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e600102600019166121fa565b8181610f7482826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e833981519152815250901515610ffb5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ae185858560006001026120d5565b600080600061101a84610ef9565b60408051808201909152601281527f5245434f5645525f444953414c4c4f5745440000000000000000000000000000602082015290151561109d5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506110a6610d4d565b92506110b183612202565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e545241435400000000000060208201529015156111345760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506000600160a060020a031684600160a060020a0316141561119c5730600160a060020a031631915082600160a060020a03166108fc839081150290604051600060405180830381858888f19350505050158015611196573d6000803e3d6000fd5b50611258565b50826111b7600160a060020a0382163063ffffffff61223a16565b91506111d3600160a060020a038216848463ffffffff61232516565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c454400000060208201529015156112565760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b600080600080600160008060006112c18c8c8c611bb2565b600019166000191681526020019081526020016000205460001916600019168152602001908152602001600020858154811015156112fb57fe5b6000918252602082200181015461010091820a810460ff9081169b6001840a83049091169a50600290920a9004600160f060020a0316975095505050505050565b6000806113476108fb565b15156113565760009150610ef1565b61135e6119d4565b90506000600160a060020a031681600160a060020a031614156113845760009150610ef1565b80600160a060020a031663fdef910686308761139f88612382565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561142c578181015183820152602001611414565b50505050905090810190601f1680156114595780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561147b57600080fd5b505af115801561148f573d6000803e3d6000fd5b505050506040513d60208110156114a557600080fd5b505195945050505050565b6000806114bb6119d4565b600160a060020a031663be00bbd87fd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb6001027fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd616001026040518363ffffffff1660e060020a028152600401808360001916600019168152602001826000191660001916815260200192505050602060405180830381600087803b158015610d1b57600080fd5b60001981565b818161157382826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e8339815191528152509015156115fa5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610b8860008585611b1f565b818161161382826116a6565b600160a060020a031633600160a060020a031614604080519081016040528060138152602001600080516020612b4e83398151915281525090151561169a5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ae1858585611b1f565b6000600260006116b6858561238c565b6000191660001916815260200190815260200160002060009054906101000a9004600160a060020a0316905092915050565b600080516020612b2e83398151915260010261172f33826000604051908082528060200260200182016040528015610968578160200160208202803883390190505061133c565b60408051808201909152600f81527f4150505f415554485f4641494c4544000000000000000000000000000000000060208201529015156117b25760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5083836000600160a060020a03166117ca83836116a6565b600160a060020a0316146040805190810160405280601481526020017f41434c5f4558495354454e545f4d414e414745520000000000000000000000008152509015156118595760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b50610ea78787878761246a565b61186e610f36565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156118f45760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506118fd612492565b6119056119d4565b600160a060020a031633600160a060020a0316146040805190810160405280601481526020017f41434c5f415554485f494e49545f4b45524e454c00000000000000000000000081525090151561199e5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b506119bc8130600080516020612b2e8339815191526001028461246a565b50565b600080516020612b0e83398151915260010281565b6000610f317f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b600102600019166121fa565b6000600019611a13610f36565b14905090565b600181565b6000806000806000611a31898989611bb2565b60001916600019168152602001908152602001600020549150600060010260001916826000191614158015611a6e5750611a6e8288888888610c19565b15611a7c5760019250611ade565b600080611a8c6000198989611bb2565b60001916600019168152602001908152602001600020549050600060010260001916816000191614158015611acb5750611acb81600019888888610c19565b15611ad95760019250611ade565b600092505b5050949350505050565b6000610c56858585611af986612562565b611a1e565b6301ffc9a760e060020a02600160e060020a031990811691161490565b4390565b8260026000611b2e858561238c565b6000191660001916815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a0316021790555082600160a060020a0316816000191683600160a060020a03167ff3addc8b8e25ee11528a61b0e65092cae0666ef0ec0c64cb303993c88d689b4d60405160405180910390a4505050565b600083838360405160200180807f5045524d495353494f4e00000000000000000000000000000000000000000000815250600a0184600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140183600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401826000191660001916815260200193505050506040516020818303038152906040526040518082805190602001908083835b602083101515611c855780518252602092839003929182019101611c66565b51815160016020949094036101000a939093039283169219169190911790526040519201829003909120979650505050505050565b6000611cc4612adc565b60008019808a161681526001602080830191825201812054819063ffffffff8a16101515611cf55760009350611efa565b600160008b600019166000191681526020019081526020016000208963ffffffff16815481101515611d2357fe5b600091825260208083206040805160608101909152920183015460ff61010085810a830482168216821685526001810a8304821682168216858501908152600160f060020a03600290920a9093048116811616919092015291810151909450811660cc9091161415611da457611d9d838b8a8a8a8a612609565b9350611efa565b8260400151600160f060020a0316905060cb60ff16836000015160ff161415611df457611dd88360400151898989896127e8565b611de3576000611de6565b60015b60ff16915060019050611e9e565b60c860ff16836000015160ff161415611e1657611e0f611b1b565b9150611e9e565b60c960ff16836000015160ff161415611e3157611e0f61292b565b60cd60ff16836000015160ff161415611e59578260400151600160f060020a03169150611e9e565b8451836000015160ff16101515611e735760009350611efa565b84836000015160ff16815181101515611e8857fe5b90602001906020020151600160f060020a031691505b6007600c811115611eab57fe5b836020015160ff16600c811115611ebe57fe5b600c811115611ec957fe5b1415611eda57600082119350611efa565b611ef782846020015160ff16600c811115611ef157fe5b8361292f565b93505b5050509695505050505050565b6000806000806000611f17612adc565b8660405160200180828051906020019060200280838360005b83811015611f48578181015183820152602001611f30565b505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083101515611f905780518252602092839003929182019101611f71565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020945060016000866000191660001916815260200190815260200160002093508380549050600014156120ca57600092505b86518310156120ca57868381518110151561200557fe5b90602001906020020151915060606040519081016040528061202684612a2e565b60ff16815260200161203784612a38565b60ff9081168252600160f060020a0380861660209384015287546001908101808a5560008a8152858120818801519284900301810180549688015160408901518616600261010090810a918202919097021991881686880a908102908902199589169490970a93840293909702199097169190911791909116929092179390931691909117905593909301929050611fee565b509295945050505050565b600080826000806120e7898989611bb2565b60001916600019168152602001908152602001600020816000191690555060006001026000191683600019161415915081801561213d5750600080516020612b0e83398151915260010260001916836000191614155b9050836000191685600160a060020a031687600160a060020a03167f759b9a74d5354b5801710a0c1b283cc9f0d32b607ac8ced10c83ac8e75c77d5285604051808215151515815260200191505060405180910390a480156121f257836000191685600160a060020a031687600160a060020a03167f8dfee25d92d73b8c9b868f9fa3e215cc1981033f426e53803e3da4f09a2cfc308660405180826000191660001916815260200191505060405180910390a45b505050505050565b5490565b5490565b6000806000600160a060020a031683600160a060020a031614156122295760009150612234565b823b90506000811191505b50919050565b60408051600160a060020a0383811616602490910190815281516020918201818103839003825290925281018051600160e060020a03908116901960e060020a6370a08231021617905260009081806122938684612a42565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f5245564552544544000000006020820152919350915082151561231b5760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5095945050505050565b60408051600160a060020a0380851616602490910190815260209081018381528251908201818103839003825290925281018051600160e060020a03908116901960e060020a63a9059cbb0216179052600090610eee8582612a73565b8051602002815290565b6000828260405160200180807f524f4c450000000000000000000000000000000000000000000000000000000081525060040183600160a060020a0316600160a060020a03166c010000000000000000000000000281526014018260001916600019168152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831015156124365780518252602092839003929182019101612417565b51815160016020949094036101000a9390930392831692191691909117905260405192018290039091209695505050505050565b612487848484600080516020612b0e8339815191526001026120d5565b610b88818484611b1f565b61249a610f36565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156125205760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5061256061252c611b1b565b60001960017febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e02169063ffffffff612ac316565b565b606060006020835181151561257357fe5b049050806020028351146040805190810160405280601a81526020017f434f4e56455253494f4e5f494d50524f5045525f4c454e4754480000000000008152509015156126025760405160e560020a62461bcd028152600401602080820182810383528351815283518392918201918501908083836000838110156109f25781810151838201526020016109da565b5082525090565b6000806000806000806000806000600c8081111561262357fe5b8f6020015160ff16600c81111561263657fe5b600c81111561264157fe5b14156126955761265d8f60400151600160f060020a0316612ac7565b919950975095506126728e898f8f8f8f611cba565b945061268e8e866126835787612685565b885b8f8f8f8f611cba565b98506127d6565b6126ab8f60400151600160f060020a0316612ac7565b5090945092506126bf8e858f8f8f8f611cba565b91506008600c8111156126ce57fe5b8f6020015160ff16600c8111156126e157fe5b600c8111156126ec57fe5b14156126fb57811598506127d6565b8180156127305750600a600c81111561271057fe5b8f6020015160ff16600c81111561272357fe5b600c81111561272e57fe5b145b1561273e57600198506127d6565b8115801561277457506009600c81111561275457fe5b8f6020015160ff16600c81111561276757fe5b600c81111561277257fe5b145b1561278257600098506127d6565b6127908e848f8f8f8f611cba565b9050600b600c81111561279f57fe5b8f6020015160ff16600c8111156127b257fe5b600c8111156127bd57fe5b14156127d257801515821515141598506127d6565b8098505b50505050505050509695505050505050565b600080606060008060008a600160a060020a0316632a151090905060e060020a029450848a8a8a8a6040516024018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015612891578181015183820152602001612879565b505050509050019550505050505060405160208183030381529060405290600160e060020a031916602082018051600160e060020a03838183161783525050505093506000808551602087018e5afa92508215156128f2576000955061291d565b3d9150816020141515612908576000955061291d565b604051826000823e8051915060008152508095505b505050505095945050505050565b4290565b60006001600c81111561293e57fe5b83600c81111561294a57fe5b14156129595750828114610c12565b6002600c81111561296657fe5b83600c81111561297257fe5b1415612982575082811415610c12565b6003600c81111561298f57fe5b83600c81111561299b57fe5b14156129aa5750808311610c12565b6004600c8111156129b757fe5b83600c8111156129c357fe5b14156129d25750808310610c12565b6005600c8111156129df57fe5b83600c8111156129eb57fe5b14156129fb575080831015610c12565b6006600c811115612a0857fe5b83600c811115612a1457fe5b1415612a24575080831115610c12565b5060009392505050565b60f860020a900490565b60f060020a900490565b6000806000806040516020818751602089018a5afa92506000831115612a6757805191505b50909590945092505050565b6000806040516020818551602087016000895af16000811115612ab9573d60008114612aa65760208114612aaf57612ab7565b60019350612ab7565b600183511493505b505b5090949350505050565b9055565b906020600290810a830491604090910a830490565b606060405190810160405280600060ff168152602001600060ff1681526020016000600160f060020a0316815250905600290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630b719b33c83b8e5d300c521cb8b54ae9bd933996a14bef8c2f4e0285d2d2400a41434c5f415554485f4e4f5f4d414e4147455200000000000000000000000000a165627a7a72305820ea4b7195f16bf7d48dfc10281c5f524cb5ebad276e463c345659b85b24e26df90029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e'; -export const ACLABI = [{ - constant: true, inputs: [{ name: '_interfaceId', type: 'bytes4' }], name: 'supportsInterface', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'pure', type: 'function', -}, { - constant: true, inputs: [], name: 'hasInitialized', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'createBurnedPermission', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'burnPermissionManager', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_entity', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'grantPermission', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '_entity', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'getPermissionParamsLength', outputs: [{ name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [{ name: '_paramsHash', type: 'bytes32' }, { name: '_who', type: 'address' }, { name: '_where', type: 'address' }, { name: '_what', type: 'bytes32' }, { name: '_how', type: 'uint256[]' }], name: 'evalParams', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'NO_PERMISSION', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [{ name: '_script', type: 'bytes' }], name: 'getEVMScriptExecutor', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'getRecoveryVault', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'CREATE_PERMISSIONS_ROLE', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_entity', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }, { name: '_params', type: 'uint256[]' }], name: 'grantPermissionP', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '_who', type: 'address' }, { name: '_where', type: 'address' }, { name: '_what', type: 'bytes32' }], name: 'hasPermission', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [{ name: 'token', type: 'address' }], name: 'allowRecoverability', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'appId', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'getInitializationBlock', outputs: [{ name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_entity', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'revokePermission', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_token', type: 'address' }], name: 'transferToVault', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '_entity', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }, { name: '_index', type: 'uint256' }], name: 'getPermissionParam', outputs: [{ name: '', type: 'uint8' }, { name: '', type: 'uint8' }, { name: '', type: 'uint240' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [{ name: '_sender', type: 'address' }, { name: '_role', type: 'bytes32' }, { name: '_params', type: 'uint256[]' }], name: 'canPerform', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'getEVMScriptRegistry', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'ANY_ENTITY', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'removePermissionManager', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_newManager', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'setPermissionManager', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [{ name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }], name: 'getPermissionManager', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_entity', type: 'address' }, { name: '_app', type: 'address' }, { name: '_role', type: 'bytes32' }, { name: '_manager', type: 'address' }], name: 'createPermission', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: false, inputs: [{ name: '_permissionsCreator', type: 'address' }], name: 'initialize', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'EMPTY_PARAM_HASH', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'kernel', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'isPetrified', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'BURN_ENTITY', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [{ name: '_who', type: 'address' }, { name: '_where', type: 'address' }, { name: '_what', type: 'bytes32' }, { name: '_how', type: 'uint256[]' }], name: 'hasPermission', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [{ name: '_who', type: 'address' }, { name: '_where', type: 'address' }, { name: '_what', type: 'bytes32' }, { name: '_how', type: 'bytes' }], name: 'hasPermission', outputs: [{ name: '', type: 'bool' }], payable: false, stateMutability: 'view', type: 'function', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'entity', type: 'address' }, { indexed: true, name: 'app', type: 'address' }, { indexed: true, name: 'role', type: 'bytes32' }, { indexed: false, name: 'allowed', type: 'bool' }], name: 'SetPermission', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'entity', type: 'address' }, { indexed: true, name: 'app', type: 'address' }, { indexed: true, name: 'role', type: 'bytes32' }, { indexed: false, name: 'paramsHash', type: 'bytes32' }], name: 'SetPermissionParams', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'app', type: 'address' }, { indexed: true, name: 'role', type: 'bytes32' }, { indexed: true, name: 'manager', type: 'address' }], name: 'ChangePermissionManager', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'executor', type: 'address' }, { indexed: false, name: 'script', type: 'bytes' }, { indexed: false, name: 'input', type: 'bytes' }, { indexed: false, name: 'returnData', type: 'bytes' }], name: 'ScriptResult', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: true, name: 'vault', type: 'address' }, { indexed: true, name: 'token', type: 'address' }, { indexed: false, name: 'amount', type: 'uint256' }], name: 'RecoverToVault', type: 'event', -}]; - -export const EVMScriptRegistryFactoryBytecode = '0x608060405234801561001057600080fd5b506100196100ab565b604051809103906000f080158015610035573d6000803e3d6000fd5b506000806101000a815481600160a060020a030219169083600160a060020a031602179055506100636100bb565b604051809103906000f08015801561007f573d6000803e3d6000fd5b50600160006101000a815481600160a060020a030219169083600160a060020a031602179055506100cb565b604051611a31806107b083390190565b604051610a60806121e183390190565b6106d6806100da6000396000f30060806040526004361061003d5763ffffffff60e060020a600035041663127d679c8114610042578063334041431461007f5780634de50a3a146100a0575b600080fd5b34801561004e57600080fd5b506100576100b5565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b34801561008b57600080fd5b50610057600160a060020a03600435166100cd565b3480156100ac57600080fd5b50610057610693565b6000809054906101000a9004600160a060020a031681565b60006060600082600160a060020a0316638129fc1c905060e060020a02604051602401604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050915083600160a060020a031663c050a7a67fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd616001026000809054906101000a9004600160a060020a03168560016040518563ffffffff1660e060020a02815260040180856000191660001916815260200184600160a060020a0316600160a060020a031681526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610219578181015183820152602001610201565b50505050905090810190601f1680156102465780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561026857600080fd5b505af115801561027c573d6000803e3d6000fd5b505050506040513d602081101561029257600080fd5b50516040805163de28735963ffffffff811660e060020a0282529151929550600160a060020a0387169260049091019060209080830381600087803b1580156102da57600080fd5b505af11580156102ee573d6000803e3d6000fd5b505050506040513d602081101561030457600080fd5b8101908080519060200190929190505050905080600160a060020a031663be038478308586600160a060020a03166319f3d10f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561036657600080fd5b505af115801561037a573d6000803e3d6000fd5b505050506040513d602081101561039057600080fd5b50516040805160e060020a63ffffffff8716028152600160a060020a03948516851660049091019081529284168416602093840190815260008019938416909316908401908152308516909416938301938452519290910191808303818387803b1580156103fd57600080fd5b505af1158015610411573d6000803e3d6000fd5b5050505082600160a060020a03166387a16f12600160009054906101000a9004600160a060020a03166040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561048557600080fd5b505af1158015610499573d6000803e3d6000fd5b505050506040513d60208110156104af57600080fd5b5050604080516319f3d10f63ffffffff811660e060020a0282529151600160a060020a0384811693639d0effdb9330938993841692916004019060209080830381600087803b15801561050157600080fd5b505af1158015610515573d6000803e3d6000fd5b505050506040513d602081101561052b57600080fd5b50516040805160e060020a63ffffffff8716028152600160a060020a039485168516600490910190815292841690931660209283019081526000801992831690921690830190815292519290910191808303818387803b15801561058e57600080fd5b505af11580156105a2573d6000803e3d6000fd5b5050505080600160a060020a031663a885508a8485600160a060020a03166319f3d10f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b505050506040513d602081101561061e57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a0393841690931660049093019283526000801992831690921660209384019081529051920191808303818387803b15801561067457600080fd5b505af1158015610688573d6000803e3d6000fd5b505050505050919050565b60015460006101000a9004600160a060020a0316815600a165627a7a72305820c23f76b24685d8f2399b5dc4dc464c727fbad20be073d9d432147925f1a02f3f00296080604052620000176401000000006200001d810204565b6200024a565b6200003064010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200010d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016020808201828103835283518152835183929182019185019080838360005b83811015620000d1578181015183820152602001620000b7565b50505050905090810190601f168015620000ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50620001246000196401000000006200015b810204565b565b6000620001568119600160008051602062001a118339815191520216640100000000620014546200024282021704565b905090565b6200016e64010000000062000126810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156200020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160208082018281038352835181528351839291820191850190808383600083811015620000d1578181015183820152602001620000b7565b506200023f600019600160008051602062001a11833981519152021682640100000000620016fe6200024682021704565b50565b5490565b9055565b6117b7806200025a6000396000f3006080604052600436106100f85763ffffffff60e060020a60003504166301ffc9a781146100fd57806304bf2a7f146101365780630803fac0146101c057806319f3d10f146101d55780632914b9bd1461020557806332f0a3b5146102675780635ca4d4bb1461027c5780637e7db6e11461029657806380afdea8146102b75780638129fc1c146102cc57806387a16f12146102e15780638b3dd749146103155780639d4941d81461032a578063a1658fad1461034b578063a479e508146103bf578063bd8fde1c146103d4578063cff606a0146103e9578063d4aae0c414610401578063de4796ed14610416578063f97a05df1461042b575b600080fd5b34801561010957600080fd5b5061011f600160e060020a031960043516610476565b604080519115151515825251602090910181900390f35b34801561014257600080fd5b50610198600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509497506104af9650505050505050565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b3480156101cc57600080fd5b5061011f6105e0565b3480156101e157600080fd5b506101ea61060b565b60408051600019928316909216825251602090910181900390f35b34801561021157600080fd5b50610198600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509497506106329650505050505050565b34801561027357600080fd5b50610198610718565b34801561028857600080fd5b50610294600435610790565b005b3480156102a257600080fd5b5061011f600160a060020a036004351661096c565b3480156102c357600080fd5b506101ea610972565b3480156102d857600080fd5b506102946109a9565b3480156102ed57600080fd5b50610302600160a060020a0360043516610a47565b6040805191825251602090910181900390f35b34801561032157600080fd5b50610302610bd3565b34801561033657600080fd5b50610294600160a060020a0360043516610c05565b34801561035757600080fd5b506040805160046020818101808201803584018035808502808601880190985280875261011f978635600160a060020a03169794356000191696368190038101969095948101949381019291829185019084908082843750949750610ea29650505050505050565b3480156103cb57600080fd5b50610198611018565b3480156103e057600080fd5b506101ea6110c9565b3480156103f557600080fd5b506102946004356110f0565b34801561040d57600080fd5b50610198611364565b34801561042257600080fd5b5061011f611396565b34801561043757600080fd5b506104436004356113a9565b6040518083600160a060020a0316600160a060020a03168152602001821515151581526020019250505060405180910390f35b6000610481826113d8565b806104a957506354053e6c60e060020a02600160e060020a03191682600160e060020a031916145b92915050565b60008060006004845110156040805190810160405280601e81526020017f45564d5245475f5343524950545f4c454e4754485f544f4f5f53484f5254000081525090151561057b5760405160e560020a62461bcd0281526004016020808201828103835283518152835183929182019185019080838360005b83811015610540578181015183820152602001610528565b50505050905090810190601f16801561056d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50610585846113f5565b63ffffffff1691506001600083815260200190815260200160002090508060000160149054906101000a900460ff166105bf5760006105d8565b8060000160009054906101000a9004600160a060020a03165b949350505050565b6000806105eb610bd3565b905080600014158015610605575080610602611402565b10155b91505090565b7fc4e90f38eea8c4212a009ca7b8947943ba4d4a58d19b683417f65291d1cd9ed260010281565b600061063c611018565b600160a060020a03166304bf2a7f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561069a578181015183820152602001610682565b50505050905090810190601f1680156106c75780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156106e657600080fd5b505af11580156106fa573d6000803e3d6000fd5b505050506040513d602081101561071057600080fd5b505192915050565b6000610722611364565b600160a060020a03166332f0a3b56040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561075f57600080fd5b505af1158015610773573d6000803e3d6000fd5b505050506040513d602081101561078957600080fd5b5051905090565b60007ff7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa36001026107bf83611406565b6107ca338383610ea2565b60408051808201909152600f81527f4150505f415554485f4641494c45440000000000000000000000000000000000602082015290151561084d5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506001600085815260200190815260200160002092508260000160149054906101000a900460ff166040805190810160405280601881526020017f45564d5245475f4558454355544f525f44495341424c454400000000000000008152509015156108fa5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b5060008360000160146101000a81548160ff0219169083151502179055508260000160009054906101000a9004600160a060020a0316600160a060020a0316847fc13cd9238f8ab1e5ab1f95cde77e89288fe5c328d04739adffd57b144b408fd160405160405180910390a350505050565b50600190565b60006109a47fd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b60010260001916611454565b905090565b6109b1610bd3565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152906000141515610a375760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b50610a40611458565b6001600055565b6000807fc4e90f38eea8c4212a009ca7b8947943ba4d4a58d19b683417f65291d1cd9ed2600102610aa433826000604051908082528060200260200182016040528015610a9e578160200160208202803883390190505b50610ea2565b60408051808201909152600f81527f4150505f415554485f4641494c454400000000000000000000000000000000006020820152901515610b275760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506000805460018082018355604080518082018252600160a060020a03808a16808352841515602080850191825287895280890196875295909501872092870151928701805495511515601461010090810a91820260ff9092021995851699900a98890298909302199095169690961791909116179091555190935083907f7697fa3288629310075a63816e294207c84f3cfc18ccf8e18eb917ec0bb566999080800390a35092915050565b60006109a47febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e60010260001916611454565b6000806000610c138461096c565b60408051808201909152601281527f5245434f5645525f444953414c4c4f57454400000000000000000000000000006020820152901515610c965760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b50610c9f610718565b9250610caa8361152c565b60408051808201909152601a81527f5245434f5645525f5641554c545f4e4f545f434f4e54524143540000000000006020820152901515610d2d5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506000600160a060020a031684600160a060020a03161415610d955730600160a060020a031631915082600160a060020a03166108fc839081150290604051600060405180830381858888f19350505050158015610d8f573d6000803e3d6000fd5b50610e51565b5082610db0600160a060020a0382163063ffffffff61156416565b9150610dcc600160a060020a038216848463ffffffff61164f16565b60408051808201909152601d81527f5245434f5645525f544f4b454e5f5452414e534645525f4641494c45440000006020820152901515610e4f5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b505b83600160a060020a031683600160a060020a03167f596caf56044b55fb8c4ca640089bbc2b63cae3e978b851f5745cbb7c5b288e02846040518082815260200191505060405180910390a350505050565b600080610ead6105e0565b1515610ebc5760009150611010565b610ec4611364565b90506000600160a060020a031681600160a060020a03161415610eea5760009150611010565b80600160a060020a031663fdef9106863087610f05886116b5565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610f92578181015183820152602001610f7a565b50505050905090810190601f168015610fbf5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b505050506040513d602081101561100b57600080fd5b505191505b509392505050565b600080611023611364565b600160a060020a031663be00bbd87fd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb6001027fddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd616001026040518363ffffffff1660e060020a028152600401808360001916600019168152602001826000191660001916815260200192505050602060405180830381600087803b1580156106e657600080fd5b7ff7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa360010281565b60007ff7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa360010261111f83611406565b61112a338383610ea2565b60408051808201909152600f81527f4150505f415554485f4641494c4544000000000000000000000000000000000060208201529015156111ad5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b50836000811180156111c0575060005481105b60408051808201909152601a81527f45564d5245475f494e4558495354454e545f4558454355544f5200000000000060208201529015156112435760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506001600086815260200190815260200160002093508360000160149054906101000a900460ff16156040805190810160405280601781526020017f45564d5245475f4558454355544f525f454e41424c45440000000000000000008152509015156112f15760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b5060018460000160146101000a81548160ff0219169083151502179055508360000160009054906101000a9004600160a060020a0316600160a060020a0316857f7697fa3288629310075a63816e294207c84f3cfc18ccf8e18eb917ec0bb5669960405160405180910390a35050505050565b60006109a47f4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b60010260001916611454565b60006000196113a3610bd3565b14905090565b600160205260009081526040812081015461010091820a8104600160a060020a0316916014900a900460ff1682565b6301ffc9a760e060020a02600160e060020a031990811691161490565b60006104a98260006116bf565b4390565b60606001604051908082528060200260200182016040528015611433578160200160208202803883390190505b5090508181600081518110151561144657fe5b602090810291010152919050565b5490565b611460610bd3565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156114e65760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b506115266114f2611402565b60001960017febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e02169063ffffffff6116fe16565b565b5490565b6000806000600160a060020a031683600160a060020a03161415611553576000915061155e565b823b90506000811191505b50919050565b60408051600160a060020a0383811616602490910190815281516020918201818103839003825290925281018051600160e060020a03908116901960e060020a6370a08231021617905260009081806115bd8684611702565b60408051808201909152601c81527f534146455f4552435f32305f42414c414e43455f524556455254454400000000602082015291935091508215156116455760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610540578181015183820152602001610528565b5095945050505050565b60408051600160a060020a0380851616602490910190815260209081018381528251908201818103839003825290925281018051600160e060020a03908116901960e060020a63a9059cbb02161790526000906116ac8582611733565b95945050505050565b8051602002815290565b6000806116cc8484611783565b60e060020a7fffffffff0000000000000000000000000000000000000000000000000000000090911604949350505050565b9055565b6000806000806040516020818751602089018a5afa9250600083111561172757805191505b50909590945092505050565b6000806040516020818551602087016000895af16000811115611779573d60008114611766576020811461176f57611777565b60019350611777565b600183511493505b505b5090949350505050565b6020010151905600a165627a7a72305820b03bf6da24af4735020436b780c3cfa6fab0f186d8b2a4a1d675e5a5bda0cf7e0029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e608060405261001564010000000061001a810204565b610232565b61002b64010000000061011b810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a454400000000000000006020820152906000141515610104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016020808201828103835283518152835183929182019185019080838360005b838110156100c95781810151838201526020016100b1565b50505050905090810190601f1680156100f65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5061011960001964010000000061014c810204565b565b600061014781196001600080516020610a4083398151915202166401000000006107c361022a82021704565b905090565b61015d64010000000061011b810204565b60408051808201909152601881527f494e49545f414c52454144595f494e495449414c495a4544000000000000000060208201529060001415156101fa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401602080820182810383528351815283518392918201918501908083836000838110156100c95781810151838201526020016100b1565b506102276000196001600080516020610a408339815191520216826401000000006107cf61022e82021704565b50565b5490565b9055565b6107ff806102416000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630803fac08114610071578063279cea351461009d5780638333d9b2146101505780638b3dd74914610180578063de4796ed146101a8575b600080fd5b34801561007d57600080fd5b506100866101bd565b604080519115151515825251602090910181900390f35b3480156100a957600080fd5b506100db60048035810160208181019291359181810180358201808401939035929181013590910190810190356101e8565b6040516020808201828103835283518152835183929182019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101656106ba565b60408051600019928316909216825251602090910181900390f35b34801561018c57600080fd5b506101956106e1565b6040805191825251602090910181900390f35b3480156101b457600080fd5b50610086610718565b6000806101c86106e1565b9050806000141580156101e25750806101df61072b565b10155b91505090565b606060008060008060008060006101fd6101bd565b60408051808201909152601481527f494e49545f4e4f545f494e495449414c495a454400000000000000000000000060208201529015156102bc5760405160e560020a62461bcd0281526004016020808201828103835283518152835183929182019185019080838360005b83811015610281578181015183820152602001610269565b50505050905090810190601f1680156102ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600496505b8c8710156106a95760408051808201909152601781527f45564d43414c4c535f494e56414c49445f4c454e47544800000000000000000060208201526018888f03101515156103535760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610281578181015183820152602001610269565b50610397878f8f8080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff61072f1692505050565b9550600094505b888510156104915789898681811015156103b457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156040805190810160405280601981526020017f45564d43414c4c535f424c41434b4c49535445445f43414c4c000000000000008152509015156104855760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610281578181015183820152602001610269565b5060019094019361039e565b8573ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f9dcff9d94fbfdb4622d11edb383005f95e78efb446c72d92f8e615c6025c470360405160405180910390a4610548876014018f8f8080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6107641692505050565b63ffffffff16935086601401600401925061059c838f8f8080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6107bc1692505050565b60408051808201909152601781527f45564d43414c4c535f494e56414c49445f4c454e475448000000000000000000602082015284860198509092508d881115151561062a5760405160e560020a62461bcd02815260040160208082018281038352835181528351839291820191850190808383600083811015610281578181015183820152602001610269565b50600080858460008a6113885a03f190508060008114610649576106a3565b6040513d6000811461065e573d6000833e3d82fd5b60e560020a62461bcd02825260206004830152601660248301527f45564d43414c4c535f43414c4c5f5245564552544544000000000000000000006044830152606482fd5b506102c2565b505050505050509695505050505050565b60017f2dc858a00f3e417be1394b87c07158e989ec681ce8cc68a9093680ac1a8703020290565b60006107137febb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e600102600019166107c3565b905090565b60006000196107256106e1565b14905090565b4390565b60008061073c84846107c7565b6c010000000000000000000000006bffffffffffffffffffffffff1990911604949350505050565b60008061077184846107c7565b7c01000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000090911604949350505050565b6020010190565b5490565b602001015190565b90555600a165627a7a7230582036ed5b0abc077894d617a4f7b362ad245a2bd5c0ab23014001effae373a3c01d0029ebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e'; -export const EVMScriptRegistryFactoryABI = [{ - constant: true, inputs: [], name: 'baseReg', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_dao', type: 'address' }], name: 'newEVMScriptRegistry', outputs: [{ name: 'reg', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'baseCallScript', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - inputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', -}]; - -export const DAOFactoryBytecode = '0x608060405234801561001057600080fd5b506040516060806110d2833981016040528051602091820180519201519091906000600160a060020a0390811690821614151561006f5780600260006101000a815481600160a060020a030219169083600160a060020a031602179055505b5060008054600160a060020a0393841661010083900a908102858202199283161790925560018054939094169091029116179055611020806100b26000396000f3006080604052600436106100485763ffffffff60e060020a600035041663086b339e811461004d578063216874441461008a578063656362b5146100ab578063b16dd130146100c0575b600080fd5b34801561005957600080fd5b506100626100d5565b6040518082600160a060020a0316600160a060020a0316815260200191505060405180910390f35b34801561009657600080fd5b50610062600160a060020a03600435166100ec565b3480156100b757600080fd5b50610062610a57565b3480156100cc57600080fd5b50610062610a6e565b60015460006101000a9004600160a060020a031681565b6000806000806000806000809054906101000a9004600160a060020a0316610112610a86565b8082600160a060020a0316600160a060020a03168152602001915050604051809103906000f08015801561014a573d6000803e3d6000fd5b5094506000600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a031614156102245784600160a060020a031663485cc955600160009054906101000a9004600160a060020a0316896040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182600160a060020a0316600160a060020a0316815260200192505050600060405180830381600087803b15801561020757600080fd5b505af115801561021b573d6000803e3d6000fd5b50505050610a0e565b84600160a060020a031663485cc955600160009054906101000a9004600160a060020a0316306040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182600160a060020a0316600160a060020a0316815260200192505050600060405180830381600087803b1580156102ae57600080fd5b505af11580156102c2573d6000803e3d6000fd5b5050505084600160a060020a031663de2873596040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d602081101561032e57600080fd5b505160408051633d6ab68f63ffffffff811660e060020a0282529151929650600160a060020a0387169260049091019060209080830381600087803b15801561037657600080fd5b505af115801561038a573d6000803e3d6000fd5b505050506040513d60208110156103a057600080fd5b505160408051638ea8dc9d63ffffffff811660e060020a0282529151929550600160a060020a0388169260049091019060209080830381600087803b1580156103e857600080fd5b505af11580156103fc573d6000803e3d6000fd5b505050506040513d602081101561041257600080fd5b505160025460408051630a8ed3db63ffffffff811660e060020a028252600160a060020a03600061010081900a9095048116811681166004909301928352898116908116602093840190815285198a8116169084019081529351959750949093929091019190808303818387803b15801561048c57600080fd5b505af11580156104a0573d6000803e3d6000fd5b5050505083600160a060020a031663be038478600260009054906101000a9004600160a060020a03168785306040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001836000191660001916815260200182600160a060020a0316600160a060020a03168152602001945050505050600060405180830381600087803b15801561055857600080fd5b505af115801561056c573d6000803e3d6000fd5b50505050600260009054906101000a9004600160a060020a0316600160a060020a03166333404143866040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156105e057600080fd5b505af11580156105f4573d6000803e3d6000fd5b505050506040513d602081101561060a57600080fd5b505160408051600160a060020a0380841616815290519192507f1a40224412580c1ae5a2fbe8029a565f49a3a029608a8fd9320b32477f31457991602090910181900390a183600160a060020a0316639d0effdb600260009054906101000a9004600160a060020a031687856040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b5050505083600160a060020a031663a885508a86846040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a03168152602001826000191660001916815260200192505050600060405180830381600087803b15801561076c57600080fd5b505af1158015610780573d6000803e3d6000fd5b5050505083600160a060020a0316639d0effdb600260009054906101000a9004600160a060020a031686866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b15801561081e57600080fd5b505af1158015610832573d6000803e3d6000fd5b5050505083600160a060020a0316639d0effdb3086866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b1580156108bb57600080fd5b505af11580156108cf573d6000803e3d6000fd5b5050505083600160a060020a0316630a8ed3db8886866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b5050505083600160a060020a031663afd925df8886866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200182600019166000191681526020019350505050600060405180830381600087803b1580156109f557600080fd5b505af1158015610a09573d6000803e3d6000fd5b505050505b60408051600160a060020a0380881616815290517f3a7eb042a769adf51e9be78b68ed7af0ad7b379246536efc376ed2ca012382829160200181900390a1509295945050505050565b60025460006101000a9004600160a060020a031681565b6000809054906101000a9004600160a060020a031681565b60405161055e80610a97833901905600608060405234801561001057600080fd5b5060405160208061055e833981016040525161003481640100000000610112810204565b151561003f57600080fd5b7fc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8600190810260008019918216808316825260208083018381528082018085207f3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c9097028616958616855295905293822080546101009390930a600160a060020a038181021990941687851691820217909155604080519190931681529151929390927f2ec1ae0a449b7ae354b9dacfb3ade6b6332ba26b7fcbb935835fa39dd7263b239290910181900390a35061014a565b6000806000600160a060020a031683600160a060020a031614156101395760009150610144565b823b90506000811191505b50919050565b610405806101596000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634555d5c9811461012e5780634558850c1461015657806348a0c8dd146101bd5780635c60da1b146101e957806386070cfe146101fe575b61271060017f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea026000825a10156100e45760003411361583541616156100df576040513381523460208201527f15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1604082a1005b600080fd5b6100ec61022e565b9050610129816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506102bc945050505050565b505050005b34801561013a57600080fd5b506101436102ff565b6040805191825251602090910181900390f35b34801561016257600080fd5b5061017b60048035600019908116916020013516610304565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c957600080fd5b506101d2610346565b604080519115151515825251602090910181900390f35b3480156101f557600080fd5b5061017b61022e565b34801561020a57600080fd5b5061021361037d565b60408051600019928316909216825251602090910181900390f35b6000801960017fc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8810282168216835260208084018481529081018085207f3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c909302841690931684525281205473ffffffffffffffffffffffffffffffffffffffff6101009290920a90041690565b60006102c783610383565b15156102d257600080fd5b612710905060008083516020850186855a03f43d604051816000823e82600081146102fb578282f35b8282fd5b600290565b60006020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006103787f665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea600102600019166103d5565b905090565b60015481565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156103c457600091506103cf565b823b90506000811191505b50919050565b54905600a165627a7a72305820d129f069f5a8553498f3d265660cfd38890ff302b163515c6a5a3d03a47c2bed0029a165627a7a72305820508849b0e7b1436712b9423c4995cf7c0ffbb64243c1f3255a6d4584f31b726d0029'; -export const DAOFactoryABI = [{ - constant: true, inputs: [], name: 'baseACL', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [{ name: '_root', type: 'address' }], name: 'newDAO', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'regFactory', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: true, inputs: [], name: 'baseKernel', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function', -}, { - inputs: [{ name: '_baseKernel', type: 'address' }, { name: '_baseACL', type: 'address' }, { name: '_regFactory', type: 'address' }], payable: false, stateMutability: 'nonpayable', type: 'constructor', -}, { - anonymous: false, inputs: [{ indexed: false, name: 'dao', type: 'address' }], name: 'DeployDAO', type: 'event', -}, { - anonymous: false, inputs: [{ indexed: false, name: 'reg', type: 'address' }], name: 'DeployEVMScriptRegistry', type: 'event', -}]; - -export const CounterBytecode = '0x60806040526000805534801561001457600080fd5b50610143806100246000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632baeceb71461005c57806361bc221a14610087578063d09de08a146100b2575b600080fd5b34801561006857600080fd5b506100716100dd565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b5061009c6100f7565b6040518082815260200191505060405180910390f35b3480156100be57600080fd5b506100c76100fd565b6040518082815260200191505060405180910390f35b600060016000808282540392505081905550600054905090565b60005481565b6000600160008082825401925050819055506000549050905600a165627a7a7230582065e2500e33bce3cfc5a98c35e4780aabaf2a2b8176c14afe5371ffe8d6dfab540029'; -export const CounterABI = [{ - constant: false, inputs: [], name: 'decrement', outputs: [{ name: '', type: 'int256' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}, { - constant: true, inputs: [], name: 'counter', outputs: [{ name: '', type: 'int256' }], payable: false, stateMutability: 'view', type: 'function', -}, { - constant: false, inputs: [], name: 'increment', outputs: [{ name: '', type: 'int256' }], payable: false, stateMutability: 'nonpayable', type: 'function', -}]; diff --git a/scripts/eth/dao/voting-dao-test.js b/scripts/eth/dao/voting-dao-test.js deleted file mode 100644 index 3e4282875..000000000 --- a/scripts/eth/dao/voting-dao-test.js +++ /dev/null @@ -1,190 +0,0 @@ -import { - KernelBytecode, KernelABI, ACLBytecode, ACLABI, EVMScriptRegistryFactoryBytecode, DAOFactoryBytecode, DAOFactoryABI, VotingDAOABI, VotingDAOBytecode, MiniMeTokenABI, MiniMeTokenBytecode, CounterABI, CounterBytecode, -} from './bytecodes-and-abis'; - -import { - getTestEVMAccountsFromWeb3, endowEVMAddressWithDefault, sendEVMTxn, deployContract, getWeb3, -} from '../helpers'; - -require('dotenv').config(); - -async function createDaoFactory(web3, signer) { - const kernelContractAddr = await deployContract(web3, signer, KernelBytecode + web3.eth.abi.encodeParameters(['bool'], [true]).slice(2)); - const aclContractAddr = await deployContract(web3, signer, ACLBytecode); - const evmRegContractAddr = await deployContract(web3, signer, EVMScriptRegistryFactoryBytecode); - const daoFactContractAddr = await deployContract(web3, signer, DAOFactoryBytecode + web3.eth.abi.encodeParameters(['address', 'address', 'address'], [kernelContractAddr, aclContractAddr, evmRegContractAddr]).slice(2)); - console.log(`Creating Kernel ${kernelContractAddr}, ACL ${aclContractAddr}, EVM Script registry ${evmRegContractAddr} and DAO factory ${daoFactContractAddr}`); - return [kernelContractAddr, aclContractAddr, evmRegContractAddr, daoFactContractAddr]; -} - -async function createNewDao(web3, signer, root, daoFactAddr) { - const daoFactContract = new web3.eth.Contract(DAOFactoryABI, daoFactAddr); - const receipt = await sendEVMTxn(web3, signer, daoFactAddr, daoFactContract.methods.newDAO(root).encodeABI()); - // The last log contains the address of the DAO - const decoded = web3.eth.abi.decodeLog([{ type: 'address', name: 'dao' }], receipt.logs[receipt.logs.length - 1].data); - console.log(`Created new DAO ${decoded.dao} from factory`); - return decoded.dao; -} - -async function setupAcl(web3, signer, root, daoAddr) { - console.log(`Setting ${root} as the manager of the kernel`); - const dao = new web3.eth.Contract(KernelABI, daoAddr); - const aclAddr = await dao.methods.acl().call(); - const acl = new web3.eth.Contract(ACLABI, aclAddr); - const managerRole = await dao.methods.APP_MANAGER_ROLE().call(); - await sendEVMTxn(web3, signer, acl.options.address, acl.methods.createPermission(root, dao.options.address, managerRole, root).encodeABI()); - console.log(`Kernel ACL is ${aclAddr}`); - return aclAddr; -} - -async function setupVotingApp(web3, signer, root, appId, daoAddr, aclAddr) { - console.log('Install voting app and permit anyone with tokens to vote'); - const dao = new web3.eth.Contract(KernelABI, daoAddr); - const acl = new web3.eth.Contract(ACLABI, aclAddr); - - // Pattern to keep the contract upgradable. - const votingBaseAddress = await deployContract(web3, signer, VotingDAOBytecode); - const votingBase = new web3.eth.Contract(VotingDAOABI, votingBaseAddress); - const receipt = await sendEVMTxn(web3, signer, dao.options.address, dao.methods.newAppInstance(appId, votingBaseAddress).encodeABI()); - // The last log contains the address of the voting app - const decoded = web3.eth.abi.decodeLog([{ type: 'address', name: 'proxy' }], receipt.logs[receipt.logs.length - 1].data); - const votingAppAddress = decoded.proxy; - console.log(`Installed voting app at ${votingAppAddress}`); - - const anyOne = '0xffffffffffffffffffffffffffffffffffffffff'; // Granting permission to this special address means everyone has this permission - await sendEVMTxn(web3, signer, acl.options.address, acl.methods.createPermission(anyOne, votingAppAddress, (await votingBase.methods.CREATE_VOTES_ROLE().call()), root).encodeABI()); - return votingAppAddress; -} - -async function deployToken(web3, signer, voters) { - const zeroAddress = `0x${'0'.repeat(40)}`; // 0x0000...0000 - console.log('Deploying MiniMeToken token and giving tokens to holders to vote with'); - const tokenArgsABI = web3.eth.abi.encodeParameters(['address', 'address', 'uint', 'string', 'uint8', 'string', 'bool'], [zeroAddress, zeroAddress, 0, 'MiniMeToken', 0, 'mm', true]); - const tokenContractBytecode = MiniMeTokenBytecode + tokenArgsABI.slice(2); - const tokenContractAddr = await deployContract(web3, signer, tokenContractBytecode); - const tokenContract = new web3.eth.Contract(MiniMeTokenABI, tokenContractAddr); - - /* eslint-disable no-await-in-loop */ - for (let i = 0; i < voters.length; i++) { - const [address, amount] = voters[i]; - await sendEVMTxn(web3, signer, tokenContractAddr, tokenContract.methods.generateTokens(address, amount).encodeABI()); - } - - console.log(`Token deployed at ${tokenContractAddr}`); - return tokenContractAddr; -} - -async function initializeVotingApp(web3, signer, votingAppAddress, tokenContractAddr) { - console.log('Initializing voting app with token'); - - const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); - const ten16 = web3.utils.toBN(10).pow(web3.utils.toBN(16)); // 10^16 - - // Acceptance requires >50% and participation of >20% and voting lasts for 30 seconds. These values are just an example. - const supportRequiredPct = web3.utils.toBN(50).mul(ten16); - const minAcceptQuorumPct = web3.utils.toBN(20).mul(ten16); - const votingDuration = 30; - - await sendEVMTxn(web3, signer, votingAppAddress, votingApp.methods.initialize(tokenContractAddr, supportRequiredPct, minAcceptQuorumPct, votingDuration).encodeABI()); -} - -async function setupVotingExecutor(web3, signer) { - console.log('Setting up Counter contract whose methods will be called through voting'); - - const counterAddr = await deployContract(web3, signer, CounterBytecode); - const counterContract = new web3.eth.Contract(CounterABI, counterAddr); - - const incrementCall = counterContract.methods.increment().encodeABI().slice(2); - const decrementCall = counterContract.methods.decrement().encodeABI().slice(2); - - // Aragon specific encoding of the `increment` and `decrement` methods of the Counter. - // [1 byte identifier] + [ 20 bytes (address) ] + [ 4 bytes (uint32: calldata length) ] + [ calldataLength bytes (payload) ] - function encode(calldata) { - return `0x00000001${ - web3.eth.abi.encodeParameter('address', counterAddr).slice(26) // Remove leading 0x and 12 more bytes - }${web3.eth.abi.encodeParameter('uint256', calldata.length / 2).slice(58) // Remove leading 0x and 28 more bytes - }${calldata}`; - } - - // Encoded actions that will be executed on successful voting - const incrementScript = encode(incrementCall); - const decrementScript = encode(decrementCall); - - console.log(`Counter deployed at ${counterAddr}, incrementer script is ${incrementScript}, decrementer script is ${decrementScript}`); - - return [counterAddr, incrementScript, decrementScript]; -} - -async function createNewVote(web3, signer, votingAppAddress, execScript) { - const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); - // vote - const receipt = await sendEVMTxn(web3, signer, votingAppAddress, votingApp.methods.newVote(execScript, '').encodeABI()); - - // Extract `voteId` from the first log - const decodedLog = web3.eth.abi.decodeLog([{ type: 'uint256', name: 'voteId', indexed: true }, { type: 'address', name: 'creator', indexed: true }, { type: 'string', name: 'metadata' }], receipt.logs[0].data, [receipt.logs[0].topics[1], receipt.logs[0].topics[2]]); - console.log(`Created a new vote with id: ${decodedLog.voteId}`); - return decodedLog.voteId; -} - -async function getCounter(web3, counterAddr) { - const counterContract = new web3.eth.Contract(CounterABI, counterAddr); - return counterContract.methods.counter().call(); -} - -async function main() { - const web3 = getWeb3(); - - // Create some test accounts. Alice will be the manager of the DAO while Bob, Carol and Dave will be voters. - const [alice, bob, carol, dave] = getTestEVMAccountsFromWeb3(web3); - - // Endow accounts with tokens so they can pay fees for transactions - await endowEVMAddressWithDefault(alice.address); - await endowEVMAddressWithDefault(bob.address); - await endowEVMAddressWithDefault(carol.address); - await endowEVMAddressWithDefault(dave.address); - - // Create a contract factory to create new DAO instance. - const [, , , daoFactContractAddr] = await createDaoFactory(web3, alice); - - // Create a new DAO instance - const daoAddr = await createNewDao(web3, alice, alice.address, daoFactContractAddr); - - // Set access control and set Alice as DAO's manager - const aclAddr = await setupAcl(web3, alice, alice.address, daoAddr); - - // Some unique app id - const appId = '0x0000000000000000000000000000000000000000000000000000000000000100'; - - // Create a voting contract, install it as an app in the DAO and allow any token holder to vote - const votingAppAddress = await setupVotingApp(web3, alice, alice.address, appId, daoAddr, aclAddr); - const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); - - // Deploy a token contract where Bob, Carol and Dave will have 51%, 29% and 20% tokens as thus proportional voting power. - const tokenContractAddr = await deployToken(web3, alice, [[bob.address, 51], [carol.address, 29], [dave.address, 20]]); - - // Initialize the voting by supplying the token contract and thresholds for voting. - await initializeVotingApp(web3, alice, votingAppAddress, tokenContractAddr); - - // A Counter contract as an example executor. In practice, the executor methods will only allow calls by the voting contract. - const [counterAddr, incrementScript] = await setupVotingExecutor(web3, alice); - - // Bob alone can increment the Counter as he has 51% tokens - console.log(`Counter before increment from Bob ${(await getCounter(web3, counterAddr))}`); - await sendEVMTxn(web3, bob, votingAppAddress, votingApp.methods.newVote(incrementScript, '').encodeABI()); - console.log(`Counter after increment from Bob ${(await getCounter(web3, counterAddr))}`); - - // Carol creates a new vote - const voteId = await createNewVote(web3, carol, votingAppAddress, incrementScript); - // Dave seconds Carol's vote - await sendEVMTxn(web3, dave, votingAppAddress, votingApp.methods.vote(voteId, true, true).encodeABI()); - console.log("Counter after attempted increment from Carol and Dave. Counter will not change as Bob and Carol don't have enough voting power"); - - process.exit(0); -} - -main() - .then(() => process.exit(0)) - .catch((e) => { - console.error(e); - process.exit(1); - }); diff --git a/scripts/fetch-block.js b/scripts/fetch-block.js deleted file mode 100644 index 1af268a5a..000000000 --- a/scripts/fetch-block.js +++ /dev/null @@ -1,13 +0,0 @@ -import { firstValueFrom } from 'rxjs'; -import { blockByNumber, withDockAPI } from './helpers'; - -const { FullNodeEndpoint, BlockNumber } = process.env; - -async function main(dock, number) { - const block = await firstValueFrom(blockByNumber(dock, number)); - - console.log('Human:', JSON.stringify(block.toHuman(), void 0, 2), '\n'); - console.log('JSON:', JSON.stringify(block.toJSON(), void 0, 2)); -} - -withDockAPI({ address: FullNodeEndpoint })(main)(BlockNumber).catch(console.error); diff --git a/scripts/run_cheqd_node_in_docker b/scripts/run_cheqd_node_in_docker new file mode 100644 index 000000000..fd2a88a2b --- /dev/null +++ b/scripts/run_cheqd_node_in_docker @@ -0,0 +1,24 @@ +#!/bin/bash + +# Starts a dock test node in docker for testing. Automatically deletes the container on exit. +# Arguments passed to this script are forwarded to the node binary. +# +# Example use: +# +# ```bash +# # Start a local test node +# ./run_dock_node_in_docker --dev +# +# # Start a testnet node +# ./run_dock_node_in_docker --chain=remdev --rpc-external --ws-external --rpc-cors=all +# ``` + +set -uexo pipefail +entrypoint="$(realpath $(dirname $0)/cheqd_entrypoint)" +config="$(realpath $(dirname $0)/cheqd_config.toml)" + +# pre-pull +docker pull --platform linux/amd64 ghcr.io/cheqd/cheqd-node + +# run the node with the random name output by the build command +docker run --platform linux/amd64 -e CHEQD_MNEMONIC="$CHEQD_MNEMONIC" -p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 -v $entrypoint:/usr/local/bin/entrypoint.sh -v $config:/tmp/cheqd_config.toml --rm --entrypoint /usr/local/bin/entrypoint.sh ghcr.io/cheqd/cheqd-node start diff --git a/scripts/run_node_in_docker b/scripts/run_dock_node_in_docker similarity index 80% rename from scripts/run_node_in_docker rename to scripts/run_dock_node_in_docker index 8cfce9028..e80046539 100755 --- a/scripts/run_node_in_docker +++ b/scripts/run_dock_node_in_docker @@ -7,10 +7,10 @@ # # ```bash # # Start a local test node -# ./run_node_in_docker --dev +# ./run_dock_node_in_docker --dev # # # Start a testnet node -# ./run_node_in_docker --chain=remdev --rpc-external --ws-external --rpc-cors=all +# ./run_dock_node_in_docker --chain=remdev --rpc-external --ws-external --rpc-cors=all # ``` set -uexo pipefail diff --git a/scripts/txn-pricing.js b/scripts/txn-pricing.js deleted file mode 100755 index b5d74603f..000000000 --- a/scripts/txn-pricing.js +++ /dev/null @@ -1,1059 +0,0 @@ -// Txn pricing and weights - -import { BTreeMap, BTreeSet } from '@polkadot/types'; - -import { randomAsHex } from '@polkadot/util-crypto'; -import { hexToU8a, stringToHex, u8aToHex } from '@polkadot/util'; -import { - Accumulator, - AccumulatorParams, - initializeWasm, - BBSPlusKeypairG2, - PositiveAccumulator, - BBSPlusSignatureParamsG1, - VBWitnessUpdateInfo, -} from '@docknetwork/crypto-wasm-ts'; -import dock from '../src/index'; -import { DockDid, DidKeypair, DidMethodKey } from '../src/did'; -import { - generateEcdsaSecp256k1Keypair, - getPublicKeyFromKeyringPair, -} from '../src/utils/misc'; -import { createRandomRegistryId, OneOfPolicy } from '../src/utils/revocation'; -import { getBalance } from './helpers'; -import { DidKey, VerificationRelationship } from '../src/public-keys'; -import { ServiceEndpointType } from '../src/modules/did/service-endpoint'; -import BBSPlusModule from '../src/modules/bbs-plus'; -import AccumulatorModule from '../src/modules/accumulator'; -import StatusList2021Credential from '../src/status-list-credential/status-list2021-credential'; -import { getKeyDoc } from '../src/utils/vc/helpers'; - -require('dotenv').config(); - -const { FullNodeEndpoint, EndowedSecretURI } = process.env; - -const unit = 1e6; - -function getDidPair() { - const did = DockDid.random(); - // Creating ECDSA pair because its most expensive to verify and thus gives max fees - const pair = generateEcdsaSecp256k1Keypair(randomAsHex(32)); - const publicKey = getPublicKeyFromKeyringPair(pair); - const didKey = new DidKey(publicKey, new VerificationRelationship()); - return [did, new DidKeypair(pair, 1), didKey]; -} - -async function printFeePaid(dockApi, address, fn) { - const before = await getBalance(dockApi, address); - await fn(); - const after = await getBalance(dockApi, address); - console.info( - `Fee paid is ${(parseInt(before[0]) - parseInt(after[0])) / unit}`, - ); -} - -async function dids() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - // Using secp curve as its most expensive to verify on node - const didMethodKeyPair = DidKeypair.randomSecp256k1(); - const didMethodKey = DidMethodKey.fromKeypair(didMethodKeyPair); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Writing did:key'); - await dock.did.newDidMethodKey(didMethodKey.asDidMethodKey, false); - }); - - const [did, pair, didKey] = getDidPair(); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Writing did:dock'); - await dock.did.new(did, [didKey], [], false, undefined, false); - }); - - // Add DID key with all verification relationships - const [, , dk1] = getDidPair(); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding DID key with all verification relationships'); - await dock.did.addKeys([dk1], did, did, pair, undefined, false); - }); - - // Add DID key with only 1 verification relationship - const [, , dk2] = getDidPair(); - dk2.verRels.setAuthentication(); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding DID key with only 1 verification relationship'); - await dock.did.addKeys([dk2], did, did, pair, undefined, false); - }); - - // Add DID key with only 2 verification relationships - const [, , dk3] = getDidPair(); - dk3.verRels.setAuthentication(); - dk3.verRels.setAssertion(); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding DID key with only 2 verification relationships'); - await dock.did.addKeys([dk3], did, did, pair, undefined, false); - }); - - // Add DID key with 3 verification relationships - const [, , dk4] = getDidPair(); - dk4.verRels.setAuthentication(); - dk4.verRels.setAssertion(); - dk4.verRels.setCapabilityInvocation(); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding DID key with 3 verification relationships'); - await dock.did.addKeys([dk4], did, did, pair, undefined, false); - }); - - // Add 2 DID keys with only 1 verification relationship - const [, , dk5] = getDidPair(); - const [, , dk6] = getDidPair(); - dk5.verRels.setAuthentication(); - dk6.verRels.setCapabilityInvocation(); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 2 DID keys with only 1 verification relationship'); - await dock.did.addKeys([dk5, dk6], did, did, pair, undefined, false); - }); - - // Add 3 DID keys with only 1 verification relationship - const [, , dk7] = getDidPair(); - const [, , dk8] = getDidPair(); - const [, , dk9] = getDidPair(); - dk7.verRels.setAuthentication(); - dk8.verRels.setCapabilityInvocation(); - dk9.verRels.setAssertion(); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 3 DID keys with only 1 verification relationship'); - await dock.did.addKeys([dk7, dk8, dk9], did, did, pair, undefined, false); - }); - - const newControllers = [DockDid.random(), DockDid.random(), DockDid.random()]; - // Add 1 controller - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 controller'); - await dock.did.addControllers( - [newControllers[0]], - did, - did, - pair, - undefined, - false, - ); - }); - - // Add 2 controllers - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 2 controllers'); - await dock.did.addControllers( - [newControllers[1], newControllers[2]], - did, - did, - pair, - undefined, - false, - ); - }); - - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - const spId1 = randomAsHex(10); - const spId2 = randomAsHex(20); - const origins1 = [randomAsHex(100)]; - const origins2 = [randomAsHex(100), randomAsHex(100)]; - // Add 1 service endpoint with 1 origin - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 service endpoint with 1 origin'); - await dock.did.addServiceEndpoint( - spId1, - spType, - origins1, - did, - did, - pair, - undefined, - false, - ); - }); - - // Add 1 service endpoint with 2 origins - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 service endpoint with 2 origins'); - await dock.did.addServiceEndpoint( - spId2, - spType, - origins2, - did, - did, - pair, - undefined, - false, - ); - }); - - // Adding a new DID which doesn't control itself but controlled by one other controller - const [did1] = getDidPair(); - await printFeePaid(dock.api, account.address, async () => { - console.info( - 'Writing a DID that has no key is controlled by 1 other controller', - ); - await dock.did.new(did1, [], [did], false); - }); - - // Adding a new DID which doesn't control itself but controlled by 2 other controllers - const [did2] = getDidPair(); - await printFeePaid(dock.api, account.address, async () => { - console.info( - 'Writing a DID that has no key is controlled by 2 other controllers', - ); - await dock.did.new(did2, [], [did, did1], false); - }); - - // Adding a new DID which doesn't control itself but has a key and controlled by one other controller - const [did3, , dk_] = getDidPair(); - await printFeePaid(dock.api, account.address, async () => { - console.info( - 'Writing a DID that has 1 key is controlled by 1 other controller', - ); - await dock.did.new(did3, [dk_], [did], false); - }); - - // Add DID key with all verification relationships to a DID that doesn't control itself - const [, , dk__] = getDidPair(); - await printFeePaid(dock.api, account.address, async () => { - console.info( - 'Adding DID key with all verification relationships to a DID that doesnt control itself', - ); - await dock.did.addKeys([dk__], did1, did, pair, undefined, false); - }); - - // Removing 1 key - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing 1 key'); - await dock.did.removeKeys([2], did, did, pair, undefined, false); - }); - - // Removing 2 keys - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing 2 keys'); - await dock.did.removeKeys([3, 4], did, did, pair, undefined, false); - }); - - // Removing 1 controller - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing 1 controller'); - await dock.did.removeControllers( - [newControllers[0]], - did, - did, - pair, - undefined, - false, - ); - }); - - // Removing 2 controllers - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing 2 controllers'); - await dock.did.removeControllers( - [newControllers[1], newControllers[2]], - did, - did, - pair, - undefined, - false, - ); - }); - - // Removing 1 service endpoint - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing service endpoint'); - await dock.did.removeServiceEndpoint( - spId1, - did, - did, - pair, - undefined, - false, - ); - }); - - // Remove DID - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing DID'); - await dock.did.remove(did, did, pair, undefined, false); - }); -} - -async function revocation() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const [did, pair, dk] = getDidPair(); - await dock.did.new(did, [dk], [], false); - - const registryId = createRandomRegistryId(); - // Create owners - const owners = new Set(); - owners.add(did); - - const policy = new OneOfPolicy(owners); - await printFeePaid(dock.api, account.address, async () => { - console.info('Create Registry'); - await dock.revocation.newRegistry(registryId, policy, false, false); - }); - - let revokeIds; - for (const count of [1, 2, 3, 5, 10]) { - revokeIds = new BTreeSet(dock.api.registry, 'RevokeId'); - for (let i = 0; i < count; i++) { - revokeIds.add(randomAsHex(32)); - } - - const [update, sig, nonce] = await dock.revocation.createSignedRevoke( - registryId, - revokeIds, - did, - pair, - { didModule: dock.did }, - ); - const revTx = dock.revocation.createRevokeTx(update, [{ nonce, sig }]); - console.info( - `Payment info of ${count} revocation is ${await revTx.paymentInfo(account.address)}`, - ); - await printFeePaid(dock.api, account.address, async () => { - await dock.signAndSend(revTx, false); - }); - } - - const [update, sig, nonce] = await dock.revocation.createSignedRemove( - registryId, - did, - pair, - { didModule: dock.did }, - ); - const revTx = dock.revocation.createRemoveRegistryTx(update, [ - { nonce, sig }, - ]); - console.info( - `Payment info of removing registry is ${await revTx.paymentInfo(account.address)}`, - ); - - await printFeePaid(dock.api, account.address, async () => { - await dock.signAndSend(revTx, false); - }); -} - -async function anchors() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const anc = randomAsHex(32); - await printFeePaid(dock.api, account.address, async () => { - console.info('Anchor write'); - await dock.anchor.deploy(anc, false); - }); -} - -async function blobs() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const [did, pair, dk] = getDidPair(); - await dock.did.new(did, [dk], [], false); - - for (const blobSize of [100, 200, 300]) { - await printFeePaid(dock.api, account.address, async () => { - console.info(`Blob write of ${blobSize} bytes`); - const blobId = randomAsHex(32); - const blob = { - id: blobId, - blob: randomAsHex(blobSize), - }; - await dock.blob.new(blob, did, pair, { didModule: dock.did }, false); - }); - } -} - -async function bbsPlus() { - await initializeWasm(); - - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const [did, pair, dk] = getDidPair(); - await dock.did.new(did, [dk], [], false); - - const label = stringToHex('My BBS+ params'); - - // Add params with different attribute sizes - for (const attributeCount of [10, 11, 12, 13, 14, 15]) { - const bytes = u8aToHex( - BBSPlusSignatureParamsG1.generate( - attributeCount, - hexToU8a(label), - ).toBytes(), - ); - const params = BBSPlusModule.prepareAddParameters(bytes, undefined, label); - await printFeePaid(dock.api, account.address, async () => { - console.info(`Add BBS+ params with ${attributeCount} attributes`); - await dock.bbsPlusModule.addParams( - params, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - } - - // Add a public key - const kp = BBSPlusKeypairG2.generate( - BBSPlusSignatureParamsG1.generate(10, hexToU8a(label)), - ); - const pk = BBSPlusModule.prepareAddPublicKey( - u8aToHex(kp.publicKey.bytes), - undefined, - [did, 1], - ); - await printFeePaid(dock.api, account.address, async () => { - console.info('Add a BBS+ key'); - await dock.bbsPlusModule.addPublicKey( - pk, - did, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - // Remove public key - await printFeePaid(dock.api, account.address, async () => { - console.info('Remove BBS+ key'); - await dock.bbsPlusModule.removePublicKey( - 2, - did, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - // Remove params - await printFeePaid(dock.api, account.address, async () => { - console.info('Remove BBS+ params'); - await dock.bbsPlusModule.removeParams( - 1, - did, - pair, - { didModule: dock.did }, - false, - ); - }); -} - -async function accumulator() { - await initializeWasm(); - - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const [did, pair, dk] = getDidPair(); - await dock.did.new(did, [dk], [], false); - - const label = stringToHex('My Accumulator params'); - const bytes = u8aToHex(Accumulator.generateParams(hexToU8a(label)).bytes); - const params = AccumulatorModule.prepareAddParameters( - bytes, - undefined, - label, - ); - await printFeePaid(dock.api, account.address, async () => { - console.info('Accumulator params write'); - await dock.accumulatorModule.addParams( - params, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - const kp = Accumulator.generateKeypair( - new AccumulatorParams(hexToU8a(params.bytes)), - ); - - const pk = AccumulatorModule.prepareAddPublicKey( - u8aToHex(kp.publicKey.bytes), - undefined, - [did, 1], - ); - await printFeePaid(dock.api, account.address, async () => { - console.info('Accumulator key write'); - await dock.accumulatorModule.addPublicKey( - pk, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - const accumulatorPos = PositiveAccumulator.initialize( - new AccumulatorParams(hexToU8a(params.bytes)), - kp.secretKey, - ); - const accumulatorIdPos = randomAsHex(32); - const accumulatedPos = u8aToHex(accumulatorPos.accumulated); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding a positive accumulator'); - await dock.accumulatorModule.addPositiveAccumulator( - accumulatorIdPos, - accumulatedPos, - [did, 1], - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - const accumulatorIdUni = randomAsHex(32); - const accumulatedUni = u8aToHex(accumulatorPos.accumulated); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding a universal accumulator'); - await dock.accumulatorModule.addUniversalAccumulator( - accumulatorIdUni, - accumulatedUni, - [did, 1], - 10000, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - const start = 10; - // The following isn't correct logically but is good enough for getting transaction pricing - const accumulated = u8aToHex(accumulatorPos.accumulated); - for (let i = 1; i <= 5; i++) { - const members = []; - for (let j = 0; j < i; j++) { - const member = Accumulator.encodePositiveNumberAsAccumulatorMember( - start * 10 * i + j, - ); - members.push(member); - } - let witUpd = u8aToHex( - VBWitnessUpdateInfo.new(hexToU8a(accumulated), members, [], kp.secretKey) - .value, - ); - await printFeePaid(dock.api, account.address, async () => { - console.info( - `Updating a positive accumulator with ${members.length} additions`, - ); - await dock.accumulatorModule.updateAccumulator( - accumulatorIdPos, - accumulated, - { - additions: members.map((m) => u8aToHex(m)), - witnessUpdateInfo: witUpd, - }, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - - witUpd = u8aToHex( - VBWitnessUpdateInfo.new(hexToU8a(accumulated), [], members, kp.secretKey) - .value, - ); - - await printFeePaid(dock.api, account.address, async () => { - console.info( - `Updating a positive accumulator with ${members.length} removals`, - ); - await dock.accumulatorModule.updateAccumulator( - accumulatorIdPos, - accumulated, - { - removals: members.map((m) => u8aToHex(m)), - witnessUpdateInfo: witUpd, - }, - did, - pair, - { didModule: dock.did }, - false, - ); - }); - } - - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing a positive accumulator'); - await dock.accumulatorModule.removeAccumulator( - accumulatorIdPos, - did, - pair, - { didModule: dock.did }, - false, - ); - }); -} - -async function transfers() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; - - const bal1 = await getBalance(dock.api, account.address); - - const amount = 10 * unit; - const transfer = dock.api.tx.balances.transfer(BOB, amount); - - console.info( - `Payment info of 1 transfer is ${await transfer.paymentInfo(account.address)}`, - ); - await dock.signAndSend(transfer, false); - - const bal2 = await getBalance(dock.api, account.address); - - console.log(parseInt(bal1[0])); - console.log(parseInt(bal2[0])); - - console.info( - `Fee paid is ${(parseInt(bal1[0]) - parseInt(bal2[0]) - amount) / unit}`, - ); - - const txs = Array(3).fill(dock.api.tx.balances.transfer(BOB, amount)); - - const txBatch = dock.api.tx.utility.batch(txs); - console.log(`Batch of ${txs.length} transfers`); - console.info( - `Payment info of batch is ${await txBatch.paymentInfo(account.address)}`, - ); -} - -async function statusList() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - const [did, pair, dk] = getDidPair(); - await dock.did.new(did, [dk], [], false); - - const statusListCredId = randomAsHex(32); - const ownerKey = getKeyDoc( - did, - pair.keyPair, - 'EcdsaSecp256k1VerificationKey2019', - ); - - const owners = new Set(); - owners.add(did); - const policy = new OneOfPolicy(owners); - - const cred = await StatusList2021Credential.create( - ownerKey, - statusListCredId, - ); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Creating status list credential'); - await dock.statusListCredential.createStatusListCredential( - statusListCredId, - cred, - policy, - false, - ); - }); - - const revokeIds = new Set(); - - revokeIds.add((Math.random() * 10e3) | 0); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Updating status list credential with 1 item'); - await cred.update(ownerKey, { revokeIndices: revokeIds }); - const [revoke, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - cred, - did, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - revoke, - [{ nonce, sig }], - false, - ); - }); - - revokeIds.add((Math.random() * 10e3) | 0); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Updating status list credential with 2 items'); - await cred.update(ownerKey, { revokeIndices: revokeIds }); - const [revoke, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - cred, - did, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - revoke, - [{ nonce, sig }], - false, - ); - }); - - revokeIds.add((Math.random() * 10e3) | 0); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Updating status list credential with 3 items'); - await cred.update(ownerKey, { revokeIndices: revokeIds }); - const [revoke, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - cred, - did, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - revoke, - [{ nonce, sig }], - false, - ); - }); - - for (let i = 0; i < 98; i++) { - revokeIds.add((Math.random() * 10e3) | 0); - } - - await printFeePaid(dock.api, account.address, async () => { - console.info('Updating status list credential with 100 items'); - await cred.update(ownerKey, { revokeIndices: revokeIds }); - const [revoke, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - cred, - did, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - revoke, - [{ nonce, sig }], - false, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing status list credential'); - const [remove, sig, nonce] = await dock.statusListCredential.createSignedRemoveStatusListCredential( - statusListCredId, - did, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.removeStatusListCredential( - remove, - [{ nonce, sig }], - false, - ); - }); -} - -async function trustRegistry() { - const account = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(account); - - let [cDid, cPair, cDk] = getDidPair(); - await dock.did.new(cDid, [cDk], [], false); - - let [i1Did, i1Pair, i1Dk] = getDidPair(); - await dock.did.new(i1Did, [i1Dk], [], false); - - let [i2Did, i2Pair, i2Dk] = getDidPair(); - await dock.did.new(i2Did, [i2Dk], [], false); - - let [i3Did, i3Pair, i3Dk] = getDidPair(); - await dock.did.new(i3Did, [i3Dk], [], false); - - let [v1Did, v1Pair, v1Dk] = getDidPair(); - await dock.did.new(v1Did, [v1Dk], [], false); - - let [v2Did, v2Pair, v2Dk] = getDidPair(); - await dock.did.new(v2Did, [v2Dk], [], false); - - cDid = DockDid.fromQualifiedString(cDid); - i1Did = DockDid.fromQualifiedString(i1Did); - i2Did = DockDid.fromQualifiedString(i2Did); - i3Did = DockDid.fromQualifiedString(i3Did); - v1Did = DockDid.fromQualifiedString(v1Did); - v2Did = DockDid.fromQualifiedString(v2Did); - - const trustRegistryId = randomAsHex(32); - await printFeePaid(dock.api, account.address, async () => { - console.info('Creating trust registry'); - await dock.trustRegistry.initOrUpdate( - cDid, - trustRegistryId, - randomAsHex(20).toString(), - randomAsHex(450).toString(), - cPair, - dock, - ); - }); - - const schemaId1 = randomAsHex(32); - const schemaId2 = randomAsHex(32); - - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); - const issuers = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - const verifiers = new BTreeSet(dock.api.registry, 'Verifier'); - - const issuerPrices1 = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices1.set('A', 20); - const issuerPrices2 = new BTreeMap( - dock.api.registry, - 'String', - 'VerificationPrice', - ); - issuerPrices2.set('A', 20); - issuerPrices2.set('B', 30); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 issuer with 1 price'); - issuers.set(i1Did, issuerPrices1); - schemas.set(schemaId1, { - issuers, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Set: schemas }, - cPair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding second issuer with 1 price'); - issuers.set(i2Did, issuerPrices1); - schemas.set(schemaId1, { - issuers, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Set: schemas }, - cPair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - // This will be less costly than previous because this doesn't add a new issuer - console.info('Adding 2 prices for both issuers'); - issuers.set(i1Did, issuerPrices2); - issuers.set(i2Did, issuerPrices2); - schemas.set(schemaId1, { - issuers, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Set: schemas }, - cPair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 verifier'); - verifiers.add(v1Did); - schemas.set(schemaId1, { - verifiers, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Set: schemas }, - cPair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 more verifier to the same schema'); - verifiers.add(v2Did); - schemas.set(schemaId1, { - verifiers, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Set: schemas }, - cPair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding 1 delegated issuer'); - const issuers = new BTreeSet(dock.api.registry, 'Issuer'); - issuers.add(i3Did); - await dock.trustRegistry.updateDelegatedIssuers( - i1Did, - trustRegistryId, - { Set: issuers }, - i1Pair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Suspending 1 issuer'); - await dock.trustRegistry.suspendIssuers( - cDid, - trustRegistryId, - [i1Did], - cPair, - dock, - ); - }); - - const schemas2 = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); - let issuers2 = new BTreeMap( - dock.api.registry, - 'Issuer', - 'VerificationPrices', - ); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding issuer with 1 price to a new schema using `Modify`'); - issuers2.set(i2Did, issuerPrices1); - schemas2.set(schemaId2, { - Add: { - issuers: issuers2, - }, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Modify: schemas2 }, - cPair, - dock, - ); - }); - - const schemaId3 = randomAsHex(32); - await printFeePaid(dock.api, account.address, async () => { - console.info('Adding issuer with 1 price to a new schema'); - const schemas3 = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); - issuers2 = new BTreeMap(dock.api.registry, 'Issuer', 'VerificationPrices'); - issuers2.set(i2Did, issuerPrices1); - schemas3.set(schemaId3, { - issuers: issuers2, - }); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Set: schemas3 }, - cPair, - dock, - ); - }); - - await printFeePaid(dock.api, account.address, async () => { - console.info('Removing 1 existing schema'); - const schemas = new BTreeMap( - dock.api.registry, - 'TrustRegistrySchemaId', - 'TrustRegistrySchemaMetadata', - ); - schemas.set(schemaId3, 'Remove'); - await dock.trustRegistry.setSchemasMetadata( - cDid, - trustRegistryId, - { Modify: schemas }, - cPair, - dock, - ); - }); -} - -async function main() { - let action = 0; - if (process.argv.length >= 3) { - action = parseInt(process.argv[2]); - } - switch (action) { - case 0: - await dids(); - break; - case 1: - await revocation(); - break; - case 2: - await anchors(); - break; - case 3: - await blobs(); - break; - case 4: - await transfers(); - break; - case 5: - await bbsPlus(); - break; - case 6: - await accumulator(); - break; - case 7: - await statusList(); - break; - case 8: - await trustRegistry(); - break; - default: - console.error('Invalid value for argument'); - process.exit(1); - } - process.exit(0); -} - -dock - .init({ - address: FullNodeEndpoint, - }) - .then(main) - .catch((error) => { - console.error('Error occurred somewhere, it was caught!', error); - process.exit(1); - }); diff --git a/scripts/with_all_docker_test_nodes b/scripts/with_all_dock_docker_test_nodes similarity index 92% rename from scripts/with_all_docker_test_nodes rename to scripts/with_all_dock_docker_test_nodes index 06fa848e0..3e22bb9f1 100755 --- a/scripts/with_all_docker_test_nodes +++ b/scripts/with_all_dock_docker_test_nodes @@ -10,7 +10,7 @@ declare -a images=("$CONFIG_DOCK_NODE_MASTER_IMAGE" "$CONFIG_DOCK_NODE_MAINNET_I for image in "${images[@]}" do - CONFIG_DOCK_NODE_IMAGE=$image bash "$root_dir/scripts/with_docker_test_node" $@ + CONFIG_DOCK_NODE_IMAGE=$image bash "$root_dir/scripts/with_dock_docker_test_node" $@ done exit 0 diff --git a/scripts/with_cheqd_docker_test_node b/scripts/with_cheqd_docker_test_node new file mode 100755 index 000000000..bad8fa9bb --- /dev/null +++ b/scripts/with_cheqd_docker_test_node @@ -0,0 +1,30 @@ +#!/bin/bash + +set -ueo pipefail + +root_dir="$(dirname $0)/.." +entrypoint="$(realpath $(dirname $0)/cheqd_entrypoint)" +config="$(realpath $(dirname $0)/cheqd_config.toml)" + +# pre-pull +docker pull --platform linux/amd64 ghcr.io/cheqd/cheqd-node + +# start a pos alice node +alice_container_id=$(docker run --platform linux/amd64 -d --rm -p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 -e CHEQD_MNEMONIC="$CHEQD_MNEMONIC" -v $entrypoint:/usr/local/bin/entrypoint.sh -v $config:/tmp/cheqd_config.toml --entrypoint /usr/local/bin/entrypoint.sh ghcr.io/cheqd/cheqd-node start) + +try_with_node() { + sleep 10; + # Execute the commands, potentially against the nodes + $@ +} + +if try_with_node $@; then + exit_code=$? +else + exit_code=$? +fi + +# Kill nodes +docker kill $alice_container_id + +exit $exit_code diff --git a/scripts/with_docker_test_node b/scripts/with_dock_docker_test_node similarity index 100% rename from scripts/with_docker_test_node rename to scripts/with_dock_docker_test_node diff --git a/src/did/did-keypair.js b/src/did/did-keypair.js deleted file mode 100644 index ae8b64bee..000000000 --- a/src/did/did-keypair.js +++ /dev/null @@ -1,56 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { DockKeypair } from '../utils/misc'; - -/** - * Signing keypair along with the optional key identifier. - */ -export class DidKeypair extends DockKeypair { - /** - * Wraps supplied keypair into a `DidKeypair`. - * - * @param {*} keyPair - * @param {?number} keyId - */ - constructor(keyPair, keyId = void 0) { - super(keyPair); - this.keyId = keyId; - } - - /** - * Create a new keypair from a DockAPI object. - * @param {DockAPI} dockApi - * @param seed - Generates 32-byte random seed if not provided - * @param keypairType - Defaults to ed25519. - * @param meta - * @param keyId - Defaults to 1 - * @returns {DidKeypair} - */ - static fromApi( - dockApi, - { - seed = randomAsHex(32), - keypairType = 'ed25519', - meta = null, - keyId = 1, - } = {}, - ) { - return new DidKeypair( - dockApi.keyring.addFromUri(seed, meta, keypairType), - keyId, - ); - } - - /** - * Generates random `Secp256k1` keypair. - * - * @param {?Object} params - * @property {?number} keyId - optional keypair identifier - * @returns {this} - */ - static randomSecp256k1({ keyId = void 0 } = {}) { - const keypair = super.randomSecp256k1.call(this); - keypair.keyId = keyId; - - return keypair; - } -} diff --git a/src/did/index.js b/src/did/index.js deleted file mode 100644 index beb115591..000000000 --- a/src/did/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export * from './utils'; -export * from './did-keypair'; -export * from './constants'; -export * from './typed-did'; diff --git a/src/did/typed-did/did-method-key.js b/src/did/typed-did/did-method-key.js deleted file mode 100644 index 1749899d2..000000000 --- a/src/did/typed-did/did-method-key.js +++ /dev/null @@ -1,140 +0,0 @@ -import { u8aToHex, hexToU8a } from '@polkadot/util'; -import bs58 from 'bs58'; -import varint from 'varint'; -import { base58btc } from 'multiformats/bases/base58'; - -import { PublicKeyEd25519, PublicKeySecp256k1 } from '../../public-keys'; - -import { parseDIDUrl } from '../../resolver/did/did-resolver'; - -import { - DidMethodKeyQualifier, - DidMethodKeyBytePrefixEd25519, - DidMethodKeyBytePrefixSecp256k1, - Ed25519PublicKeyPrefix, - Secp256k1PublicKeyPrefix, -} from '../constants'; -import DockDidOrDidMethodKey from './dock-did-or-did-method-key'; - -/** - * `did:key:*` - * - * As of now, the public key can be either `PublicKeyEd25519` or `PublicKeySecp256k1`. - */ -export default class DidMethodKey extends DockDidOrDidMethodKey { - static Qualifier = DidMethodKeyQualifier; - static Type = 'didMethodKey'; - /** - * Instantiates `did:key:*` using supplied public key. - * As of now, the public key can be either `PublicKeyEd25519` or `PublicKeySecp256k1`. - * - * @param {PublicKeyEd25519|PublicKeySecp256k1} didMethodKey - */ - constructor(didMethodKey) { - super(didMethodKey); - - if ( - !( - didMethodKey instanceof PublicKeyEd25519 - || didMethodKey instanceof PublicKeySecp256k1 - ) - ) { - throw new Error('Unsupported public key type'); - } - } - - /** - * Creates a new `DidMethodKey` from the supplied keypair. - * - * @param {DockKeypair} keypair - * @returns {DidMethodKey} - */ - static fromKeypair(keypair) { - return new this(keypair.publicKey()); - } - - /** - * Instantiates `DidMethodKey` from a fully qualified did string. - * @param {string} did - fully qualified `did:key:*` string - * @returns {DidMethodKey} - */ - static fromQualifiedString(did) { - const { id } = parseDIDUrl(did); - - const multicodecPubKey = base58btc.decode(id); - varint.decode(multicodecPubKey); // NOTE: called to get byte length below - const pubKeyBytes = multicodecPubKey.slice(varint.decode.bytes); - const pubkeyHex = u8aToHex(pubKeyBytes); - - if (id.startsWith(Secp256k1PublicKeyPrefix)) { - return new this(new PublicKeySecp256k1(pubkeyHex)); - } else if (id.startsWith(Ed25519PublicKeyPrefix)) { - return new this(new PublicKeyEd25519(pubkeyHex)); - } else { - throw new Error(`Unsupported \`did:key:*\`: \`${did}\``); - } - } - - /** - * Instantiates `DidMethodKey` from an unqualified did string. - * @param {string} did - BS58 encoded did key. - * @returns {DidMethodKey} - */ - static fromUnqualifiedString(did) { - return this.fromQualifiedString(`did:key:${did}`); - } - - /** - * Instantiates `DockDid` from a did method key object received from the substrate side. - * @param {object} key - substrate did method key - * @returns {DidMethodKey} - */ - static fromSubstrateValue(did) { - const key = did.asDidMethodKey; - - if (key.isSecp256k1) { - return new this(new PublicKeySecp256k1(u8aToHex(key.asSecp256k1))); - } else if (key.isEd25519) { - return new this(new PublicKeyEd25519(u8aToHex(key.asEd25519))); - } else { - throw new Error(`Invalid \`did:key:*\`: provided: \`${key}\``); - } - } - - get isDidMethodKey() { - return true; - } - - get asDidMethodKey() { - return this.didMethodKey; - } - - /** - * Returns underlying public key. - * @returns {PublicKeyEd25519|PublicKeySecp256k1} - */ - get publicKey() { - return this.didMethodKey; - } - - /** - * Returns unqualified public key encoded in `BS58`. - */ - toEncodedString() { - // Define the prefix for ed25519 DID key - const publicKeyBytes = hexToU8a(this.publicKey.value); - const prefix = this.didMethodKey.ed25519 - ? DidMethodKeyBytePrefixEd25519 - : DidMethodKeyBytePrefixSecp256k1; - - // Concatenate the prefix and the public key bytes - const didKeyBytes = new Uint8Array(prefix.length + publicKeyBytes.length); - didKeyBytes.set(prefix); - didKeyBytes.set(publicKeyBytes, prefix.length); - - // Encode the concatenated bytes to Base58 with z prefix - return `z${bs58.encode(didKeyBytes)}`; - } -} - -DockDidOrDidMethodKey.DidMethodKey = DidMethodKey; diff --git a/src/did/typed-did/dock-did-or-did-method-key.js b/src/did/typed-did/dock-did-or-did-method-key.js deleted file mode 100644 index 9c5714f62..000000000 --- a/src/did/typed-did/dock-did-or-did-method-key.js +++ /dev/null @@ -1,183 +0,0 @@ -import { getStateChange } from '../../utils/misc'; -import { createDidSig } from '../utils'; - -import { DockDIDQualifier, DidMethodKeyQualifier } from '../constants'; -import { withExtendedStaticProperties } from '../../utils/inheritance'; -import { TypedEnum } from '../../utils/typed-enum'; - -/** - * Either `did:dock:*` or `did:key:*`. - */ -class DockDidOrDidMethodKey extends TypedEnum { - /** - * Prefix to form the fully qualified string. - * - * @type {string} - */ - static Qualifier; - /** - * @type {typeof this} - */ - static DockDid; - /** - * @type {typeof this} - */ - static DidMethodKey; - - /** - * Checks whether provided string is qualified according to the caller class. - * @param {string} did - * @returns {boolean} - */ - static isQualifiedString(did) { - return this.Qualifier - ? did.startsWith(this.Qualifier) - : this.DockDid.isQualifiedString(did) - || this.DidMethodKey.isQualifiedString(did); - } - - /** - * Instantiates `DockDid` or `DidMethodKey` from a fully qualified did string. - * @param {string} did - fully qualified `dock:did:` or `dock:key:` string - * @returns {DockDid|DidMethodKey} - */ - static fromQualifiedString(did) { - if (did.startsWith(DockDIDQualifier)) { - return this.DockDid.fromQualifiedString(did); - } else if (did.startsWith(DidMethodKeyQualifier)) { - return this.DidMethodKey.fromQualifiedString(did); - } else { - throw new Error( - `Unsupported did string: ${did}, expected either \`dock:did:\` or \`dock:key:\``, - ); - } - } - - /** - * Instantiates `DockDid` or `DidMethodKey` from a did or did method key object received from the substrate side. - * @param {object} did - substrate did or did method key - * @returns {DockDid|DidMethodKey} - */ - static fromSubstrateValue(did) { - if (did.isDid) { - return this.DockDid.fromSubstrateValue(did); - } else if (did.isDidMethodKey) { - return this.DidMethodKey.fromSubstrateValue(did); - } else { - throw new Error(`Invalid \`did:*\` provided: \`${JSON.stringify(did)}\``); - } - } - - /** - * Attempts to instantiate `DockDid` or `DidMethodKey` from the provided object or string. - * - * @param {string|DockDid|DidMethodKey|object} did - * @returns {DockDid|DidMethodKey} - */ - static from(did) { - if (!did) { - throw new Error(`Invalid DID: ${did}`); - } else if (typeof did === 'object') { - if (did instanceof this) { - return did; - } else { - return this.fromSubstrateValue(did); - } - } else if (typeof did === 'string') { - if (this.Qualifier && !this.isQualifiedString(did)) { - return this.fromUnqualifiedString(did); - } else { - return this.fromQualifiedString(did); - } - } else { - throw new TypeError( - `Unsupported DID value: \`${did}\` with type \`${typeof did}\`, expected a string or an object`, - ); - } - } - - /** - * Extracts raw underlying value if it's `did:dock:*`, throws an error otherwise. - */ - get asDid() { - throw new Error('Not a `Did`'); - } - - /** - * Extracts raw underlying value if it's `did:key:*`, throws an error otherwise. - */ - get asDidMethodKey() { - throw new Error('Not a `DidMethodKey`'); - } - - /** - * Returns `true` if the underlying value is a `did:dock:*`. - */ - get isDid() { - return false; - } - - /** - * Returns `true` if the underlying value is a `did:key:* `. - */ - get isDidMethodKey() { - return false; - } - - /** - * Creates signature for the state change with supplied arguments. - * - * @param api - * @param name - * @param payload - * @param keyRef - * @returns {object} - */ - signStateChange(api, name, payload, keyRef) { - const stateChange = getStateChange(api, name, payload); - const keySignature = keyRef.sign(stateChange); - - return createDidSig(this, keyRef, keySignature); - } - - /** - * Creates a transaction that will modify the chain state. - * - * @param api - * @param method - * @param name - * @param payload - * @param keyRef - */ - changeState(api, method, name, payload, keyRef) { - const signature = this.signStateChange(api, name, payload, keyRef); - - return method(payload, signature); - } - - /** - * Returns underlying value encoded according to the specification. - */ - toEncodedString() { - throw new Error('Unimplemented'); - } - - /** - * Returns fully qualified `did:dock:*` encoded in SS58 or `did:key:*` encoded in BS58. - */ - toString() { - return this.toQualifiedEncodedString(); - } - - /** - * Returns fully qualified `did:dock:*` encoded in SS58 or `did:key:*` encoded in BS58. - */ - toQualifiedEncodedString() { - return `${this.constructor.Qualifier}${this.toEncodedString()}`; - } -} - -export default withExtendedStaticProperties( - ['Qualifier', 'fromUnqualifiedString'], - DockDidOrDidMethodKey, -); diff --git a/src/did/typed-did/dock-did.js b/src/did/typed-did/dock-did.js deleted file mode 100644 index 5092debfe..000000000 --- a/src/did/typed-did/dock-did.js +++ /dev/null @@ -1,85 +0,0 @@ -import { randomAsHex, encodeAddress } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; -import { getHexIdentifier } from '../../utils/codec'; - -import { validateDockDIDHexIdentifier } from '../utils'; - -import { DockDIDByteSize, DockDIDQualifier } from '../constants'; -import DockDidOrDidMethodKey from './dock-did-or-did-method-key'; - -/** - * `did:dock:*` - */ -export default class DockDid extends DockDidOrDidMethodKey { - static Qualifier = DockDIDQualifier; - static Type = 'did'; - - /** - * Instantiates `DockDid` using supplied 32-byte hex sequence. - * @param {*} did - */ - constructor(did) { - super(did); - validateDockDIDHexIdentifier(did); - } - - /** - * Generates a random DID. - * - * @returns {DockDid} - */ - static random() { - return new this(randomAsHex(DockDIDByteSize)); - } - - /** - * Instantiates `DockDid` from a fully qualified did string. - * @param {string} did - fully qualified `did:dock:*` string - * @returns {DockDid} - */ - static fromQualifiedString(did) { - return new this(getHexIdentifier(did, DockDIDQualifier, DockDIDByteSize)); - } - - /** - * Instantiates `DockDid` from an unqualified did string. - * @param {string} did - SS58-encoded or hex did. - * @returns {DockDid} - */ - static fromUnqualifiedString(did) { - return new this(getHexIdentifier(did, '', DockDIDByteSize)); - } - - /** - * Instantiates `DockDid` from a did object received from the substrate side. - * @param {object} did - substrate did - * @returns {DockDid} - */ - static fromSubstrateValue(did) { - return new this(u8aToHex(did.asDid)); - } - - get isDid() { - return true; - } - - get asDid() { - return this.did; - } - - /** - * Returns fully qualified `did:dock:*` with did represented as a hex value. - */ - toQualifiedHexString() { - return `${DockDIDQualifier}${this.asDid}`; - } - - /** - * Returns unqualified DID encoded as a `SS58` address. - */ - toEncodedString() { - return encodeAddress(this.asDid); - } -} - -DockDidOrDidMethodKey.DockDid = DockDid; diff --git a/src/did/typed-did/helpers.js b/src/did/typed-did/helpers.js deleted file mode 100644 index 44c3d34d6..000000000 --- a/src/did/typed-did/helpers.js +++ /dev/null @@ -1,24 +0,0 @@ -import DockDidOrDidMethodKey from './dock-did-or-did-method-key'; -import DockDid from './dock-did'; -import DidMethodKey from "./did-method-key"; // eslint-disable-line - -/** - * Takes a DID string, gets the hexadecimal value of that and returns either the `DockDid` or `DidMethodKey` object. - * @deprecated Use `DockDidOrDidMethodKey.from`/`DockDid.from`/`DidMethodKey.from` instead. - * - * @param {*} api - unused - * @param {string|DockDid|DidMethodKey|object} did - The DID can be passed as fully qualified DID like `did:dock:` or - * `did:key:` or a 32 byte hex string - * @return {string|DockDid|DidMethodKey} Returns a `string` or `DockDid` or `DidMethodKey` object. - */ -export function typedHexDID(_api, did) { - return DockDidOrDidMethodKey.from(did); -} - -/** - * Create and return a new Dock DID. - * @deprecated Use `DockDid.random` instead. - * - * @returns {DockDid} - The DID - */ -export const createNewDockDID = () => DockDid.random(); diff --git a/src/did/typed-did/index.js b/src/did/typed-did/index.js deleted file mode 100644 index ed02f6134..000000000 --- a/src/did/typed-did/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export { default as DidMethodKey } from './did-method-key'; -export { default as DockDid } from './dock-did'; -export { default as DockDidOrDidMethodKey } from './dock-did-or-did-method-key'; -export * from './helpers'; diff --git a/src/errors/extrinsic-error.js b/src/errors/extrinsic-error.js deleted file mode 100644 index f68e11d13..000000000 --- a/src/errors/extrinsic-error.js +++ /dev/null @@ -1,11 +0,0 @@ -// Error class for passing extrinsic errors upstream -export default class ExtrinsicError extends Error { - constructor(message, method, data, status, events) { - super(message); - this.name = 'ExtrinsicError'; - this.method = method; - this.data = data; - this.status = status; - this.events = events; - } -} diff --git a/src/index.js b/src/index.js deleted file mode 100644 index da50c0ed8..000000000 --- a/src/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import DockAPI from './dock-api'; - -export { default as AnchorModule } from './modules/anchor'; -export { default as BlobModule } from './modules/blob'; -export { DIDModule } from './modules/did'; -export { default as RevocationModule } from './modules/revocation'; -export { default as StatusListCredentialModule } from './modules/status-list-credential'; -export { default as BBSModule } from './modules/bbs'; -export { default as BBSPlusModule } from './modules/bbs-plus'; -export { default as LegacyBBSPlusModule } from './modules/legacy-bbs-plus'; -export { default as PSModule } from './modules/ps'; - -export { - PublicKey, - PublicKeySr25519, - PublicKeyEd25519, - PublicKeySecp256k1, -} from './public-keys'; - -export { Signature, SignatureSr25519, SignatureEd25519 } from './signatures'; -export { default as OffchainSignatures } from './modules/offchain-signatures'; -export { default as StatusList2021Credential } from './status-list-credential/status-list2021-credential'; - -export { DockAPI }; -export default new DockAPI(); diff --git a/src/modules/WithParamsAndPublicKeys.js b/src/modules/WithParamsAndPublicKeys.js deleted file mode 100644 index fe03a7834..000000000 --- a/src/modules/WithParamsAndPublicKeys.js +++ /dev/null @@ -1,356 +0,0 @@ -/* eslint-disable camelcase */ - -import { u8aToHex } from '@polkadot/util'; -import { createDidSig, DockDidOrDidMethodKey } from '../did'; -import { getDidNonce } from '../utils/misc'; - -/** - * Class with logic for public keys and corresponding setup parameters. - * This logic is common in offchain signatures modules and accumulator - */ -export default class WithParamsAndPublicKeys { - /** - * Builds module-specific params from the provided value. - */ - static buildParams(params) { - return params; - } - - /** - * Create object to add new parameters on chain - * @param bytes - * @param curveType - * @param label - * @returns {{}} - */ - static prepareAddParameters(bytes, curveType = undefined, label = undefined) { - const params = {}; - if (bytes === undefined) { - throw new Error('bytes must be provided'); - } else { - params.bytes = bytes; - } - if (curveType === undefined) { - params.curveType = 'Bls12381'; - } else if (curveType === 'Bls12381') { - params.curveType = curveType; - } else { - throw new Error(`Invalid curve type ${curveType}`); - } - params.label = label; - return params; - } - - /** - * Create object to add new public key on chain - * @param bytes - * @param curveType - * @param paramsRef - Provide if this public key was created using params present on chain. - * @returns {{}} - */ - static prepareAddPublicKey( - bytes, - curveType = undefined, - paramsRef = undefined, - ) { - const publicKey = {}; - if (bytes === undefined) { - throw new Error('bytes must be provided'); - } else { - publicKey.bytes = bytes; - } - if (curveType === undefined) { - publicKey.curveType = 'Bls12381'; - } else if (curveType === 'Bls12381') { - publicKey.curveType = curveType; - } else { - throw new Error(`Invalid curve type ${curveType}`); - } - publicKey.paramsRef = paramsRef !== undefined - ? WithParamsAndPublicKeys.parseRef(paramsRef) - : undefined; - return publicKey; - } - - /** - * Parse a reference to a param or a public key. A reference uniquely identifies a param or a public key and is a pair - * of a DID and a positive number starting from 1. - * @param ref - * @returns {any[]} - */ - static parseRef(ref) { - const parsed = new Array(2); - if ( - !(typeof ref === 'object' && ref instanceof Array && ref.length === 2) - ) { - throw new Error('Reference should be an array of 2 items'); - } - try { - parsed[0] = DockDidOrDidMethodKey.from(ref[0]); - } catch (error) { - throw new Error( - `First item of reference should be a DID but was ${ref[0]}, error: ${error}`, - ); - } - if (typeof ref[1] !== 'number') { - throw new Error( - `Second item of reference should be a number but was ${ref[1]}`, - ); - } - // eslint-disable-next-line prefer-destructuring - parsed[1] = ref[1]; - return parsed; - } - - /** - * Create transaction to add new BBS+ params. - * @param params - The BBS+ params to add. - * @param signerDid - Signer of the payload - * @param keyPair - Signer's keypair - * @param signingKeyRef - Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createAddParamsTx( - params, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const offchainParams = this.constructor.buildParams(params); - const hexDid = DockDidOrDidMethodKey.from(signerDid); - const [addParams, signature] = await this.createSignedAddParams( - offchainParams, - hexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.addParams(addParams, signature); - } - - /** - * Create transaction to remove existing BBS+ params. - * @param index - Index to uniquely identify BBS+ params - * @param signerDid - Signer of the payload - * @param keyPair - Signer's keypair - * @param signingKeyRef - Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async removeParamsTx( - index, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const hexDid = DockDidOrDidMethodKey.from(signerDid); - const [removeParams, signature] = await this.createSignedRemoveParams( - index, - hexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.removeParams(removeParams, signature); - } - - /** - * Add new signature params. - * @param param - The signature params to add. - * @param signerDid - Signer of the payload - * @param keyPair - Signer's keypair - * @param signingKeyRef - Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addParams( - param, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddParamsTx(param, signerDid, signingKeyRef, { - nonce, - didModule, - }); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Remove existing BBS+ params. - * @param index - Index to uniquely identify BBS+ params - * @param signerDid - Signer of the blob - * @param keyPair - Signer's keypair - * @param signingKeyRef - Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removeParams( - index, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.removeParamsTx(index, signerDid, signingKeyRef, { - nonce, - didModule, - }); - return this.signAndSend(tx, waitForFinalization, params); - } - - async createSignedAddParams( - params, - hexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(hexDid, nonce, didModule); - const addParams = { params, nonce }; - const signature = this.signAddParams(signingKeyRef, addParams); - const didSig = createDidSig(hexDid, signingKeyRef, signature); - return [addParams, didSig]; - } - - async createSignedRemoveParams( - index, - hexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(hexDid, nonce, didModule); - const removeParams = { paramsRef: [hexDid, index], nonce }; - const signature = this.signRemoveParams(signingKeyRef, removeParams); - const didSig = createDidSig(hexDid, signingKeyRef, signature); - return [removeParams, didSig]; - } - - // eslint-disable-next-line no-unused-vars - async queryParamsFromChain(hexDid, counter) { - throw new Error('Extending class should implement queryParamsFromChain'); - } - - // eslint-disable-next-line no-unused-vars - async queryPublicKeyFromChain(hexDid, keyId) { - throw new Error('Extending class should implement queryPublicKeyFromChain'); - } - - async getParams(did, counter) { - const hexId = DockDidOrDidMethodKey.from(did); - return this.getParamsByHexDid(hexId, counter); - } - - /** - * - * @param did - * @param keyId - * @param withParams - If true, return the params referenced by the public key. It will throw an error if paramsRef is null - * or params were not found on chain which can happen if they were deleted after this public key was added. - * @returns {Promise<{bytes: string}|null>} - */ - async getPublicKey(did, keyId, withParams = false) { - const hexId = DockDidOrDidMethodKey.from(did); - return this.getPublicKeyByHexDid(hexId, keyId, withParams); - } - - async getParamsByHexDid(hexDid, counter) { - const resp = await this.queryParamsFromChain(hexDid, counter); - if (resp) { - return this.createParamsObjFromChainResponse(resp); - } - return null; - } - - async getPublicKeyByHexDid(hexDid, keyId, withParams = false) { - const resp = await this.queryPublicKeyFromChain(hexDid, keyId); - if (resp) { - const pkObj = WithParamsAndPublicKeys.createPublicKeyObjFromChainResponse(resp); - if (withParams) { - if (pkObj.paramsRef === null) { - throw new Error('No reference to parameters for the public key'); - } else { - const params = await this.getParamsByHexDid( - pkObj.paramsRef[0], - pkObj.paramsRef[1], - ); - if (params === null) { - throw new Error( - `Parameters with reference (${pkObj.paramsRef[0]}, ${pkObj.paramsRef[1]}) not found on chain`, - ); - } - pkObj.params = params; - } - } - return pkObj; - } - return null; - } - - /** - * Format an object received from the chain as a params object with keys `bytes`, `label` and `curveType`. - * @param params - * @returns {{bytes: string}} - */ - createParamsObjFromChainResponse(params) { - const paramsObj = { - bytes: u8aToHex(params.bytes), - }; - if (params.curveType.isBls12381) { - paramsObj.curveType = 'Bls12381'; - } - if (params.label.isSome) { - paramsObj.label = u8aToHex(params.label.unwrap()); - } else { - paramsObj.label = null; - } - return paramsObj; - } - - /** - * Format an object received from the chain as a public key object with keys `bytes`, ` paramsRef` and `curveType`. - * @param pk - * @returns {{bytes: string}} - */ - static createPublicKeyObjFromChainResponse(pk) { - const pkObj = { - bytes: u8aToHex(pk.bytes), - }; - if (pk.curveType.isBls12381) { - pkObj.curveType = 'Bls12381'; - } - if (pk.paramsRef.isSome) { - const pr = pk.paramsRef.unwrap(); - pkObj.paramsRef = [DockDidOrDidMethodKey.from(pr[0]), pr[1].toNumber()]; - } else { - pkObj.paramsRef = null; - } - pkObj.participantId = null; - return pkObj; - } - - // eslint-disable-next-line no-unused-vars - signAddParams(keyPair, params) { - throw new Error('Extending class should implement signAddParams'); - } - - // eslint-disable-next-line no-unused-vars - signRemoveParams(keyPair, ref) { - throw new Error('Extending class should implement signRemoveParams'); - } -} diff --git a/src/modules/accumulator.js b/src/modules/accumulator.js deleted file mode 100644 index 1103d1a31..000000000 --- a/src/modules/accumulator.js +++ /dev/null @@ -1,1079 +0,0 @@ -/* eslint-disable camelcase */ - -import { hexToU8a, isHex, u8aToHex } from '@polkadot/util'; -import { - KBUniversalAccumulatorValue, - VBWitnessUpdateInfo, -} from '@docknetwork/crypto-wasm-ts'; -import { getDidNonce, getStateChange, inclusiveRange } from '../utils/misc'; -import WithParamsAndPublicKeys from './WithParamsAndPublicKeys'; -import { getAllExtrinsicsFromBlock } from '../utils/chain-ops'; -import { createDidSig, DockDidOrDidMethodKey } from '../did'; - -export const AccumulatorType = { - VBPos: 0, - VBUni: 1, - KBUni: 2, -}; - -/** Class to manage accumulators on chain */ -export default class AccumulatorModule extends WithParamsAndPublicKeys { - constructor(api, signAndSend) { - super(); - this.api = api; - this.moduleName = 'accumulator'; - this.module = api.tx[this.moduleName]; - this.signAndSend = signAndSend; - } - - static prepareAddPositiveAccumulator(api, id, accumulated, publicKeyRef) { - const keyRef = AccumulatorModule.parseRef(publicKeyRef); - return { - id, - accumulator: { - Positive: { - accumulated, - keyRef, - }, - }, - }; - } - - static prepareAddUniversalAccumulator( - api, - id, - accumulated, - publicKeyRef, - maxSize, - ) { - const keyRef = AccumulatorModule.parseRef(publicKeyRef); - return { - id, - accumulator: { - Universal: { - common: { - accumulated, - keyRef, - }, - maxSize, - }, - }, - }; - } - - static prepareAddKBUniversalAccumulator(api, id, accumulated, publicKeyRef) { - const keyRef = AccumulatorModule.parseRef(publicKeyRef); - return { - id, - accumulator: { - KBUniversal: { - accumulated, - keyRef, - }, - }, - }; - } - - static ensureArrayOfBytearrays(arr) { - if (!(typeof arr === 'object' && arr instanceof Array)) { - throw new Error(`Require an array but got ${arr}`); - } - for (let i = 0; i < arr.length; i++) { - if (!isHex(arr[i])) { - throw new Error(`Require a hex string but got ${arr[0]}`); - } - } - } - - /** - * Accepts an event and returns the accumulator id and accumulated value if the event was - * `accumulator:AccumulatorUpdated` - * @param event - The event. This is the `event` key in the `event` object, i.e. for the `event` object got in response - * of `api.query.system.events`, the argument to this function is `event.event`. - * @returns {null|string[]} - null if the event is not `accumulator:AccumulatorUpdated` else [accumulatorId, accumulated] - */ - static parseEventAsAccumulatorUpdate(event) { - if ( - event.section === 'accumulator' - && event.method === 'AccumulatorUpdated' - ) { - return [u8aToHex(event.data[0]), u8aToHex(event.data[1])]; - } - return null; - } - - /** - * Return the accumulated value as hex - * @param accumulated {Uint8Array|KBUniversalAccumulatorValue} - * @param typ {number} - Type of the accumulator - * @returns {string} - */ - static accumulatedAsHex(accumulated, typ = AccumulatorType.VBPos) { - if (typ === AccumulatorType.VBPos || typ === AccumulatorType.VBUni) { - return u8aToHex(accumulated); - } else if (typ === AccumulatorType.KBUni) { - return u8aToHex(accumulated.toBytes()); - } else { - throw new Error(`Unknown accumulator type ${typ}`); - } - } - - /** - * Parse the given accumulated value in hex form - * @param accumulated {string} - * @param typ {number} - Type of the accumulator - * @returns {Uint8Array|KBUniversalAccumulatorValue} - */ - static accumulatedFromHex(accumulated, typ = AccumulatorType.VBPos) { - if (typ === AccumulatorType.VBPos || typ === AccumulatorType.VBUni) { - return hexToU8a(accumulated); - } else if (typ === AccumulatorType.KBUni) { - return KBUniversalAccumulatorValue.fromBytes(hexToU8a(accumulated)); - } else { - throw new Error(`Unknown accumulator type ${typ}`); - } - } - - /** - * Create transaction to add accumulator public key - * @param publicKey - Accumulator public key - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createAddPublicKeyTx( - publicKey, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addPk, signature] = await this.createSignedAddPublicKey( - publicKey, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.addPublicKey(addPk, signature); - } - - /** - * Create transaction to remove accumulator public key - * @param removeKeyId - Index of the accumulator public key - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createRemovePublicKeyTx( - removeKeyId, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [remPk, signature] = await this.createSignedRemovePublicKey( - removeKeyId, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.removePublicKey(remPk, signature); - } - - /** - * Create a transaction to add positive (add-only) accumulator - * @param id - Unique accumulator id - * @param accumulated - Current accumulated value. - * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not - * have any public key on the chain. This is useful for KVAC. - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createAddPositiveAccumulatorTx( - id, - accumulated, - publicKeyRef, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addAccumulator, signature] = await this.createSignedAddPositiveAccumulator( - id, - accumulated, - publicKeyRef, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.addAccumulator(addAccumulator, signature); - } - - /** - * Create a transaction to add universal (supports add/remove) accumulator - * @param id - Unique accumulator id - * @param accumulated - Current accumulated value. - * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not - * have any public key on the chain. This is useful for KVAC. - * @param maxSize - Maximum size of the accumulator - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createAddUniversalAccumulatorTx( - id, - accumulated, - publicKeyRef, - maxSize, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addAccumulator, signature] = await this.createSignedAddUniversalAccumulator( - id, - accumulated, - publicKeyRef, - maxSize, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.addAccumulator(addAccumulator, signature); - } - - /** - * Create a transaction to add KB universal (supports add/remove) accumulator - * @param id - Unique accumulator id - * @param accumulated - Current accumulated value. - * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not - * have any public key on the chain. This is useful for KVAC. - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createAddKBUniversalAccumulatorTx( - id, - accumulated, - publicKeyRef, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addAccumulator, signature] = await this.createSignedAddKBUniversalAccumulator( - id, - accumulated, - publicKeyRef, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.addAccumulator(addAccumulator, signature); - } - - /** - * Create a transaction to update accumulator - * @param id - Unique accumulator id - * @param newAccumulated - Accumulated value after the update - * @param additions - * @param removals - * @param witnessUpdateInfo - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise} - */ - async updateAccumulatorTx( - id, - newAccumulated, - { - additions = undefined, - removals = undefined, - witnessUpdateInfo = undefined, - }, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [update, signature] = await this.createSignedUpdateAccumulator( - id, - newAccumulated, - { additions, removals, witnessUpdateInfo }, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.updateAccumulator(update, signature); - } - - /** - * Create transaction to remove accumulator - * @param id - id to remove - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise} - */ - async removeAccumulatorTx( - id, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [removal, signature] = await this.createSignedRemoveAccumulator( - id, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.removeAccumulator(removal, signature); - } - - /** - * Add accumulator public key - * @param publicKey - Accumulator public key - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addPublicKey( - publicKey, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddPublicKeyTx( - publicKey, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Remove a public key - * @param removeKeyId - Index of the accumulator public key - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removePublicKey( - removeKeyId, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createRemovePublicKeyTx( - removeKeyId, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Add a positive (add-only) accumulator - * @param id - Unique accumulator id - * @param accumulated - Current accumulated value. - * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not - * have any public key on the chain. This is useful for KVAC. - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addPositiveAccumulator( - id, - accumulated, - publicKeyRef, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddPositiveAccumulatorTx( - id, - accumulated, - publicKeyRef, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Add universal (supports add/remove) accumulator - * @param id - Unique accumulator id - * @param accumulated - Current accumulated value. - * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not - * have any public key on the chain. This is useful for KVAC. - * @param maxSize - Maximum size of the accumulator - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addUniversalAccumulator( - id, - accumulated, - publicKeyRef, - maxSize, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddUniversalAccumulatorTx( - id, - accumulated, - publicKeyRef, - maxSize, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Add KB universal (supports add/remove) accumulator - * @param id - Unique accumulator id - * @param accumulated - Current accumulated value. - * @param publicKeyRef - Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not - * have any public key on the chain. This is useful for KVAC. - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addKBUniversalAccumulator( - id, - accumulated, - publicKeyRef, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddKBUniversalAccumulatorTx( - id, - accumulated, - publicKeyRef, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Update existing accumulator - * @param id - * @param newAccumulated - Accumulated value after the update - * @param additions - * @param removals - * @param witnessUpdateInfo - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise< object>} - */ - async updateAccumulator( - id, - newAccumulated, - { - additions = undefined, - removals = undefined, - witnessUpdateInfo = undefined, - }, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.updateAccumulatorTx( - id, - newAccumulated, - { additions, removals, witnessUpdateInfo }, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Remove the accumulator from chain. This frees up the id for reuse. - * @param id - id to remove - * @param signerDid - Signer of the transaction payload - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removeAccumulator( - id, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.removeAccumulatorTx(id, signerDid, signingKeyRef, { - nonce, - didModule, - }); - return this.signAndSend(tx, waitForFinalization, params); - } - - async createSignedAddPublicKey( - publicKey, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const addPk = { publicKey, nonce }; - const signature = this.signAddPublicKey(signingKeyRef, addPk); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [addPk, didSig]; - } - - async createSignedRemovePublicKey( - removeKeyId, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const removeKey = { keyRef: [signerHexDid, removeKeyId], nonce }; - const signature = this.signRemovePublicKey(signingKeyRef, removeKey); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [removeKey, didSig]; - } - - async createSignedAddPositiveAccumulator( - id, - accumulated, - publicKeyRef, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const accum = AccumulatorModule.prepareAddPositiveAccumulator( - this.api, - id, - accumulated, - publicKeyRef, - ); - const addAccum = { ...accum, nonce }; - const signature = this.signAddAccumulator(signingKeyRef, addAccum); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [addAccum, didSig]; - } - - async createSignedAddUniversalAccumulator( - id, - accumulated, - publicKeyRef, - maxSize, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const accum = AccumulatorModule.prepareAddUniversalAccumulator( - this.api, - id, - accumulated, - publicKeyRef, - maxSize, - ); - const addAccum = { ...accum, nonce }; - const signature = this.signAddAccumulator(signingKeyRef, addAccum); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [addAccum, didSig]; - } - - async createSignedAddKBUniversalAccumulator( - id, - accumulated, - publicKeyRef, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const accum = AccumulatorModule.prepareAddKBUniversalAccumulator( - this.api, - id, - accumulated, - publicKeyRef, - ); - const addAccum = { ...accum, nonce }; - const signature = this.signAddAccumulator(signingKeyRef, addAccum); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [addAccum, didSig]; - } - - async createSignedUpdateAccumulator( - id, - newAccumulated, - { - additions = undefined, - removals = undefined, - witnessUpdateInfo = undefined, - }, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - if (additions !== undefined) { - AccumulatorModule.ensureArrayOfBytearrays(additions); - } - if (removals !== undefined) { - AccumulatorModule.ensureArrayOfBytearrays(removals); - } - if (witnessUpdateInfo !== undefined && !isHex(witnessUpdateInfo)) { - throw new Error(`Require a hex string but got ${witnessUpdateInfo}`); - } - const updateAccum = { - id, - new_accumulated: newAccumulated, - additions, - removals, - witness_update_info: witnessUpdateInfo, - nonce, - }; - const signature = this.signUpdateAccumulator(signingKeyRef, updateAccum); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [updateAccum, didSig]; - } - - async createSignedRemoveAccumulator( - id, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const remAccum = { id, nonce }; - const signature = this.signRemoveAccumulator(signingKeyRef, remAccum); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [remAccum, didSig]; - } - - /** - * Get the accumulator as an object. The field `type` in object specifies whether it is "positive" or "universal". - * Fields `created` and `lastModified` are block nos where the accumulator was created and last updated respectively. - * Field `nonce` is the last accepted nonce by the chain, the next write to the accumulator should increment the nonce by 1. - * Field `accumulated` contains the current accumulated value. - * @param id - * @param withKeyAndParams - Fetch both keys and params. - * @param withKeyOnly - Fetch key only. This is useful when default params are used. - * @returns {Promise<{created: *, lastModified: *}|null>} - */ - async getAccumulator(id, withKeyAndParams = false, withKeyOnly = false) { - const resp = await this.api.query[this.moduleName].accumulators(id); - if (resp.isSome) { - const accumInfo = resp.unwrap(); - const accumulatorObj = { - created: accumInfo.createdAt.toNumber(), - lastModified: accumInfo.lastUpdatedAt.toNumber(), - }; - let common; - if (accumInfo.accumulator.isPositive) { - accumulatorObj.type = 'positive'; - common = accumInfo.accumulator.asPositive; - } else if (accumInfo.accumulator.isUniversal) { - accumulatorObj.type = 'universal'; - common = accumInfo.accumulator.asUniversal.common; - accumulatorObj.maxSize = accumInfo.accumulator.asUniversal.maxSize.toNumber(); - } else { - accumulatorObj.type = 'kb-universal'; - common = accumInfo.accumulator.asKbUniversal; - } - accumulatorObj.accumulated = u8aToHex(common.accumulated); - const owner = common.keyRef[0]; - const keyId = common.keyRef[1].toNumber(); - accumulatorObj.keyRef = [DockDidOrDidMethodKey.from(owner), keyId]; - - if (withKeyAndParams || withKeyOnly) { - if (keyId === 0) { - throw new Error( - 'Key id is 0 which means no public key exists for the accumulator on chain', - ); - } - const pk = await this.getPublicKeyByHexDid( - owner, - keyId, - withKeyAndParams, - ); - if (pk !== null) { - accumulatorObj.publicKey = pk; - } - } - return accumulatorObj; - } - return null; - } - - /** - * Fetch a block and get all accumulator updates made in that block's extrinsics corresponding to accumulator id `accumulatorId` - * @param accumulatorId - * @param blockNoOrBlockHash - * @returns {Promise} - Resolves to an array of `update`s where each `update` is an object with keys - * `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. The last keys have value null if they were - * not provided in the extrinsic. - */ - async getUpdatesFromBlock(accumulatorId, blockNoOrBlockHash) { - const extrinsics = await getAllExtrinsicsFromBlock( - this.api, - blockNoOrBlockHash, - false, - ); - return extrinsics - .map((e) => this.getUpdatesFromExtrinsic(e, accumulatorId)) - .filter((u) => u !== undefined); - } - - /** - * Fetch blocks corresponding to the given block numbers or hashes and get all accumulator updates made in those blocks' extrinsics corresponding to accumulator id `accumulatorId` - * @param accumulatorId - * @param blockNosOrBlockHashes {number[]|string[]} - * @returns {Promise} - Resolves to an array of `update`s where each `update` is an object with keys - * `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. The last keys have value null if they were - * not provided in the extrinsic. - */ - async getUpdatesFromBlocks(accumulatorId, blockNosOrBlockHashes) { - // NOTE: polkadot-js doesn't allow to fetch more than one block in 1 RPC call. - const extrinsics = await Promise.all( - blockNosOrBlockHashes.map( - async (b) => await getAllExtrinsicsFromBlock(this.api, b, false), - ), - ); - return extrinsics - .flat() - .map((e) => this.getUpdatesFromExtrinsic(e, accumulatorId)) - .filter((u) => u !== undefined); - } - - /** - * Get accumulator updates corresponding to accumulator id `accumulatorId` - * @param ext - * @param accumulatorId - * @returns {Promise} - Resolves to an `update` object with keys `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. - * The last keys have value null if they were not provided in the extrinsic. - */ - getUpdatesFromExtrinsic(ext, accumulatorId) { - if ( - ext.method - && ext.method.section === 'accumulator' - && ext.method.method === 'updateAccumulator' - ) { - const update = this.api.createType( - 'UpdateAccumulator', - ext.method.args[0], - ); - if (u8aToHex(update.id) === accumulatorId) { - // The following commented line produces truncated hex strings. Don't know why - // const additions = update.additions.isSome ? update.additions.unwrap().map(u8aToHex) : null; - const additions = update.additions.isSome - ? update.additions.unwrap().map((i) => u8aToHex(i)) - : null; - const removals = update.removals.isSome - ? update.removals.unwrap().map((i) => u8aToHex(i)) - : null; - const witnessUpdateInfo = update.witnessUpdateInfo.isSome - ? u8aToHex(update.witnessUpdateInfo.unwrap()) - : null; - - return { - newAccumulated: u8aToHex(update.newAccumulated), - additions, - removals, - witnessUpdateInfo, - }; - } - } - return undefined; - } - - /** - * Get last params written by this DID - * @param did - * @returns {Promise<{bytes: string}|null>} - */ - async getLastParamsWritten(did) { - const hexId = DockDidOrDidMethodKey.from(did); - - const counters = await this.api.query[this.moduleName].accumulatorOwnerCounters(hexId); - const counter = counters.paramsCounter.toNumber(); - if (counter > 0) { - const resp = await this.queryParamsFromChain(hexId, counter); - if (resp) { - return this.createParamsObjFromChainResponse(resp); - } - } - return null; - } - - /** - * Get all params written by a DID - * @param did - * @returns {Promise} - */ - async getAllParamsByDid(did) { - const hexId = DockDidOrDidMethodKey.from(did); - - const params = []; - const counters = await this.api.query[this.moduleName].accumulatorOwnerCounters(hexId); - const counter = counters.paramsCounter.toNumber(); - if (counter > 0) { - for (let i = 1; i <= counter; i++) { - // eslint-disable-next-line no-await-in-loop - const param = await this.getParamsByHexDid(hexId, i); - if (param !== null) { - params.push(param); - } - } - } - return params; - } - - /** - * Get all public keys written by a DID - * @param did - * @param withParams - * @returns {Promise< object[]>} - */ - async getAllPublicKeysByDid(did, withParams = false) { - const hexId = DockDidOrDidMethodKey.from(did); - - const pks = []; - const counters = await this.api.query[this.moduleName].accumulatorOwnerCounters(hexId); - const counter = counters.keyCounter.toNumber(); - if (counter > 0) { - for (let i = 1; i <= counter; i++) { - // eslint-disable-next-line no-await-in-loop - const pk = await this.getPublicKeyByHexDid(hexId, i, withParams); - if (pk !== null) { - pks.push(pk); - } - } - } - return pks; - } - - async queryParamsFromChain(hexDid, counter) { - const params = await this.api.query[this.moduleName].accumulatorParams( - hexDid, - counter, - ); - - if (params.isSome) { - return params.unwrap(); - } else { - return null; - } - } - - async queryPublicKeyFromChain(hexDid, counter) { - const key = await this.api.query[this.moduleName].accumulatorKeys( - hexDid, - counter, - ); - - if (key.isSome) { - return key.unwrap(); - } else { - return null; - } - } - - /** - * Update given witness by downloading necessary blocks and applying the updates if found. Both start and end are inclusive - * @param accumulatorId - * @param member - * @param witness - this will be updated to the latest witness - * @param startBlock - block number to start from - * @param endBlock - block number to end at. If not specified, it will pick the `lastUpdated` field of the accumulator. - * @param batchSize - the number of blocks to fetch in one go - * @returns {Promise} - */ - // eslint-disable-next-line sonarjs/cognitive-complexity - async updateVbAccumulatorWitnessFromUpdatesInBlocks( - accumulatorId, - member, - witness, - startBlock, - endBlock = undefined, - batchSize = 10, - ) { - if (endBlock === undefined) { - const accum = await this.accumulatorModule.getAccumulator( - accumulatorId, - false, - ); - // eslint-disable-next-line no-param-reassign - endBlock = accum.lastModified; - } - // If endBlock < startBlock, it won't throw an error but won't fetch any updates and witness won't be updated. - console.debug( - `Will start updating witness from block ${startBlock} to ${endBlock}`, - ); - let current = startBlock; - while (current <= endBlock) { - const till = current + batchSize <= endBlock ? current + batchSize : endBlock; - // Get updates from blocks [current, current + 1, current + 2, ..., till] - // eslint-disable-next-line no-await-in-loop - const updates = await this.getUpdatesFromBlocks( - accumulatorId, - inclusiveRange(current, till, 1), - ); - for (const update of updates) { - const additions = []; - const removals = []; - if (update.additions !== null) { - for (const a of update.additions) { - additions.push(hexToU8a(a)); - } - } - if (update.removals !== null) { - for (const a of update.removals) { - removals.push(hexToU8a(a)); - } - } - console.debug( - `Found ${additions.length} additions and ${removals.length} removals in block no ${current}`, - ); - const queriedWitnessInfo = new VBWitnessUpdateInfo( - hexToU8a(update.witnessUpdateInfo), - ); - - witness.updateUsingPublicInfoPostBatchUpdate( - member, - additions, - removals, - queriedWitnessInfo, - ); - } - current = till + 1; - } - } - - signAddParams(signingKeyRef, params) { - const serialized = getStateChange(this.api, 'AddAccumulatorParams', params); - return signingKeyRef.sign(serialized); - } - - signAddPublicKey(signingKeyRef, pk) { - const serialized = getStateChange(this.api, 'AddAccumulatorPublicKey', pk); - return signingKeyRef.sign(serialized); - } - - signRemoveParams(signingKeyRef, ref) { - const serialized = getStateChange(this.api, 'RemoveAccumulatorParams', ref); - return signingKeyRef.sign(serialized); - } - - signRemovePublicKey(signingKeyRef, ref) { - const serialized = getStateChange( - this.api, - 'RemoveAccumulatorPublicKey', - ref, - ); - return signingKeyRef.sign(serialized); - } - - signAddAccumulator(signingKeyRef, addAccumulator) { - const serialized = getStateChange( - this.api, - 'AddAccumulator', - addAccumulator, - ); - return signingKeyRef.sign(serialized); - } - - signUpdateAccumulator(signingKeyRef, update) { - const serialized = getStateChange(this.api, 'UpdateAccumulator', update); - return signingKeyRef.sign(serialized); - } - - signRemoveAccumulator(signingKeyRef, removal) { - const serialized = getStateChange(this.api, 'RemoveAccumulator', removal); - return signingKeyRef.sign(serialized); - } -} diff --git a/src/modules/anchor.js b/src/modules/anchor.js deleted file mode 100644 index 6f5bacb92..000000000 --- a/src/modules/anchor.js +++ /dev/null @@ -1,125 +0,0 @@ -/* eslint-disable camelcase */ -import { construct, verify_proof } from 'mrklt'; -import BLAKE2b from 'blake2b'; -import { u8aToHex, hexToU8a } from '@polkadot/util'; -import { isHexWithGivenByteSize, normalizeToHex } from '../utils/codec'; -import NoAnchorError from '../utils/errors/no-anchor-error'; - -/** Class to create and query anchors from chain. */ -export default class AnchorModule { - /** - * sets the dock api for this module - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param {Function} signAndSend - Callback signing and sending - */ - setApi(api, signAndSend) { - this.api = api; - this.module = api.tx.anchor; - this.signAndSend = signAndSend; - } - - /** - * Prepare transaction to write anchor on chain - * @param {Uint8Array|string} anchor - * @return {object} The extrinsic to sign and send. - */ - deployTx(anchor) { - const toPost = normalizeToHex(anchor); - return this.module.deploy(toPost); - } - - /** - * Write anchor on chain - * @param anchor - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async deploy(anchor, waitForFinalization = true, params = {}) { - return this.signAndSend(this.deployTx(anchor), waitForFinalization, params); - } - - /** - * Query anchor from chain - * @param anchor - * @param {Boolean} preHashed - If the anchor has already been hashed. - * @returns {Promise<*>} - The promise will either successfully resolve to the block number where anchor was created - * or reject with an error. - */ - async get(anchor, preHashed = false) { - let key; - if (preHashed) { - key = normalizeToHex(anchor); - } else if (anchor instanceof Uint8Array) { - key = u8aToHex(this.hash(anchor)); - } else if (isHexWithGivenByteSize(anchor)) { - key = u8aToHex(this.hash(hexToU8a(anchor))); - } else { - throw new Error('Require a hex string or a byte array'); - } - - const resp = await this.api.query.anchor.anchors(key); - if (resp.isNone) { - throw new NoAnchorError(anchor); - } - return resp.unwrap().toNumber(); - } - - /** - * Batch multiple documents in binary merkle tree and return the root and proofs for each document - * @param documents - * @returns {Array} - An 2 element array where 1st element is root and 2nd is an array with proofs for - * each document. - */ - batchDocumentsInMerkleTree(documents) { - // Hash all documents - const leafHashes = documents.map(this.hash); - - // If only one document was hashed, just return that as the root with no proofs (single anchor) - if (leafHashes.length === 1) { - return [leafHashes[0], []]; - } - - // Concatenate all leaf hashes into one bytearray - const packed = new Uint8Array(leafHashes.map((a) => [...a]).flat()); - const [root, proofs] = construct(packed); - return [Uint8Array.from(root), proofs, leafHashes]; - } - - /** - * Verify inclusion proof of document in a merkle tree with given root. The document is hashed to form a leaf first - * @param document - * @param proof - * @param root - * @returns {boolean} - */ - verifyMerkleProofOfDocument(document, proof, root) { - const hash = this.hash(document); - return this.verifyMerkleProofOfLeaf(hash, proof, root); - } - - /** - * Verify inclusion proof of leaf in a merkle tree with given root. - * @param leaf - * @param proof - * @param root - * @returns {boolean} - */ - verifyMerkleProofOfLeaf(leaf, proof, root) { - /* eslint-disable camelcase */ - const calculatedRoot = verify_proof(leaf, proof); - return calculatedRoot.length === root.length && calculatedRoot.every((v, i) => v === root[i]); - } - - /** - * Hash given data using Blake2b - * @param anchor - * @returns {Uint8Array} - */ - hash(anchor) { - const h = BLAKE2b(32); - h.update(anchor); - return h.digest(); - } -} diff --git a/src/modules/bbs-plus.js b/src/modules/bbs-plus.js deleted file mode 100644 index e4435af7e..000000000 --- a/src/modules/bbs-plus.js +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-disable camelcase */ - -import OffchainSignaturesModule from './offchain-signatures'; -import BBSPlusPublicKey from '../offchain-signatures/public-keys/bbs-plus'; -import BBSPlusParams from '../offchain-signatures/params/bbs-plus'; - -/** Class to write `BBS+` parameters and keys on chain */ -export default class BBSPlusModule extends OffchainSignaturesModule { - /** - * Builds `BBS+` params from the provided value. - */ - static buildParams(params) { - return new BBSPlusParams(params); - } - - /** - * Builds `BBS+` public key from the provided value. - */ - static buildPublicKey(publicKey) { - return new BBSPlusPublicKey(publicKey); - } - - async queryParamsFromChain(hexDid, counter) { - const params = await super.queryParamsFromChain(hexDid, counter); - - if (params != null && params.isBbsPlus) { - return params.asBbsPlus; - } else { - return null; - } - } - - async queryPublicKeyFromChain(hexDid, keyId) { - const key = await super.queryPublicKeyFromChain(hexDid, keyId); - - if (key != null && key.isBbsPlus) { - return key.asBbsPlus; - } else { - return null; - } - } -} diff --git a/src/modules/bbs.js b/src/modules/bbs.js deleted file mode 100644 index f823486a7..000000000 --- a/src/modules/bbs.js +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-disable camelcase */ - -import OffchainSignaturesModule from './offchain-signatures'; -import BBSPublicKey from '../offchain-signatures/public-keys/bbs'; -import BBSParams from '../offchain-signatures/params/bbs'; - -/** Class to write `BBS` parameters and keys on chain */ -export default class BBSModule extends OffchainSignaturesModule { - /** - * Builds `BBS` params from the provided value. - */ - static buildParams(params) { - return new BBSParams(params); - } - - /** - * Builds `BBS` public key from the provided value. - */ - static buildPublicKey(publicKey) { - return new BBSPublicKey(publicKey); - } - - async queryParamsFromChain(hexDid, counter) { - const params = await super.queryParamsFromChain(hexDid, counter); - - if (params != null && params.isBbs) { - return params.asBbs; - } else { - return null; - } - } - - async queryPublicKeyFromChain(hexDid, keyId) { - const key = await super.queryPublicKeyFromChain(hexDid, keyId); - - if (key != null && key.isBbs) { - return key.asBbs; - } else { - return null; - } - } -} diff --git a/src/modules/blob.js b/src/modules/blob.js deleted file mode 100644 index f6cf39323..000000000 --- a/src/modules/blob.js +++ /dev/null @@ -1,226 +0,0 @@ -import { encodeAddress, randomAsHex } from '@polkadot/util-crypto'; -import { - u8aToHex, - u8aToString, - stringToHex, - bufferToU8a, -} from '@polkadot/util'; - -import { getDidNonce, getStateChange } from '../utils/misc'; -import { isHexWithGivenByteSize, getHexIdentifier } from '../utils/codec'; -import NoBlobError from '../utils/errors/no-blob-error'; -import { DockDidOrDidMethodKey, createDidSig } from '../did'; - -export const DockBlobQualifier = 'blob:dock:'; -export const DockBlobIdByteSize = 32; - -// Maximum size of the blob in bytes -// implementer may choose to implement this as a dynamic config option settable with the `parameter_type!` macro -export const BLOB_MAX_BYTE_SIZE = 8192; - -/** - * Check if the given identifier is 32 byte hex - * @param {string} identifier - The identifier to check. - * @return {void} Throws exception if invalid identifier - */ -export function validateBlobIDHexIdentifier(identifier) { - if (!isHexWithGivenByteSize(identifier, DockBlobIdByteSize)) { - throw new Error(`ID must be ${DockBlobIdByteSize} bytes`); - } -} - -/** - * Gets the hexadecimal value of the given ID. - * @param {string} id - The ID can be passed as fully qualified ID like `blob:dock:` or - * a 32 byte hex string - * @return {string} Returns the hexadecimal representation of the ID. - */ -export function getHexIdentifierFromBlobID(id) { - const hexId = getHexIdentifier(id, DockBlobQualifier, DockBlobIdByteSize); - validateBlobIDHexIdentifier(hexId); - - return hexId; -} - -/** - * Create and return a fully qualified Dock Blob id, i.e. "blob:dock:" - * @returns {string} - The Blob id - */ -export function createNewDockBlobId() { - const hexId = randomAsHex(DockBlobIdByteSize); - return blobHexIdToQualified(hexId); -} - -/** - * Return a fully qualified Dock Blob id, i.e. "blob:dock:" - * @param {string} hexId - The hex blob id (without the qualifier) - * @returns {string} - The fully qualified Blob id - */ -export function blobHexIdToQualified(hexId) { - const ss58Id = encodeAddress(hexId); - return `${DockBlobQualifier}${ss58Id}`; -} - -/** Class to create and update Blobs on chain. */ -class BlobModule { - /** - * Creates a new instance of BlobModule and sets the api - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param signAndSend - */ - constructor(api, signAndSend) { - this.api = api; - this.module = api.tx.blobStore; - this.signAndSend = signAndSend; - } - - /** - * Create a signed transaction for adding a new blob - * @param blob - * @param signerDid - Signer of the blob - * @param signingKeyRef - The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createNewTx( - blob, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addBlob, didSig] = await this.createSignedAddBlob( - blob, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.new(addBlob, didSig); - } - - /** - * Write a new blob on chain. - * @param blob - * @param signerDid - Signer of the blob - * @param signingKeyRef - The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async new( - blob, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - await this.createNewTx(blob, signerDid, signingKeyRef, { - nonce, - didModule, - }), - waitForFinalization, - params, - ); - } - - /** - * Get blob with given id from the chain. Throws if the blob can't be found. - * @param {string} id - Can either be a full blob id like blob:dock:0x... or just the hex identifier - * @returns {Promise} - A 2-element array where the first is the author and the second is the blob contents. - */ - async get(id) { - const hexId = getHexIdentifierFromBlobID(id); - const resp = await this.api.query.blobStore.blobs(hexId); - if (resp.isNone) { - throw new NoBlobError(id); - } - - const respTuple = resp.unwrap(); - if (respTuple.length === 2) { - let value = bufferToU8a(respTuple[1]); - - // Try to convert the value to a JSON object - try { - const strValue = u8aToString(value); - if (strValue.substring(0, 1) === '{') { - value = JSON.parse(strValue); - } - } catch (e) { - // no-op, just use default Uint8 array value - } - - return [DockDidOrDidMethodKey.from(respTuple[0]), value]; - } - throw new Error(`Needed 2 items in response but got${respTuple.length}`); - } - - /** - * Create an `AddBlob` struct as expected by node and return along with signature. - * @param blob - * @param {DockDidOrDidMethodKey} signerDid - Signer DID - * @param signingKeyRef - The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise} - */ - async createSignedAddBlob( - blob, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - if (!blob.blob) { - throw new Error('Blob must have a value!'); - } - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerDid, nonce, didModule); - - const blobObj = { - ...blob, - blob: this.getSerializedBlobValue(blob.blob), - }; - const addBlob = { - blob: blobObj, - nonce, - }; - const serializedAddBlob = this.getSerializedBlob(addBlob); - const signature = signingKeyRef.sign(serializedAddBlob); - const didSig = createDidSig(signerDid, signingKeyRef, signature); - return [addBlob, didSig]; - } - - getSerializedBlobValue(blobValue) { - if (blobValue instanceof Uint8Array) { - return u8aToHex(blobValue); - } else if (typeof blobValue === 'object') { - return stringToHex(JSON.stringify(blobValue)); - } else if ( - typeof blobValue === 'string' - && !isHexWithGivenByteSize(blobValue) - ) { - return stringToHex(blobValue); - } - // Assuming `blobValue` is in hex - return blobValue; - } - - /** - * Serializes the `Blob` (for signing before sending to the node) - * @param {object} blob - `Blob` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedBlob(blob) { - return getStateChange(this.api, 'AddBlob', blob); - } -} - -export default BlobModule; diff --git a/src/modules/did/did.js b/src/modules/did/did.js deleted file mode 100644 index 8f0047835..000000000 --- a/src/modules/did/did.js +++ /dev/null @@ -1,1374 +0,0 @@ -import { encodeAddress } from '@polkadot/util-crypto'; -import { u8aToString, hexToU8a, u8aToHex } from '@polkadot/util'; -import { BTreeSet } from '@polkadot/types'; -import b58 from 'bs58'; -import { - DockDidOrDidMethodKey, - DockDIDQualifier, - NoDIDError, - validateDockDIDHexIdentifier, - NoOnchainDIDError, - NoOffchainDIDError, - createDidSig, - DidMethodKeyQualifier, -} from '../../did'; -import { getStateChange } from '../../utils/misc'; - -import OffChainDidDocRef from './offchain-did-doc-ref'; -import { - PublicKeyEd25519, - PublicKeySecp256k1, - PublicKeySr25519, - PublicKeyX25519, - DidKey, - VerificationRelationship, -} from '../../public-keys'; -import { ServiceEndpointType } from './service-endpoint'; -import WithParamsAndPublicKeys from '../WithParamsAndPublicKeys'; - -export const ATTESTS_IRI = 'https://rdf.dock.io/alpha/2021#attestsDocumentContents'; - -const valuePropOrIdentity = (val) => val.value || val; - -/** Class to create, update and destroy DIDs */ -class DIDModule { - /** - * Creates a new instance of DIDModule and sets the api - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param signAndSend - Function to sign and send transaction - */ - constructor(api, signAndSend) { - this.api = api; - this.module = api.tx.didModule; - this.signAndSend = signAndSend; - } - - /** - * Creates transaction to create a new off-chain DID - * @param did - - * @param {OffChainDidDocRef} didDocRef - Off chain reference for the DID - * @returns {*} - */ - createNewOffchainTx(did, didDocRef) { - const hexId = DockDidOrDidMethodKey.from(did).asDid; - return this.module.newOffchain(hexId, didDocRef); - } - - /** - * Create a new off-chain DID - * @param did - * @param didDocRef - Off chain reference for the DID - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async newOffchain(did, didDocRef, waitForFinalization = true, params = {}) { - return this.signAndSend( - this.createNewOffchainTx(did, didDocRef), - waitForFinalization, - params, - ); - } - - /** - * Create a transaction to update the DID Doc reference of the off chain DID - * @param did - * @param didDocRef - new reference - * @returns {*} - */ - createSetOffchainDidRefTx(did, didDocRef) { - const hexId = DockDidOrDidMethodKey.from(did).asDid; - return this.module.setOffchainDidDocRef(hexId, didDocRef); - } - - /** - * Update the DID Doc reference of the off chain DID - * @param did - * @param didDocRef - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async setOffchainDidRef( - did, - didDocRef, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.createSetOffchainDidRefTx(did, didDocRef), - waitForFinalization, - params, - ); - } - - /** - * Create transaction to remove off chain DID - * @param did - * @returns {Promise<*>} - */ - createRemoveOffchainDidTx(did) { - const hexId = DockDidOrDidMethodKey.from(did).asDid; - return this.module.removeOffchainDid(hexId); - } - - /** - * Remove off-chain DID - * @param did - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removeOffchainDid(did, waitForFinalization = true, params = {}) { - return this.signAndSend( - this.createRemoveOffchainDidTx(did), - waitForFinalization, - params, - ); - } - - /** - * Creates transaction to create a new DID on the Dock chain. - * @param {string} did - The new DID. Can be a full DID or hex identifier - * @param {DidKey[]} didKeys - Array of `DidKey`s as expected by the Substrate node - * @param {array} controllers - Array of `Did`s as expected by the Substrate node - * @return {object} The extrinsic to sign and send. - */ - createNewOnchainTx(did, didKeys, controllers) { - const cnts = new BTreeSet(this.api.registry, 'Controller'); - if (controllers !== undefined) { - controllers.forEach((c) => { - cnts.add(DockDidOrDidMethodKey.from(c)); - }); - } - const hexId = DockDidOrDidMethodKey.from(did).asDid; - return this.module.newOnchain( - hexId, - didKeys.map((d) => d.toJSON()), - cnts, - ); - } - - /** - * Creates a new DID on the Dock chain. - * @param {string} did - The new DID. Can be a full DID or hex identifier - * @param {DidKey[]} didKeys - Array of `DidKey`s as expected by the Substrate node - * @param {array} controllers - Array of `Did`s as expected by the Substrate node. - * @param waitForFinalization - * @param params - * @return {Promise} Promise to the pending transaction - */ - async new( - did, - didKeys, - controllers, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.createNewOnchainTx(did, didKeys, controllers), - waitForFinalization, - params, - ); - } - - /** - * Creates a new `did:key:` on the Dock chain. - * @param {{ ed25519: Uint8Array } | { secp256k1: Uint8Array }} did - The new DID. Can be either `PublicKeyEd25519` or `PublicKeySecp256k1`. - * @param waitForFinalization - * @param params - * @return {Promise} Promise to the pending transaction - */ - async newDidMethodKey(didMethodKey, waitForFinalization = true, params = {}) { - return this.signAndSend( - this.module.newDidMethodKey(didMethodKey), - waitForFinalization, - params, - ); - } - - /** - * Create transaction to add keys to an on-chain DID. - * @param {DidKey[]} didKeys - Array of `DidKey`s as expected by the Substrate node - * @param targetDid - The DID to which keys are being added - * @param signerDid - The DID that is adding the keys by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @returns {Promise<*>} - */ - async createAddKeysTx( - didKeys, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addKeys, signature] = await this.createSignedAddKeys( - didKeys, - targetHexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.addKeys(addKeys, signature); - } - - /** - * Add keys to an on-chain DID - * @param {DidKey[]} didKeys - Array of `DidKey`s as expected by the Substrate node - * @param targetDid - The DID to which keys are being added - * @param signerDid - The DID that is adding the keys by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addKeys( - didKeys, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - await this.createAddKeysTx( - didKeys, - targetDid, - signerDid, - signingKeyRef, - nonce, - ), - waitForFinalization, - params, - ); - } - - /** - * Create transaction to add controllers to an on-chain DID. - * @param controllers - The DIDs that will control the `targetDid` - * @param targetDid - The DID to which keys are being added - * @param signerDid - The DID that is adding the controllers by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @returns {Promise<*>} - */ - async createAddControllersTx( - controllers, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addControllers, signature] = await this.createSignedAddControllers( - controllers, - targetHexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.addControllers(addControllers, signature); - } - - /** - * Add controllers to an on-chain DID. - * @param controllers - The DIDs that will control the `targetDid` - * @param targetDid - The DID to which controllers are being added - * @param signerDid - The DID that is adding the controllers by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addControllers( - controllers, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddControllersTx( - controllers, - targetDid, - signerDid, - signingKeyRef, - nonce, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Create a transaction to add a new service endpoint - * @param endpointId - The id of the service endpoint. Each endpoint has a unique id. - * @param {ServiceEndpointType} endpointType - The type of the endpoint. - * @param {Array} origins - An array of one of URIs encoded as hex. - * @param targetDid - The DID to which service endpoint is being added - * @param signerDid - The DID that is adding the service endpoint by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @returns {Promise<*>} - */ - async createAddServiceEndpointTx( - endpointId, - endpointType, - origins, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addServiceEndpoint, signature] = await this.createSignedAddServiceEndpoint( - endpointId, - endpointType, - origins, - targetHexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.addServiceEndpoint(addServiceEndpoint, signature); - } - - /** - * Add a new service endpoint - * @param endpointId - The id of the service endpoint. Each endpoint has a unique id. - * @param {ServiceEndpointType} endpointType - The type of the endpoint. - * @param {Array} origins - An array of one of URIs encoded as hex. - * @param targetDid - The DID to which service endpoint is being added - * @param signerDid - The DID that is adding the service endpoint by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addServiceEndpoint( - endpointId, - endpointType, - origins, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddServiceEndpointTx( - endpointId, - endpointType, - origins, - targetDid, - signerDid, - signingKeyRef, - nonce, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Create transaction to remove keys - * @param keyIds - Key indices to remove - * @param targetDid - The DID from which keys are being removed - * @param signerDid - The DID that is removing the keys by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @returns {Promise<*>} - */ - async createRemoveKeysTx( - keyIds, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [removeKeys, signature] = await this.createSignedRemoveKeys( - keyIds, - targetHexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.removeKeys(removeKeys, signature); - } - - /** - * Remove keys from a DID - * @param keyIds - Key indices to remove - * @param targetDid - The DID from which keys are being removed - * @param signerDid - The DID that is removing the keys by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removeKeys( - keyIds, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createRemoveKeysTx( - keyIds, - targetDid, - signerDid, - signingKeyRef, - nonce, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Create transaction to remove controllers from a DID - * @param controllers - Controller DIDs to remove. - * @param targetDid - The DID from which controllers are being removed - * @param signerDid - The DID that is removing the controllers by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @returns {Promise<*>} - */ - async removeControllersTx( - controllers, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [removeControllers, signature] = await this.createSignedRemoveControllers( - controllers, - targetHexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.removeControllers(removeControllers, signature); - } - - /** - * Remove controllers from a DID - * @param controllers - Controller DIDs to remove. - * @param targetDid - The DID from which controllers are being removed - * @param signerDid - The DID that is removing the controllers by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removeControllers( - controllers, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.removeControllersTx( - controllers, - targetDid, - signerDid, - signingKeyRef, - nonce, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Create transaction to remove a service endpoint from a DID - * @param endpointId - The endpoint to remove - * @param targetDid - The DID from which endpoint is being removed - * @param signerDid - The DID that is removing the endpoint by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @returns {Promise<*>} - */ - async createRemoveServiceEndpointTx( - endpointId, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [removeServiceEndpoint, signature] = await this.createSignedRemoveServiceEndpoint( - endpointId, - targetHexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.removeServiceEndpoint(removeServiceEndpoint, signature); - } - - /** - * Remove a service endpoint from a DID - * @param endpointId - The endpoint to remove - * @param targetDid - The DID from which endpoint is being removed - * @param signerDid - The DID that is removing the endpoint by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removeServiceEndpoint( - endpointId, - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createRemoveServiceEndpointTx( - endpointId, - targetDid, - signerDid, - signingKeyRef, - nonce, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Create a transaction to remove an on-chain DID - * @param targetDid - The DID being removed - * @param signerDid - The DID that is removing `targetDid` by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @return {Promise} The extrinsic to sign and send. - */ - async createRemoveTx(targetDid, signerDid, signingKeyRef, nonce = undefined) { - const hexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [didRemoval, signature] = await this.createSignedDidRemoval( - hexDid, - signerHexDid, - signingKeyRef, - nonce, - ); - return this.module.removeOnchainDid(didRemoval, signature); - } - - /** - * Removes an on-chain DID. - * @param targetDid - The DID being removed - * @param signerDid - The DID that is removing `targetDid` by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's keypair reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then an appropriate nonce will be - * fetched from chain before creating the transaction - * @param waitForFinalization - * @param params - * @return {Promise} Promise to the pending transaction - */ - async remove( - targetDid, - signerDid, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createRemoveTx( - targetDid, - signerDid, - signingKeyRef, - nonce, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * - * @param priority - * @param iri - * @param did - * @param signingKeyRef - * @param nonce - * @returns {Promise>} - */ - async createSetClaimTx(priority, iri, did, signingKeyRef, nonce = undefined) { - const hexDid = DockDidOrDidMethodKey.from(did); - const [setAttestation, signature] = await this.createSignedAttestation( - priority, - iri, - hexDid, - signingKeyRef, - nonce, - ); - return this.api.tx.attest.setClaim(setAttestation, signature); - } - - /** - * Creates an attestation claim on chain for a specific DID - * @param priority - * @param iri - * @param did - * @param signingKeyRef - * @param nonce - * @param waitForFinalization - * @param params - */ - async setClaim( - priority, - iri, - did, - signingKeyRef, - nonce = undefined, - waitForFinalization = true, - params = {}, - ) { - const attestTx = await this.createSetClaimTx( - priority, - iri, - did, - signingKeyRef, - nonce, - ); - return this.signAndSend(attestTx, waitForFinalization, params); - } - - /** - * Create the fully qualified DID like "did:dock:..." - * @param {string} did - DID - * @return {string} The DID identifier. - */ - getFullyQualifiedDID(did) { - return `${DockDIDQualifier}${did}`; - } - - /** - * Create the fully qualified DID like "did:dock:..." - * @param {string} didMethodKey - DID - * @return {string} The DID identifier. - */ - getFullyQualifiedDIDMethodKey(didMethodKey) { - return `${DidMethodKeyQualifier}${didMethodKey}`; - } - - /** - * Fetches the DIDs attestations IRI from the chain - * @param {string} hexId - DID in hex format - * @return {Promise} The DID's attestation, if any - */ - async getAttests(hexId) { - const attests = await this.api.query.attest.attestations(hexId); - return attests.iri.isSome - ? u8aToString(hexToU8a(attests.iri.toString())) - : null; - } - - /** - * Gets a DID from the Dock chain and create a DID document according to W3C spec. - * Throws NoDID if the DID does not exist on chain. - * @param {string} did - The DID can be passed as fully qualified DID like `did:dock:` or - * a 32 byte hex string - * @param getOffchainSigKeys - * @return {Promise} The DID document. - */ - // eslint-disable-next-line sonarjs/cognitive-complexity - async getDocument(did, { getOffchainSigKeys = true } = {}) { - const typedDid = DockDidOrDidMethodKey.from(did); - const hexDid = typedDid.asDid; - let didDetails = await this.getOnchainDidDetail(hexDid); - didDetails = didDetails.data || didDetails; - - // Get DIDs attestations - const attests = await this.getAttests(typedDid); - - // If given DID was in hex, encode to SS58 and then construct fully qualified DID else the DID was already fully qualified - const id = String(typedDid); - - // Get controllers - const controllers = []; - if (didDetails.activeControllers > 0) { - const cnts = await this.api.query.didModule.didControllers.entries(hexDid); - cnts.forEach(([key, value]) => { - if (value.isSome) { - const [controlled, controller] = key.toHuman(); - if (controlled !== hexDid) { - throw new Error( - `Controlled DID ${controlled[0]} was found to be different than queried DID ${hexDid}`, - ); - } - controllers.push(controller); - } - }); - } - - // Get service endpoints - const serviceEndpoints = []; - const sps = await this.api.query.didModule.didServiceEndpoints.entries(hexDid); - sps.forEach(([key, value]) => { - if (value.isSome) { - const sp = value.unwrap(); - // eslint-disable-next-line no-underscore-dangle - const [d, spId] = key.args; - // eslint-disable-next-line no-underscore-dangle - const d_ = u8aToHex(d); - if (d_ !== hexDid) { - throw new Error( - `DID ${d_} was found to be different than queried DID ${hexDid}`, - ); - } - serviceEndpoints.push([spId, sp]); - } - }); - - // Get keys and categorize them by verification relationship type - const keys = []; - const assertion = []; - const authn = []; - const capInv = []; - const keyAgr = []; - if (didDetails.lastKeyId > 0) { - const dks = await this.api.query.didModule.didKeys.entries(hexDid); - dks.forEach(([key, value]) => { - if (value.isSome) { - const dk = value.unwrap(); - // eslint-disable-next-line no-underscore-dangle - const [d, i] = key.args; - // eslint-disable-next-line no-underscore-dangle - const d_ = u8aToHex(d); - if (d_ !== hexDid) { - throw new Error( - `DID ${d_} was found to be different than queried DID ${hexDid}`, - ); - } - const index = i.toNumber(); - const pk = dk.publicKey; - let publicKeyRaw; - let typ; - if (pk.isSr25519) { - typ = 'Sr25519VerificationKey2020'; - publicKeyRaw = valuePropOrIdentity(pk.asSr25519); - } else if (pk.isEd25519) { - typ = 'Ed25519VerificationKey2018'; - publicKeyRaw = valuePropOrIdentity(pk.asEd25519); - } else if (pk.isSecp256k1) { - typ = 'EcdsaSecp256k1VerificationKey2019'; - publicKeyRaw = valuePropOrIdentity(pk.asSecp256k1); - } else if (pk.isX25519) { - typ = 'X25519KeyAgreementKey2019'; - publicKeyRaw = valuePropOrIdentity(pk.asX25519); - } else { - throw new Error(`Cannot parse public key ${pk}`); - } - keys.push([index, typ, publicKeyRaw]); - const vr = new VerificationRelationship(dk.verRels.toNumber()); - if (vr.isAuthentication(vr)) { - authn.push(index); - } - if (vr.isAssertion(vr)) { - assertion.push(index); - } - if (vr.isCapabilityInvocation(vr)) { - capInv.push(index); - } - if (vr.isKeyAgreement(vr)) { - keyAgr.push(index); - } - } - }); - } - - if (getOffchainSigKeys === true) { - const { lastKeyId } = didDetails; - - // If any keys should be fetched - if (lastKeyId > keys.length) { - // key id can be anything from 1 to `lastKeyId` - const possibleKeyIds = new Set(); - for (let i = 1; i <= lastKeyId; i++) { - possibleKeyIds.add(i); - } - // Remove key ids already seen as non-BBS+ - for (const [i] of keys) { - possibleKeyIds.delete(i); - } - - // Query all BBS+ keys in a single RPC call to the node. - const queryKeys = []; - for (const k of possibleKeyIds) { - queryKeys.push([hexDid, k]); - } - if (this.api.query.offchainSignatures != null) { - const resp = await this.api.query.offchainSignatures.publicKeys.multi(queryKeys); - let currentIter = 0; - for (let r of resp) { - // The gaps in `keyId` might correspond to removed keys - if (r.isSome) { - let rawKey; - let keyType; - r = r.unwrap(); - - if (r.isBbs) { - keyType = 'Bls12381BBSVerificationKeyDock2023'; - rawKey = r.asBbs; - } else if (r.isBbsPlus) { - keyType = 'Bls12381G2VerificationKeyDock2022'; - rawKey = r.asBbsPlus; - } else if (r.isPs) { - keyType = 'Bls12381PSVerificationKeyDock2023'; - rawKey = r.asPs; - } - // Don't care about signature params for now - const pkObj = WithParamsAndPublicKeys.createPublicKeyObjFromChainResponse( - rawKey, - ); - if (pkObj.curveType !== 'Bls12381') { - throw new Error( - `Curve type should have been Bls12381 but was ${pkObj.curveType}`, - ); - } - const keyIndex = queryKeys[currentIter][1]; - keys.push([keyIndex, keyType, hexToU8a(pkObj.bytes)]); - assertion.push(keyIndex); - } - currentIter++; - } - } else { - const resp = await this.api.query.bbsPlus.bbsPlusKeys.multi(queryKeys); - let currentIter = 0; - for (const r of resp) { - // The gaps in `keyId` might correspond to removed keys - if (r.isSome) { - const keyType = 'Bls12381G2VerificationKeyDock2022'; - const rawKey = r.unwrap(); - - // Don't care about signature params for now - const pkObj = WithParamsAndPublicKeys.createPublicKeyObjFromChainResponse( - rawKey, - ); - if (pkObj.curveType !== 'Bls12381') { - throw new Error( - `Curve type should have been Bls12381 but was ${pkObj.curveType}`, - ); - } - const keyIndex = queryKeys[currentIter][1]; - keys.push([keyIndex, keyType, hexToU8a(pkObj.bytes)]); - assertion.push(keyIndex); - } - currentIter++; - } - } - } - } - - keys.sort((a, b) => a[0] - b[0]); - assertion.sort(); - authn.sort(); - capInv.sort(); - keyAgr.sort(); - - const verificationMethod = keys.map(([index, typ, publicKeyRaw]) => ({ - id: `${id}#keys-${index}`, - type: typ, - controller: id, - publicKeyBase58: b58.encode(publicKeyRaw), - })); - const assertionMethod = assertion.map((i) => `${id}#keys-${i}`); - const authentication = authn.map((i) => `${id}#keys-${i}`); - const capabilityInvocation = capInv.map((i) => `${id}#keys-${i}`); - const keyAgreement = keyAgr.map((i) => `${id}#keys-${i}`); - - // Construct document - const document = { - '@context': ['https://www.w3.org/ns/did/v1'], - id, - controller: [...controllers].map((c) => { - if (c.Did) { - return this.getFullyQualifiedDID(encodeAddress(c.Did)); - } else if (c.DidMethodKey) { - return this.getFullyQualifiedDIDMethodKey( - encodeAddress(c.DidMethodKey), - ); - } else { - return this.getFullyQualifiedDID(encodeAddress(c)); - } - }), - publicKey: verificationMethod, - }; - - if (authentication.length > 0) { - document.authentication = authentication; - } - if (assertionMethod.length > 0) { - document.assertionMethod = assertionMethod; - } - if (keyAgreement.length > 0) { - document.keyAgreement = keyAgreement; - } - if (capabilityInvocation.length > 0) { - document.capabilityInvocation = capabilityInvocation; - } - - if (serviceEndpoints.length > 0) { - const decoder = new TextDecoder(); - document.service = serviceEndpoints.map(([spId, sp]) => { - const spType = sp.types.toNumber(); - if (spType !== 1) { - throw new Error( - `Only "LinkedDomains" supported as service endpoint type for now but found ${spType}`, - ); - } - return { - id: decoder.decode(spId), - type: 'LinkedDomains', - serviceEndpoint: sp.origins.map((o) => decoder.decode(o)), - }; - }); - } - - // Assign attestations - if (attests) { - document[ATTESTS_IRI] = attests; - } - - return document; - } - - /** - * Gets the DID detail of an on chain DID - * the chain and return them. It will throw NoDID if the DID does not exist on - * chain. - * @param {string} didIdentifier - DID identifier as hex. Not accepting full DID intentionally for efficiency as these - * methods are used internally - * @return {Promise} - */ - async getOnchainDidDetail(didIdentifier) { - validateDockDIDHexIdentifier(didIdentifier); - let resp = await this.api.query.didModule.dids(didIdentifier); - if (resp.isNone) { - throw new NoDIDError(`did:dock:${didIdentifier}`); - } - - resp = resp.unwrap(); - if (resp.isOffChain) { - throw new NoOnchainDIDError(`did:dock:${didIdentifier}`); - } - const didDetail = resp.asOnChain; - const data = didDetail.data || didDetail; - return { - nonce: didDetail.nonce.toNumber(), - lastKeyId: data.lastKeyId.toNumber(), - activeControllerKeys: data.activeControllerKeys.toNumber(), - activeControllers: data.activeControllers.toNumber(), - }; - } - - async getDidMethodKeyDetail(did) { - let resp = await this.api.query.didModule.didMethodKeys(did); - if (resp.isNone) { - throw new NoDIDError(String(did)); - } - resp = resp.unwrap(); - - return { - nonce: resp.nonce.toNumber(), - }; - } - - /** - * Gets the DID detail of an on chain DID - * @param didIdentifier - * @returns {Promise<{accountId: HexString}>} - */ - async getOffchainDidDetail(didIdentifier) { - validateDockDIDHexIdentifier(didIdentifier); - let resp = await this.api.query.didModule.dids(didIdentifier); - if (resp.isNone) { - throw new NoDIDError(`did:dock:${didIdentifier}`); - } - resp = resp.unwrap(); - if (resp.isOnChain) { - throw new NoOffchainDIDError(`did:dock:${didIdentifier}`); - } - resp = resp.asOffChain; - const detail = { accountId: u8aToHex(resp.accountId) }; - - if (resp.docRef.isCid) { - detail.docRef = OffChainDidDocRef.cid(u8aToHex(resp.docRef.asCid)); - } else if (resp.docRef.isUrl) { - detail.docRef = OffChainDidDocRef.url(u8aToHex(resp.docRef.asUrl)); - } else if (resp.docRef.isCustom) { - detail.docRef = OffChainDidDocRef.custom(u8aToHex(resp.docRef.asCustom)); - } else { - throw new Error(`Cannot parse DIDDoc ref ${resp.docRef}`); - } - return detail; - } - - /** - * Gets the current nonce for the DID. It will throw error if the DID does not exist on - * chain or chain returns null response. - * @param {DockDidOrDidMethodKey} did - DID identifier as hex. Not accepting full DID intentionally for efficiency as these - * methods are used internally - * @return {Promise} - */ - async getNonceForDid(did) { - if (did.isDid) { - return (await this.getOnchainDidDetail(did.asDid)).nonce; - } else if (did.isDidMethodKey) { - return (await this.getDidMethodKeyDetail(did.asDidMethodKey)).nonce; - } else { - return (await this.getOnchainDidDetail(did)).nonce; - } - } - - /** - * Gets the nonce that should be used for sending the next transaction by this DID. Its 1 more than the current nonce. - * @param {DockDidOrDidMethodKey} did - * @returns {Promise<*>} - */ - async getNextNonceForDid(did) { - return (await this.getNonceForDid(did)) + 1; - } - - /** - * Get the `DidKey` for the DID with given key index. Key indices start from 1 and can have holes - * @param did - * @param {number} keyIndex - * @returns {Promise} - */ - async getDidKey(did, keyIndex) { - const hexId = DockDidOrDidMethodKey.from(did).asDid; - let resp = await this.api.query.didModule.didKeys(hexId, keyIndex); - if (resp.isNone) { - throw new Error(`No key for found did ${did} and key index ${keyIndex}`); - } - resp = resp.unwrap(); - - const pk = resp.publicKey; - - let publicKey; - if (pk.isSr25519) { - publicKey = new PublicKeySr25519( - u8aToHex(valuePropOrIdentity(pk.asSr25519)), - ); - } else if (pk.isEd25519) { - publicKey = new PublicKeyEd25519( - u8aToHex(valuePropOrIdentity(pk.asEd25519)), - ); - } else if (pk.isSecp256k1) { - publicKey = new PublicKeySecp256k1( - u8aToHex(valuePropOrIdentity(pk.asSecp256k1)), - ); - } else if (pk.isX25519) { - publicKey = new PublicKeyX25519( - u8aToHex(valuePropOrIdentity(pk.asX25519)), - ); - } else { - throw new Error(`Cannot parse public key ${pk}`); - } - return new DidKey( - publicKey, - new VerificationRelationship(resp.verRels.toNumber()), - ); - } - - /** - * Returns true if DID `controller` is a controller of DID `controlled`, false otherwise - * @param controlled - * @param controller - * @returns {Promise} - */ - async isController(controlled, controller) { - const controlledDid = DockDidOrDidMethodKey.from(controlled).asDid; - const controllerDid = DockDidOrDidMethodKey.from(controller); - const resp = await this.api.query.didModule.didControllers( - controlledDid, - controllerDid, - ); - return resp.isSome; - } - - /** - * Returns the service endpoint of the DID and known by `endpointId` - * @param did - * @param endpointId - * @returns {Promise} - */ - async getServiceEndpoint(did, endpointId) { - const hexId = DockDidOrDidMethodKey.from(did).asDid; - let resp = await this.api.query.didModule.didServiceEndpoints( - hexId, - endpointId, - ); - if (resp.isNone) { - throw new Error( - `No service endpoint found for did ${did} and with id ${endpointId}`, - ); - } - resp = resp.unwrap(); - return { - type: new ServiceEndpointType(resp.types.toNumber()), - origins: resp.origins.map((origin) => u8aToHex(origin)), - }; - } - - async createSignedAddKeys( - didKeys, - did, - controllerDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerDid); - } - - const keys = didKeys.map((d) => d.toJSON()); - const addKeys = { did, keys, nonce }; - const serializedAddKeys = this.getSerializedAddKeys(addKeys); - const signature = signingKeyRef.sign(serializedAddKeys); - const didSig = createDidSig(controllerDid, signingKeyRef, signature); - return [addKeys, didSig]; - } - - async createSignedAddControllers( - controllers, - hexDid, - controllerHexDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerHexDid); - } - - const cnts = new BTreeSet(this.api.registry, 'Controller'); - controllers.forEach((c) => { - cnts.add(DockDidOrDidMethodKey.from(c)); - }); - const addControllers = { did: hexDid, controllers: cnts, nonce }; - const serializedAddControllers = this.getSerializedAddControllers(addControllers); - const signature = signingKeyRef.sign(serializedAddControllers); - const didSig = createDidSig(controllerHexDid, signingKeyRef, signature); - return [addControllers, didSig]; - } - - async createSignedAddServiceEndpoint( - endpointId, - endpointType, - origins, - hexDid, - controllerHexDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerHexDid); - } - - const endpoint = { types: endpointType.value, origins }; - const addServiceEndpoint = { - did: hexDid, - id: endpointId, - endpoint, - nonce, - }; - const serializedServiceEndpoint = this.getSerializedAddServiceEndpoint(addServiceEndpoint); - const signature = signingKeyRef.sign(serializedServiceEndpoint); - const didSig = createDidSig(controllerHexDid, signingKeyRef, signature); - return [addServiceEndpoint, didSig]; - } - - async createSignedRemoveKeys( - keyIds, - did, - controllerHexDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerHexDid); - } - - const keys = new BTreeSet(this.api.registry, 'DidKey'); - keyIds.forEach((k) => { - keys.add(k); - }); - const removeKeys = { did, keys, nonce }; - const serializedRemoveKeys = this.getSerializedRemoveKeys(removeKeys); - const signature = signingKeyRef.sign(serializedRemoveKeys); - const didSig = createDidSig(controllerHexDid, signingKeyRef, signature); - return [removeKeys, didSig]; - } - - async createSignedRemoveControllers( - controllers, - hexDid, - controllerHexDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerHexDid); - } - - const cnts = new BTreeSet(this.api.registry, 'Controller'); - controllers.forEach((c) => { - cnts.add(DockDidOrDidMethodKey.from(c)); - }); - - const removeControllers = { did: hexDid, controllers: cnts, nonce }; - const serializedRemoveControllers = this.getSerializedRemoveControllers(removeControllers); - const signature = signingKeyRef.sign(serializedRemoveControllers); - const didSig = createDidSig(controllerHexDid, signingKeyRef, signature); - return [removeControllers, didSig]; - } - - async createSignedRemoveServiceEndpoint( - endpointId, - hexDid, - controllerHexDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerHexDid); - } - - const removeServiceEndpoint = { did: hexDid, id: endpointId, nonce }; - const serializedRemoveServiceEndpoint = this.getSerializedRemoveServiceEndpoint(removeServiceEndpoint); - const signature = signingKeyRef.sign(serializedRemoveServiceEndpoint); - const didSig = createDidSig(controllerHexDid, signingKeyRef, signature); - return [removeServiceEndpoint, didSig]; - } - - async createSignedDidRemoval( - did, - controllerDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(controllerDid); - } - - const removal = { did, nonce }; - const serializedRemoval = this.getSerializedDidRemoval(removal); - const signature = signingKeyRef.sign(serializedRemoval); - const didSig = createDidSig(controllerDid, signingKeyRef, signature); - return [removal, didSig]; - } - - async createSignedAttestation( - priority, - iri, - hexDid, - signingKeyRef, - nonce = undefined, - ) { - if (nonce === undefined) { - // eslint-disable-next-line no-param-reassign - nonce = await this.getNextNonceForDid(hexDid); - } - const setAttestation = { - attest: { - priority, - iri, - }, - nonce, - }; - const serializedAttestation = this.getSerializedAttestation(setAttestation); - const signature = signingKeyRef.sign(serializedAttestation); - const didSig = createDidSig(hexDid, signingKeyRef, signature); - return [setAttestation, didSig]; - } - - /** - * Serializes a `AddKeys` for signing. - * @param {object} addKeys - `AddKeys` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedAddKeys(addKeys) { - return getStateChange(this.api, 'AddKeys', addKeys); - } - - getSerializedAddControllers(addControllers) { - return getStateChange(this.api, 'AddControllers', addControllers); - } - - getSerializedAddServiceEndpoint(addServiceEndpoint) { - return getStateChange(this.api, 'AddServiceEndpoint', addServiceEndpoint); - } - - getSerializedRemoveKeys(removeKeys) { - return getStateChange(this.api, 'RemoveKeys', removeKeys); - } - - getSerializedRemoveControllers(removeControllers) { - return getStateChange(this.api, 'RemoveControllers', removeControllers); - } - - getSerializedRemoveServiceEndpoint(removeServiceEndpoint) { - return getStateChange( - this.api, - 'RemoveServiceEndpoint', - removeServiceEndpoint, - ); - } - - /** - * Serializes a `DidRemoval` for signing. - * @param {object} didRemoval - `DidRemoval` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedDidRemoval(didRemoval) { - return getStateChange(this.api, 'DidRemoval', didRemoval); - } - - /** - * Serializes an `Attestation` for signing. - * @param {object} setAttestation - `SetAttestationClaim` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedAttestation(setAttestation) { - return getStateChange(this.api, 'SetAttestationClaim', setAttestation); - } -} - -export default DIDModule; diff --git a/src/modules/did/index.js b/src/modules/did/index.js deleted file mode 100644 index 7765dd9d8..000000000 --- a/src/modules/did/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import OffChainDidDocRef from './offchain-did-doc-ref'; -import DIDModule, { ATTESTS_IRI } from './did'; - -export { - OffChainDidDocRef, DIDModule, ATTESTS_IRI, -}; diff --git a/src/modules/did/offchain-did-doc-ref.js b/src/modules/did/offchain-did-doc-ref.js deleted file mode 100644 index 0b42fad47..000000000 --- a/src/modules/did/offchain-did-doc-ref.js +++ /dev/null @@ -1,29 +0,0 @@ -export const FORMATS = new Set(['CID', 'URL', 'Custom']); - -/** - * An off-chain DID Doc reference stored on chain. The reference may be - * - a CID, https://docs.ipfs.io/concepts/content-addressing/#identifier-formats - * - a URL - * - any other format - */ -export default class OffChainDidDocRef { - constructor(type, bytes) { - if (!FORMATS.has(type)) { - throw new Error(`Unsupported type: ${type}`); - } - - this[type] = bytes; - } - - static cid(bytes) { - return new this('CID', bytes); - } - - static url(bytes) { - return new this('URL', bytes); - } - - static custom(bytes) { - return new this('Custom', bytes); - } -} diff --git a/src/modules/did/service-endpoint.js b/src/modules/did/service-endpoint.js deleted file mode 100644 index 680923e47..000000000 --- a/src/modules/did/service-endpoint.js +++ /dev/null @@ -1,10 +0,0 @@ -export class ServiceEndpointType { - constructor(value = 0) { - this.value = value; - } - - setLinkedDomains() { - // eslint-disable-next-line no-bitwise - this.value |= 0b0001; - } -} diff --git a/src/modules/legacy-bbs-plus.js b/src/modules/legacy-bbs-plus.js deleted file mode 100644 index 181d912f7..000000000 --- a/src/modules/legacy-bbs-plus.js +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable camelcase */ - -import OffchainSignaturesModule from './offchain-signatures'; - -const LEGACY_STATE_CHANGES = { - AddParams: 'AddBBSPlusParams', - RemoveParams: 'RemoveBBSPlusParams', - AddPublicKey: 'AddBBSPlusPublicKey', - RemovePublicKey: 'RemoveBBSPlusPublicKey', -}; - -const LEGACY_METHODS = { - Params: 'bbsPlusParams', - PublicKeys: 'bbsPlusKeys', -}; - -/** Legacy class to write `BBS+` parameters and keys on chain. - * Use to interact with chains without offchain signatures module. - */ -export default class LegacyBBSPlusModule extends OffchainSignaturesModule { - constructor(...args) { - super(...args); - this.moduleName = 'bbsPlus'; - this.module = this.api.tx[this.moduleName]; - this.methods = LEGACY_METHODS; - this.stateChanges = LEGACY_STATE_CHANGES; - } -} diff --git a/src/modules/migration.js b/src/modules/migration.js deleted file mode 100644 index 45f5853b8..000000000 --- a/src/modules/migration.js +++ /dev/null @@ -1,159 +0,0 @@ -import { BTreeMap } from '@polkadot/types'; -import { bnToBn } from '@polkadot/util'; - -const MaxAllowedMigrations = 65535; - -class TokenMigration { - /** - * Creates a new instance of TokenMigration and sets the api - * @constructor - * @param {object} api - PolkadotJS API Reference - */ - constructor(api) { - this.api = api; - this.module = api.tx.migrationModule; - } - - addMigrator(migratorId, allowedMigrations, asSudo = false) { - if (!Number.isInteger(allowedMigrations) || allowedMigrations < 1 || allowedMigrations > MaxAllowedMigrations) { - throw new Error(`allowedMigrations must an integer between 1 and ${MaxAllowedMigrations}`); - } - const txn = this.module.addMigrator(migratorId, allowedMigrations); - return this.asSudoIfNeeded(txn, asSudo); - } - - removeMigrator(migratorId, asSudo = false) { - const txn = this.module.removeMigrator(migratorId); - return this.asSudoIfNeeded(txn, asSudo); - } - - /** - * Accepts recipients as an BTreeMap of address -> amount - * @param {*} recipients - */ - migrate(recipients) { - return this.api.tx.migrationModule.migrate(recipients); - } - - /** - * Accepts recipients as an array of pairs, each pair is (address, amount). Amount can either be a safe JS integer - * or a string which will be expected in decimal format. If an address is repeated, its intended amounts are added. - * @param {*} recipients - */ - migrateRecipAsList(recipients) { - // @ts-ignore - const recipMap = new BTreeMap(this.api.registry, 'AccountId', 'BalanceOf'); - [...recipients].sort().forEach(([address, amount]) => { - const existingVal = recipMap.get(address); - let value = amount; - if (existingVal !== undefined) { - // The list in argument repeated addresses. Convert both existing and new values to big number and add. - // An alternative could be trying to parse both as either safe integer (`Number.isSafeInteger`) and then checking - // if no overflow happens on add and if it does then try to convert to BN - const newVal = bnToBn(amount); - // @ts-ignore - const oldVal = bnToBn(existingVal); - const sum = newVal.add(oldVal); - // Convert to string decimal representation. - value = sum.toString(); - } - recipMap.set(address, value); - }); - return this.api.tx.migrationModule.migrate(recipMap); - } - - /** - * swapBonuses should be an array of arrays with each inner array of size 3 where first item is recipient account, 2nd item is bonus amount and 3rd item is offset (u32) - * vestingBonuses should be an array of arrays with each inner array of size 3 where first item is recipient account, 2nd item is bonus amount and 3rd item is offset (u32) - * @param {*} swapBonuses - * @param {*} vestingBonuses - */ - giveBonuses(swapBonuses, vestingBonuses) { - return this.api.tx.migrationModule.giveBonuses(swapBonuses, vestingBonuses); - } - - /** - * Claim bonus for itself - */ - claimBonus() { - return this.api.tx.migrationModule.claimBonus(); - } - - /** - * Claim bonus for other account - * @param {*} other - */ - claimBonusForOther(other) { - return this.api.tx.migrationModule.claimBonusForOther(other); - } - - /** - * Claim swap bonus for itself - */ - claimSwapBonus() { - return this.api.tx.migrationModule.claimSwapBonus(); - } - - /** - * Claim swap bonus for other account - * @param {*} other - */ - claimSwapBonusForOther(other) { - return this.api.tx.migrationModule.claimSwapBonusForOther(other); - } - - /** - * Claim vesting bonus for itself - */ - claimVestingBonus() { - return this.api.tx.migrationModule.claimVestingBonus(); - } - - /** - * Claim vesting bonus for other account - * @param {*} other - */ - claimVestingBonusForOther(other) { - return this.api.tx.migrationModule.claimVestingBonusForOther(other); - } - - /** - * Get details of all migrators - */ - async getMigrators() { - return this.api.query.migrationModule.migrators.entries(); - } - - /** - * Get detail of a given migrator - * @param {*} address - */ - async getMigrator(address) { - return this.api.query.migrationModule.migrators(address); - } - - /** - * Get bonus of given account - * @param {*} address - */ - async getBonus(address) { - const bonus = await this.api.query.migrationModule.bonuses(address); - return this.api.createType('Option', bonus).unwrapOr(this.api.createType('Bonus')); - } - - /** - * Takes an extrinsic and returns a modified extrinsic if it needs to be sent by sudo otherwise returns the given - * extrinsic as it is - * @param {object} txn - The extrinsic to send - * @param {boolean} asSudo - If the extrinsic needs to be sent by sudo - * @returns {object} The extrinsic to sign and send. - */ - asSudoIfNeeded(txn, asSudo = false) { - if (asSudo) { - return this.api.tx.sudo.sudo(txn); - } - return txn; - } -} - -export default TokenMigration; diff --git a/src/modules/offchain-signatures.js b/src/modules/offchain-signatures.js deleted file mode 100644 index c342b1c10..000000000 --- a/src/modules/offchain-signatures.js +++ /dev/null @@ -1,327 +0,0 @@ -/* eslint-disable camelcase */ - -import { getDidNonce, getStateChange } from '../utils/misc'; -import WithParamsAndPublicKeys from './WithParamsAndPublicKeys'; -import { createDidSig, DockDidOrDidMethodKey } from '../did'; - -const STATE_CHANGES = { - AddParams: 'AddOffchainSignatureParams', - RemoveParams: 'RemoveOffchainSignatureParams', - AddPublicKey: 'AddOffchainSignaturePublicKey', - RemovePublicKey: 'RemoveOffchainSignaturePublicKey', -}; - -const METHODS = { - Params: 'signatureParams', - PublicKeys: 'publicKeys', -}; - -/** Class to write offchain signature parameters and keys on chain */ -export default class OffchainSignaturesModule extends WithParamsAndPublicKeys { - /** - * sets the dock api for this module - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param {Function} signAndSend - Callback signing and sending - */ - constructor(api, signAndSend) { - super(); - this.api = api; - this.moduleName = 'offchainSignatures'; - this.stateChanges = STATE_CHANGES; - this.methods = METHODS; - this.module = api.tx[this.moduleName]; - this.signAndSend = signAndSend; - } - - /** - * Builds module-specific public key from the provided value. - */ - static buildPublicKey(publicKey) { - return publicKey; - } - - /** - * Get last params written by this DID - * @param did - * @returns {Promise<{bytes: string}|null>} - */ - async getLastParamsWritten(did) { - const hexId = DockDidOrDidMethodKey.from(did); - const counter = await this.api.query[this.moduleName].paramsCounter(hexId); - if (counter > 0) { - const resp = await this.queryParamsFromChain(hexId, counter); - if (resp) { - return this.createParamsObjFromChainResponse(resp); - } - } - return null; - } - - /** - * Get all params written by a DID - * @param did - * @returns {Promise} - */ - async getAllParamsByDid(did) { - const hexId = DockDidOrDidMethodKey.from(did); - - const params = []; - const counter = await this.api.query[this.moduleName].paramsCounter(hexId); - if (counter > 0) { - for (let i = 1; i <= counter; i++) { - // eslint-disable-next-line no-await-in-loop - const param = await this.getParamsByHexDid(hexId, i); - if (param != null) { - params.push(param); - } - } - } - return params; - } - - async queryParamsFromChain(hexDid, counter) { - const params = await this.api.query[this.moduleName][this.methods.Params]( - hexDid, - counter, - ); - - if (params.isSome) { - return params.unwrap(); - } else { - return null; - } - } - - async queryPublicKeyFromChain(hexDid, keyId) { - const key = await this.api.query[this.moduleName][this.methods.PublicKeys]( - hexDid.asDid, - keyId, - ); - - if (key.isSome) { - return key.unwrap(); - } else { - return null; - } - } - - /** - * Create transaction to add a public key - * @param publicKey - public key to add. - * @param targetDid - The DID to which key is being added - * @param signerDid - The DID that is adding the key by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's signingKeyRef - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createAddPublicKeyTx( - publicKey, - targetDid, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const offchainPublicKey = this.constructor.buildPublicKey(publicKey); - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [addPk, signature] = await this.createSignedAddPublicKey( - offchainPublicKey, - targetHexDid, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.addPublicKey(addPk, signature); - } - - /** - * Create transaction to remove public key - * @param removeKeyId - The key index for key to remove. - * @param targetDid - The DID from which key is being removed - * @param signerDid - The DID that is removing the key by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's signingKeyRef - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @returns {Promise<*>} - */ - async createRemovePublicKeyTx( - removeKeyId, - targetDid, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const targetHexDid = DockDidOrDidMethodKey.from(targetDid).asDid; - const signerHexDid = DockDidOrDidMethodKey.from(signerDid); - const [removePk, signature] = await this.createSignedRemovePublicKey( - removeKeyId, - targetHexDid, - signerHexDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.module.removePublicKey(removePk, signature); - } - - /** - * Add a public key - * @param publicKey - public key to add. - * @param targetDid - The DID to which key is being added - * @param signerDid - The DID that is adding the key by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's signingKeyRef - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async addPublicKey( - publicKey, - targetDid, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createAddPublicKeyTx( - publicKey, - targetDid, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - /** - * Remove public key - * @param removeKeyId - The key index for key to remove. - * @param targetDid - The DID from which key is being removed - * @param signerDid - The DID that is removing the key by signing the payload because it controls `targetDid` - * @param signingKeyRef - Signer's signing key reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise<*>} - */ - async removePublicKey( - removeKeyId, - targetDid, - signerDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const tx = await this.createRemovePublicKeyTx( - removeKeyId, - targetDid, - signerDid, - signingKeyRef, - { nonce, didModule }, - ); - return this.signAndSend(tx, waitForFinalization, params); - } - - async createSignedAddPublicKey( - publicKey, - targetHexDid, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const addPk = { key: publicKey, did: targetHexDid, nonce }; - const signature = this.signAddPublicKey(signingKeyRef, addPk); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [addPk, didSig]; - } - - async createSignedRemovePublicKey( - removeKeyId, - targetHexDid, - signerHexDid, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(signerHexDid, nonce, didModule); - const removeKey = { - keyRef: [targetHexDid, removeKeyId], - did: targetHexDid, - nonce, - }; - const signature = this.signRemovePublicKey(signingKeyRef, removeKey); - const didSig = createDidSig(signerHexDid, signingKeyRef, signature); - return [removeKey, didSig]; - } - - /** - * - * @param signingKeyRef - * @param params - * @returns {Signature} - */ - signAddParams(signingKeyRef, params) { - const serialized = getStateChange( - this.api, - this.stateChanges.AddParams, - params, - ); - return signingKeyRef.sign(serialized); - } - - /** - * - * @param signingKeyRef - * @param pk - * @returns {Signature} - */ - signAddPublicKey(signingKeyRef, pk) { - const serialized = getStateChange( - this.api, - this.stateChanges.AddPublicKey, - pk, - ); - return signingKeyRef.sign(serialized); - } - - /** - * - * @param signingKeyRef - * @param ref - * @returns {Signature} - */ - signRemoveParams(signingKeyRef, ref) { - const serialized = getStateChange( - this.api, - this.stateChanges.RemoveParams, - ref, - ); - return signingKeyRef.sign(serialized); - } - - /** - * - * @param signingKeyRef - * @param ref - * @returns {Signature} - */ - signRemovePublicKey(signingKeyRef, ref) { - const serialized = getStateChange( - this.api, - this.stateChanges.RemovePublicKey, - ref, - ); - return signingKeyRef.sign(serialized); - } -} diff --git a/src/modules/ps.js b/src/modules/ps.js deleted file mode 100644 index 7ec4da97f..000000000 --- a/src/modules/ps.js +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-disable camelcase */ - -import OffchainSignaturesModule from './offchain-signatures'; -import PSPublicKey from '../offchain-signatures/public-keys/ps'; -import PSParams from '../offchain-signatures/params/ps'; - -/** Class to write `Pointcheval-Sanders` parameters and keys on chain */ -export default class PSModule extends OffchainSignaturesModule { - /** - * Builds `Pointcheval-Sanders` params from the provided value. - */ - static buildParams(params) { - return new PSParams(params); - } - - /** - * Builds `Pointcheval-Sanders` public key from the provided value. - */ - static buildPublicKey(publicKey) { - return new PSPublicKey(publicKey); - } - - async queryParamsFromChain(hexDid, counter) { - const params = await super.queryParamsFromChain(hexDid, counter); - - if (params != null && params.isPs) { - return params.asPs; - } else { - return null; - } - } - - async queryPublicKeyFromChain(hexDid, keyId) { - const key = await super.queryPublicKeyFromChain(hexDid, keyId); - - if (key != null && key.isPs) { - return key.asPs; - } else { - return null; - } - } -} diff --git a/src/modules/revocation.js b/src/modules/revocation.js deleted file mode 100644 index 0c7d10860..000000000 --- a/src/modules/revocation.js +++ /dev/null @@ -1,391 +0,0 @@ -import { getDidNonce, getStateChange } from '../utils/misc'; - -import { createDidSig, DockDidOrDidMethodKey } from "../did"; // eslint-disable-line - -/** Class to create, update and destroy revocations */ -class RevocationModule { - /** - * Creates a new instance of RevocationModule and sets the api - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param signAndSend - */ - constructor(api, signAndSend) { - this.api = api; - this.module = api.tx.revoke; - this.signAndSend = signAndSend; - } - - /** - * Creating a revocation registry - * @param {string} id - is the unique id of the registry. The function will check whether `id` is already taken or not. - * @param {Policy} policy - The registry policy - * @param {Boolean} addOnly - true: credentials can be revoked, but not un-revoked, false: credentials can be revoked and un-revoked - * @return {Promise} The extrinsic to sign and send. - */ - createNewRegistryTx(id, policy, addOnly) { - const addReg = { - id, - newRegistry: { - policy: policy.toJSON(), - addOnly, - }, - }; - return this.module.newRegistry(addReg); - } - - /** - * Creating a revocation registry - * @param {string} id - is the unique id of the registry. The function will check whether `id` is already taken or not. - * @param {Policy} policy - The registry policy - * @param {Boolean} addOnly - true: credentials can be revoked, but not un-revoked, false: credentials can be revoked and un-revoked - * @param waitForFinalization - * @param params - * @return {Promise} Promise to the pending transaction - */ - async newRegistry( - id, - policy, - addOnly, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.createNewRegistryTx(id, policy, addOnly), - waitForFinalization, - params, - ); - } - - /** - * Create a transaction to remove a revocation registry - * @return {Promise} The extrinsic to sign and send. - * @param removal - The payload to remove the registry - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - */ - createRemoveRegistryTx(removal, didSigs) { - return this.module.removeRegistry(removal, didSigs); - } - - /** - * Remove a revocation registry - * @return {Promise} Promise to the pending transaction - * @param removal - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - * @param waitForFinalization - * @param params - */ - async removeRegistry( - removal, - didSigs, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.createRemoveRegistryTx(removal, didSigs), - waitForFinalization, - params, - ); - } - - /** - * Create transaction to revoke credentials - * @return {Promise} The extrinsic to sign and send. - * @param revoke - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - */ - createRevokeTx(revoke, didSigs) { - return this.module.revoke(revoke, didSigs); - } - - /** - * Revoke credentials - * @return {Promise} Promise to the pending transaction - * @param revoke - * @param didSigs - * @param waitForFinalization - * @param params - */ - async revoke(revoke, didSigs, waitForFinalization = true, params = {}) { - return this.signAndSend( - this.createRevokeTx(revoke, didSigs), - waitForFinalization, - params, - ); - } - - /** - * Create transaction to unrevoke credentials - * @return {Promise} The extrinsic to sign and send. - * @param unrevoke - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - */ - createUnrevokeTx(unrevoke, didSigs) { - return this.module.unrevoke(unrevoke, didSigs); - } - - /** - * Unrevoke credentials - * @return {Promise} Promise to the pending transaction - * @param unrevoke - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - * @param waitForFinalization - * @param params - */ - async unrevoke(unrevoke, didSigs, waitForFinalization = true, params = {}) { - return this.signAndSend( - this.createUnrevokeTx(unrevoke, didSigs), - waitForFinalization, - params, - ); - } - - /** - * Get data of the revocation registry like controllers, policy and type. - * If the registry is not present, error is thrown. - * @param {string} registryID - Revocation registry ID - * @return {Promise} A promise to registry data - */ - async getRevocationRegistry(registryID) { - const resp = await this.api.query.revoke.registries(registryID); - if (resp.isNone) { - throw new Error(`Could not find revocation registry: ${registryID}`); - } - - return resp.unwrap(); - } - - /** - * The read-only call get_revocation_status is used to check whether a credential is revoked or not and does not consume any tokens. If - * @param {string} registryId - Revocation registry ID - * @param {string} revokeId - Revocation id. This is set as the hash of the credential id. - * @return {Promise} Returns a promise to true if credential is revoked else to false. - */ - async getIsRevoked(registryId, revokeId) { - const resp = await this.api.query.revoke.revocations(registryId, revokeId); - return !resp.isNone; - } - - /** - * Get revocation statuses of multiple ids. Note that this function sees changes a bit delayed after the actual write - * so if this function is being called immediately after any concerned storage is written to, you should wait for block - * finalization. See its usage in the test. - * @param {Array[]} regRevPairs - An array of pairs where the first item is the registry id and the - * second is the revocation id. - * @param {String} regRevPairs[][0] - Registry id. - * @param {String} regRevPairs[][1] - Revocation id. - * @returns {Promise<*>} - */ - async areRevoked(regRevPairs) { - const resp = await this.api.query.revoke.revocations.multi(regRevPairs); - return resp.map((r) => !r.isNone); - } - - /** - * TODO: Use the spread operator to accept multiple revocation ids - * Revoke a single credential. Works only with registries having `OneOf` policy - * @param registryId - The registry id being updated - * @param revId - The revocation id that is being revoked - * @param did - * @param signingKeyRef - * @param nonce - * @param didModule - * @param waitForFinalization - * @param params - * @returns {Promise} - */ - async revokeCredentialWithOneOfPolicy( - registryId, - revId, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const [revoke, sig, sigNonce] = await this.createSignedRevoke( - registryId, - [revId], - did, - signingKeyRef, - { nonce, didModule }, - ); - return this.revoke( - revoke, - [{ sig, nonce: sigNonce }], - waitForFinalization, - params, - ); - } - - /** - * Unrevoke a single credential. Works only with registries having `OneOf` policy - * @param registryId - * @param revId - * @param did - * @param signingKeyRef - * @param nonce - * @param didModule - * @param waitForFinalization - * @param params - * @returns {Promise} - */ - async unrevokeCredentialWithOneOfPolicy( - registryId, - revId, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const [revoke, sig, sigNonce] = await this.createSignedUnRevoke( - registryId, - [revId], - did, - signingKeyRef, - { nonce, didModule }, - ); - return this.unrevoke( - revoke, - [{ sig, nonce: sigNonce }], - waitForFinalization, - params, - ); - } - - async removeRegistryWithOneOfPolicy( - registryId, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const [removal, sig, sigNonce] = await this.createSignedRemove( - registryId, - did, - signingKeyRef, - { nonce, didModule }, - ); - return this.removeRegistry( - removal, - [{ sig, nonce: sigNonce }], - waitForFinalization, - params, - ); - } - - async createSignedUpdate( - updateFunc, - registryId, - [...revokeIds], - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const hexDid = DockDidOrDidMethodKey.from(did); - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(hexDid, nonce, didModule); - - const update = { - data: { - registryId, - revokeIds, - }, - nonce, - }; - const serializedRevoke = updateFunc.call(this, update); - const signature = signingKeyRef.sign(serializedRevoke); - const didSig = createDidSig(hexDid, signingKeyRef, signature); - return [{ registryId, revokeIds }, didSig, nonce]; - } - - async createSignedRevoke( - registryId, - revokeIds, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - return this.createSignedUpdate( - this.getSerializedRevoke, - registryId, - revokeIds, - did, - signingKeyRef, - { nonce, didModule }, - ); - } - - async createSignedUnRevoke( - registryId, - revokeIds, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - return this.createSignedUpdate( - this.getSerializedUnrevoke, - registryId, - revokeIds, - did, - signingKeyRef, - { nonce, didModule }, - ); - } - - async createSignedRemove( - registryId, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const hexDid = DockDidOrDidMethodKey.from(did); - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(hexDid, nonce, didModule); - - const remove = { - data: { registryId }, - nonce, - }; - const serializedRemove = this.getSerializedRemoveRegistry(remove); - const signature = signingKeyRef.sign(serializedRemove); - const didSig = createDidSig(hexDid, signingKeyRef, signature); - return [{ registryId }, didSig, nonce]; - } - - /** - * Serializes a `Revoke` for signing. - * @param {object} revoke - `Revoke` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedRevoke(revoke) { - return getStateChange(this.api, 'Revoke', revoke); - } - - /** - * Serializes a `Unrevoke` for signing. - * @param {object} unrevoke - `Unrevoke` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedUnrevoke(unrevoke) { - return getStateChange(this.api, 'UnRevoke', unrevoke); - } - - /** - * Serializes a `RemoveRegistry` for signing. - * @param {object} removeReg - `RemoveRegistry` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedRemoveRegistry(removeReg) { - return getStateChange(this.api, 'RemoveRegistry', removeReg); - } -} - -export default RevocationModule; diff --git a/src/modules/status-list-credential.js b/src/modules/status-list-credential.js deleted file mode 100644 index a79cc57d3..000000000 --- a/src/modules/status-list-credential.js +++ /dev/null @@ -1,326 +0,0 @@ -import StatusList2021Credential from '../status-list-credential/status-list2021-credential'; -import { getDidNonce, getStateChange } from '../utils/misc'; - -import { createDidSig, DockDidOrDidMethodKey } from '../did'; - -/** - * Module supporting `StatusList2021Credential` and `RevocationList2020Credential`. - */ -export default class StatusListCredentialModule { - /** - * Creates a new instance of `StatusListCredentialModule` and sets the api - * @constructor - * @param {object} api - PolkadotJS API Reference - * @param signAndSend - */ - constructor(api, signAndSend) { - this.api = api; - this.module = api.tx.statusListCredential; - this.signAndSend = signAndSend; - } - - /** - * Fetches `StatusList2021Credential` with the supplied identifier. - * @param {*} statusListCredentialId - * @returns {Promise} - */ - async fetchStatusList2021Credential(statusListCredentialId) { - let statusListCredential = await this.api.query.statusListCredential.statusListCredentials( - statusListCredentialId, - ); - - if (statusListCredential.isSome) { - statusListCredential = statusListCredential.unwrap().statusListCredential; - - if (statusListCredential.isStatusList2021Credential) { - return StatusList2021Credential.fromBytes( - statusListCredential.asStatusList2021Credential, - ); - } else { - throw new Error( - "Fetched credential isn't of `StatusList2021Credential` type", - ); - } - } - - return null; - } - - /** - * Create a transaction to create a new status list credential on-chain. - * @param id - is the unique id of the status list credential. The function will check whether `id` is already taken or not. - * @param statusListCredential - the credential to be associated with the given `id` - * @param policy - the credential policy - * @return {Promise} - the extrinsic to sign and send. - */ - buildCreateStatusListCredentialTx(id, statusListCredential, policy) { - const credentialWithPolicy = { - statusListCredential: statusListCredential.toSubstrate(), - policy: policy.toJSON(), - }; - - return this.module.create(id, credentialWithPolicy); - } - - /** - * Create a transaction to update an existing status list credential on-chain. - * @param statusListCredentialUpdate - Update for the status list credential. - * @param didSigs - `DID` signatures over an action with a nonce authorizing this action according to the existing policy. - * @return {Promise} - the extrinsic to sign and send. - */ - buildUpdateStatusListCredentialTx(statusListCredentialUpdate, didSigs) { - return this.module.update(statusListCredentialUpdate, didSigs); - } - - /** - * Create a transaction to remove an existing status list credential from the chain. - * @param statusListCredentialId - is the unique id of the status list credential. The function will check whether `id` is already taken or not. - * @param didSigs - `DID` signatures over an action with a nonce authorizing this action according to the existing policy. - * @return {Promise} - the extrinsic to sign and send. - */ - buildRemoveStatusListCredentialTx(statusListCredentialId, didSigs) { - return this.module.remove(statusListCredentialId, didSigs); - } - - /** - * Create a new status list credential on-chain. - * @param id - is the unique id of the status list credential. The function will check whether `id` is already taken or not. - * @param statusListCredential - The status list credential to be associated with the given `id`. - * @param policy - The credential policy. - * @param waitForFinalization - * @param params - * @return {Promise<*>} - Sent transaction. - */ - createStatusListCredential( - id, - statusListCredential, - policy, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.buildCreateStatusListCredentialTx(id, statusListCredential, policy), - waitForFinalization, - params, - ); - } - - /** - * Update a single `StatusListCredential`. Works only with credentials having `OneOf` policy - * @param id - Unique identifier of the status list credential. - * @param statusListCredential - Status list credential. - * @param did - Signer of the transaction payload - * @param signingKeyRef - Signer's signing key reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise} - */ - async updateStatusListCredentialWithOneOfPolicy( - id, - statusListCredential, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const [payload, sig, sigNonce] = await this.createSignedUpdateStatusListCredential( - id, - statusListCredential, - did, - signingKeyRef, - { nonce, didModule }, - ); - return this.updateStatusListCredential( - payload, - [{ nonce: sigNonce, sig }], - waitForFinalization, - params, - ); - } - - /** - * Remove a single `StatusListCredential`. Works only with credentials having `OneOf` policy - * @param id - Unique identifier of the status list credential. - * @param did - Signer of the transaction payload - * @param signingKeyRef - Signer's signing key reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * using this - * @param waitForFinalization - * @param params - * @returns {Promise} - */ - async removeStatusListCredentialWithOneOfPolicy( - id, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - waitForFinalization = true, - params = {}, - ) { - const [payload, sig, sigNonce] = await this.createSignedRemoveStatusListCredential( - id, - did, - signingKeyRef, - { nonce, didModule }, - ); - return this.removeStatusListCredential( - payload, - [{ nonce: sigNonce, sig }], - waitForFinalization, - params, - ); - } - - /** - * Updates status list credential. - * - * @param updateStatusListCredential - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - * @param waitForFinalization - * @param params - */ - updateStatusListCredential( - updateStatusListCredential, - didSigs, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.buildUpdateStatusListCredentialTx( - updateStatusListCredential, - didSigs, - ), - waitForFinalization, - params, - ); - } - - /** - * Removes status list credential. - * - * @param id - Unique identifier of the status list credential. - * @param didSigs - Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while - * signing the payload - * @param waitForFinalization - * @param params - */ - removeStatusListCredential( - id, - didSigs, - waitForFinalization = true, - params = {}, - ) { - return this.signAndSend( - this.buildRemoveStatusListCredentialTx(id, didSigs), - waitForFinalization, - params, - ); - } - - /** - * Creates `DID` signature. - * - * @param createSerializedTx - Function to create a serialized transaction using supplied payload. - * @param data - Payload data. - * @param did - Signer of the transaction payload - * @param signingKeyRef - Signer's signing key reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * @param params - parameters to be used - */ - async createDidSignature( - createSerializedTx, - data, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - const hexDid = DockDidOrDidMethodKey.from(did); - // eslint-disable-next-line no-param-reassign - nonce = await getDidNonce(hexDid, nonce, didModule); - - const update = { - data, - nonce, - }; - const serializedTx = createSerializedTx.call(this, update); - const signature = signingKeyRef.sign(serializedTx); - const didSig = createDidSig(hexDid, signingKeyRef, signature); - return [data, didSig, nonce]; - } - - /** - * Creates signed transaction to update status list credential. - * - * @param id - Unique identifier of the status list credential. - * @param statusListCredential - Status list credential. - * @param did - Signer of the transaction payload - * @param signingKeyRef - Signer's signing key ref key reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - * @param params - parameters to be used - */ - async createSignedUpdateStatusListCredential( - id, - statusListCredential, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - return this.createDidSignature( - this.getSerializedUpdateStatusListCredential, - { id, credential: statusListCredential.toSubstrate() }, - did, - signingKeyRef, - { nonce, didModule }, - ); - } - - /** - * Creates signed transaction to remove status list credential. - * - * @param id - Unique identifier of the status list credential. - * @param did - Signer of the transaction payload - * @param signingKeyRef - Signer's signing key reference - * @param nonce - The nonce to be used for sending this transaction. If not provided then `didModule` must be provided. - * @param didModule - Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by - */ - async createSignedRemoveStatusListCredential( - id, - did, - signingKeyRef, - { nonce = undefined, didModule = undefined }, - ) { - return this.createDidSignature( - this.getSerializedRemoveStatusListCredential, - { id }, - did, - signingKeyRef, - { nonce, didModule }, - ); - } - - /** - * Serializes a `UpdateStatusListCredential` for signing. - * @param {object} update - `UpdateStatusListCredential` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedUpdateStatusListCredential(update) { - return getStateChange(this.api, 'UpdateStatusListCredential', update); - } - - /** - * Serializes a `RemoveStatusListCredential` for signing. - * @param {object} removal - `RemoveStatusListCredential` as expected by the Substrate node - * @returns {Array} An array of Uint8 - */ - getSerializedRemoveStatusListCredential(removal) { - return getStateChange(this.api, 'RemoveStatusListCredential', removal); - } -} diff --git a/src/offchain-signatures/params/bbs-plus.js b/src/offchain-signatures/params/bbs-plus.js deleted file mode 100644 index 7ac9278aa..000000000 --- a/src/offchain-signatures/params/bbs-plus.js +++ /dev/null @@ -1,6 +0,0 @@ -/** Class representing offchain params used in BBS+ signature scheme */ -export default class BBSPlusParams { - constructor(params) { - this.BBSPlus = params; - } -} diff --git a/src/offchain-signatures/params/bbs.js b/src/offchain-signatures/params/bbs.js deleted file mode 100644 index 0fa93b1ae..000000000 --- a/src/offchain-signatures/params/bbs.js +++ /dev/null @@ -1,6 +0,0 @@ -/** Class representing offchain params used in BBS signature scheme */ -export default class BBSParams { - constructor(params) { - this.BBS = params; - } -} diff --git a/src/offchain-signatures/params/ps.js b/src/offchain-signatures/params/ps.js deleted file mode 100644 index 66084750b..000000000 --- a/src/offchain-signatures/params/ps.js +++ /dev/null @@ -1,6 +0,0 @@ -/** Class representing offchain params used in Pointcheval-Sanders signature scheme */ -export default class PSParams { - constructor(params) { - this.PS = params; - } -} diff --git a/src/offchain-signatures/public-keys/bbs-plus.js b/src/offchain-signatures/public-keys/bbs-plus.js deleted file mode 100644 index 62f39f65f..000000000 --- a/src/offchain-signatures/public-keys/bbs-plus.js +++ /dev/null @@ -1,6 +0,0 @@ -/** Class representing offchain public key used in BBS+ signature scheme */ -export default class BBSPlusPublicKey { - constructor(key) { - this.BBSPlus = key; - } -} diff --git a/src/offchain-signatures/public-keys/bbs.js b/src/offchain-signatures/public-keys/bbs.js deleted file mode 100644 index e77232165..000000000 --- a/src/offchain-signatures/public-keys/bbs.js +++ /dev/null @@ -1,6 +0,0 @@ -/** Class representing offchain public key used in BBS signature scheme */ -export default class BBSPublicKey { - constructor(key) { - this.BBS = key; - } -} diff --git a/src/offchain-signatures/public-keys/ps.js b/src/offchain-signatures/public-keys/ps.js deleted file mode 100644 index 76aca5c06..000000000 --- a/src/offchain-signatures/public-keys/ps.js +++ /dev/null @@ -1,6 +0,0 @@ -/** Class representing offchain public key used in Pointcheval-Sanders signature scheme */ -export default class PSPublicKey { - constructor(key) { - this.PS = key; - } -} diff --git a/src/public-keys/did-key.js b/src/public-keys/did-key.js deleted file mode 100644 index 6d01100f7..000000000 --- a/src/public-keys/did-key.js +++ /dev/null @@ -1,20 +0,0 @@ -import VerificationRelationship from './verification-relationship'; - -export default class DidKey { - /** - * - * @param {PublicKey} publicKey - * @param {VerificationRelationship} verRels - */ - constructor(publicKey, verRels = undefined) { - this.publicKey = publicKey; - this.verRels = verRels !== undefined ? verRels : new VerificationRelationship(); - } - - toJSON() { - return { - publicKey: this.publicKey.toJSON(), - verRels: this.verRels.value, - }; - } -} diff --git a/src/public-keys/index.js b/src/public-keys/index.js deleted file mode 100644 index 54378899b..000000000 --- a/src/public-keys/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import PublicKey, { getKeyPairType } from './public-key'; - -import PublicKeySr25519 from './public-key-sr25519'; -import PublicKeyEd25519 from './public-key-ed25519'; -import PublicKeySecp256k1 from './public-key-secp256k1'; -import PublicKeyX25519 from './public-key-x25519'; -import VerificationRelationship from './verification-relationship'; -import DidKey from './did-key'; - -export { - getKeyPairType, - PublicKey, - PublicKeySr25519, - PublicKeyEd25519, - PublicKeySecp256k1, - PublicKeyX25519, - VerificationRelationship, - DidKey, -}; diff --git a/src/public-keys/public-key-ed25519.js b/src/public-keys/public-key-ed25519.js deleted file mode 100644 index 554d3c0d2..000000000 --- a/src/public-keys/public-key-ed25519.js +++ /dev/null @@ -1,7 +0,0 @@ -import PublicKey from './public-key'; - -/** Class representing a Ed25519 PublicKey */ -export default class PublicKeyEd25519 extends PublicKey { - static Type = 'ed25519'; - static Size = 32; -} diff --git a/src/public-keys/public-key-secp256k1.js b/src/public-keys/public-key-secp256k1.js deleted file mode 100644 index e6033e543..000000000 --- a/src/public-keys/public-key-secp256k1.js +++ /dev/null @@ -1,23 +0,0 @@ -import PublicKey from './public-key'; - -/** Class representing a compressed Secp256k1 PublicKey */ -export default class PublicKeySecp256k1 extends PublicKey { - static Type = 'secp256k1'; - static Size = 33; - - /** - * Returns a compressed public key for Secp256k1 curve. The name is intentionally kept same with the base export class to - * keep the API uniform - * @param {object} pair - A KeyPair from elliptic library - * @returns {PublicKeySecp256k1} - */ - static fromKeyringPair(keyringPair) { - // `true` is for compressed - const publicKey = this.validateKeyringPair(keyringPair).getPublic( - true, - 'hex', - ); - // public key is in hex but doesn't contain a leading zero - return new this(`0x${publicKey}`); - } -} diff --git a/src/public-keys/public-key-sr25519.js b/src/public-keys/public-key-sr25519.js deleted file mode 100644 index 2b829fa8f..000000000 --- a/src/public-keys/public-key-sr25519.js +++ /dev/null @@ -1,7 +0,0 @@ -import PublicKey from './public-key'; - -/** Class representing a Sr25519 PublicKey */ -export default class PublicKeySr25519 extends PublicKey { - static Type = 'sr25519'; - static Size = 32; -} diff --git a/src/public-keys/public-key-x25519.js b/src/public-keys/public-key-x25519.js deleted file mode 100644 index 3261e9dd3..000000000 --- a/src/public-keys/public-key-x25519.js +++ /dev/null @@ -1,7 +0,0 @@ -import PublicKey from './public-key'; - -/** Class representing a X25519 PublicKey */ -export default class PublicKeyX25519 extends PublicKey { - static Type = 'x25519'; - static Size = 32; -} diff --git a/src/public-keys/public-key.js b/src/public-keys/public-key.js deleted file mode 100644 index c4b435cf0..000000000 --- a/src/public-keys/public-key.js +++ /dev/null @@ -1,64 +0,0 @@ -import { u8aToHex } from '@polkadot/util'; -import { isHexWithGivenByteSize } from '../utils/codec'; -import { SizedTypedEnum } from '../utils/typed-enum'; - -/** Class representing a PublicKey. This export class should always be extended (abstract export class in some languages) */ -export default class PublicKey extends SizedTypedEnum { - /** - * Check that the given public key has the expected byte size. Assumes the public key is in hex. - */ - static validateSize(value) { - if (!isHexWithGivenByteSize(value, this.Size)) { - throw new Error( - `Public key must be ${this.Size} bytes, got ${value.replace('0x', '').length / 2} bytes from value: ${value}`, - ); - } - - return value; - } - - /** - * Validates the provided keyring pair and returns it in case of success. - * @param {object} keyringPair - * @returns {object} - */ - static validateKeyringPair(keyringPair) { - const pairType = getKeyPairType(keyringPair); - - if (this.Type !== pairType) { - throw new Error( - `Invalid keypair type - expected: ${this.Type}, received: ${pairType}`, - ); - } - - return keyringPair; - } - - /** - * Extracts the public key from a pair. Assumes the KeyringPair is of the correct type. The `type` is intentionally not - * inspected to follow dependency inversion principle. - * generate the instance correct subclass - * @param {object} pair A polkadot-js KeyringPair. - * @returns {PublicKey} - */ - static fromKeyringPair(keyringPair) { - return new this(u8aToHex(this.validateKeyringPair(keyringPair).publicKey)); - } -} - -/** - * Return the type of signature from a given keypair - * @param {object} pair - Can be a keypair from polkadot-js or elliptic library. - * @returns {string|*} - */ -export function getKeyPairType(pair) { - if (pair.type) { - return pair.type; - } - - if (pair.ec && pair.priv) { - // elliptic library's pair has `ec`, `priv` and `pub`. There is not a cleaner way to detect that - return 'secp256k1'; - } - throw new Error('Cannot detect key pair type'); -} diff --git a/src/resolver/did/did-jwk-resolver.js b/src/resolver/did/did-jwk-resolver.js deleted file mode 100644 index 82800441c..000000000 --- a/src/resolver/did/did-jwk-resolver.js +++ /dev/null @@ -1,20 +0,0 @@ -import { getDidJwkResolver } from '@sphereon/ssi-sdk-ext.did-resolver-jwk'; -import DIDResolver from './did-resolver'; - -const jwkResolver = getDidJwkResolver(); - -export default class DIDJWKResolver extends DIDResolver { - static METHOD = 'jwk'; - - constructor() { - super(undefined); - } - - async resolve(did) { - const { didDocument } = await jwkResolver.jwk(did); - return { - '@context': 'https://www.w3.org/ns/did/v1', - ...didDocument, - }; - } -} diff --git a/src/resolver/rev-reg/dock-rev-reg-resolver.js b/src/resolver/rev-reg/dock-rev-reg-resolver.js deleted file mode 100644 index 529a3b4a1..000000000 --- a/src/resolver/rev-reg/dock-rev-reg-resolver.js +++ /dev/null @@ -1,31 +0,0 @@ -import { withInitializedDockAPI } from '../utils'; -import RevRegResolver from './rev-reg-resolver'; - -class DockRevRegResolver extends RevRegResolver { - static METHOD = 'dock'; - - /** - * @param {DockAPI} dock - An initialized connection to a dock full-node. - * @constructor - */ - constructor(dock) { - super(); - - /** - * @type {DockAPI} - */ - this.dock = dock; - } - - async resolve(revRegId) { - const { regId, revId } = this.parse(revRegId); - - return await this.dock.revocation.getIsRevoked(regId, revId); - } -} - -/** - * Resolves revocation status with identifier `rev-reg:dock:*`. - * @type {DockRevRegResolver} - */ -export default withInitializedDockAPI(DockRevRegResolver); diff --git a/src/resolver/rev-reg/index.js b/src/resolver/rev-reg/index.js deleted file mode 100644 index 27f1d7972..000000000 --- a/src/resolver/rev-reg/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default as RevRegResolver } from './rev-reg-resolver'; -export { default as DockRevRegResolver } from './dock-rev-reg-resolver'; diff --git a/src/resolver/rev-reg/rev-reg-resolver.js b/src/resolver/rev-reg/rev-reg-resolver.js deleted file mode 100644 index 2eb3a065c..000000000 --- a/src/resolver/rev-reg/rev-reg-resolver.js +++ /dev/null @@ -1,27 +0,0 @@ -import { MultiResolver, METHOD_REG_EXP_PATTERN, HEX_ID_REG_EXP_PATTERN } from '../generic'; - -const REV_REG_ID_MATCHER = new RegExp( - `^rev-reg:${METHOD_REG_EXP_PATTERN}:${HEX_ID_REG_EXP_PATTERN}#${HEX_ID_REG_EXP_PATTERN}$`, -); - -/** - * Resolves revocation status with identifier `rev-reg:*`. - */ -export default class RevRegResolver extends MultiResolver { - static PREFIX = 'rev-reg'; - - /** - * @param {string} revRegId - */ - parse(revRegId) { - if (revRegId === '' || !revRegId) throw new Error('Missing `revRegId`'); - const match = revRegId.match(REV_REG_ID_MATCHER); - - if (match == null) { - throw new Error(`Invalid revocation registry entry id: ${revRegId}`); - } - const [_, method, regId, revId] = match; - - return { method, regId, revId }; - } -} diff --git a/src/resolver/status-list2021/dock-status-list2021-resolver.js b/src/resolver/status-list2021/dock-status-list2021-resolver.js deleted file mode 100644 index 964361429..000000000 --- a/src/resolver/status-list2021/dock-status-list2021-resolver.js +++ /dev/null @@ -1,35 +0,0 @@ -import { withInitializedDockAPI } from '../utils'; -import StatusList2021Resolver from './status-list2021-resolver'; - -class DockStatusListResolver extends StatusList2021Resolver { - static METHOD = 'dock'; - - /** - * @param {DockAPI} dock - An initialized connection to a dock full-node. - * @constructor - */ - constructor(dock) { - super(); - - /** - * @type {DockAPI} - */ - this.dock = dock; - } - - async resolve(fullyQualifiedStatusListId) { - const { id: dockStatusListId } = this.parse(fullyQualifiedStatusListId); - - const cred = await this.dock.statusListCredential.fetchStatusList2021Credential( - dockStatusListId, - ); - - return cred?.toJSON(); - } -} - -/** - * Resolves `StatusList2021Credential`s with identifier `status-list2021:dock:*`. - * @type {DockStatusListResolver} - */ -export default withInitializedDockAPI(DockStatusListResolver); diff --git a/src/rpc-defs/poa-rpc-defs.js b/src/rpc-defs/poa-rpc-defs.js deleted file mode 100644 index 9e701cae9..000000000 --- a/src/rpc-defs/poa-rpc-defs.js +++ /dev/null @@ -1,14 +0,0 @@ -export default { - poa: { - treasuryAccount: { - description: 'Return account address of treasury. The account address can then be used to query the chain for balance', - params: [], - type: 'AccountId', - }, - treasuryBalance: { - description: 'Return free balance of treasury account. In the context of PoA, only free balance makes sense for treasury. But just in case, to check all kinds of balance (locked, reserved, etc), get the account address with above call and query the chain.', - params: [], - type: 'Balance', - }, - }, -}; diff --git a/src/signatures/index.js b/src/signatures/index.js deleted file mode 100644 index fb337feda..000000000 --- a/src/signatures/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import Signature from './signature'; - -import SignatureSr25519 from './signature-sr25519'; -import SignatureEd25519 from './signature-ed25519'; -import SignatureSecp256k1 from './signature-secp256k1'; - -export { - Signature, - SignatureSr25519, - SignatureEd25519, - SignatureSecp256k1, -}; diff --git a/src/signatures/signature-secp256k1.js b/src/signatures/signature-secp256k1.js deleted file mode 100644 index 80757b6a4..000000000 --- a/src/signatures/signature-secp256k1.js +++ /dev/null @@ -1,34 +0,0 @@ -import { sha256 } from 'js-sha256'; -import Signature from './signature'; -import { PublicKeySecp256k1 } from '../public-keys'; - -/** Class representing a Secp256k1 Signature */ -export default class SignatureSecp256k1 extends Signature { - static PublicKey = PublicKeySecp256k1; - static Size = 65; - - static signWithKeyringPair(message, keyringPair) { - return this.signPrehashed(sha256.digest(message), keyringPair); - } - - /** - * Sign an already hashed message - * @param messageHash - Hash of the message - * @param signingPair - * @returns {string} - */ - static signPrehashed(messageHash, keyringPair) { - const sig = this.PublicKey.validateKeyringPair(keyringPair).sign( - messageHash, - { - canonical: true, - }, - ); - // The signature is recoverable in 65-byte { R | S | index } format - const r = sig.r.toString('hex', 32); - const s = sig.s.toString('hex', 32); - const i = sig.recoveryParam.toString(16).padStart(2, '0'); - // Make it proper hex - return new this(`0x${r}${s}${i}`); - } -} diff --git a/src/signatures/signature.js b/src/signatures/signature.js deleted file mode 100644 index dad2d3af8..000000000 --- a/src/signatures/signature.js +++ /dev/null @@ -1,54 +0,0 @@ -import { isHexWithGivenByteSize } from '../utils/codec'; -import { TypedEnum } from '../utils/typed-enum'; -import { withExtendedStaticProperties } from '../utils/inheritance'; - -/** Class representing a Signature. This export class should always be extended (abstract export class in some languages) */ -export default withExtendedStaticProperties( - ['Size', 'PublicKey'], - class Signature extends TypedEnum { - /** - * Public key associated with the signature. - * @type {typeof PublicKey} - */ - static PublicKey; - - static get Type() { - return this.PublicKey.Type; - } - - /** - * Check that the given public key has the expected byte size. Assumes the signature is in hex. - */ - static validateSize(value) { - if (!isHexWithGivenByteSize(value, this.Size)) { - throw new Error(`Signature must be ${this.Size} bytes`); - } - - return value; - } - - /** - * Signs supplied message using the provided keyring pair. - * - * @param message - * @param keyringPair - * @param signingOpts - * @returns {Signature} - */ - static signWithKeyringPair(message, keyringPair, signingOpts = {}) { - const signed = this.PublicKey.validateKeyringPair(keyringPair).sign( - message, - signingOpts, - ); - - return new this(signed); - } - - /** - * Returns the size of the underlying signature. - */ - get size() { - return this.constructor.Size; - } - }, -); diff --git a/src/utils/codec.js b/src/utils/codec.js deleted file mode 100644 index 0b9601dec..000000000 --- a/src/utils/codec.js +++ /dev/null @@ -1,98 +0,0 @@ -import { u8aToHex } from '@polkadot/util'; -import { decodeAddress, encodeAddress } from '@polkadot/util-crypto'; - -/** - * Check if the given input is hexadecimal or not. Optionally checks for the byte size of the hex. Case-insensitive on hex chars - * @param {string} value - Hexadecimal value - * @param {number} [byteSize] - Expected byte size of the input. - * @return {Boolean} True if hex (with given size) else false - */ -export function isHexWithGivenByteSize(value, byteSize = undefined) { - if (typeof value !== 'string') { - return false; - } - const match = value.match(/^0x([0-9a-f]+$)/i); - if (match && match.length > 1) { - if (byteSize !== undefined) { - // If `byteSize` is not a positive integer type, then check will fail - // 2 hex digits make a byte - return match[1].length === 2 * byteSize; - } - // Don't care about byte size of the match but it must be full byte - return match[1].length % 2 === 0; - } - return false; -} - -/** - * Gets the hexadecimal value of the given string. - * @return {string} Returns the hexadecimal representation of the ID. - */ -export function getHexIdentifier(id, qualifiers, byteSize) { - const strId = String(id); - - for (const qualifier of [].concat(qualifiers)) { - if (strId.startsWith(qualifier)) { - // Fully qualified ID. Remove the qualifier - const ss58Did = strId.slice(qualifier.length); - try { - const hex = u8aToHex(decodeAddress(ss58Did)); - // 2 characters for `0x` and 2*byte size of ID - if (hex.length !== 2 + 2 * byteSize) { - throw new Error('Unexpected byte size'); - } - return hex; - } catch (e) { - throw new Error(`Invalid SS58 ID ${strId} with qualifier ${qualifier}. ${e}`); - } - } - } - - try { - // Check if hex and of correct size and return the hex value if successful. - if (!isHexWithGivenByteSize(strId, byteSize)) { - throw new Error(`Expected ${byteSize}-byte sequence`); - } - - return strId; - } catch (error) { - // Cannot parse as hex - throw new Error(`Invalid hex Did \`${id}\`, stringified \`${strId}\`: ${error}`); - } -} - -/** - * Convert address to Dock appropriate network address. - * @param addr - address to convert - * @param network - the network to use, allowed values are `main`, `test` and `dev` corresponding to mainnet, testnet and dev node - */ -export function asDockAddress(addr, network = 'test') { - switch (network) { - case 'dev': - return encodeAddress(addr, 42); - case 'test': - return encodeAddress(addr, 21); - case 'main': - return encodeAddress(addr, 22); - default: - throw new Error( - `Network can be either test or main or dev but was passed as ${network}`, - ); - } -} - -/** - * Normalizes the given input to hex. Expects a Uint8Array or a hex string - * @param {Uint8Array|string} data - */ -export function normalizeToHex(data) { - let hex; - if (data instanceof Uint8Array) { - hex = u8aToHex(data); - } else if (isHexWithGivenByteSize(data)) { - hex = data; - } else { - throw new Error('Require a hex string or a byte array'); - } - return hex; -} diff --git a/src/utils/evm-utils.js b/src/utils/evm-utils.js deleted file mode 100644 index dd82198b7..000000000 --- a/src/utils/evm-utils.js +++ /dev/null @@ -1,38 +0,0 @@ -import { blake2AsHex, decodeAddress } from '@polkadot/util-crypto'; -import { hexToU8a, u8aToHex, bnToBn } from '@polkadot/util'; -import { asDockAddress } from './codec'; - -require('dotenv').config(); - -const { - Network, MinGasPrice, MaxGas, -} = process.env; - -// Convert EVM address to Substrate address -export function evmAddrToSubstrateAddr(evmAddr) { - const bytes = hexToU8a(evmAddr); - // Hash(evm:||EVM address) => Substrate address - const prefix = 'evm:'; - const preimage = [0, 1, 2, 3].map((i) => prefix.charCodeAt(i)).concat(...bytes); - // @ts-ignore - return asDockAddress(blake2AsHex(preimage), Network); -} - -// Convert Substrate address to EVM address -export function substrateAddrToEVMAddr(address) { - const bytes = decodeAddress(address); - return u8aToHex(bytes.slice(0, 20)); -} - -// Give `amount` of Dock tokens to EVM address. `amount` defaults to the number of tokens required to pay of maximum gas -export function endowEVMAddress(dock, evmAddr, amount) { - // Convert EVM address to a Substrate address - const substrateAddr = evmAddrToSubstrateAddr(evmAddr); - - // Selecting the amount such that it can pay fees for the upto the maximum gas allowed and some extra - const amt = amount !== undefined ? amount : bnToBn(MinGasPrice).mul(bnToBn(MaxGas)).muln(2); - - // Transfer to the Substrate address created above - const transfer = dock.api.tx.balances.transfer(substrateAddr, amt); - return dock.signAndSend(transfer, false); -} diff --git a/src/utils/inheritance.js b/src/utils/inheritance.js deleted file mode 100644 index 8dd67a9c8..000000000 --- a/src/utils/inheritance.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Enhances the provided class with the given list of static properties to require - * in the inherited class. - * All properties will be checked for presence during the object constructor call. - * Each property on its own will be checked every time it is accessed. - * In case some property is missing, an error will be thrown. - * - * @template T - * @param {Array} properties - * @param {T} parentClass - * @returns {T} - */ -export function withExtendedStaticProperties(properties, parentClass) { - const extendedClass = class extends parentClass { - constructor(...args) { - super(...args); - - /* - * Ensures that properties are extended properly. - */ - for (const property of properties) { - if (this.constructor[property] == null) { - throw new Error( - `Static property \`${property}\` of \`${this.constructor.name}\` isn't extended properly`, - ); - } - } - } - }; - - for (const property of properties) { - const propertySymbol = Symbol(property); - - Object.defineProperty(extendedClass, property, { - get() { - return this[propertySymbol]; - }, - set(newValue) { - if (this[propertySymbol] != null) { - throw new Error( - `Can't override the property \`${property}\` of \`${this.name}\``, - ); - } - - this[propertySymbol] = newValue; - }, - }); - } - - return extendedClass; -} diff --git a/src/utils/keypair.js b/src/utils/keypair.js deleted file mode 100644 index 77c86d924..000000000 --- a/src/utils/keypair.js +++ /dev/null @@ -1,137 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import elliptic from 'elliptic'; -import { - PublicKeyEd25519, - PublicKeySr25519, - PublicKeySecp256k1, - getKeyPairType, // eslint-disable-line -} from '../public-keys'; -import { - SignatureEd25519, - SignatureSecp256k1, - SignatureSr25519, // eslint-disable-line -} from '../signatures'; -import { - EcdsaSecp256k1VerKeyName, - Ed25519VerKeyName, - Sr25519VerKeyName, -} from './vc/custom_crypto'; - -const EC = elliptic.ec; -const secp256k1Curve = new EC('secp256k1'); - -/** - * Wrapped keypair used to interact with the dock blockchain. - */ -export class DockKeypair { - /** - * Wraps supplied keypair into a `DockKeypair`. - * - * @param {*} keyPair - */ - constructor(keyPair) { - this.keyPair = keyPair; - this.verKeyType = getVerKeyTypeForKeypair(keyPair); - } - - /** - * Returns underlying public key. - */ - publicKey() { - return getPublicKeyFromKeyringPair(this.keyPair); - } - - /** - * Signs supplied message using underlying keypair. - * @param {*} message - */ - sign(message) { - return getSignatureFromKeyringPair(this.keyPair, message); - } - - /** - * Generates random `Secp256k1` keypair. - * - * @param params - * @returns {this} - */ - static randomSecp256k1() { - return new this(generateEcdsaSecp256k1Keypair(randomAsHex(32))); - } -} - -/** - * Return the crypto type of the verification key for the given keypair. - * @param {object} pair - Can be a keypair from polkadot-js or elliptic library. - * @returns {string|*} - */ -export function getVerKeyTypeForKeypair(pair) { - const ty = getKeyPairType(pair); - - switch (ty) { - case 'ed25519': - return Ed25519VerKeyName; - case 'sr25519': - return Sr25519VerKeyName; - case 'secp256k1': - return EcdsaSecp256k1VerKeyName; - default: - throw new Error(`Unsupported key type: \`${ty}\``); - } -} - -/** - * Inspect the `type` of the `KeyringPair` to generate the correct kind of PublicKey. - * @param {object} pair - A polkadot-js KeyringPair. - * @return {PublicKey} An instance of the correct subclass of PublicKey - */ -export function getPublicKeyFromKeyringPair(pair) { - const type = getKeyPairType(pair); - let Cls; - if (type === 'ed25519') { - Cls = PublicKeyEd25519; - } else if (type === 'sr25519') { - Cls = PublicKeySr25519; - } else { - Cls = PublicKeySecp256k1; - } - return Cls.fromKeyringPair(pair); -} - -/** - * Inspect the `type` of the `KeyringPair` to generate the correct kind of Signature. - * @param {object} pair - A polkadot-js KeyringPair. - * @param {array} message - an array of bytes (Uint8) - * @returns {Signature} An instance of the correct subclass of Signature - */ -export function getSignatureFromKeyringPair(pair, message) { - const type = getKeyPairType(pair); - - let Cls; - switch (type) { - case 'ed25519': - Cls = SignatureEd25519; - break; - case 'sr25519': - Cls = SignatureSr25519; - break; - case 'secp256k1': - Cls = SignatureSecp256k1; - break; - default: - throw new Error(`Unsupported keypair type: \`${type}\``); - } - - return Cls.signWithKeyringPair(message, pair); -} - -/** - * Generate keypair for Ecdsa over Secp256k1. Explicitly denying other options to keep the API simple - * @param {string} [pers] - A string - * @param {array|string} [entropy] - A byte array or hex string - * @returns {object} A keypair - */ - -export function generateEcdsaSecp256k1Keypair(entropy = null) { - return secp256k1Curve.genKeyPair({ entropy }); -} diff --git a/src/utils/revocation/one-of-policy.js b/src/utils/revocation/one-of-policy.js deleted file mode 100644 index 069ee76e8..000000000 --- a/src/utils/revocation/one-of-policy.js +++ /dev/null @@ -1,45 +0,0 @@ -import Policy from './policy'; - -// Revocation policy that allows one of the pre-decided controllers to update the registry. -export default class OneOfPolicy extends Policy { - /** - * Constructs a OneOfPolicy with given controllers - * @param {any} [controllers] - Controller set - * @constructor - */ - constructor(controllers = []) { - super(); - this.controllers = new Set(controllers); - } - - /** - * Add a owner to the policy - * @param {string} ownerDID - Owner's DID - */ - addOwner(ownerDID) { - this.controllers.add(ownerDID); - } - - /** - * Returns list containing unique sorted owner DIDs. - * @returns {DockDidOrDidMethodKey[]} - */ - controllerIds() { - const controllerIds = [...this.controllers]; - // Sort the controller ids as the node is expecting sorted ids and keeping ids unsorted is giving a signature - // verification error. This is a workaround and is needed for now. It maybe fixed later - controllerIds.sort(); - - return controllerIds; - } - - /** - * Converts policy to JSON object - * @returns {object} - */ - toJSON() { - return { - OneOf: this.controllerIds(), - }; - } -} diff --git a/src/utils/revocation/policy.js b/src/utils/revocation/policy.js deleted file mode 100644 index 58d343e8c..000000000 --- a/src/utils/revocation/policy.js +++ /dev/null @@ -1,10 +0,0 @@ -/** Class representing a regitry Policy */ -export default class Policy { - /** - * Converts policy to JSON object - * @returns {object} - */ - toJSON() { - return {}; - } -} diff --git a/src/utils/typed-enum.js b/src/utils/typed-enum.js deleted file mode 100644 index 132aaff03..000000000 --- a/src/utils/typed-enum.js +++ /dev/null @@ -1,91 +0,0 @@ -/* eslint-disable max-classes-per-file */ -import { withExtendedStaticProperties } from './inheritance'; - -export const TypedEnum = withExtendedStaticProperties( - ['Type'], - /** - * @template V - */ - class TypedEnum { - /** - * The type of the enumeration. - * @type {string} - * @static - */ - static Type; - - /** - * Create a new TypedEnum instance. - * @param {V} value - The value of the enumeration. - */ - constructor(value) { - this[this.type] = value; - } - - /** - * Get the type of the enumeration. - * @returns {string} The type of the enumeration. - */ - get type() { - return this.constructor.Type; - } - - /** - * Get the value of the enumeration. - * @returns {V} The value of the enumeration. - */ - get value() { - return this[this.type]; - } - - /** - * Convert the instance to a JSON representation. - * @returns {Object} The JSON representation of the instance. - */ - toJSON() { - const key = `${this.type[0].toUpperCase()}${this.type.slice(1)}`; - const value = this.value && typeof this.value.toJSON === 'function' - ? this.value.toJSON() - : this.value; - - return { - [key]: value, - }; - } - }, -); - -export const SizedTypedEnum = withExtendedStaticProperties( - ['Size'], - /** - * @template V - * @extends TypedEnum - */ - class SizedTypedEnum extends TypedEnum { - /** - * The size of underlying value. - * @type {number} - * @static - */ - static Size; - - /** - * Create a new SizedTypedEnum instance. - * @param {V} value - The value of the enumeration. - */ - constructor(value) { - super(value); - - this.constructor.validateSize(value); - } - - /** - * Validate the size of the value. To be implemented by subclasses. - * @param {V} _value - The value to validate. - * @throws {Error} Throws an error if the method is not implemented. - */ - static validateSize(_value) { - throw new Error('Unimplemented'); - } - }, -); diff --git a/src/utils/vc/contexts.js b/src/utils/vc/contexts.js deleted file mode 100644 index d90e9e52b..000000000 --- a/src/utils/vc/contexts.js +++ /dev/null @@ -1,114 +0,0 @@ -import vcExamplesV1 from './contexts/vc-examples-v1'; -import ed25519V1Context from './contexts/ed25519-2020-v1-context.json'; -import sr25519Context from './contexts/sr25519-context.json'; -import secContext from './contexts/security_context'; -import secContextV1 from './contexts/security-v1.json'; -import didV1Context from './contexts/did-v1-updated.json'; -import credV1Context from './contexts/credential-v1-updated.json'; -import schema from './contexts/schema.json'; -import odrl from './contexts/odrl.json'; -import bbsV1Context from './contexts/bbs-v1.json'; -import dockBBSV1Context from './contexts/dock-bbs-v1.json'; -import dockBBS23V1Context from './contexts/dock-bbs23-v1.json'; -import dockPSV1Context from './contexts/dock-ps-v1.json'; -import dockBBDT16V1Context from './contexts/dock-bbdt16-v1.json'; -import dockPrettyVCContext from './contexts/prettyvc.json'; -import jws2020V1Context from './contexts/jws-2020-v1.json'; -import statusList21Context from './contexts/status-list-21'; -import privateStatusList21Context from './contexts/private-status-list-21'; -import sphereonId from './contexts/sphereon-wallet-identity-v1.json'; - -// Lookup of following URLs will lead to loading data from the context directory, this is done as the Sr25519 keys are not -// supported in any W3C standard and vc-js has them stored locally. This is a temporary solution. -export default new Map([ - [ - 'https://ld.dock.io/credentials/prettyvc', - dockPrettyVCContext, - ], - [ - 'https://ld.dock.io/security/bbs/v1', - dockBBSV1Context, - ], - [ - 'https://ld.dock.io/security/bbs23/v1', - dockBBS23V1Context, - ], - [ - 'https://ld.dock.io/security/ps/v1', - dockPSV1Context, - ], - [ - 'https://ld.dock.io/security/bbdt16/v1', - dockBBDT16V1Context, - ], - [ - 'https://w3id.org/security/bbs/v1', - bbsV1Context, - ], - [ - 'https://w3c-ccg.github.io/ldp-bbs2020/contexts/v1/', - bbsV1Context, - ], - [ - 'https://www.w3.org/2018/credentials/v1', - credV1Context, - ], - [ - 'https://www.w3.org/2018/credentials/examples/v1', - vcExamplesV1, - ], - [ - 'https://www.w3.org/ns/odrl.jsonld', - odrl, - ], - [ - 'https://schema.org', - schema, - ], - [ - 'http://schema.org', - schema, - ], - [ - 'https://www.dock.io/2020/credentials/context/sr25519', - sr25519Context, - ], - [ - 'https://w3id.org/security/v1', - secContextV1, - ], - [ - 'https://w3id.org/security/v2', - secContext, - ], - [ - 'https://w3id.org/did/v0.11', - didV1Context, - ], - [ - 'https://www.w3.org/ns/did/v1', - didV1Context, - ], - [ - 'https://w3id.org/security/suites/ed25519-2020/v1', - ed25519V1Context, - ], - [ - 'https://w3id.org/security/suites/jws-2020/v1', - jws2020V1Context, - ], - // This is overridden because the URL is 404 now, likely because domain name change. But the status-list library still uses the old domain name - [ - 'https://w3id.org/vc/status-list/2021/v1', - statusList21Context, - ], - [ - 'https://ld.dock.io/private-status-list-21', - privateStatusList21Context, - ], - // Overriden due to 404ing - [ - 'https://sphereon-opensource.github.io/ssi-mobile-wallet/context/sphereon-wallet-identity-v1.jsonld', - sphereonId, - ], -]); diff --git a/src/utils/vc/contexts/schema.json b/src/utils/vc/contexts/schema.json deleted file mode 100644 index 1cd287b67..000000000 --- a/src/utils/vc/contexts/schema.json +++ /dev/null @@ -1,2368 +0,0 @@ -{ - "@context": { - "type": "@type", - "id": "@id", - "HTML": { "@id": "rdf:HTML" }, - - "@vocab": "http://schema.org/", - "xml": "http://www.w3.org/XML/1998/namespace", - "foaf": "http://xmlns.com/foaf/0.1/", - "eli": "http://data.europa.eu/eli/ontology#", - "snomed": "http://purl.bioontology.org/ontology/SNOMEDCT/", - "bibo": "http://purl.org/ontology/bibo/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "skos": "http://www.w3.org/2004/02/skos/core#", - "void": "http://rdfs.org/ns/void#", - "dc": "http://purl.org/dc/elements/1.1/", - "dctype": "http://purl.org/dc/dcmitype/", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "dcat": "http://www.w3.org/ns/dcat#", - "rdfa": "http://www.w3.org/ns/rdfa#", - "xsd": "http://www.w3.org/2001/XMLSchema#", - "schema": "http://schema.org/", - "dct": "http://purl.org/dc/terms/", - "dcterms": "http://purl.org/dc/terms/", - "owl": "http://www.w3.org/2002/07/owl#", - "xsd1": "hhttp://www.w3.org/2001/XMLSchema#", - "3DModel": {"@id": "schema:3DModel"}, - "AMRadioChannel": {"@id": "schema:AMRadioChannel"}, - "APIReference": {"@id": "schema:APIReference"}, - "Abdomen": {"@id": "schema:Abdomen"}, - "AboutPage": {"@id": "schema:AboutPage"}, - "AcceptAction": {"@id": "schema:AcceptAction"}, - "Accommodation": {"@id": "schema:Accommodation"}, - "AccountingService": {"@id": "schema:AccountingService"}, - "AchieveAction": {"@id": "schema:AchieveAction"}, - "Action": {"@id": "schema:Action"}, - "ActionAccessSpecification": {"@id": "schema:ActionAccessSpecification"}, - "ActionStatusType": {"@id": "schema:ActionStatusType"}, - "ActivateAction": {"@id": "schema:ActivateAction"}, - "ActiveActionStatus": {"@id": "schema:ActiveActionStatus"}, - "ActiveNotRecruiting": {"@id": "schema:ActiveNotRecruiting"}, - "AddAction": {"@id": "schema:AddAction"}, - "AdministrativeArea": {"@id": "schema:AdministrativeArea"}, - "AdultEntertainment": {"@id": "schema:AdultEntertainment"}, - "AdvertiserContentArticle": {"@id": "schema:AdvertiserContentArticle"}, - "AerobicActivity": {"@id": "schema:AerobicActivity"}, - "AggregateOffer": {"@id": "schema:AggregateOffer"}, - "AggregateRating": {"@id": "schema:AggregateRating"}, - "AgreeAction": {"@id": "schema:AgreeAction"}, - "Airline": {"@id": "schema:Airline"}, - "Airport": {"@id": "schema:Airport"}, - "AlbumRelease": {"@id": "schema:AlbumRelease"}, - "AlignmentObject": {"@id": "schema:AlignmentObject"}, - "AllWheelDriveConfiguration": {"@id": "schema:AllWheelDriveConfiguration"}, - "AllocateAction": {"@id": "schema:AllocateAction"}, - "AmusementPark": {"@id": "schema:AmusementPark"}, - "AnaerobicActivity": {"@id": "schema:AnaerobicActivity"}, - "AnalysisNewsArticle": {"@id": "schema:AnalysisNewsArticle"}, - "AnatomicalStructure": {"@id": "schema:AnatomicalStructure"}, - "AnatomicalSystem": {"@id": "schema:AnatomicalSystem"}, - "Anesthesia": {"@id": "schema:Anesthesia"}, - "AnimalShelter": {"@id": "schema:AnimalShelter"}, - "Answer": {"@id": "schema:Answer"}, - "Apartment": {"@id": "schema:Apartment"}, - "ApartmentComplex": {"@id": "schema:ApartmentComplex"}, - "Appearance": {"@id": "schema:Appearance"}, - "AppendAction": {"@id": "schema:AppendAction"}, - "ApplyAction": {"@id": "schema:ApplyAction"}, - "ApprovedIndication": {"@id": "schema:ApprovedIndication"}, - "Aquarium": {"@id": "schema:Aquarium"}, - "ArchiveComponent": {"@id": "schema:ArchiveComponent"}, - "ArchiveOrganization": {"@id": "schema:ArchiveOrganization"}, - "ArriveAction": {"@id": "schema:ArriveAction"}, - "ArtGallery": {"@id": "schema:ArtGallery"}, - "Artery": {"@id": "schema:Artery"}, - "Article": {"@id": "schema:Article"}, - "AskAction": {"@id": "schema:AskAction"}, - "AskPublicNewsArticle": {"@id": "schema:AskPublicNewsArticle"}, - "AssessAction": {"@id": "schema:AssessAction"}, - "AssignAction": {"@id": "schema:AssignAction"}, - "Atlas": {"@id": "schema:Atlas"}, - "Attorney": {"@id": "schema:Attorney"}, - "Audience": {"@id": "schema:Audience"}, - "AudioObject": {"@id": "schema:AudioObject"}, - "Audiobook": {"@id": "schema:Audiobook"}, - "AudiobookFormat": {"@id": "schema:AudiobookFormat"}, - "AuthoritativeLegalValue": {"@id": "schema:AuthoritativeLegalValue"}, - "AuthorizeAction": {"@id": "schema:AuthorizeAction"}, - "AutoBodyShop": {"@id": "schema:AutoBodyShop"}, - "AutoDealer": {"@id": "schema:AutoDealer"}, - "AutoPartsStore": {"@id": "schema:AutoPartsStore"}, - "AutoRental": {"@id": "schema:AutoRental"}, - "AutoRepair": {"@id": "schema:AutoRepair"}, - "AutoWash": {"@id": "schema:AutoWash"}, - "AutomatedTeller": {"@id": "schema:AutomatedTeller"}, - "AutomotiveBusiness": {"@id": "schema:AutomotiveBusiness"}, - "Ayurvedic": {"@id": "schema:Ayurvedic"}, - "BackgroundNewsArticle": {"@id": "schema:BackgroundNewsArticle"}, - "Bacteria": {"@id": "schema:Bacteria"}, - "Bakery": {"@id": "schema:Bakery"}, - "Balance": {"@id": "schema:Balance"}, - "BankAccount": {"@id": "schema:BankAccount"}, - "BankOrCreditUnion": {"@id": "schema:BankOrCreditUnion"}, - "BarOrPub": {"@id": "schema:BarOrPub"}, - "Barcode": {"@id": "schema:Barcode"}, - "Beach": {"@id": "schema:Beach"}, - "BeautySalon": {"@id": "schema:BeautySalon"}, - "BedAndBreakfast": {"@id": "schema:BedAndBreakfast"}, - "BedDetails": {"@id": "schema:BedDetails"}, - "BedType": {"@id": "schema:BedType"}, - "BefriendAction": {"@id": "schema:BefriendAction"}, - "BikeStore": {"@id": "schema:BikeStore"}, - "Blog": {"@id": "schema:Blog"}, - "BlogPosting": {"@id": "schema:BlogPosting"}, - "BloodTest": {"@id": "schema:BloodTest"}, - "BoardingPolicyType": {"@id": "schema:BoardingPolicyType"}, - "BodyOfWater": {"@id": "schema:BodyOfWater"}, - "Bone": {"@id": "schema:Bone"}, - "Book": {"@id": "schema:Book"}, - "BookFormatType": {"@id": "schema:BookFormatType"}, - "BookSeries": {"@id": "schema:BookSeries"}, - "BookStore": {"@id": "schema:BookStore"}, - "BookmarkAction": {"@id": "schema:BookmarkAction"}, - "Boolean": {"@id": "schema:Boolean"}, - "BorrowAction": {"@id": "schema:BorrowAction"}, - "BowlingAlley": {"@id": "schema:BowlingAlley"}, - "BrainStructure": {"@id": "schema:BrainStructure"}, - "Brand": {"@id": "schema:Brand"}, - "BreadcrumbList": {"@id": "schema:BreadcrumbList"}, - "Brewery": {"@id": "schema:Brewery"}, - "Bridge": {"@id": "schema:Bridge"}, - "BroadcastChannel": {"@id": "schema:BroadcastChannel"}, - "BroadcastEvent": {"@id": "schema:BroadcastEvent"}, - "BroadcastFrequencySpecification": {"@id": "schema:BroadcastFrequencySpecification"}, - "BroadcastRelease": {"@id": "schema:BroadcastRelease"}, - "BroadcastService": {"@id": "schema:BroadcastService"}, - "BrokerageAccount": {"@id": "schema:BrokerageAccount"}, - "BuddhistTemple": {"@id": "schema:BuddhistTemple"}, - "BusOrCoach": {"@id": "schema:BusOrCoach"}, - "BusReservation": {"@id": "schema:BusReservation"}, - "BusStation": {"@id": "schema:BusStation"}, - "BusStop": {"@id": "schema:BusStop"}, - "BusTrip": {"@id": "schema:BusTrip"}, - "BusinessAudience": {"@id": "schema:BusinessAudience"}, - "BusinessEntityType": {"@id": "schema:BusinessEntityType"}, - "BusinessEvent": {"@id": "schema:BusinessEvent"}, - "BusinessFunction": {"@id": "schema:BusinessFunction"}, - "BuyAction": {"@id": "schema:BuyAction"}, - "CDFormat": {"@id": "schema:CDFormat"}, - "CT": {"@id": "schema:CT"}, - "CableOrSatelliteService": {"@id": "schema:CableOrSatelliteService"}, - "CafeOrCoffeeShop": {"@id": "schema:CafeOrCoffeeShop"}, - "Campground": {"@id": "schema:Campground"}, - "CampingPitch": {"@id": "schema:CampingPitch"}, - "Canal": {"@id": "schema:Canal"}, - "CancelAction": {"@id": "schema:CancelAction"}, - "Car": {"@id": "schema:Car"}, - "CarUsageType": {"@id": "schema:CarUsageType"}, - "Cardiovascular": {"@id": "schema:Cardiovascular"}, - "CardiovascularExam": {"@id": "schema:CardiovascularExam"}, - "CaseSeries": {"@id": "schema:CaseSeries"}, - "Casino": {"@id": "schema:Casino"}, - "CassetteFormat": {"@id": "schema:CassetteFormat"}, - "CategoryCode": {"@id": "schema:CategoryCode"}, - "CategoryCodeSet": {"@id": "schema:CategoryCodeSet"}, - "CatholicChurch": {"@id": "schema:CatholicChurch"}, - "Cemetery": {"@id": "schema:Cemetery"}, - "Chapter": {"@id": "schema:Chapter"}, - "CheckAction": {"@id": "schema:CheckAction"}, - "CheckInAction": {"@id": "schema:CheckInAction"}, - "CheckOutAction": {"@id": "schema:CheckOutAction"}, - "CheckoutPage": {"@id": "schema:CheckoutPage"}, - "ChildCare": {"@id": "schema:ChildCare"}, - "ChildrensEvent": {"@id": "schema:ChildrensEvent"}, - "Chiropractic": {"@id": "schema:Chiropractic"}, - "ChooseAction": {"@id": "schema:ChooseAction"}, - "Church": {"@id": "schema:Church"}, - "City": {"@id": "schema:City"}, - "CityHall": {"@id": "schema:CityHall"}, - "CivicStructure": {"@id": "schema:CivicStructure"}, - "Claim": {"@id": "schema:Claim"}, - "ClaimReview": {"@id": "schema:ClaimReview"}, - "Class": {"@id": "schema:Class"}, - "Clinician": {"@id": "schema:Clinician"}, - "Clip": {"@id": "schema:Clip"}, - "ClothingStore": {"@id": "schema:ClothingStore"}, - "CoOp": {"@id": "schema:CoOp"}, - "Code": {"@id": "schema:Code"}, - "CohortStudy": {"@id": "schema:CohortStudy"}, - "Collection": {"@id": "schema:Collection"}, - "CollectionPage": {"@id": "schema:CollectionPage"}, - "CollegeOrUniversity": {"@id": "schema:CollegeOrUniversity"}, - "ComedyClub": {"@id": "schema:ComedyClub"}, - "ComedyEvent": {"@id": "schema:ComedyEvent"}, - "ComicCoverArt": {"@id": "schema:ComicCoverArt"}, - "ComicIssue": {"@id": "schema:ComicIssue"}, - "ComicSeries": {"@id": "schema:ComicSeries"}, - "ComicStory": {"@id": "schema:ComicStory"}, - "Comment": {"@id": "schema:Comment"}, - "CommentAction": {"@id": "schema:CommentAction"}, - "CommentPermission": {"@id": "schema:CommentPermission"}, - "CommunicateAction": {"@id": "schema:CommunicateAction"}, - "CommunityHealth": {"@id": "schema:CommunityHealth"}, - "CompilationAlbum": {"@id": "schema:CompilationAlbum"}, - "CompleteDataFeed": {"@id": "schema:CompleteDataFeed"}, - "Completed": {"@id": "schema:Completed"}, - "CompletedActionStatus": {"@id": "schema:CompletedActionStatus"}, - "CompoundPriceSpecification": {"@id": "schema:CompoundPriceSpecification"}, - "ComputerLanguage": {"@id": "schema:ComputerLanguage"}, - "ComputerStore": {"@id": "schema:ComputerStore"}, - "ConfirmAction": {"@id": "schema:ConfirmAction"}, - "Consortium": {"@id": "schema:Consortium"}, - "ConsumeAction": {"@id": "schema:ConsumeAction"}, - "ContactPage": {"@id": "schema:ContactPage"}, - "ContactPoint": {"@id": "schema:ContactPoint"}, - "ContactPointOption": {"@id": "schema:ContactPointOption"}, - "Continent": {"@id": "schema:Continent"}, - "ControlAction": {"@id": "schema:ControlAction"}, - "ConvenienceStore": {"@id": "schema:ConvenienceStore"}, - "Conversation": {"@id": "schema:Conversation"}, - "CookAction": {"@id": "schema:CookAction"}, - "Corporation": {"@id": "schema:Corporation"}, - "CorrectionComment": {"@id": "schema:CorrectionComment"}, - "Country": {"@id": "schema:Country"}, - "Course": {"@id": "schema:Course"}, - "CourseInstance": {"@id": "schema:CourseInstance"}, - "Courthouse": {"@id": "schema:Courthouse"}, - "CoverArt": {"@id": "schema:CoverArt"}, - "CreateAction": {"@id": "schema:CreateAction"}, - "CreativeWork": {"@id": "schema:CreativeWork"}, - "CreativeWorkSeason": {"@id": "schema:CreativeWorkSeason"}, - "CreativeWorkSeries": {"@id": "schema:CreativeWorkSeries"}, - "CreditCard": {"@id": "schema:CreditCard"}, - "Crematorium": {"@id": "schema:Crematorium"}, - "CriticReview": {"@id": "schema:CriticReview"}, - "CrossSectional": {"@id": "schema:CrossSectional"}, - "CssSelectorType": {"@id": "schema:CssSelectorType"}, - "CurrencyConversionService": {"@id": "schema:CurrencyConversionService"}, - "DDxElement": {"@id": "schema:DDxElement"}, - "DJMixAlbum": {"@id": "schema:DJMixAlbum"}, - "DVDFormat": {"@id": "schema:DVDFormat"}, - "DamagedCondition": {"@id": "schema:DamagedCondition"}, - "DanceEvent": {"@id": "schema:DanceEvent"}, - "DanceGroup": {"@id": "schema:DanceGroup"}, - "DataCatalog": {"@id": "schema:DataCatalog"}, - "DataDownload": {"@id": "schema:DataDownload"}, - "DataFeed": {"@id": "schema:DataFeed"}, - "DataFeedItem": {"@id": "schema:DataFeedItem"}, - "DataType": {"@id": "schema:DataType"}, - "Dataset": {"@id": "schema:Dataset"}, - "Date": {"@id": "schema:Date"}, - "DateTime": {"@id": "schema:DateTime"}, - "DatedMoneySpecification": {"@id": "schema:DatedMoneySpecification"}, - "DayOfWeek": {"@id": "schema:DayOfWeek"}, - "DaySpa": {"@id": "schema:DaySpa"}, - "DeactivateAction": {"@id": "schema:DeactivateAction"}, - "DefenceEstablishment": {"@id": "schema:DefenceEstablishment"}, - "DefinedTerm": {"@id": "schema:DefinedTerm"}, - "DefinedTermSet": {"@id": "schema:DefinedTermSet"}, - "DefinitiveLegalValue": {"@id": "schema:DefinitiveLegalValue"}, - "DeleteAction": {"@id": "schema:DeleteAction"}, - "DeliveryChargeSpecification": {"@id": "schema:DeliveryChargeSpecification"}, - "DeliveryEvent": {"@id": "schema:DeliveryEvent"}, - "DeliveryMethod": {"@id": "schema:DeliveryMethod"}, - "Demand": {"@id": "schema:Demand"}, - "DemoAlbum": {"@id": "schema:DemoAlbum"}, - "Dentist": {"@id": "schema:Dentist"}, - "Dentistry": {"@id": "schema:Dentistry"}, - "DepartAction": {"@id": "schema:DepartAction"}, - "DepartmentStore": {"@id": "schema:DepartmentStore"}, - "DepositAccount": {"@id": "schema:DepositAccount"}, - "Dermatologic": {"@id": "schema:Dermatologic"}, - "Dermatology": {"@id": "schema:Dermatology"}, - "DiabeticDiet": {"@id": "schema:DiabeticDiet"}, - "Diagnostic": {"@id": "schema:Diagnostic"}, - "DiagnosticLab": {"@id": "schema:DiagnosticLab"}, - "DiagnosticProcedure": {"@id": "schema:DiagnosticProcedure"}, - "Diet": {"@id": "schema:Diet"}, - "DietNutrition": {"@id": "schema:DietNutrition"}, - "DietarySupplement": {"@id": "schema:DietarySupplement"}, - "DigitalAudioTapeFormat": {"@id": "schema:DigitalAudioTapeFormat"}, - "DigitalDocument": {"@id": "schema:DigitalDocument"}, - "DigitalDocumentPermission": {"@id": "schema:DigitalDocumentPermission"}, - "DigitalDocumentPermissionType": {"@id": "schema:DigitalDocumentPermissionType"}, - "DigitalFormat": {"@id": "schema:DigitalFormat"}, - "DisagreeAction": {"@id": "schema:DisagreeAction"}, - "Discontinued": {"@id": "schema:Discontinued"}, - "DiscoverAction": {"@id": "schema:DiscoverAction"}, - "DiscussionForumPosting": {"@id": "schema:DiscussionForumPosting"}, - "DislikeAction": {"@id": "schema:DislikeAction"}, - "Distance": {"@id": "schema:Distance"}, - "Distillery": {"@id": "schema:Distillery"}, - "DonateAction": {"@id": "schema:DonateAction"}, - "DoseSchedule": {"@id": "schema:DoseSchedule"}, - "DoubleBlindedTrial": {"@id": "schema:DoubleBlindedTrial"}, - "DownloadAction": {"@id": "schema:DownloadAction"}, - "DrawAction": {"@id": "schema:DrawAction"}, - "Drawing": {"@id": "schema:Drawing"}, - "DrinkAction": {"@id": "schema:DrinkAction"}, - "DriveWheelConfigurationValue": {"@id": "schema:DriveWheelConfigurationValue"}, - "DrivingSchoolVehicleUsage": {"@id": "schema:DrivingSchoolVehicleUsage"}, - "Drug": {"@id": "schema:Drug"}, - "DrugClass": {"@id": "schema:DrugClass"}, - "DrugCost": {"@id": "schema:DrugCost"}, - "DrugCostCategory": {"@id": "schema:DrugCostCategory"}, - "DrugLegalStatus": {"@id": "schema:DrugLegalStatus"}, - "DrugPregnancyCategory": {"@id": "schema:DrugPregnancyCategory"}, - "DrugPrescriptionStatus": {"@id": "schema:DrugPrescriptionStatus"}, - "DrugStrength": {"@id": "schema:DrugStrength"}, - "DryCleaningOrLaundry": {"@id": "schema:DryCleaningOrLaundry"}, - "Duration": {"@id": "schema:Duration"}, - "EBook": {"@id": "schema:EBook"}, - "EPRelease": {"@id": "schema:EPRelease"}, - "Ear": {"@id": "schema:Ear"}, - "EatAction": {"@id": "schema:EatAction"}, - "EducationEvent": {"@id": "schema:EducationEvent"}, - "EducationalAudience": {"@id": "schema:EducationalAudience"}, - "EducationalOccupationalCredential": {"@id": "schema:EducationalOccupationalCredential"}, - "EducationalOrganization": {"@id": "schema:EducationalOrganization"}, - "Electrician": {"@id": "schema:Electrician"}, - "ElectronicsStore": {"@id": "schema:ElectronicsStore"}, - "ElementarySchool": {"@id": "schema:ElementarySchool"}, - "EmailMessage": {"@id": "schema:EmailMessage"}, - "Embassy": {"@id": "schema:Embassy"}, - "Emergency": {"@id": "schema:Emergency"}, - "EmergencyService": {"@id": "schema:EmergencyService"}, - "EmployeeRole": {"@id": "schema:EmployeeRole"}, - "EmployerAggregateRating": {"@id": "schema:EmployerAggregateRating"}, - "EmployerReview": {"@id": "schema:EmployerReview"}, - "EmploymentAgency": {"@id": "schema:EmploymentAgency"}, - "Endocrine": {"@id": "schema:Endocrine"}, - "EndorseAction": {"@id": "schema:EndorseAction"}, - "EndorsementRating": {"@id": "schema:EndorsementRating"}, - "Energy": {"@id": "schema:Energy"}, - "EngineSpecification": {"@id": "schema:EngineSpecification"}, - "EnrollingByInvitation": {"@id": "schema:EnrollingByInvitation"}, - "EntertainmentBusiness": {"@id": "schema:EntertainmentBusiness"}, - "EntryPoint": {"@id": "schema:EntryPoint"}, - "Enumeration": {"@id": "schema:Enumeration"}, - "Episode": {"@id": "schema:Episode"}, - "Event": {"@id": "schema:Event"}, - "EventCancelled": {"@id": "schema:EventCancelled"}, - "EventPostponed": {"@id": "schema:EventPostponed"}, - "EventRescheduled": {"@id": "schema:EventRescheduled"}, - "EventReservation": {"@id": "schema:EventReservation"}, - "EventScheduled": {"@id": "schema:EventScheduled"}, - "EventSeries": {"@id": "schema:EventSeries"}, - "EventStatusType": {"@id": "schema:EventStatusType"}, - "EventVenue": {"@id": "schema:EventVenue"}, - "EvidenceLevelA": {"@id": "schema:EvidenceLevelA"}, - "EvidenceLevelB": {"@id": "schema:EvidenceLevelB"}, - "EvidenceLevelC": {"@id": "schema:EvidenceLevelC"}, - "ExchangeRateSpecification": {"@id": "schema:ExchangeRateSpecification"}, - "ExchangeRefund": {"@id": "schema:ExchangeRefund"}, - "ExerciseAction": {"@id": "schema:ExerciseAction"}, - "ExerciseGym": {"@id": "schema:ExerciseGym"}, - "ExercisePlan": {"@id": "schema:ExercisePlan"}, - "ExhibitionEvent": {"@id": "schema:ExhibitionEvent"}, - "Eye": {"@id": "schema:Eye"}, - "FAQPage": {"@id": "schema:FAQPage"}, - "FDAcategoryA": {"@id": "schema:FDAcategoryA"}, - "FDAcategoryB": {"@id": "schema:FDAcategoryB"}, - "FDAcategoryC": {"@id": "schema:FDAcategoryC"}, - "FDAcategoryD": {"@id": "schema:FDAcategoryD"}, - "FDAcategoryX": {"@id": "schema:FDAcategoryX"}, - "FDAnotEvaluated": {"@id": "schema:FDAnotEvaluated"}, - "FMRadioChannel": {"@id": "schema:FMRadioChannel"}, - "FailedActionStatus": {"@id": "schema:FailedActionStatus"}, - "False": {"@id": "schema:False"}, - "FastFoodRestaurant": {"@id": "schema:FastFoodRestaurant"}, - "Female": {"@id": "schema:Female"}, - "Festival": {"@id": "schema:Festival"}, - "FilmAction": {"@id": "schema:FilmAction"}, - "FinancialProduct": {"@id": "schema:FinancialProduct"}, - "FinancialService": {"@id": "schema:FinancialService"}, - "FindAction": {"@id": "schema:FindAction"}, - "FireStation": {"@id": "schema:FireStation"}, - "Flexibility": {"@id": "schema:Flexibility"}, - "Flight": {"@id": "schema:Flight"}, - "FlightReservation": {"@id": "schema:FlightReservation"}, - "Float": {"@id": "schema:Float"}, - "Florist": {"@id": "schema:Florist"}, - "FollowAction": {"@id": "schema:FollowAction"}, - "FoodEstablishment": {"@id": "schema:FoodEstablishment"}, - "FoodEstablishmentReservation": {"@id": "schema:FoodEstablishmentReservation"}, - "FoodEvent": {"@id": "schema:FoodEvent"}, - "FoodService": {"@id": "schema:FoodService"}, - "FourWheelDriveConfiguration": {"@id": "schema:FourWheelDriveConfiguration"}, - "Friday": {"@id": "schema:Friday"}, - "FrontWheelDriveConfiguration": {"@id": "schema:FrontWheelDriveConfiguration"}, - "FullRefund": {"@id": "schema:FullRefund"}, - "FundingAgency": {"@id": "schema:FundingAgency"}, - "FundingScheme": {"@id": "schema:FundingScheme"}, - "Fungus": {"@id": "schema:Fungus"}, - "FurnitureStore": {"@id": "schema:FurnitureStore"}, - "Game": {"@id": "schema:Game"}, - "GamePlayMode": {"@id": "schema:GamePlayMode"}, - "GameServer": {"@id": "schema:GameServer"}, - "GameServerStatus": {"@id": "schema:GameServerStatus"}, - "GardenStore": {"@id": "schema:GardenStore"}, - "GasStation": {"@id": "schema:GasStation"}, - "Gastroenterologic": {"@id": "schema:Gastroenterologic"}, - "GatedResidenceCommunity": {"@id": "schema:GatedResidenceCommunity"}, - "GenderType": {"@id": "schema:GenderType"}, - "GeneralContractor": {"@id": "schema:GeneralContractor"}, - "Genetic": {"@id": "schema:Genetic"}, - "Genitourinary": {"@id": "schema:Genitourinary"}, - "GeoCircle": {"@id": "schema:GeoCircle"}, - "GeoCoordinates": {"@id": "schema:GeoCoordinates"}, - "GeoShape": {"@id": "schema:GeoShape"}, - "GeospatialGeometry": {"@id": "schema:GeospatialGeometry"}, - "Geriatric": {"@id": "schema:Geriatric"}, - "GiveAction": {"@id": "schema:GiveAction"}, - "GlutenFreeDiet": {"@id": "schema:GlutenFreeDiet"}, - "GolfCourse": {"@id": "schema:GolfCourse"}, - "GovernmentBuilding": {"@id": "schema:GovernmentBuilding"}, - "GovernmentOffice": {"@id": "schema:GovernmentOffice"}, - "GovernmentOrganization": {"@id": "schema:GovernmentOrganization"}, - "GovernmentPermit": {"@id": "schema:GovernmentPermit"}, - "GovernmentService": {"@id": "schema:GovernmentService"}, - "Grant": {"@id": "schema:Grant"}, - "GraphicNovel": {"@id": "schema:GraphicNovel"}, - "GroceryStore": {"@id": "schema:GroceryStore"}, - "GroupBoardingPolicy": {"@id": "schema:GroupBoardingPolicy"}, - "Gynecologic": {"@id": "schema:Gynecologic"}, - "HVACBusiness": {"@id": "schema:HVACBusiness"}, - "HairSalon": {"@id": "schema:HairSalon"}, - "HalalDiet": {"@id": "schema:HalalDiet"}, - "Hardcover": {"@id": "schema:Hardcover"}, - "HardwareStore": {"@id": "schema:HardwareStore"}, - "Head": {"@id": "schema:Head"}, - "HealthAndBeautyBusiness": {"@id": "schema:HealthAndBeautyBusiness"}, - "HealthClub": {"@id": "schema:HealthClub"}, - "HealthInsurancePlan": {"@id": "schema:HealthInsurancePlan"}, - "HealthPlanCostSharingSpecification": {"@id": "schema:HealthPlanCostSharingSpecification"}, - "HealthPlanFormulary": {"@id": "schema:HealthPlanFormulary"}, - "HealthPlanNetwork": {"@id": "schema:HealthPlanNetwork"}, - "HearingImpairedSupported": {"@id": "schema:HearingImpairedSupported"}, - "Hematologic": {"@id": "schema:Hematologic"}, - "HighSchool": {"@id": "schema:HighSchool"}, - "HinduDiet": {"@id": "schema:HinduDiet"}, - "HinduTemple": {"@id": "schema:HinduTemple"}, - "HobbyShop": {"@id": "schema:HobbyShop"}, - "HomeAndConstructionBusiness": {"@id": "schema:HomeAndConstructionBusiness"}, - "HomeGoodsStore": {"@id": "schema:HomeGoodsStore"}, - "Homeopathic": {"@id": "schema:Homeopathic"}, - "Hospital": {"@id": "schema:Hospital"}, - "Hostel": {"@id": "schema:Hostel"}, - "Hotel": {"@id": "schema:Hotel"}, - "HotelRoom": {"@id": "schema:HotelRoom"}, - "House": {"@id": "schema:House"}, - "HousePainter": {"@id": "schema:HousePainter"}, - "HowTo": {"@id": "schema:HowTo"}, - "HowToDirection": {"@id": "schema:HowToDirection"}, - "HowToItem": {"@id": "schema:HowToItem"}, - "HowToSection": {"@id": "schema:HowToSection"}, - "HowToStep": {"@id": "schema:HowToStep"}, - "HowToSupply": {"@id": "schema:HowToSupply"}, - "HowToTip": {"@id": "schema:HowToTip"}, - "HowToTool": {"@id": "schema:HowToTool"}, - "IceCreamShop": {"@id": "schema:IceCreamShop"}, - "IgnoreAction": {"@id": "schema:IgnoreAction"}, - "ImageGallery": {"@id": "schema:ImageGallery"}, - "ImageObject": {"@id": "schema:ImageObject"}, - "ImagingTest": {"@id": "schema:ImagingTest"}, - "InForce": {"@id": "schema:InForce"}, - "InStock": {"@id": "schema:InStock"}, - "InStoreOnly": {"@id": "schema:InStoreOnly"}, - "IndividualProduct": {"@id": "schema:IndividualProduct"}, - "Infectious": {"@id": "schema:Infectious"}, - "InfectiousAgentClass": {"@id": "schema:InfectiousAgentClass"}, - "InfectiousDisease": {"@id": "schema:InfectiousDisease"}, - "InformAction": {"@id": "schema:InformAction"}, - "InsertAction": {"@id": "schema:InsertAction"}, - "InstallAction": {"@id": "schema:InstallAction"}, - "InsuranceAgency": {"@id": "schema:InsuranceAgency"}, - "Intangible": {"@id": "schema:Intangible"}, - "Integer": {"@id": "schema:Integer"}, - "InteractAction": {"@id": "schema:InteractAction"}, - "InteractionCounter": {"@id": "schema:InteractionCounter"}, - "InternationalTrial": {"@id": "schema:InternationalTrial"}, - "InternetCafe": {"@id": "schema:InternetCafe"}, - "InvestmentFund": {"@id": "schema:InvestmentFund"}, - "InvestmentOrDeposit": {"@id": "schema:InvestmentOrDeposit"}, - "InviteAction": {"@id": "schema:InviteAction"}, - "Invoice": {"@id": "schema:Invoice"}, - "ItemAvailability": {"@id": "schema:ItemAvailability"}, - "ItemList": {"@id": "schema:ItemList"}, - "ItemListOrderAscending": {"@id": "schema:ItemListOrderAscending"}, - "ItemListOrderDescending": {"@id": "schema:ItemListOrderDescending"}, - "ItemListOrderType": {"@id": "schema:ItemListOrderType"}, - "ItemListUnordered": {"@id": "schema:ItemListUnordered"}, - "ItemPage": {"@id": "schema:ItemPage"}, - "JewelryStore": {"@id": "schema:JewelryStore"}, - "JobPosting": {"@id": "schema:JobPosting"}, - "JoinAction": {"@id": "schema:JoinAction"}, - "Joint": {"@id": "schema:Joint"}, - "KosherDiet": {"@id": "schema:KosherDiet"}, - "LaboratoryScience": {"@id": "schema:LaboratoryScience"}, - "LakeBodyOfWater": {"@id": "schema:LakeBodyOfWater"}, - "Landform": {"@id": "schema:Landform"}, - "LandmarksOrHistoricalBuildings": {"@id": "schema:LandmarksOrHistoricalBuildings"}, - "Language": {"@id": "schema:Language"}, - "LaserDiscFormat": {"@id": "schema:LaserDiscFormat"}, - "LeaveAction": {"@id": "schema:LeaveAction"}, - "LeftHandDriving": {"@id": "schema:LeftHandDriving"}, - "LegalForceStatus": {"@id": "schema:LegalForceStatus"}, - "LegalService": {"@id": "schema:LegalService"}, - "LegalValueLevel": {"@id": "schema:LegalValueLevel"}, - "Legislation": {"@id": "schema:Legislation"}, - "LegislationObject": {"@id": "schema:LegislationObject"}, - "LegislativeBuilding": {"@id": "schema:LegislativeBuilding"}, - "LeisureTimeActivity": {"@id": "schema:LeisureTimeActivity"}, - "LendAction": {"@id": "schema:LendAction"}, - "Library": {"@id": "schema:Library"}, - "LibrarySystem": {"@id": "schema:LibrarySystem"}, - "LifestyleModification": {"@id": "schema:LifestyleModification"}, - "Ligament": {"@id": "schema:Ligament"}, - "LikeAction": {"@id": "schema:LikeAction"}, - "LimitedAvailability": {"@id": "schema:LimitedAvailability"}, - "LinkRole": {"@id": "schema:LinkRole"}, - "LiquorStore": {"@id": "schema:LiquorStore"}, - "ListItem": {"@id": "schema:ListItem"}, - "ListenAction": {"@id": "schema:ListenAction"}, - "LiteraryEvent": {"@id": "schema:LiteraryEvent"}, - "LiveAlbum": {"@id": "schema:LiveAlbum"}, - "LiveBlogPosting": {"@id": "schema:LiveBlogPosting"}, - "LoanOrCredit": {"@id": "schema:LoanOrCredit"}, - "LocalBusiness": {"@id": "schema:LocalBusiness"}, - "LocationFeatureSpecification": {"@id": "schema:LocationFeatureSpecification"}, - "LockerDelivery": {"@id": "schema:LockerDelivery"}, - "Locksmith": {"@id": "schema:Locksmith"}, - "LodgingBusiness": {"@id": "schema:LodgingBusiness"}, - "LodgingReservation": {"@id": "schema:LodgingReservation"}, - "Longitudinal": {"@id": "schema:Longitudinal"}, - "LoseAction": {"@id": "schema:LoseAction"}, - "LowCalorieDiet": {"@id": "schema:LowCalorieDiet"}, - "LowFatDiet": {"@id": "schema:LowFatDiet"}, - "LowLactoseDiet": {"@id": "schema:LowLactoseDiet"}, - "LowSaltDiet": {"@id": "schema:LowSaltDiet"}, - "Lung": {"@id": "schema:Lung"}, - "LymphaticVessel": {"@id": "schema:LymphaticVessel"}, - "MRI": {"@id": "schema:MRI"}, - "Male": {"@id": "schema:Male"}, - "Manuscript": {"@id": "schema:Manuscript"}, - "Map": {"@id": "schema:Map"}, - "MapCategoryType": {"@id": "schema:MapCategoryType"}, - "MarryAction": {"@id": "schema:MarryAction"}, - "Mass": {"@id": "schema:Mass"}, - "MaximumDoseSchedule": {"@id": "schema:MaximumDoseSchedule"}, - "MediaObject": {"@id": "schema:MediaObject"}, - "MediaSubscription": {"@id": "schema:MediaSubscription"}, - "MedicalAudience": {"@id": "schema:MedicalAudience"}, - "MedicalBusiness": {"@id": "schema:MedicalBusiness"}, - "MedicalCause": {"@id": "schema:MedicalCause"}, - "MedicalClinic": {"@id": "schema:MedicalClinic"}, - "MedicalCode": {"@id": "schema:MedicalCode"}, - "MedicalCondition": {"@id": "schema:MedicalCondition"}, - "MedicalConditionStage": {"@id": "schema:MedicalConditionStage"}, - "MedicalContraindication": {"@id": "schema:MedicalContraindication"}, - "MedicalDevice": {"@id": "schema:MedicalDevice"}, - "MedicalDevicePurpose": {"@id": "schema:MedicalDevicePurpose"}, - "MedicalEntity": {"@id": "schema:MedicalEntity"}, - "MedicalEnumeration": {"@id": "schema:MedicalEnumeration"}, - "MedicalEvidenceLevel": {"@id": "schema:MedicalEvidenceLevel"}, - "MedicalGuideline": {"@id": "schema:MedicalGuideline"}, - "MedicalGuidelineContraindication": {"@id": "schema:MedicalGuidelineContraindication"}, - "MedicalGuidelineRecommendation": {"@id": "schema:MedicalGuidelineRecommendation"}, - "MedicalImagingTechnique": {"@id": "schema:MedicalImagingTechnique"}, - "MedicalIndication": {"@id": "schema:MedicalIndication"}, - "MedicalIntangible": {"@id": "schema:MedicalIntangible"}, - "MedicalObservationalStudy": {"@id": "schema:MedicalObservationalStudy"}, - "MedicalObservationalStudyDesign": {"@id": "schema:MedicalObservationalStudyDesign"}, - "MedicalOrganization": {"@id": "schema:MedicalOrganization"}, - "MedicalProcedure": {"@id": "schema:MedicalProcedure"}, - "MedicalProcedureType": {"@id": "schema:MedicalProcedureType"}, - "MedicalResearcher": {"@id": "schema:MedicalResearcher"}, - "MedicalRiskCalculator": {"@id": "schema:MedicalRiskCalculator"}, - "MedicalRiskEstimator": {"@id": "schema:MedicalRiskEstimator"}, - "MedicalRiskFactor": {"@id": "schema:MedicalRiskFactor"}, - "MedicalRiskScore": {"@id": "schema:MedicalRiskScore"}, - "MedicalScholarlyArticle": {"@id": "schema:MedicalScholarlyArticle"}, - "MedicalSign": {"@id": "schema:MedicalSign"}, - "MedicalSignOrSymptom": {"@id": "schema:MedicalSignOrSymptom"}, - "MedicalSpecialty": {"@id": "schema:MedicalSpecialty"}, - "MedicalStudy": {"@id": "schema:MedicalStudy"}, - "MedicalStudyStatus": {"@id": "schema:MedicalStudyStatus"}, - "MedicalSymptom": {"@id": "schema:MedicalSymptom"}, - "MedicalTest": {"@id": "schema:MedicalTest"}, - "MedicalTestPanel": {"@id": "schema:MedicalTestPanel"}, - "MedicalTherapy": {"@id": "schema:MedicalTherapy"}, - "MedicalTrial": {"@id": "schema:MedicalTrial"}, - "MedicalTrialDesign": {"@id": "schema:MedicalTrialDesign"}, - "MedicalWebPage": {"@id": "schema:MedicalWebPage"}, - "MedicineSystem": {"@id": "schema:MedicineSystem"}, - "MeetingRoom": {"@id": "schema:MeetingRoom"}, - "MensClothingStore": {"@id": "schema:MensClothingStore"}, - "Menu": {"@id": "schema:Menu"}, - "MenuItem": {"@id": "schema:MenuItem"}, - "MenuSection": {"@id": "schema:MenuSection"}, - "Message": {"@id": "schema:Message"}, - "MiddleSchool": {"@id": "schema:MiddleSchool"}, - "Midwifery": {"@id": "schema:Midwifery"}, - "MixtapeAlbum": {"@id": "schema:MixtapeAlbum"}, - "MobileApplication": {"@id": "schema:MobileApplication"}, - "MobilePhoneStore": {"@id": "schema:MobilePhoneStore"}, - "Monday": {"@id": "schema:Monday"}, - "MonetaryAmount": {"@id": "schema:MonetaryAmount"}, - "MonetaryAmountDistribution": {"@id": "schema:MonetaryAmountDistribution"}, - "MonetaryGrant": {"@id": "schema:MonetaryGrant"}, - "MoneyTransfer": {"@id": "schema:MoneyTransfer"}, - "MortgageLoan": {"@id": "schema:MortgageLoan"}, - "Mosque": {"@id": "schema:Mosque"}, - "Motel": {"@id": "schema:Motel"}, - "Motorcycle": {"@id": "schema:Motorcycle"}, - "MotorcycleDealer": {"@id": "schema:MotorcycleDealer"}, - "MotorcycleRepair": {"@id": "schema:MotorcycleRepair"}, - "MotorizedBicycle": {"@id": "schema:MotorizedBicycle"}, - "Mountain": {"@id": "schema:Mountain"}, - "MoveAction": {"@id": "schema:MoveAction"}, - "Movie": {"@id": "schema:Movie"}, - "MovieClip": {"@id": "schema:MovieClip"}, - "MovieRentalStore": {"@id": "schema:MovieRentalStore"}, - "MovieSeries": {"@id": "schema:MovieSeries"}, - "MovieTheater": {"@id": "schema:MovieTheater"}, - "MovingCompany": {"@id": "schema:MovingCompany"}, - "MultiCenterTrial": {"@id": "schema:MultiCenterTrial"}, - "MultiPlayer": {"@id": "schema:MultiPlayer"}, - "MulticellularParasite": {"@id": "schema:MulticellularParasite"}, - "Muscle": {"@id": "schema:Muscle"}, - "Musculoskeletal": {"@id": "schema:Musculoskeletal"}, - "MusculoskeletalExam": {"@id": "schema:MusculoskeletalExam"}, - "Museum": {"@id": "schema:Museum"}, - "MusicAlbum": {"@id": "schema:MusicAlbum"}, - "MusicAlbumProductionType": {"@id": "schema:MusicAlbumProductionType"}, - "MusicAlbumReleaseType": {"@id": "schema:MusicAlbumReleaseType"}, - "MusicComposition": {"@id": "schema:MusicComposition"}, - "MusicEvent": {"@id": "schema:MusicEvent"}, - "MusicGroup": {"@id": "schema:MusicGroup"}, - "MusicPlaylist": {"@id": "schema:MusicPlaylist"}, - "MusicRecording": {"@id": "schema:MusicRecording"}, - "MusicRelease": {"@id": "schema:MusicRelease"}, - "MusicReleaseFormatType": {"@id": "schema:MusicReleaseFormatType"}, - "MusicStore": {"@id": "schema:MusicStore"}, - "MusicVenue": {"@id": "schema:MusicVenue"}, - "MusicVideoObject": {"@id": "schema:MusicVideoObject"}, - "NGO": {"@id": "schema:NGO"}, - "NailSalon": {"@id": "schema:NailSalon"}, - "Neck": {"@id": "schema:Neck"}, - "Nerve": {"@id": "schema:Nerve"}, - "Neuro": {"@id": "schema:Neuro"}, - "Neurologic": {"@id": "schema:Neurologic"}, - "NewCondition": {"@id": "schema:NewCondition"}, - "NewsArticle": {"@id": "schema:NewsArticle"}, - "NewsMediaOrganization": {"@id": "schema:NewsMediaOrganization"}, - "Newspaper": {"@id": "schema:Newspaper"}, - "NightClub": {"@id": "schema:NightClub"}, - "NoninvasiveProcedure": {"@id": "schema:NoninvasiveProcedure"}, - "Nose": {"@id": "schema:Nose"}, - "NotInForce": {"@id": "schema:NotInForce"}, - "NotYetRecruiting": {"@id": "schema:NotYetRecruiting"}, - "Notary": {"@id": "schema:Notary"}, - "NoteDigitalDocument": {"@id": "schema:NoteDigitalDocument"}, - "Number": {"@id": "schema:Number"}, - "Nursing": {"@id": "schema:Nursing"}, - "NutritionInformation": {"@id": "schema:NutritionInformation"}, - "OTC": {"@id": "schema:OTC"}, - "Observational": {"@id": "schema:Observational"}, - "Obstetric": {"@id": "schema:Obstetric"}, - "Occupation": {"@id": "schema:Occupation"}, - "OccupationalActivity": {"@id": "schema:OccupationalActivity"}, - "OccupationalTherapy": {"@id": "schema:OccupationalTherapy"}, - "OceanBodyOfWater": {"@id": "schema:OceanBodyOfWater"}, - "Offer": {"@id": "schema:Offer"}, - "OfferCatalog": {"@id": "schema:OfferCatalog"}, - "OfferItemCondition": {"@id": "schema:OfferItemCondition"}, - "OfficeEquipmentStore": {"@id": "schema:OfficeEquipmentStore"}, - "OfficialLegalValue": {"@id": "schema:OfficialLegalValue"}, - "OfflinePermanently": {"@id": "schema:OfflinePermanently"}, - "OfflineTemporarily": {"@id": "schema:OfflineTemporarily"}, - "OnDemandEvent": {"@id": "schema:OnDemandEvent"}, - "OnSitePickup": {"@id": "schema:OnSitePickup"}, - "Oncologic": {"@id": "schema:Oncologic"}, - "Online": {"@id": "schema:Online"}, - "OnlineFull": {"@id": "schema:OnlineFull"}, - "OnlineOnly": {"@id": "schema:OnlineOnly"}, - "OpenTrial": {"@id": "schema:OpenTrial"}, - "OpeningHoursSpecification": {"@id": "schema:OpeningHoursSpecification"}, - "OpinionNewsArticle": {"@id": "schema:OpinionNewsArticle"}, - "Optician": {"@id": "schema:Optician"}, - "Optometric": {"@id": "schema:Optometric"}, - "Order": {"@id": "schema:Order"}, - "OrderAction": {"@id": "schema:OrderAction"}, - "OrderCancelled": {"@id": "schema:OrderCancelled"}, - "OrderDelivered": {"@id": "schema:OrderDelivered"}, - "OrderInTransit": {"@id": "schema:OrderInTransit"}, - "OrderItem": {"@id": "schema:OrderItem"}, - "OrderPaymentDue": {"@id": "schema:OrderPaymentDue"}, - "OrderPickupAvailable": {"@id": "schema:OrderPickupAvailable"}, - "OrderProblem": {"@id": "schema:OrderProblem"}, - "OrderProcessing": {"@id": "schema:OrderProcessing"}, - "OrderReturned": {"@id": "schema:OrderReturned"}, - "OrderStatus": {"@id": "schema:OrderStatus"}, - "Organization": {"@id": "schema:Organization"}, - "OrganizationRole": {"@id": "schema:OrganizationRole"}, - "OrganizeAction": {"@id": "schema:OrganizeAction"}, - "OriginalShippingFees": {"@id": "schema:OriginalShippingFees"}, - "Osteopathic": {"@id": "schema:Osteopathic"}, - "Otolaryngologic": {"@id": "schema:Otolaryngologic"}, - "OutOfStock": {"@id": "schema:OutOfStock"}, - "OutletStore": {"@id": "schema:OutletStore"}, - "OwnershipInfo": {"@id": "schema:OwnershipInfo"}, - "PET": {"@id": "schema:PET"}, - "PaintAction": {"@id": "schema:PaintAction"}, - "Painting": {"@id": "schema:Painting"}, - "PalliativeProcedure": {"@id": "schema:PalliativeProcedure"}, - "Paperback": {"@id": "schema:Paperback"}, - "ParcelDelivery": {"@id": "schema:ParcelDelivery"}, - "ParcelService": {"@id": "schema:ParcelService"}, - "ParentAudience": {"@id": "schema:ParentAudience"}, - "Park": {"@id": "schema:Park"}, - "ParkingFacility": {"@id": "schema:ParkingFacility"}, - "ParkingMap": {"@id": "schema:ParkingMap"}, - "PartiallyInForce": {"@id": "schema:PartiallyInForce"}, - "Pathology": {"@id": "schema:Pathology"}, - "PathologyTest": {"@id": "schema:PathologyTest"}, - "Patient": {"@id": "schema:Patient"}, - "PawnShop": {"@id": "schema:PawnShop"}, - "PayAction": {"@id": "schema:PayAction"}, - "PaymentAutomaticallyApplied": {"@id": "schema:PaymentAutomaticallyApplied"}, - "PaymentCard": {"@id": "schema:PaymentCard"}, - "PaymentChargeSpecification": {"@id": "schema:PaymentChargeSpecification"}, - "PaymentComplete": {"@id": "schema:PaymentComplete"}, - "PaymentDeclined": {"@id": "schema:PaymentDeclined"}, - "PaymentDue": {"@id": "schema:PaymentDue"}, - "PaymentMethod": {"@id": "schema:PaymentMethod"}, - "PaymentPastDue": {"@id": "schema:PaymentPastDue"}, - "PaymentService": {"@id": "schema:PaymentService"}, - "PaymentStatusType": {"@id": "schema:PaymentStatusType"}, - "Pediatric": {"@id": "schema:Pediatric"}, - "PeopleAudience": {"@id": "schema:PeopleAudience"}, - "PercutaneousProcedure": {"@id": "schema:PercutaneousProcedure"}, - "PerformAction": {"@id": "schema:PerformAction"}, - "PerformanceRole": {"@id": "schema:PerformanceRole"}, - "PerformingArtsTheater": {"@id": "schema:PerformingArtsTheater"}, - "PerformingGroup": {"@id": "schema:PerformingGroup"}, - "Periodical": {"@id": "schema:Periodical"}, - "Permit": {"@id": "schema:Permit"}, - "Person": {"@id": "schema:Person"}, - "PetStore": {"@id": "schema:PetStore"}, - "Pharmacy": {"@id": "schema:Pharmacy"}, - "PharmacySpecialty": {"@id": "schema:PharmacySpecialty"}, - "Photograph": {"@id": "schema:Photograph"}, - "PhotographAction": {"@id": "schema:PhotographAction"}, - "PhysicalActivity": {"@id": "schema:PhysicalActivity"}, - "PhysicalActivityCategory": {"@id": "schema:PhysicalActivityCategory"}, - "PhysicalExam": {"@id": "schema:PhysicalExam"}, - "PhysicalTherapy": {"@id": "schema:PhysicalTherapy"}, - "Physician": {"@id": "schema:Physician"}, - "Physiotherapy": {"@id": "schema:Physiotherapy"}, - "Place": {"@id": "schema:Place"}, - "PlaceOfWorship": {"@id": "schema:PlaceOfWorship"}, - "PlaceboControlledTrial": {"@id": "schema:PlaceboControlledTrial"}, - "PlanAction": {"@id": "schema:PlanAction"}, - "PlasticSurgery": {"@id": "schema:PlasticSurgery"}, - "Play": {"@id": "schema:Play"}, - "PlayAction": {"@id": "schema:PlayAction"}, - "Playground": {"@id": "schema:Playground"}, - "Plumber": {"@id": "schema:Plumber"}, - "Podiatric": {"@id": "schema:Podiatric"}, - "PoliceStation": {"@id": "schema:PoliceStation"}, - "Pond": {"@id": "schema:Pond"}, - "PostOffice": {"@id": "schema:PostOffice"}, - "PostalAddress": {"@id": "schema:PostalAddress"}, - "Poster": {"@id": "schema:Poster"}, - "PotentialActionStatus": {"@id": "schema:PotentialActionStatus"}, - "PreOrder": {"@id": "schema:PreOrder"}, - "PreOrderAction": {"@id": "schema:PreOrderAction"}, - "PreSale": {"@id": "schema:PreSale"}, - "PrependAction": {"@id": "schema:PrependAction"}, - "Preschool": {"@id": "schema:Preschool"}, - "PrescriptionOnly": {"@id": "schema:PrescriptionOnly"}, - "PresentationDigitalDocument": {"@id": "schema:PresentationDigitalDocument"}, - "PreventionIndication": {"@id": "schema:PreventionIndication"}, - "PriceSpecification": {"@id": "schema:PriceSpecification"}, - "PrimaryCare": {"@id": "schema:PrimaryCare"}, - "Prion": {"@id": "schema:Prion"}, - "Product": {"@id": "schema:Product"}, - "ProductModel": {"@id": "schema:ProductModel"}, - "ProductReturnEnumeration": {"@id": "schema:ProductReturnEnumeration"}, - "ProductReturnFiniteReturnWindow": {"@id": "schema:ProductReturnFiniteReturnWindow"}, - "ProductReturnNotPermitted": {"@id": "schema:ProductReturnNotPermitted"}, - "ProductReturnPolicy": {"@id": "schema:ProductReturnPolicy"}, - "ProductReturnUnlimitedWindow": {"@id": "schema:ProductReturnUnlimitedWindow"}, - "ProductReturnUnspecified": {"@id": "schema:ProductReturnUnspecified"}, - "ProfessionalService": {"@id": "schema:ProfessionalService"}, - "ProfilePage": {"@id": "schema:ProfilePage"}, - "ProgramMembership": {"@id": "schema:ProgramMembership"}, - "Project": {"@id": "schema:Project"}, - "Property": {"@id": "schema:Property"}, - "PropertyValue": {"@id": "schema:PropertyValue"}, - "PropertyValueSpecification": {"@id": "schema:PropertyValueSpecification"}, - "Protozoa": {"@id": "schema:Protozoa"}, - "Psychiatric": {"@id": "schema:Psychiatric"}, - "PsychologicalTreatment": {"@id": "schema:PsychologicalTreatment"}, - "PublicHealth": {"@id": "schema:PublicHealth"}, - "PublicHolidays": {"@id": "schema:PublicHolidays"}, - "PublicSwimmingPool": {"@id": "schema:PublicSwimmingPool"}, - "PublicToilet": {"@id": "schema:PublicToilet"}, - "PublicationEvent": {"@id": "schema:PublicationEvent"}, - "PublicationIssue": {"@id": "schema:PublicationIssue"}, - "PublicationVolume": {"@id": "schema:PublicationVolume"}, - "Pulmonary": {"@id": "schema:Pulmonary"}, - "QAPage": {"@id": "schema:QAPage"}, - "QualitativeValue": {"@id": "schema:QualitativeValue"}, - "QuantitativeValue": {"@id": "schema:QuantitativeValue"}, - "QuantitativeValueDistribution": {"@id": "schema:QuantitativeValueDistribution"}, - "Quantity": {"@id": "schema:Quantity"}, - "Question": {"@id": "schema:Question"}, - "Quotation": {"@id": "schema:Quotation"}, - "QuoteAction": {"@id": "schema:QuoteAction"}, - "RVPark": {"@id": "schema:RVPark"}, - "RadiationTherapy": {"@id": "schema:RadiationTherapy"}, - "RadioBroadcastService": {"@id": "schema:RadioBroadcastService"}, - "RadioChannel": {"@id": "schema:RadioChannel"}, - "RadioClip": {"@id": "schema:RadioClip"}, - "RadioEpisode": {"@id": "schema:RadioEpisode"}, - "RadioSeason": {"@id": "schema:RadioSeason"}, - "RadioSeries": {"@id": "schema:RadioSeries"}, - "RadioStation": {"@id": "schema:RadioStation"}, - "Radiography": {"@id": "schema:Radiography"}, - "RandomizedTrial": {"@id": "schema:RandomizedTrial"}, - "Rating": {"@id": "schema:Rating"}, - "ReactAction": {"@id": "schema:ReactAction"}, - "ReadAction": {"@id": "schema:ReadAction"}, - "ReadPermission": {"@id": "schema:ReadPermission"}, - "RealEstateAgent": {"@id": "schema:RealEstateAgent"}, - "RearWheelDriveConfiguration": {"@id": "schema:RearWheelDriveConfiguration"}, - "ReceiveAction": {"@id": "schema:ReceiveAction"}, - "Recipe": {"@id": "schema:Recipe"}, - "RecommendedDoseSchedule": {"@id": "schema:RecommendedDoseSchedule"}, - "Recruiting": {"@id": "schema:Recruiting"}, - "RecyclingCenter": {"@id": "schema:RecyclingCenter"}, - "RefundTypeEnumeration": {"@id": "schema:RefundTypeEnumeration"}, - "RefurbishedCondition": {"@id": "schema:RefurbishedCondition"}, - "RegisterAction": {"@id": "schema:RegisterAction"}, - "Registry": {"@id": "schema:Registry"}, - "ReimbursementCap": {"@id": "schema:ReimbursementCap"}, - "RejectAction": {"@id": "schema:RejectAction"}, - "RemixAlbum": {"@id": "schema:RemixAlbum"}, - "Renal": {"@id": "schema:Renal"}, - "RentAction": {"@id": "schema:RentAction"}, - "RentalCarReservation": {"@id": "schema:RentalCarReservation"}, - "RentalVehicleUsage": {"@id": "schema:RentalVehicleUsage"}, - "RepaymentSpecification": {"@id": "schema:RepaymentSpecification"}, - "ReplaceAction": {"@id": "schema:ReplaceAction"}, - "ReplyAction": {"@id": "schema:ReplyAction"}, - "Report": {"@id": "schema:Report"}, - "ReportageNewsArticle": {"@id": "schema:ReportageNewsArticle"}, - "ReportedDoseSchedule": {"@id": "schema:ReportedDoseSchedule"}, - "ResearchProject": {"@id": "schema:ResearchProject"}, - "Researcher": {"@id": "schema:Researcher"}, - "Reservation": {"@id": "schema:Reservation"}, - "ReservationCancelled": {"@id": "schema:ReservationCancelled"}, - "ReservationConfirmed": {"@id": "schema:ReservationConfirmed"}, - "ReservationHold": {"@id": "schema:ReservationHold"}, - "ReservationPackage": {"@id": "schema:ReservationPackage"}, - "ReservationPending": {"@id": "schema:ReservationPending"}, - "ReservationStatusType": {"@id": "schema:ReservationStatusType"}, - "ReserveAction": {"@id": "schema:ReserveAction"}, - "Reservoir": {"@id": "schema:Reservoir"}, - "Residence": {"@id": "schema:Residence"}, - "Resort": {"@id": "schema:Resort"}, - "RespiratoryTherapy": {"@id": "schema:RespiratoryTherapy"}, - "Restaurant": {"@id": "schema:Restaurant"}, - "RestockingFees": {"@id": "schema:RestockingFees"}, - "RestrictedDiet": {"@id": "schema:RestrictedDiet"}, - "ResultsAvailable": {"@id": "schema:ResultsAvailable"}, - "ResultsNotAvailable": {"@id": "schema:ResultsNotAvailable"}, - "ResumeAction": {"@id": "schema:ResumeAction"}, - "Retail": {"@id": "schema:Retail"}, - "ReturnAction": {"@id": "schema:ReturnAction"}, - "ReturnFeesEnumeration": {"@id": "schema:ReturnFeesEnumeration"}, - "ReturnShippingFees": {"@id": "schema:ReturnShippingFees"}, - "Review": {"@id": "schema:Review"}, - "ReviewAction": {"@id": "schema:ReviewAction"}, - "ReviewNewsArticle": {"@id": "schema:ReviewNewsArticle"}, - "Rheumatologic": {"@id": "schema:Rheumatologic"}, - "RightHandDriving": {"@id": "schema:RightHandDriving"}, - "RiverBodyOfWater": {"@id": "schema:RiverBodyOfWater"}, - "Role": {"@id": "schema:Role"}, - "RoofingContractor": {"@id": "schema:RoofingContractor"}, - "Room": {"@id": "schema:Room"}, - "RsvpAction": {"@id": "schema:RsvpAction"}, - "RsvpResponseMaybe": {"@id": "schema:RsvpResponseMaybe"}, - "RsvpResponseNo": {"@id": "schema:RsvpResponseNo"}, - "RsvpResponseType": {"@id": "schema:RsvpResponseType"}, - "RsvpResponseYes": {"@id": "schema:RsvpResponseYes"}, - "SaleEvent": {"@id": "schema:SaleEvent"}, - "SatiricalArticle": {"@id": "schema:SatiricalArticle"}, - "Saturday": {"@id": "schema:Saturday"}, - "Schedule": {"@id": "schema:Schedule"}, - "ScheduleAction": {"@id": "schema:ScheduleAction"}, - "ScholarlyArticle": {"@id": "schema:ScholarlyArticle"}, - "School": {"@id": "schema:School"}, - "ScreeningEvent": {"@id": "schema:ScreeningEvent"}, - "Sculpture": {"@id": "schema:Sculpture"}, - "SeaBodyOfWater": {"@id": "schema:SeaBodyOfWater"}, - "SearchAction": {"@id": "schema:SearchAction"}, - "SearchResultsPage": {"@id": "schema:SearchResultsPage"}, - "Season": {"@id": "schema:Season"}, - "Seat": {"@id": "schema:Seat"}, - "SeatingMap": {"@id": "schema:SeatingMap"}, - "SelfStorage": {"@id": "schema:SelfStorage"}, - "SellAction": {"@id": "schema:SellAction"}, - "SendAction": {"@id": "schema:SendAction"}, - "Series": {"@id": "schema:Series"}, - "Service": {"@id": "schema:Service"}, - "ServiceChannel": {"@id": "schema:ServiceChannel"}, - "ShareAction": {"@id": "schema:ShareAction"}, - "SheetMusic": {"@id": "schema:SheetMusic"}, - "ShoeStore": {"@id": "schema:ShoeStore"}, - "ShoppingCenter": {"@id": "schema:ShoppingCenter"}, - "ShortStory": {"@id": "schema:ShortStory"}, - "SingleBlindedTrial": {"@id": "schema:SingleBlindedTrial"}, - "SingleCenterTrial": {"@id": "schema:SingleCenterTrial"}, - "SingleFamilyResidence": {"@id": "schema:SingleFamilyResidence"}, - "SinglePlayer": {"@id": "schema:SinglePlayer"}, - "SingleRelease": {"@id": "schema:SingleRelease"}, - "SiteNavigationElement": {"@id": "schema:SiteNavigationElement"}, - "SkiResort": {"@id": "schema:SkiResort"}, - "Skin": {"@id": "schema:Skin"}, - "SocialEvent": {"@id": "schema:SocialEvent"}, - "SocialMediaPosting": {"@id": "schema:SocialMediaPosting"}, - "SoftwareApplication": {"@id": "schema:SoftwareApplication"}, - "SoftwareSourceCode": {"@id": "schema:SoftwareSourceCode"}, - "SoldOut": {"@id": "schema:SoldOut"}, - "SomeProducts": {"@id": "schema:SomeProducts"}, - "SoundtrackAlbum": {"@id": "schema:SoundtrackAlbum"}, - "SpeakableSpecification": {"@id": "schema:SpeakableSpecification"}, - "Specialty": {"@id": "schema:Specialty"}, - "SpeechPathology": {"@id": "schema:SpeechPathology"}, - "SpokenWordAlbum": {"@id": "schema:SpokenWordAlbum"}, - "SportingGoodsStore": {"@id": "schema:SportingGoodsStore"}, - "SportsActivityLocation": {"@id": "schema:SportsActivityLocation"}, - "SportsClub": {"@id": "schema:SportsClub"}, - "SportsEvent": {"@id": "schema:SportsEvent"}, - "SportsOrganization": {"@id": "schema:SportsOrganization"}, - "SportsTeam": {"@id": "schema:SportsTeam"}, - "SpreadsheetDigitalDocument": {"@id": "schema:SpreadsheetDigitalDocument"}, - "StadiumOrArena": {"@id": "schema:StadiumOrArena"}, - "State": {"@id": "schema:State"}, - "SteeringPositionValue": {"@id": "schema:SteeringPositionValue"}, - "Store": {"@id": "schema:Store"}, - "StoreCreditRefund": {"@id": "schema:StoreCreditRefund"}, - "StrengthTraining": {"@id": "schema:StrengthTraining"}, - "StructuredValue": {"@id": "schema:StructuredValue"}, - "StudioAlbum": {"@id": "schema:StudioAlbum"}, - "StupidType": {"@id": "schema:StupidType"}, - "SubscribeAction": {"@id": "schema:SubscribeAction"}, - "Substance": {"@id": "schema:Substance"}, - "SubwayStation": {"@id": "schema:SubwayStation"}, - "Suite": {"@id": "schema:Suite"}, - "Sunday": {"@id": "schema:Sunday"}, - "SuperficialAnatomy": {"@id": "schema:SuperficialAnatomy"}, - "Surgical": {"@id": "schema:Surgical"}, - "SurgicalProcedure": {"@id": "schema:SurgicalProcedure"}, - "SuspendAction": {"@id": "schema:SuspendAction"}, - "Suspended": {"@id": "schema:Suspended"}, - "Synagogue": {"@id": "schema:Synagogue"}, - "TVClip": {"@id": "schema:TVClip"}, - "TVEpisode": {"@id": "schema:TVEpisode"}, - "TVSeason": {"@id": "schema:TVSeason"}, - "TVSeries": {"@id": "schema:TVSeries"}, - "Table": {"@id": "schema:Table"}, - "TakeAction": {"@id": "schema:TakeAction"}, - "TattooParlor": {"@id": "schema:TattooParlor"}, - "Taxi": {"@id": "schema:Taxi"}, - "TaxiReservation": {"@id": "schema:TaxiReservation"}, - "TaxiService": {"@id": "schema:TaxiService"}, - "TaxiStand": {"@id": "schema:TaxiStand"}, - "TaxiVehicleUsage": {"@id": "schema:TaxiVehicleUsage"}, - "TechArticle": {"@id": "schema:TechArticle"}, - "TelevisionChannel": {"@id": "schema:TelevisionChannel"}, - "TelevisionStation": {"@id": "schema:TelevisionStation"}, - "TennisComplex": {"@id": "schema:TennisComplex"}, - "Terminated": {"@id": "schema:Terminated"}, - "Text": {"@id": "schema:Text"}, - "TextDigitalDocument": {"@id": "schema:TextDigitalDocument"}, - "TheaterEvent": {"@id": "schema:TheaterEvent"}, - "TheaterGroup": {"@id": "schema:TheaterGroup"}, - "Therapeutic": {"@id": "schema:Therapeutic"}, - "TherapeuticProcedure": {"@id": "schema:TherapeuticProcedure"}, - "Thesis": {"@id": "schema:Thesis"}, - "Thing": {"@id": "schema:Thing"}, - "Throat": {"@id": "schema:Throat"}, - "Thursday": {"@id": "schema:Thursday"}, - "Ticket": {"@id": "schema:Ticket"}, - "TieAction": {"@id": "schema:TieAction"}, - "Time": {"@id": "schema:Time"}, - "TipAction": {"@id": "schema:TipAction"}, - "TireShop": {"@id": "schema:TireShop"}, - "TollFree": {"@id": "schema:TollFree"}, - "TouristAttraction": {"@id": "schema:TouristAttraction"}, - "TouristDestination": {"@id": "schema:TouristDestination"}, - "TouristInformationCenter": {"@id": "schema:TouristInformationCenter"}, - "TouristTrip": {"@id": "schema:TouristTrip"}, - "Toxicologic": {"@id": "schema:Toxicologic"}, - "ToyStore": {"@id": "schema:ToyStore"}, - "TrackAction": {"@id": "schema:TrackAction"}, - "TradeAction": {"@id": "schema:TradeAction"}, - "TraditionalChinese": {"@id": "schema:TraditionalChinese"}, - "TrainReservation": {"@id": "schema:TrainReservation"}, - "TrainStation": {"@id": "schema:TrainStation"}, - "TrainTrip": {"@id": "schema:TrainTrip"}, - "TransferAction": {"@id": "schema:TransferAction"}, - "TransitMap": {"@id": "schema:TransitMap"}, - "TravelAction": {"@id": "schema:TravelAction"}, - "TravelAgency": {"@id": "schema:TravelAgency"}, - "TreatmentIndication": {"@id": "schema:TreatmentIndication"}, - "Trip": {"@id": "schema:Trip"}, - "TripleBlindedTrial": {"@id": "schema:TripleBlindedTrial"}, - "True": {"@id": "schema:True"}, - "Tuesday": {"@id": "schema:Tuesday"}, - "TypeAndQuantityNode": {"@id": "schema:TypeAndQuantityNode"}, - "URL": {"@id": "schema:URL"}, - "Ultrasound": {"@id": "schema:Ultrasound"}, - "UnRegisterAction": {"@id": "schema:UnRegisterAction"}, - "UnitPriceSpecification": {"@id": "schema:UnitPriceSpecification"}, - "UnofficialLegalValue": {"@id": "schema:UnofficialLegalValue"}, - "UpdateAction": {"@id": "schema:UpdateAction"}, - "Urologic": {"@id": "schema:Urologic"}, - "UseAction": {"@id": "schema:UseAction"}, - "UsedCondition": {"@id": "schema:UsedCondition"}, - "UserBlocks": {"@id": "schema:UserBlocks"}, - "UserCheckins": {"@id": "schema:UserCheckins"}, - "UserComments": {"@id": "schema:UserComments"}, - "UserDownloads": {"@id": "schema:UserDownloads"}, - "UserInteraction": {"@id": "schema:UserInteraction"}, - "UserLikes": {"@id": "schema:UserLikes"}, - "UserPageVisits": {"@id": "schema:UserPageVisits"}, - "UserPlays": {"@id": "schema:UserPlays"}, - "UserPlusOnes": {"@id": "schema:UserPlusOnes"}, - "UserReview": {"@id": "schema:UserReview"}, - "UserTweets": {"@id": "schema:UserTweets"}, - "VeganDiet": {"@id": "schema:VeganDiet"}, - "VegetarianDiet": {"@id": "schema:VegetarianDiet"}, - "Vehicle": {"@id": "schema:Vehicle"}, - "Vein": {"@id": "schema:Vein"}, - "VenueMap": {"@id": "schema:VenueMap"}, - "Vessel": {"@id": "schema:Vessel"}, - "VeterinaryCare": {"@id": "schema:VeterinaryCare"}, - "VideoGallery": {"@id": "schema:VideoGallery"}, - "VideoGame": {"@id": "schema:VideoGame"}, - "VideoGameClip": {"@id": "schema:VideoGameClip"}, - "VideoGameSeries": {"@id": "schema:VideoGameSeries"}, - "VideoObject": {"@id": "schema:VideoObject"}, - "ViewAction": {"@id": "schema:ViewAction"}, - "VinylFormat": {"@id": "schema:VinylFormat"}, - "Virus": {"@id": "schema:Virus"}, - "VisualArtsEvent": {"@id": "schema:VisualArtsEvent"}, - "VisualArtwork": {"@id": "schema:VisualArtwork"}, - "VitalSign": {"@id": "schema:VitalSign"}, - "Volcano": {"@id": "schema:Volcano"}, - "VoteAction": {"@id": "schema:VoteAction"}, - "WPAdBlock": {"@id": "schema:WPAdBlock"}, - "WPFooter": {"@id": "schema:WPFooter"}, - "WPHeader": {"@id": "schema:WPHeader"}, - "WPSideBar": {"@id": "schema:WPSideBar"}, - "WantAction": {"@id": "schema:WantAction"}, - "WarrantyPromise": {"@id": "schema:WarrantyPromise"}, - "WarrantyScope": {"@id": "schema:WarrantyScope"}, - "WatchAction": {"@id": "schema:WatchAction"}, - "Waterfall": {"@id": "schema:Waterfall"}, - "WearAction": {"@id": "schema:WearAction"}, - "WebAPI": {"@id": "schema:WebAPI"}, - "WebApplication": {"@id": "schema:WebApplication"}, - "WebPage": {"@id": "schema:WebPage"}, - "WebPageElement": {"@id": "schema:WebPageElement"}, - "WebSite": {"@id": "schema:WebSite"}, - "Wednesday": {"@id": "schema:Wednesday"}, - "WesternConventional": {"@id": "schema:WesternConventional"}, - "Wholesale": {"@id": "schema:Wholesale"}, - "WholesaleStore": {"@id": "schema:WholesaleStore"}, - "WinAction": {"@id": "schema:WinAction"}, - "Winery": {"@id": "schema:Winery"}, - "Withdrawn": {"@id": "schema:Withdrawn"}, - "WorkersUnion": {"@id": "schema:WorkersUnion"}, - "WriteAction": {"@id": "schema:WriteAction"}, - "WritePermission": {"@id": "schema:WritePermission"}, - "XPathType": {"@id": "schema:XPathType"}, - "XRay": {"@id": "schema:XRay"}, - "ZoneBoardingPolicy": {"@id": "schema:ZoneBoardingPolicy"}, - "Zoo": {"@id": "schema:Zoo"}, - "about": { "@id": "schema:about"}, - "abridged": { "@id": "schema:abridged"}, - "accelerationTime": { "@id": "schema:accelerationTime"}, - "acceptedAnswer": { "@id": "schema:acceptedAnswer"}, - "acceptedOffer": { "@id": "schema:acceptedOffer"}, - "acceptedPaymentMethod": { "@id": "schema:acceptedPaymentMethod"}, - "acceptsReservations": { "@id": "schema:acceptsReservations"}, - "accessCode": { "@id": "schema:accessCode"}, - "accessMode": { "@id": "schema:accessMode"}, - "accessModeSufficient": { "@id": "schema:accessModeSufficient"}, - "accessibilityAPI": { "@id": "schema:accessibilityAPI"}, - "accessibilityControl": { "@id": "schema:accessibilityControl"}, - "accessibilityFeature": { "@id": "schema:accessibilityFeature"}, - "accessibilityHazard": { "@id": "schema:accessibilityHazard"}, - "accessibilitySummary": { "@id": "schema:accessibilitySummary"}, - "accountId": { "@id": "schema:accountId"}, - "accountMinimumInflow": { "@id": "schema:accountMinimumInflow"}, - "accountOverdraftLimit": { "@id": "schema:accountOverdraftLimit"}, - "accountablePerson": { "@id": "schema:accountablePerson"}, - "acquiredFrom": { "@id": "schema:acquiredFrom"}, - "acrissCode": { "@id": "schema:acrissCode"}, - "action": { "@id": "schema:action"}, - "actionAccessibilityRequirement": { "@id": "schema:actionAccessibilityRequirement"}, - "actionApplication": { "@id": "schema:actionApplication"}, - "actionOption": { "@id": "schema:actionOption"}, - "actionPlatform": { "@id": "schema:actionPlatform"}, - "actionStatus": { "@id": "schema:actionStatus"}, - "actionableFeedbackPolicy": { "@id": "schema:actionableFeedbackPolicy", "@type": "@id"}, - "activeIngredient": { "@id": "schema:activeIngredient"}, - "activityDuration": { "@id": "schema:activityDuration"}, - "activityFrequency": { "@id": "schema:activityFrequency"}, - "actor": { "@id": "schema:actor"}, - "actors": { "@id": "schema:actors"}, - "addOn": { "@id": "schema:addOn"}, - "additionalName": { "@id": "schema:additionalName"}, - "additionalNumberOfGuests": { "@id": "schema:additionalNumberOfGuests"}, - "additionalProperty": { "@id": "schema:additionalProperty"}, - "additionalType": { "@id": "schema:additionalType", "@type": "@id"}, - "additionalVariable": { "@id": "schema:additionalVariable"}, - "address": { "@id": "schema:address"}, - "addressCountry": { "@id": "schema:addressCountry"}, - "addressLocality": { "@id": "schema:addressLocality"}, - "addressRegion": { "@id": "schema:addressRegion"}, - "administrationRoute": { "@id": "schema:administrationRoute"}, - "advanceBookingRequirement": { "@id": "schema:advanceBookingRequirement"}, - "adverseOutcome": { "@id": "schema:adverseOutcome"}, - "affectedBy": { "@id": "schema:affectedBy"}, - "affiliation": { "@id": "schema:affiliation"}, - "afterMedia": { "@id": "schema:afterMedia", "@type": "@id"}, - "agent": { "@id": "schema:agent"}, - "aggregateRating": { "@id": "schema:aggregateRating"}, - "aircraft": { "@id": "schema:aircraft"}, - "album": { "@id": "schema:album"}, - "albumProductionType": { "@id": "schema:albumProductionType"}, - "albumRelease": { "@id": "schema:albumRelease"}, - "albumReleaseType": { "@id": "schema:albumReleaseType"}, - "albums": { "@id": "schema:albums"}, - "alcoholWarning": { "@id": "schema:alcoholWarning"}, - "algorithm": { "@id": "schema:algorithm"}, - "alignmentType": { "@id": "schema:alignmentType"}, - "alternateName": { "@id": "schema:alternateName"}, - "alternativeHeadline": { "@id": "schema:alternativeHeadline"}, - "alumni": { "@id": "schema:alumni"}, - "alumniOf": { "@id": "schema:alumniOf"}, - "amenityFeature": { "@id": "schema:amenityFeature"}, - "amount": { "@id": "schema:amount"}, - "amountOfThisGood": { "@id": "schema:amountOfThisGood"}, - "annualPercentageRate": { "@id": "schema:annualPercentageRate"}, - "answerCount": { "@id": "schema:answerCount"}, - "antagonist": { "@id": "schema:antagonist"}, - "appearance": { "@id": "schema:appearance"}, - "applicableLocation": { "@id": "schema:applicableLocation"}, - "applicantLocationRequirements": { "@id": "schema:applicantLocationRequirements"}, - "application": { "@id": "schema:application"}, - "applicationCategory": { "@id": "schema:applicationCategory"}, - "applicationSubCategory": { "@id": "schema:applicationSubCategory"}, - "applicationSuite": { "@id": "schema:applicationSuite"}, - "appliesToDeliveryMethod": { "@id": "schema:appliesToDeliveryMethod"}, - "appliesToPaymentMethod": { "@id": "schema:appliesToPaymentMethod"}, - "archiveHeld": { "@id": "schema:archiveHeld"}, - "area": { "@id": "schema:area"}, - "areaServed": { "@id": "schema:areaServed"}, - "arrivalAirport": { "@id": "schema:arrivalAirport"}, - "arrivalBusStop": { "@id": "schema:arrivalBusStop"}, - "arrivalGate": { "@id": "schema:arrivalGate"}, - "arrivalPlatform": { "@id": "schema:arrivalPlatform"}, - "arrivalStation": { "@id": "schema:arrivalStation"}, - "arrivalTerminal": { "@id": "schema:arrivalTerminal"}, - "arrivalTime": { "@id": "schema:arrivalTime", "@type": "DateTime"}, - "artEdition": { "@id": "schema:artEdition"}, - "artMedium": { "@id": "schema:artMedium"}, - "arterialBranch": { "@id": "schema:arterialBranch"}, - "artform": { "@id": "schema:artform"}, - "articleBody": { "@id": "schema:articleBody"}, - "articleSection": { "@id": "schema:articleSection"}, - "artist": { "@id": "schema:artist"}, - "artworkSurface": { "@id": "schema:artworkSurface"}, - "aspect": { "@id": "schema:aspect"}, - "assembly": { "@id": "schema:assembly"}, - "assemblyVersion": { "@id": "schema:assemblyVersion"}, - "associatedAnatomy": { "@id": "schema:associatedAnatomy"}, - "associatedArticle": { "@id": "schema:associatedArticle"}, - "associatedMedia": { "@id": "schema:associatedMedia"}, - "associatedPathophysiology": { "@id": "schema:associatedPathophysiology"}, - "athlete": { "@id": "schema:athlete"}, - "attendee": { "@id": "schema:attendee"}, - "attendees": { "@id": "schema:attendees"}, - "audience": { "@id": "schema:audience"}, - "audienceType": { "@id": "schema:audienceType"}, - "audio": { "@id": "schema:audio"}, - "authenticator": { "@id": "schema:authenticator"}, - "author": { "@id": "schema:author"}, - "availability": { "@id": "schema:availability"}, - "availabilityEnds": { "@id": "schema:availabilityEnds", "@type": "Date"}, - "availabilityStarts": { "@id": "schema:availabilityStarts", "@type": "Date"}, - "availableAtOrFrom": { "@id": "schema:availableAtOrFrom"}, - "availableChannel": { "@id": "schema:availableChannel"}, - "availableDeliveryMethod": { "@id": "schema:availableDeliveryMethod"}, - "availableFrom": { "@id": "schema:availableFrom", "@type": "DateTime"}, - "availableIn": { "@id": "schema:availableIn"}, - "availableLanguage": { "@id": "schema:availableLanguage"}, - "availableOnDevice": { "@id": "schema:availableOnDevice"}, - "availableService": { "@id": "schema:availableService"}, - "availableStrength": { "@id": "schema:availableStrength"}, - "availableTest": { "@id": "schema:availableTest"}, - "availableThrough": { "@id": "schema:availableThrough", "@type": "DateTime"}, - "award": { "@id": "schema:award"}, - "awards": { "@id": "schema:awards"}, - "awayTeam": { "@id": "schema:awayTeam"}, - "background": { "@id": "schema:background"}, - "backstory": { "@id": "schema:backstory"}, - "bankAccountType": { "@id": "schema:bankAccountType"}, - "baseSalary": { "@id": "schema:baseSalary"}, - "bccRecipient": { "@id": "schema:bccRecipient"}, - "bed": { "@id": "schema:bed"}, - "beforeMedia": { "@id": "schema:beforeMedia", "@type": "@id"}, - "beneficiaryBank": { "@id": "schema:beneficiaryBank"}, - "benefits": { "@id": "schema:benefits"}, - "benefitsSummaryUrl": { "@id": "schema:benefitsSummaryUrl", "@type": "@id"}, - "bestRating": { "@id": "schema:bestRating"}, - "billingAddress": { "@id": "schema:billingAddress"}, - "billingIncrement": { "@id": "schema:billingIncrement"}, - "billingPeriod": { "@id": "schema:billingPeriod"}, - "biomechnicalClass": { "@id": "schema:biomechnicalClass"}, - "birthDate": { "@id": "schema:birthDate", "@type": "Date"}, - "birthPlace": { "@id": "schema:birthPlace"}, - "bitrate": { "@id": "schema:bitrate"}, - "blogPost": { "@id": "schema:blogPost"}, - "blogPosts": { "@id": "schema:blogPosts"}, - "bloodSupply": { "@id": "schema:bloodSupply"}, - "boardingGroup": { "@id": "schema:boardingGroup"}, - "boardingPolicy": { "@id": "schema:boardingPolicy"}, - "bodyLocation": { "@id": "schema:bodyLocation"}, - "bodyType": { "@id": "schema:bodyType"}, - "bookEdition": { "@id": "schema:bookEdition"}, - "bookFormat": { "@id": "schema:bookFormat"}, - "bookingAgent": { "@id": "schema:bookingAgent"}, - "bookingTime": { "@id": "schema:bookingTime", "@type": "DateTime"}, - "borrower": { "@id": "schema:borrower"}, - "box": { "@id": "schema:box"}, - "branch": { "@id": "schema:branch"}, - "branchCode": { "@id": "schema:branchCode"}, - "branchOf": { "@id": "schema:branchOf"}, - "brand": { "@id": "schema:brand"}, - "breadcrumb": { "@id": "schema:breadcrumb"}, - "breastfeedingWarning": { "@id": "schema:breastfeedingWarning"}, - "broadcastAffiliateOf": { "@id": "schema:broadcastAffiliateOf"}, - "broadcastChannelId": { "@id": "schema:broadcastChannelId"}, - "broadcastDisplayName": { "@id": "schema:broadcastDisplayName"}, - "broadcastFrequency": { "@id": "schema:broadcastFrequency"}, - "broadcastFrequencyValue": { "@id": "schema:broadcastFrequencyValue"}, - "broadcastOfEvent": { "@id": "schema:broadcastOfEvent"}, - "broadcastServiceTier": { "@id": "schema:broadcastServiceTier"}, - "broadcastSignalModulation": { "@id": "schema:broadcastSignalModulation"}, - "broadcastSubChannel": { "@id": "schema:broadcastSubChannel"}, - "broadcastTimezone": { "@id": "schema:broadcastTimezone"}, - "broadcaster": { "@id": "schema:broadcaster"}, - "broker": { "@id": "schema:broker"}, - "browserRequirements": { "@id": "schema:browserRequirements"}, - "busName": { "@id": "schema:busName"}, - "busNumber": { "@id": "schema:busNumber"}, - "businessFunction": { "@id": "schema:businessFunction"}, - "buyer": { "@id": "schema:buyer"}, - "byArtist": { "@id": "schema:byArtist"}, - "byDay": { "@id": "schema:byDay"}, - "byMonth": { "@id": "schema:byMonth"}, - "byMonthDay": { "@id": "schema:byMonthDay"}, - "callSign": { "@id": "schema:callSign"}, - "calories": { "@id": "schema:calories"}, - "candidate": { "@id": "schema:candidate"}, - "caption": { "@id": "schema:caption"}, - "carbohydrateContent": { "@id": "schema:carbohydrateContent"}, - "cargoVolume": { "@id": "schema:cargoVolume"}, - "carrier": { "@id": "schema:carrier"}, - "carrierRequirements": { "@id": "schema:carrierRequirements"}, - "cashBack": { "@id": "schema:cashBack"}, - "catalog": { "@id": "schema:catalog"}, - "catalogNumber": { "@id": "schema:catalogNumber"}, - "category": { "@id": "schema:category"}, - "cause": { "@id": "schema:cause"}, - "causeOf": { "@id": "schema:causeOf"}, - "ccRecipient": { "@id": "schema:ccRecipient"}, - "character": { "@id": "schema:character"}, - "characterAttribute": { "@id": "schema:characterAttribute"}, - "characterName": { "@id": "schema:characterName"}, - "cheatCode": { "@id": "schema:cheatCode"}, - "checkinTime": { "@id": "schema:checkinTime", "@type": "DateTime"}, - "checkoutTime": { "@id": "schema:checkoutTime", "@type": "DateTime"}, - "childMaxAge": { "@id": "schema:childMaxAge"}, - "childMinAge": { "@id": "schema:childMinAge"}, - "children": { "@id": "schema:children"}, - "cholesterolContent": { "@id": "schema:cholesterolContent"}, - "circle": { "@id": "schema:circle"}, - "citation": { "@id": "schema:citation"}, - "claimReviewed": { "@id": "schema:claimReviewed"}, - "clincalPharmacology": { "@id": "schema:clincalPharmacology"}, - "clinicalPharmacology": { "@id": "schema:clinicalPharmacology"}, - "clipNumber": { "@id": "schema:clipNumber"}, - "closes": { "@id": "schema:closes"}, - "coach": { "@id": "schema:coach"}, - "code": { "@id": "schema:code"}, - "codeRepository": { "@id": "schema:codeRepository", "@type": "@id"}, - "codeSampleType": { "@id": "schema:codeSampleType"}, - "codeValue": { "@id": "schema:codeValue"}, - "codingSystem": { "@id": "schema:codingSystem"}, - "colleague": { "@id": "schema:colleague", "@type": "@id"}, - "colleagues": { "@id": "schema:colleagues"}, - "collection": { "@id": "schema:collection"}, - "collectionSize": { "@id": "schema:collectionSize"}, - "color": { "@id": "schema:color"}, - "colorist": { "@id": "schema:colorist"}, - "comment": { "@id": "schema:comment"}, - "commentCount": { "@id": "schema:commentCount"}, - "commentText": { "@id": "schema:commentText"}, - "commentTime": { "@id": "schema:commentTime", "@type": "Date"}, - "competencyRequired": { "@id": "schema:competencyRequired"}, - "competitor": { "@id": "schema:competitor"}, - "composer": { "@id": "schema:composer"}, - "comprisedOf": { "@id": "schema:comprisedOf"}, - "conditionsOfAccess": { "@id": "schema:conditionsOfAccess"}, - "confirmationNumber": { "@id": "schema:confirmationNumber"}, - "connectedTo": { "@id": "schema:connectedTo"}, - "contactOption": { "@id": "schema:contactOption"}, - "contactPoint": { "@id": "schema:contactPoint"}, - "contactPoints": { "@id": "schema:contactPoints"}, - "contactType": { "@id": "schema:contactType"}, - "contactlessPayment": { "@id": "schema:contactlessPayment"}, - "containedIn": { "@id": "schema:containedIn"}, - "containedInPlace": { "@id": "schema:containedInPlace"}, - "containsPlace": { "@id": "schema:containsPlace"}, - "containsSeason": { "@id": "schema:containsSeason"}, - "contentLocation": { "@id": "schema:contentLocation"}, - "contentRating": { "@id": "schema:contentRating"}, - "contentReferenceTime": { "@id": "schema:contentReferenceTime", "@type": "DateTime"}, - "contentSize": { "@id": "schema:contentSize"}, - "contentType": { "@id": "schema:contentType"}, - "contentUrl": { "@id": "schema:contentUrl", "@type": "@id"}, - "contraindication": { "@id": "schema:contraindication"}, - "contributor": { "@id": "schema:contributor"}, - "cookTime": { "@id": "schema:cookTime"}, - "cookingMethod": { "@id": "schema:cookingMethod"}, - "copyrightHolder": { "@id": "schema:copyrightHolder"}, - "copyrightYear": { "@id": "schema:copyrightYear"}, - "correction": { "@id": "schema:correction"}, - "correctionsPolicy": { "@id": "schema:correctionsPolicy", "@type": "@id"}, - "cost": { "@id": "schema:cost"}, - "costCategory": { "@id": "schema:costCategory"}, - "costCurrency": { "@id": "schema:costCurrency"}, - "costOrigin": { "@id": "schema:costOrigin"}, - "costPerUnit": { "@id": "schema:costPerUnit"}, - "countriesNotSupported": { "@id": "schema:countriesNotSupported"}, - "countriesSupported": { "@id": "schema:countriesSupported"}, - "countryOfOrigin": { "@id": "schema:countryOfOrigin"}, - "course": { "@id": "schema:course"}, - "courseCode": { "@id": "schema:courseCode"}, - "courseMode": { "@id": "schema:courseMode"}, - "coursePrerequisites": { "@id": "schema:coursePrerequisites"}, - "courseWorkload": { "@id": "schema:courseWorkload"}, - "coverageEndTime": { "@id": "schema:coverageEndTime", "@type": "DateTime"}, - "coverageStartTime": { "@id": "schema:coverageStartTime", "@type": "DateTime"}, - "creativeWorkStatus": { "@id": "schema:creativeWorkStatus"}, - "creator": { "@id": "schema:creator"}, - "credentialCategory": { "@id": "schema:credentialCategory"}, - "creditedTo": { "@id": "schema:creditedTo"}, - "cssSelector": { "@id": "schema:cssSelector"}, - "currenciesAccepted": { "@id": "schema:currenciesAccepted"}, - "currency": { "@id": "schema:currency"}, - "currentExchangeRate": { "@id": "schema:currentExchangeRate"}, - "customer": { "@id": "schema:customer"}, - "dataFeedElement": { "@id": "schema:dataFeedElement"}, - "dataset": { "@id": "schema:dataset"}, - "datasetTimeInterval": { "@id": "schema:datasetTimeInterval", "@type": "DateTime"}, - "dateCreated": { "@id": "schema:dateCreated", "@type": "Date"}, - "dateDeleted": { "@id": "schema:dateDeleted", "@type": "Date"}, - "dateIssued": { "@id": "schema:dateIssued", "@type": "Date"}, - "dateModified": { "@id": "schema:dateModified", "@type": "Date"}, - "datePosted": { "@id": "schema:datePosted", "@type": "Date"}, - "datePublished": { "@id": "schema:datePublished", "@type": "Date"}, - "dateRead": { "@id": "schema:dateRead", "@type": "Date"}, - "dateReceived": { "@id": "schema:dateReceived", "@type": "DateTime"}, - "dateSent": { "@id": "schema:dateSent", "@type": "DateTime"}, - "dateVehicleFirstRegistered": { "@id": "schema:dateVehicleFirstRegistered", "@type": "Date"}, - "dateline": { "@id": "schema:dateline"}, - "dayOfWeek": { "@id": "schema:dayOfWeek"}, - "deathDate": { "@id": "schema:deathDate", "@type": "Date"}, - "deathPlace": { "@id": "schema:deathPlace"}, - "defaultValue": { "@id": "schema:defaultValue"}, - "deliveryAddress": { "@id": "schema:deliveryAddress"}, - "deliveryLeadTime": { "@id": "schema:deliveryLeadTime"}, - "deliveryMethod": { "@id": "schema:deliveryMethod"}, - "deliveryStatus": { "@id": "schema:deliveryStatus"}, - "department": { "@id": "schema:department"}, - "departureAirport": { "@id": "schema:departureAirport"}, - "departureBusStop": { "@id": "schema:departureBusStop"}, - "departureGate": { "@id": "schema:departureGate"}, - "departurePlatform": { "@id": "schema:departurePlatform"}, - "departureStation": { "@id": "schema:departureStation"}, - "departureTerminal": { "@id": "schema:departureTerminal"}, - "departureTime": { "@id": "schema:departureTime", "@type": "DateTime"}, - "dependencies": { "@id": "schema:dependencies"}, - "depth": { "@id": "schema:depth"}, - "description": { "@id": "schema:description"}, - "device": { "@id": "schema:device"}, - "diagnosis": { "@id": "schema:diagnosis"}, - "diagram": { "@id": "schema:diagram"}, - "diet": { "@id": "schema:diet"}, - "dietFeatures": { "@id": "schema:dietFeatures"}, - "differentialDiagnosis": { "@id": "schema:differentialDiagnosis"}, - "director": { "@id": "schema:director"}, - "directors": { "@id": "schema:directors"}, - "disambiguatingDescription": { "@id": "schema:disambiguatingDescription"}, - "discount": { "@id": "schema:discount"}, - "discountCode": { "@id": "schema:discountCode"}, - "discountCurrency": { "@id": "schema:discountCurrency"}, - "discusses": { "@id": "schema:discusses"}, - "discussionUrl": { "@id": "schema:discussionUrl", "@type": "@id"}, - "dissolutionDate": { "@id": "schema:dissolutionDate", "@type": "Date"}, - "distance": { "@id": "schema:distance"}, - "distinguishingSign": { "@id": "schema:distinguishingSign"}, - "distribution": { "@id": "schema:distribution"}, - "diversityPolicy": { "@id": "schema:diversityPolicy", "@type": "@id"}, - "diversityStaffingReport": { "@id": "schema:diversityStaffingReport", "@type": "@id"}, - "documentation": { "@id": "schema:documentation", "@type": "@id"}, - "domainIncludes": { "@id": "schema:domainIncludes"}, - "domiciledMortgage": { "@id": "schema:domiciledMortgage"}, - "doorTime": { "@id": "schema:doorTime", "@type": "DateTime"}, - "dosageForm": { "@id": "schema:dosageForm"}, - "doseSchedule": { "@id": "schema:doseSchedule"}, - "doseUnit": { "@id": "schema:doseUnit"}, - "doseValue": { "@id": "schema:doseValue"}, - "downPayment": { "@id": "schema:downPayment"}, - "downloadUrl": { "@id": "schema:downloadUrl", "@type": "@id"}, - "downvoteCount": { "@id": "schema:downvoteCount"}, - "drainsTo": { "@id": "schema:drainsTo"}, - "driveWheelConfiguration": { "@id": "schema:driveWheelConfiguration"}, - "dropoffLocation": { "@id": "schema:dropoffLocation"}, - "dropoffTime": { "@id": "schema:dropoffTime", "@type": "DateTime"}, - "drug": { "@id": "schema:drug"}, - "drugClass": { "@id": "schema:drugClass"}, - "drugUnit": { "@id": "schema:drugUnit"}, - "duns": { "@id": "schema:duns"}, - "duplicateTherapy": { "@id": "schema:duplicateTherapy"}, - "duration": { "@id": "schema:duration"}, - "durationOfWarranty": { "@id": "schema:durationOfWarranty"}, - "duringMedia": { "@id": "schema:duringMedia", "@type": "@id"}, - "earlyPrepaymentPenalty": { "@id": "schema:earlyPrepaymentPenalty"}, - "editor": { "@id": "schema:editor"}, - "educationRequirements": { "@id": "schema:educationRequirements"}, - "educationalAlignment": { "@id": "schema:educationalAlignment"}, - "educationalCredentialAwarded": { "@id": "schema:educationalCredentialAwarded"}, - "educationalFramework": { "@id": "schema:educationalFramework"}, - "educationalLevel": { "@id": "schema:educationalLevel"}, - "educationalRole": { "@id": "schema:educationalRole"}, - "educationalUse": { "@id": "schema:educationalUse"}, - "elevation": { "@id": "schema:elevation"}, - "eligibleCustomerType": { "@id": "schema:eligibleCustomerType"}, - "eligibleDuration": { "@id": "schema:eligibleDuration"}, - "eligibleQuantity": { "@id": "schema:eligibleQuantity"}, - "eligibleRegion": { "@id": "schema:eligibleRegion"}, - "eligibleTransactionVolume": { "@id": "schema:eligibleTransactionVolume"}, - "email": { "@id": "schema:email"}, - "embedUrl": { "@id": "schema:embedUrl", "@type": "@id"}, - "emissionsCO2": { "@id": "schema:emissionsCO2"}, - "employee": { "@id": "schema:employee"}, - "employees": { "@id": "schema:employees"}, - "employmentType": { "@id": "schema:employmentType"}, - "encodesCreativeWork": { "@id": "schema:encodesCreativeWork"}, - "encoding": { "@id": "schema:encoding"}, - "encodingFormat": { "@id": "schema:encodingFormat"}, - "encodingType": { "@id": "schema:encodingType"}, - "encodings": { "@id": "schema:encodings"}, - "endDate": { "@id": "schema:endDate", "@type": "Date"}, - "endOffset": { "@id": "schema:endOffset"}, - "endTime": { "@id": "schema:endTime", "@type": "DateTime"}, - "endorsee": { "@id": "schema:endorsee"}, - "endorsers": { "@id": "schema:endorsers"}, - "engineDisplacement": { "@id": "schema:engineDisplacement"}, - "enginePower": { "@id": "schema:enginePower"}, - "engineType": { "@id": "schema:engineType"}, - "entertainmentBusiness": { "@id": "schema:entertainmentBusiness"}, - "epidemiology": { "@id": "schema:epidemiology"}, - "episode": { "@id": "schema:episode"}, - "episodeNumber": { "@id": "schema:episodeNumber"}, - "episodes": { "@id": "schema:episodes"}, - "equal": { "@id": "schema:equal"}, - "error": { "@id": "schema:error"}, - "estimatedCost": { "@id": "schema:estimatedCost"}, - "estimatedFlightDuration": { "@id": "schema:estimatedFlightDuration"}, - "estimatedSalary": { "@id": "schema:estimatedSalary"}, - "estimatesRiskOf": { "@id": "schema:estimatesRiskOf"}, - "ethicsPolicy": { "@id": "schema:ethicsPolicy", "@type": "@id"}, - "event": { "@id": "schema:event"}, - "eventSchedule": { "@id": "schema:eventSchedule"}, - "eventStatus": { "@id": "schema:eventStatus"}, - "events": { "@id": "schema:events"}, - "evidenceLevel": { "@id": "schema:evidenceLevel"}, - "evidenceOrigin": { "@id": "schema:evidenceOrigin"}, - "exampleOfWork": { "@id": "schema:exampleOfWork"}, - "exceptDate": { "@id": "schema:exceptDate", "@type": "Date"}, - "exchangeRateSpread": { "@id": "schema:exchangeRateSpread"}, - "executableLibraryName": { "@id": "schema:executableLibraryName"}, - "exerciseCourse": { "@id": "schema:exerciseCourse"}, - "exercisePlan": { "@id": "schema:exercisePlan"}, - "exerciseRelatedDiet": { "@id": "schema:exerciseRelatedDiet"}, - "exerciseType": { "@id": "schema:exerciseType"}, - "exifData": { "@id": "schema:exifData"}, - "expectedArrivalFrom": { "@id": "schema:expectedArrivalFrom", "@type": "Date"}, - "expectedArrivalUntil": { "@id": "schema:expectedArrivalUntil", "@type": "Date"}, - "expectedPrognosis": { "@id": "schema:expectedPrognosis"}, - "expectsAcceptanceOf": { "@id": "schema:expectsAcceptanceOf"}, - "experienceRequirements": { "@id": "schema:experienceRequirements"}, - "expertConsiderations": { "@id": "schema:expertConsiderations"}, - "expires": { "@id": "schema:expires", "@type": "Date"}, - "familyName": { "@id": "schema:familyName"}, - "fatContent": { "@id": "schema:fatContent"}, - "faxNumber": { "@id": "schema:faxNumber"}, - "featureList": { "@id": "schema:featureList"}, - "feesAndCommissionsSpecification": { "@id": "schema:feesAndCommissionsSpecification"}, - "fiberContent": { "@id": "schema:fiberContent"}, - "fileFormat": { "@id": "schema:fileFormat"}, - "fileSize": { "@id": "schema:fileSize"}, - "firstAppearance": { "@id": "schema:firstAppearance"}, - "firstPerformance": { "@id": "schema:firstPerformance"}, - "flightDistance": { "@id": "schema:flightDistance"}, - "flightNumber": { "@id": "schema:flightNumber"}, - "floorLimit": { "@id": "schema:floorLimit"}, - "floorSize": { "@id": "schema:floorSize"}, - "followee": { "@id": "schema:followee"}, - "follows": { "@id": "schema:follows"}, - "followup": { "@id": "schema:followup"}, - "foodEstablishment": { "@id": "schema:foodEstablishment"}, - "foodEvent": { "@id": "schema:foodEvent"}, - "foodWarning": { "@id": "schema:foodWarning"}, - "founder": { "@id": "schema:founder"}, - "founders": { "@id": "schema:founders"}, - "foundingDate": { "@id": "schema:foundingDate", "@type": "Date"}, - "foundingLocation": { "@id": "schema:foundingLocation"}, - "free": { "@id": "schema:free"}, - "frequency": { "@id": "schema:frequency"}, - "fromLocation": { "@id": "schema:fromLocation"}, - "fuelCapacity": { "@id": "schema:fuelCapacity"}, - "fuelConsumption": { "@id": "schema:fuelConsumption"}, - "fuelEfficiency": { "@id": "schema:fuelEfficiency"}, - "fuelType": { "@id": "schema:fuelType"}, - "function": { "@id": "schema:function"}, - "functionalClass": { "@id": "schema:functionalClass"}, - "fundedItem": { "@id": "schema:fundedItem"}, - "funder": { "@id": "schema:funder"}, - "game": { "@id": "schema:game"}, - "gameItem": { "@id": "schema:gameItem"}, - "gameLocation": { "@id": "schema:gameLocation", "@type": "@id"}, - "gamePlatform": { "@id": "schema:gamePlatform"}, - "gameServer": { "@id": "schema:gameServer"}, - "gameTip": { "@id": "schema:gameTip"}, - "gender": { "@id": "schema:gender"}, - "genre": { "@id": "schema:genre"}, - "geo": { "@id": "schema:geo"}, - "geoContains": { "@id": "schema:geoContains"}, - "geoCoveredBy": { "@id": "schema:geoCoveredBy"}, - "geoCovers": { "@id": "schema:geoCovers"}, - "geoCrosses": { "@id": "schema:geoCrosses"}, - "geoDisjoint": { "@id": "schema:geoDisjoint"}, - "geoEquals": { "@id": "schema:geoEquals"}, - "geoIntersects": { "@id": "schema:geoIntersects"}, - "geoMidpoint": { "@id": "schema:geoMidpoint"}, - "geoOverlaps": { "@id": "schema:geoOverlaps"}, - "geoRadius": { "@id": "schema:geoRadius"}, - "geoTouches": { "@id": "schema:geoTouches"}, - "geoWithin": { "@id": "schema:geoWithin"}, - "geographicArea": { "@id": "schema:geographicArea"}, - "givenName": { "@id": "schema:givenName"}, - "globalLocationNumber": { "@id": "schema:globalLocationNumber"}, - "gracePeriod": { "@id": "schema:gracePeriod"}, - "grantee": { "@id": "schema:grantee"}, - "greater": { "@id": "schema:greater"}, - "greaterOrEqual": { "@id": "schema:greaterOrEqual"}, - "gtin": { "@id": "schema:gtin"}, - "gtin12": { "@id": "schema:gtin12"}, - "gtin13": { "@id": "schema:gtin13"}, - "gtin14": { "@id": "schema:gtin14"}, - "gtin8": { "@id": "schema:gtin8"}, - "guideline": { "@id": "schema:guideline"}, - "guidelineDate": { "@id": "schema:guidelineDate", "@type": "Date"}, - "guidelineSubject": { "@id": "schema:guidelineSubject"}, - "hasBroadcastChannel": { "@id": "schema:hasBroadcastChannel"}, - "hasCategoryCode": { "@id": "schema:hasCategoryCode"}, - "hasCourseInstance": { "@id": "schema:hasCourseInstance"}, - "hasDefinedTerm": { "@id": "schema:hasDefinedTerm"}, - "hasDeliveryMethod": { "@id": "schema:hasDeliveryMethod"}, - "hasDigitalDocumentPermission": { "@id": "schema:hasDigitalDocumentPermission"}, - "hasMap": { "@id": "schema:hasMap", "@type": "@id"}, - "hasMenu": { "@id": "schema:hasMenu"}, - "hasMenuItem": { "@id": "schema:hasMenuItem"}, - "hasMenuSection": { "@id": "schema:hasMenuSection"}, - "hasOccupation": { "@id": "schema:hasOccupation"}, - "hasOfferCatalog": { "@id": "schema:hasOfferCatalog"}, - "hasPOS": { "@id": "schema:hasPOS"}, - "hasPart": { "@id": "schema:hasPart"}, - "hasProductReturnPolicy": { "@id": "schema:hasProductReturnPolicy"}, - "headline": { "@id": "schema:headline"}, - "healthCondition": { "@id": "schema:healthCondition"}, - "healthPlanCoinsuranceOption": { "@id": "schema:healthPlanCoinsuranceOption"}, - "healthPlanCoinsuranceRate": { "@id": "schema:healthPlanCoinsuranceRate"}, - "healthPlanCopay": { "@id": "schema:healthPlanCopay"}, - "healthPlanCopayOption": { "@id": "schema:healthPlanCopayOption"}, - "healthPlanCostSharing": { "@id": "schema:healthPlanCostSharing"}, - "healthPlanDrugOption": { "@id": "schema:healthPlanDrugOption"}, - "healthPlanDrugTier": { "@id": "schema:healthPlanDrugTier"}, - "healthPlanId": { "@id": "schema:healthPlanId"}, - "healthPlanMarketingUrl": { "@id": "schema:healthPlanMarketingUrl", "@type": "@id"}, - "healthPlanNetworkId": { "@id": "schema:healthPlanNetworkId"}, - "healthPlanNetworkTier": { "@id": "schema:healthPlanNetworkTier"}, - "healthPlanPharmacyCategory": { "@id": "schema:healthPlanPharmacyCategory"}, - "height": { "@id": "schema:height"}, - "highPrice": { "@id": "schema:highPrice"}, - "hiringOrganization": { "@id": "schema:hiringOrganization"}, - "holdingArchive": { "@id": "schema:holdingArchive"}, - "homeLocation": { "@id": "schema:homeLocation"}, - "homeTeam": { "@id": "schema:homeTeam"}, - "honorificPrefix": { "@id": "schema:honorificPrefix"}, - "honorificSuffix": { "@id": "schema:honorificSuffix"}, - "hospitalAffiliation": { "@id": "schema:hospitalAffiliation"}, - "hostingOrganization": { "@id": "schema:hostingOrganization"}, - "hoursAvailable": { "@id": "schema:hoursAvailable"}, - "howPerformed": { "@id": "schema:howPerformed"}, - "iataCode": { "@id": "schema:iataCode"}, - "icaoCode": { "@id": "schema:icaoCode"}, - "identifier": { "@id": "schema:identifier"}, - "identifyingExam": { "@id": "schema:identifyingExam"}, - "identifyingTest": { "@id": "schema:identifyingTest"}, - "illustrator": { "@id": "schema:illustrator"}, - "image": { "@id": "schema:image", "@type": "@id"}, - "imagingTechnique": { "@id": "schema:imagingTechnique"}, - "inAlbum": { "@id": "schema:inAlbum"}, - "inBroadcastLineup": { "@id": "schema:inBroadcastLineup"}, - "inCodeSet": { "@id": "schema:inCodeSet", "@type": "@id"}, - "inDefinedTermSet": { "@id": "schema:inDefinedTermSet", "@type": "@id"}, - "inLanguage": { "@id": "schema:inLanguage"}, - "inPlaylist": { "@id": "schema:inPlaylist"}, - "inStoreReturnsOffered": { "@id": "schema:inStoreReturnsOffered"}, - "inSupportOf": { "@id": "schema:inSupportOf"}, - "incentiveCompensation": { "@id": "schema:incentiveCompensation"}, - "incentives": { "@id": "schema:incentives"}, - "includedComposition": { "@id": "schema:includedComposition"}, - "includedDataCatalog": { "@id": "schema:includedDataCatalog"}, - "includedInDataCatalog": { "@id": "schema:includedInDataCatalog"}, - "includedInHealthInsurancePlan": { "@id": "schema:includedInHealthInsurancePlan"}, - "includedRiskFactor": { "@id": "schema:includedRiskFactor"}, - "includesAttraction": { "@id": "schema:includesAttraction"}, - "includesHealthPlanFormulary": { "@id": "schema:includesHealthPlanFormulary"}, - "includesHealthPlanNetwork": { "@id": "schema:includesHealthPlanNetwork"}, - "includesObject": { "@id": "schema:includesObject"}, - "increasesRiskOf": { "@id": "schema:increasesRiskOf"}, - "indication": { "@id": "schema:indication"}, - "industry": { "@id": "schema:industry"}, - "ineligibleRegion": { "@id": "schema:ineligibleRegion"}, - "infectiousAgent": { "@id": "schema:infectiousAgent"}, - "infectiousAgentClass": { "@id": "schema:infectiousAgentClass"}, - "ingredients": { "@id": "schema:ingredients"}, - "inker": { "@id": "schema:inker"}, - "insertion": { "@id": "schema:insertion"}, - "installUrl": { "@id": "schema:installUrl", "@type": "@id"}, - "instructor": { "@id": "schema:instructor"}, - "instrument": { "@id": "schema:instrument"}, - "intensity": { "@id": "schema:intensity"}, - "interactingDrug": { "@id": "schema:interactingDrug"}, - "interactionCount": { "@id": "schema:interactionCount"}, - "interactionService": { "@id": "schema:interactionService"}, - "interactionStatistic": { "@id": "schema:interactionStatistic"}, - "interactionType": { "@id": "schema:interactionType"}, - "interactivityType": { "@id": "schema:interactivityType"}, - "interestRate": { "@id": "schema:interestRate"}, - "inventoryLevel": { "@id": "schema:inventoryLevel"}, - "inverseOf": { "@id": "schema:inverseOf"}, - "isAcceptingNewPatients": { "@id": "schema:isAcceptingNewPatients"}, - "isAccessibleForFree": { "@id": "schema:isAccessibleForFree"}, - "isAccessoryOrSparePartFor": { "@id": "schema:isAccessoryOrSparePartFor"}, - "isAvailableGenerically": { "@id": "schema:isAvailableGenerically"}, - "isBasedOn": { "@id": "schema:isBasedOn", "@type": "@id"}, - "isBasedOnUrl": { "@id": "schema:isBasedOnUrl", "@type": "@id"}, - "isConsumableFor": { "@id": "schema:isConsumableFor"}, - "isFamilyFriendly": { "@id": "schema:isFamilyFriendly"}, - "isGift": { "@id": "schema:isGift"}, - "isLiveBroadcast": { "@id": "schema:isLiveBroadcast"}, - "isPartOf": { "@id": "schema:isPartOf"}, - "isProprietary": { "@id": "schema:isProprietary"}, - "isRelatedTo": { "@id": "schema:isRelatedTo"}, - "isSimilarTo": { "@id": "schema:isSimilarTo"}, - "isVariantOf": { "@id": "schema:isVariantOf"}, - "isbn": { "@id": "schema:isbn"}, - "isicV4": { "@id": "schema:isicV4"}, - "isrcCode": { "@id": "schema:isrcCode"}, - "issn": { "@id": "schema:issn"}, - "issueNumber": { "@id": "schema:issueNumber"}, - "issuedBy": { "@id": "schema:issuedBy"}, - "issuedThrough": { "@id": "schema:issuedThrough"}, - "iswcCode": { "@id": "schema:iswcCode"}, - "item": { "@id": "schema:item"}, - "itemCondition": { "@id": "schema:itemCondition"}, - "itemListElement": { "@id": "schema:itemListElement"}, - "itemListOrder": { "@id": "schema:itemListOrder"}, - "itemLocation": { "@id": "schema:itemLocation"}, - "itemOffered": { "@id": "schema:itemOffered"}, - "itemReviewed": { "@id": "schema:itemReviewed"}, - "itemShipped": { "@id": "schema:itemShipped"}, - "itinerary": { "@id": "schema:itinerary"}, - "jobBenefits": { "@id": "schema:jobBenefits"}, - "jobImmediateStart": { "@id": "schema:jobImmediateStart"}, - "jobLocation": { "@id": "schema:jobLocation"}, - "jobLocationType": { "@id": "schema:jobLocationType"}, - "jobStartDate": { "@id": "schema:jobStartDate"}, - "jobTitle": { "@id": "schema:jobTitle"}, - "keywords": { "@id": "schema:keywords"}, - "knownVehicleDamages": { "@id": "schema:knownVehicleDamages"}, - "knows": { "@id": "schema:knows"}, - "knowsAbout": { "@id": "schema:knowsAbout"}, - "knowsLanguage": { "@id": "schema:knowsLanguage"}, - "labelDetails": { "@id": "schema:labelDetails", "@type": "@id"}, - "landlord": { "@id": "schema:landlord"}, - "language": { "@id": "schema:language"}, - "lastReviewed": { "@id": "schema:lastReviewed", "@type": "Date"}, - "latitude": { "@id": "schema:latitude"}, - "learningResourceType": { "@id": "schema:learningResourceType"}, - "legalName": { "@id": "schema:legalName"}, - "legalStatus": { "@id": "schema:legalStatus"}, - "legislationApplies": { "@id": "schema:legislationApplies"}, - "legislationChanges": { "@id": "schema:legislationChanges"}, - "legislationConsolidates": { "@id": "schema:legislationConsolidates"}, - "legislationDate": { "@id": "schema:legislationDate", "@type": "Date"}, - "legislationDateVersion": { "@id": "schema:legislationDateVersion", "@type": "Date"}, - "legislationIdentifier": { "@id": "schema:legislationIdentifier"}, - "legislationJurisdiction": { "@id": "schema:legislationJurisdiction"}, - "legislationLegalForce": { "@id": "schema:legislationLegalForce"}, - "legislationLegalValue": { "@id": "schema:legislationLegalValue"}, - "legislationPassedBy": { "@id": "schema:legislationPassedBy"}, - "legislationResponsible": { "@id": "schema:legislationResponsible"}, - "legislationTransposes": { "@id": "schema:legislationTransposes"}, - "legislationType": { "@id": "schema:legislationType"}, - "leiCode": { "@id": "schema:leiCode"}, - "lender": { "@id": "schema:lender"}, - "lesser": { "@id": "schema:lesser"}, - "lesserOrEqual": { "@id": "schema:lesserOrEqual"}, - "letterer": { "@id": "schema:letterer"}, - "license": { "@id": "schema:license", "@type": "@id"}, - "line": { "@id": "schema:line"}, - "linkRelationship": { "@id": "schema:linkRelationship"}, - "liveBlogUpdate": { "@id": "schema:liveBlogUpdate"}, - "loanMortgageMandateAmount": { "@id": "schema:loanMortgageMandateAmount"}, - "loanPaymentAmount": { "@id": "schema:loanPaymentAmount"}, - "loanPaymentFrequency": { "@id": "schema:loanPaymentFrequency"}, - "loanRepaymentForm": { "@id": "schema:loanRepaymentForm"}, - "loanTerm": { "@id": "schema:loanTerm"}, - "loanType": { "@id": "schema:loanType"}, - "location": { "@id": "schema:location"}, - "locationCreated": { "@id": "schema:locationCreated"}, - "lodgingUnitDescription": { "@id": "schema:lodgingUnitDescription"}, - "lodgingUnitType": { "@id": "schema:lodgingUnitType"}, - "logo": { "@id": "schema:logo", "@type": "@id"}, - "longitude": { "@id": "schema:longitude"}, - "loser": { "@id": "schema:loser"}, - "lowPrice": { "@id": "schema:lowPrice"}, - "lyricist": { "@id": "schema:lyricist"}, - "lyrics": { "@id": "schema:lyrics"}, - "mainContentOfPage": { "@id": "schema:mainContentOfPage"}, - "mainEntity": { "@id": "schema:mainEntity"}, - "mainEntityOfPage": { "@id": "schema:mainEntityOfPage", "@type": "@id"}, - "makesOffer": { "@id": "schema:makesOffer"}, - "manufacturer": { "@id": "schema:manufacturer"}, - "map": { "@id": "schema:map", "@type": "@id"}, - "mapType": { "@id": "schema:mapType"}, - "maps": { "@id": "schema:maps", "@type": "@id"}, - "masthead": { "@id": "schema:masthead", "@type": "@id"}, - "material": { "@id": "schema:material"}, - "materialExtent": { "@id": "schema:materialExtent"}, - "maxPrice": { "@id": "schema:maxPrice"}, - "maxValue": { "@id": "schema:maxValue"}, - "maximumAttendeeCapacity": { "@id": "schema:maximumAttendeeCapacity"}, - "maximumIntake": { "@id": "schema:maximumIntake"}, - "mealService": { "@id": "schema:mealService"}, - "measurementTechnique": { "@id": "schema:measurementTechnique"}, - "mechanismOfAction": { "@id": "schema:mechanismOfAction"}, - "median": { "@id": "schema:median"}, - "medicalSpecialty": { "@id": "schema:medicalSpecialty"}, - "medicineSystem": { "@id": "schema:medicineSystem"}, - "meetsEmissionStandard": { "@id": "schema:meetsEmissionStandard"}, - "member": { "@id": "schema:member"}, - "memberOf": { "@id": "schema:memberOf"}, - "members": { "@id": "schema:members"}, - "membershipNumber": { "@id": "schema:membershipNumber"}, - "membershipPointsEarned": { "@id": "schema:membershipPointsEarned"}, - "memoryRequirements": { "@id": "schema:memoryRequirements"}, - "mentions": { "@id": "schema:mentions"}, - "menu": { "@id": "schema:menu"}, - "menuAddOn": { "@id": "schema:menuAddOn"}, - "merchant": { "@id": "schema:merchant"}, - "messageAttachment": { "@id": "schema:messageAttachment"}, - "mileageFromOdometer": { "@id": "schema:mileageFromOdometer"}, - "minPrice": { "@id": "schema:minPrice"}, - "minValue": { "@id": "schema:minValue"}, - "minimumPaymentDue": { "@id": "schema:minimumPaymentDue"}, - "missionCoveragePrioritiesPolicy": { "@id": "schema:missionCoveragePrioritiesPolicy", "@type": "@id"}, - "model": { "@id": "schema:model"}, - "modelDate": { "@id": "schema:modelDate", "@type": "Date"}, - "modifiedTime": { "@id": "schema:modifiedTime", "@type": "DateTime"}, - "monthlyMinimumRepaymentAmount": { "@id": "schema:monthlyMinimumRepaymentAmount"}, - "mpn": { "@id": "schema:mpn"}, - "multipleValues": { "@id": "schema:multipleValues"}, - "muscleAction": { "@id": "schema:muscleAction"}, - "musicArrangement": { "@id": "schema:musicArrangement"}, - "musicBy": { "@id": "schema:musicBy"}, - "musicCompositionForm": { "@id": "schema:musicCompositionForm"}, - "musicGroupMember": { "@id": "schema:musicGroupMember"}, - "musicReleaseFormat": { "@id": "schema:musicReleaseFormat"}, - "musicalKey": { "@id": "schema:musicalKey"}, - "naics": { "@id": "schema:naics"}, - "name": { "@id": "schema:name"}, - "namedPosition": { "@id": "schema:namedPosition"}, - "nationality": { "@id": "schema:nationality"}, - "naturalProgression": { "@id": "schema:naturalProgression"}, - "nerve": { "@id": "schema:nerve"}, - "nerveMotor": { "@id": "schema:nerveMotor"}, - "netWorth": { "@id": "schema:netWorth"}, - "nextItem": { "@id": "schema:nextItem"}, - "noBylinesPolicy": { "@id": "schema:noBylinesPolicy", "@type": "@id"}, - "nonEqual": { "@id": "schema:nonEqual"}, - "nonProprietaryName": { "@id": "schema:nonProprietaryName"}, - "normalRange": { "@id": "schema:normalRange"}, - "nsn": { "@id": "schema:nsn"}, - "numAdults": { "@id": "schema:numAdults"}, - "numChildren": { "@id": "schema:numChildren"}, - "numTracks": { "@id": "schema:numTracks"}, - "numberOfAirbags": { "@id": "schema:numberOfAirbags"}, - "numberOfAxles": { "@id": "schema:numberOfAxles"}, - "numberOfBeds": { "@id": "schema:numberOfBeds"}, - "numberOfDoors": { "@id": "schema:numberOfDoors"}, - "numberOfEmployees": { "@id": "schema:numberOfEmployees"}, - "numberOfEpisodes": { "@id": "schema:numberOfEpisodes"}, - "numberOfForwardGears": { "@id": "schema:numberOfForwardGears"}, - "numberOfItems": { "@id": "schema:numberOfItems"}, - "numberOfLoanPayments": { "@id": "schema:numberOfLoanPayments"}, - "numberOfPages": { "@id": "schema:numberOfPages"}, - "numberOfPlayers": { "@id": "schema:numberOfPlayers"}, - "numberOfPreviousOwners": { "@id": "schema:numberOfPreviousOwners"}, - "numberOfRooms": { "@id": "schema:numberOfRooms"}, - "numberOfSeasons": { "@id": "schema:numberOfSeasons"}, - "numberedPosition": { "@id": "schema:numberedPosition"}, - "nutrition": { "@id": "schema:nutrition"}, - "object": { "@id": "schema:object"}, - "occupancy": { "@id": "schema:occupancy"}, - "occupationLocation": { "@id": "schema:occupationLocation"}, - "occupationalCategory": { "@id": "schema:occupationalCategory"}, - "offerCount": { "@id": "schema:offerCount"}, - "offeredBy": { "@id": "schema:offeredBy"}, - "offers": { "@id": "schema:offers"}, - "offersPrescriptionByMail": { "@id": "schema:offersPrescriptionByMail"}, - "openingHours": { "@id": "schema:openingHours"}, - "openingHoursSpecification": { "@id": "schema:openingHoursSpecification"}, - "opens": { "@id": "schema:opens"}, - "operatingSystem": { "@id": "schema:operatingSystem"}, - "opponent": { "@id": "schema:opponent"}, - "option": { "@id": "schema:option"}, - "orderDate": { "@id": "schema:orderDate", "@type": "Date"}, - "orderDelivery": { "@id": "schema:orderDelivery"}, - "orderItemNumber": { "@id": "schema:orderItemNumber"}, - "orderItemStatus": { "@id": "schema:orderItemStatus"}, - "orderNumber": { "@id": "schema:orderNumber"}, - "orderQuantity": { "@id": "schema:orderQuantity"}, - "orderStatus": { "@id": "schema:orderStatus"}, - "orderedItem": { "@id": "schema:orderedItem"}, - "organizer": { "@id": "schema:organizer"}, - "origin": { "@id": "schema:origin"}, - "originAddress": { "@id": "schema:originAddress"}, - "originatesFrom": { "@id": "schema:originatesFrom"}, - "outcome": { "@id": "schema:outcome"}, - "overdosage": { "@id": "schema:overdosage"}, - "overview": { "@id": "schema:overview"}, - "ownedFrom": { "@id": "schema:ownedFrom", "@type": "DateTime"}, - "ownedThrough": { "@id": "schema:ownedThrough", "@type": "DateTime"}, - "ownershipFundingInfo": { "@id": "schema:ownershipFundingInfo"}, - "owns": { "@id": "schema:owns"}, - "pageEnd": { "@id": "schema:pageEnd"}, - "pageStart": { "@id": "schema:pageStart"}, - "pagination": { "@id": "schema:pagination"}, - "parent": { "@id": "schema:parent"}, - "parentItem": { "@id": "schema:parentItem"}, - "parentOrganization": { "@id": "schema:parentOrganization"}, - "parentService": { "@id": "schema:parentService"}, - "parents": { "@id": "schema:parents"}, - "partOfEpisode": { "@id": "schema:partOfEpisode"}, - "partOfInvoice": { "@id": "schema:partOfInvoice"}, - "partOfOrder": { "@id": "schema:partOfOrder"}, - "partOfSeason": { "@id": "schema:partOfSeason"}, - "partOfSeries": { "@id": "schema:partOfSeries"}, - "partOfSystem": { "@id": "schema:partOfSystem"}, - "partOfTVSeries": { "@id": "schema:partOfTVSeries"}, - "partOfTrip": { "@id": "schema:partOfTrip"}, - "participant": { "@id": "schema:participant"}, - "partySize": { "@id": "schema:partySize"}, - "passengerPriorityStatus": { "@id": "schema:passengerPriorityStatus"}, - "passengerSequenceNumber": { "@id": "schema:passengerSequenceNumber"}, - "pathophysiology": { "@id": "schema:pathophysiology"}, - "payload": { "@id": "schema:payload"}, - "paymentAccepted": { "@id": "schema:paymentAccepted"}, - "paymentDue": { "@id": "schema:paymentDue", "@type": "DateTime"}, - "paymentDueDate": { "@id": "schema:paymentDueDate", "@type": "Date"}, - "paymentMethod": { "@id": "schema:paymentMethod"}, - "paymentMethodId": { "@id": "schema:paymentMethodId"}, - "paymentStatus": { "@id": "schema:paymentStatus"}, - "paymentUrl": { "@id": "schema:paymentUrl", "@type": "@id"}, - "penciler": { "@id": "schema:penciler"}, - "percentile10": { "@id": "schema:percentile10"}, - "percentile25": { "@id": "schema:percentile25"}, - "percentile75": { "@id": "schema:percentile75"}, - "percentile90": { "@id": "schema:percentile90"}, - "performTime": { "@id": "schema:performTime"}, - "performer": { "@id": "schema:performer"}, - "performerIn": { "@id": "schema:performerIn"}, - "performers": { "@id": "schema:performers"}, - "permissionType": { "@id": "schema:permissionType"}, - "permissions": { "@id": "schema:permissions"}, - "permitAudience": { "@id": "schema:permitAudience"}, - "permittedUsage": { "@id": "schema:permittedUsage"}, - "petsAllowed": { "@id": "schema:petsAllowed"}, - "phase": { "@id": "schema:phase"}, - "photo": { "@id": "schema:photo"}, - "photos": { "@id": "schema:photos"}, - "physiologicalBenefits": { "@id": "schema:physiologicalBenefits"}, - "pickupLocation": { "@id": "schema:pickupLocation"}, - "pickupTime": { "@id": "schema:pickupTime", "@type": "DateTime"}, - "playMode": { "@id": "schema:playMode"}, - "playerType": { "@id": "schema:playerType"}, - "playersOnline": { "@id": "schema:playersOnline"}, - "polygon": { "@id": "schema:polygon"}, - "population": { "@id": "schema:population"}, - "position": { "@id": "schema:position"}, - "possibleComplication": { "@id": "schema:possibleComplication"}, - "possibleTreatment": { "@id": "schema:possibleTreatment"}, - "postOfficeBoxNumber": { "@id": "schema:postOfficeBoxNumber"}, - "postOp": { "@id": "schema:postOp"}, - "postalCode": { "@id": "schema:postalCode"}, - "potentialAction": { "@id": "schema:potentialAction"}, - "preOp": { "@id": "schema:preOp"}, - "predecessorOf": { "@id": "schema:predecessorOf"}, - "pregnancyCategory": { "@id": "schema:pregnancyCategory"}, - "pregnancyWarning": { "@id": "schema:pregnancyWarning"}, - "prepTime": { "@id": "schema:prepTime"}, - "preparation": { "@id": "schema:preparation"}, - "prescribingInfo": { "@id": "schema:prescribingInfo", "@type": "@id"}, - "prescriptionStatus": { "@id": "schema:prescriptionStatus"}, - "previousItem": { "@id": "schema:previousItem"}, - "previousStartDate": { "@id": "schema:previousStartDate", "@type": "Date"}, - "price": { "@id": "schema:price"}, - "priceComponent": { "@id": "schema:priceComponent"}, - "priceCurrency": { "@id": "schema:priceCurrency"}, - "priceRange": { "@id": "schema:priceRange"}, - "priceSpecification": { "@id": "schema:priceSpecification"}, - "priceType": { "@id": "schema:priceType"}, - "priceValidUntil": { "@id": "schema:priceValidUntil", "@type": "Date"}, - "primaryImageOfPage": { "@id": "schema:primaryImageOfPage"}, - "primaryPrevention": { "@id": "schema:primaryPrevention"}, - "printColumn": { "@id": "schema:printColumn"}, - "printEdition": { "@id": "schema:printEdition"}, - "printPage": { "@id": "schema:printPage"}, - "printSection": { "@id": "schema:printSection"}, - "procedure": { "@id": "schema:procedure"}, - "procedureType": { "@id": "schema:procedureType"}, - "processingTime": { "@id": "schema:processingTime"}, - "processorRequirements": { "@id": "schema:processorRequirements"}, - "producer": { "@id": "schema:producer"}, - "produces": { "@id": "schema:produces"}, - "productID": { "@id": "schema:productID"}, - "productReturnDays": { "@id": "schema:productReturnDays"}, - "productReturnLink": { "@id": "schema:productReturnLink", "@type": "@id"}, - "productSupported": { "@id": "schema:productSupported"}, - "productionCompany": { "@id": "schema:productionCompany"}, - "productionDate": { "@id": "schema:productionDate", "@type": "Date"}, - "proficiencyLevel": { "@id": "schema:proficiencyLevel"}, - "programMembershipUsed": { "@id": "schema:programMembershipUsed"}, - "programName": { "@id": "schema:programName"}, - "programmingLanguage": { "@id": "schema:programmingLanguage"}, - "programmingModel": { "@id": "schema:programmingModel"}, - "propertyID": { "@id": "schema:propertyID"}, - "proprietaryName": { "@id": "schema:proprietaryName"}, - "proteinContent": { "@id": "schema:proteinContent"}, - "provider": { "@id": "schema:provider"}, - "providerMobility": { "@id": "schema:providerMobility"}, - "providesBroadcastService": { "@id": "schema:providesBroadcastService"}, - "providesService": { "@id": "schema:providesService"}, - "publicAccess": { "@id": "schema:publicAccess"}, - "publication": { "@id": "schema:publication"}, - "publicationType": { "@id": "schema:publicationType"}, - "publishedBy": { "@id": "schema:publishedBy"}, - "publishedOn": { "@id": "schema:publishedOn"}, - "publisher": { "@id": "schema:publisher"}, - "publisherImprint": { "@id": "schema:publisherImprint"}, - "publishingPrinciples": { "@id": "schema:publishingPrinciples", "@type": "@id"}, - "purchaseDate": { "@id": "schema:purchaseDate", "@type": "Date"}, - "purpose": { "@id": "schema:purpose"}, - "qualifications": { "@id": "schema:qualifications"}, - "query": { "@id": "schema:query"}, - "quest": { "@id": "schema:quest"}, - "question": { "@id": "schema:question"}, - "rangeIncludes": { "@id": "schema:rangeIncludes"}, - "ratingCount": { "@id": "schema:ratingCount"}, - "ratingValue": { "@id": "schema:ratingValue"}, - "readBy": { "@id": "schema:readBy"}, - "readonlyValue": { "@id": "schema:readonlyValue"}, - "realEstateAgent": { "@id": "schema:realEstateAgent"}, - "recipe": { "@id": "schema:recipe"}, - "recipeCategory": { "@id": "schema:recipeCategory"}, - "recipeCuisine": { "@id": "schema:recipeCuisine"}, - "recipeIngredient": { "@id": "schema:recipeIngredient"}, - "recipeInstructions": { "@id": "schema:recipeInstructions"}, - "recipeYield": { "@id": "schema:recipeYield"}, - "recipient": { "@id": "schema:recipient"}, - "recognizedBy": { "@id": "schema:recognizedBy"}, - "recognizingAuthority": { "@id": "schema:recognizingAuthority"}, - "recommendationStrength": { "@id": "schema:recommendationStrength"}, - "recommendedIntake": { "@id": "schema:recommendedIntake"}, - "recordLabel": { "@id": "schema:recordLabel"}, - "recordedAs": { "@id": "schema:recordedAs"}, - "recordedAt": { "@id": "schema:recordedAt"}, - "recordedIn": { "@id": "schema:recordedIn"}, - "recordingOf": { "@id": "schema:recordingOf"}, - "recourseLoan": { "@id": "schema:recourseLoan"}, - "referenceQuantity": { "@id": "schema:referenceQuantity"}, - "referencesOrder": { "@id": "schema:referencesOrder"}, - "refundType": { "@id": "schema:refundType"}, - "regionDrained": { "@id": "schema:regionDrained"}, - "regionsAllowed": { "@id": "schema:regionsAllowed"}, - "relatedAnatomy": { "@id": "schema:relatedAnatomy"}, - "relatedCondition": { "@id": "schema:relatedCondition"}, - "relatedDrug": { "@id": "schema:relatedDrug"}, - "relatedLink": { "@id": "schema:relatedLink", "@type": "@id"}, - "relatedStructure": { "@id": "schema:relatedStructure"}, - "relatedTherapy": { "@id": "schema:relatedTherapy"}, - "relatedTo": { "@id": "schema:relatedTo"}, - "releaseDate": { "@id": "schema:releaseDate", "@type": "Date"}, - "releaseNotes": { "@id": "schema:releaseNotes"}, - "releaseOf": { "@id": "schema:releaseOf"}, - "releasedEvent": { "@id": "schema:releasedEvent"}, - "relevantOccupation": { "@id": "schema:relevantOccupation"}, - "relevantSpecialty": { "@id": "schema:relevantSpecialty"}, - "remainingAttendeeCapacity": { "@id": "schema:remainingAttendeeCapacity"}, - "renegotiableLoan": { "@id": "schema:renegotiableLoan"}, - "repeatCount": { "@id": "schema:repeatCount"}, - "repeatFrequency": { "@id": "schema:repeatFrequency"}, - "repetitions": { "@id": "schema:repetitions"}, - "replacee": { "@id": "schema:replacee"}, - "replacer": { "@id": "schema:replacer"}, - "replyToUrl": { "@id": "schema:replyToUrl", "@type": "@id"}, - "reportNumber": { "@id": "schema:reportNumber"}, - "representativeOfPage": { "@id": "schema:representativeOfPage"}, - "requiredCollateral": { "@id": "schema:requiredCollateral"}, - "requiredGender": { "@id": "schema:requiredGender"}, - "requiredMaxAge": { "@id": "schema:requiredMaxAge"}, - "requiredMinAge": { "@id": "schema:requiredMinAge"}, - "requiredQuantity": { "@id": "schema:requiredQuantity"}, - "requirements": { "@id": "schema:requirements"}, - "requiresSubscription": { "@id": "schema:requiresSubscription"}, - "reservationFor": { "@id": "schema:reservationFor"}, - "reservationId": { "@id": "schema:reservationId"}, - "reservationStatus": { "@id": "schema:reservationStatus"}, - "reservedTicket": { "@id": "schema:reservedTicket"}, - "responsibilities": { "@id": "schema:responsibilities"}, - "restPeriods": { "@id": "schema:restPeriods"}, - "result": { "@id": "schema:result"}, - "resultComment": { "@id": "schema:resultComment"}, - "resultReview": { "@id": "schema:resultReview"}, - "returnFees": { "@id": "schema:returnFees"}, - "returnPolicyCategory": { "@id": "schema:returnPolicyCategory"}, - "review": { "@id": "schema:review"}, - "reviewAspect": { "@id": "schema:reviewAspect"}, - "reviewBody": { "@id": "schema:reviewBody"}, - "reviewCount": { "@id": "schema:reviewCount"}, - "reviewRating": { "@id": "schema:reviewRating"}, - "reviewedBy": { "@id": "schema:reviewedBy"}, - "reviews": { "@id": "schema:reviews"}, - "riskFactor": { "@id": "schema:riskFactor"}, - "risks": { "@id": "schema:risks"}, - "roleName": { "@id": "schema:roleName"}, - "roofLoad": { "@id": "schema:roofLoad"}, - "rsvpResponse": { "@id": "schema:rsvpResponse"}, - "runsTo": { "@id": "schema:runsTo"}, - "runtime": { "@id": "schema:runtime"}, - "runtimePlatform": { "@id": "schema:runtimePlatform"}, - "rxcui": { "@id": "schema:rxcui"}, - "safetyConsideration": { "@id": "schema:safetyConsideration"}, - "salaryCurrency": { "@id": "schema:salaryCurrency"}, - "sameAs": { "@id": "schema:sameAs", "@type": "@id"}, - "sampleType": { "@id": "schema:sampleType"}, - "saturatedFatContent": { "@id": "schema:saturatedFatContent"}, - "scheduledPaymentDate": { "@id": "schema:scheduledPaymentDate", "@type": "Date"}, - "scheduledTime": { "@id": "schema:scheduledTime", "@type": "DateTime"}, - "schemaVersion": { "@id": "schema:schemaVersion"}, - "screenCount": { "@id": "schema:screenCount"}, - "screenshot": { "@id": "schema:screenshot", "@type": "@id"}, - "sdDatePublished": { "@id": "schema:sdDatePublished", "@type": "Date"}, - "sdLicense": { "@id": "schema:sdLicense", "@type": "@id"}, - "sdPublisher": { "@id": "schema:sdPublisher"}, - "season": { "@id": "schema:season"}, - "seasonNumber": { "@id": "schema:seasonNumber"}, - "seasons": { "@id": "schema:seasons"}, - "seatNumber": { "@id": "schema:seatNumber"}, - "seatRow": { "@id": "schema:seatRow"}, - "seatSection": { "@id": "schema:seatSection"}, - "seatingCapacity": { "@id": "schema:seatingCapacity"}, - "seatingType": { "@id": "schema:seatingType"}, - "secondaryPrevention": { "@id": "schema:secondaryPrevention"}, - "securityScreening": { "@id": "schema:securityScreening"}, - "seeks": { "@id": "schema:seeks"}, - "seller": { "@id": "schema:seller"}, - "sender": { "@id": "schema:sender"}, - "sensoryUnit": { "@id": "schema:sensoryUnit"}, - "serialNumber": { "@id": "schema:serialNumber"}, - "seriousAdverseOutcome": { "@id": "schema:seriousAdverseOutcome"}, - "serverStatus": { "@id": "schema:serverStatus"}, - "servesCuisine": { "@id": "schema:servesCuisine"}, - "serviceArea": { "@id": "schema:serviceArea"}, - "serviceAudience": { "@id": "schema:serviceAudience"}, - "serviceLocation": { "@id": "schema:serviceLocation"}, - "serviceOperator": { "@id": "schema:serviceOperator"}, - "serviceOutput": { "@id": "schema:serviceOutput"}, - "servicePhone": { "@id": "schema:servicePhone"}, - "servicePostalAddress": { "@id": "schema:servicePostalAddress"}, - "serviceSmsNumber": { "@id": "schema:serviceSmsNumber"}, - "serviceType": { "@id": "schema:serviceType"}, - "serviceUrl": { "@id": "schema:serviceUrl", "@type": "@id"}, - "servingSize": { "@id": "schema:servingSize"}, - "sharedContent": { "@id": "schema:sharedContent"}, - "sibling": { "@id": "schema:sibling"}, - "siblings": { "@id": "schema:siblings"}, - "signDetected": { "@id": "schema:signDetected"}, - "signOrSymptom": { "@id": "schema:signOrSymptom"}, - "significance": { "@id": "schema:significance"}, - "significantLink": { "@id": "schema:significantLink", "@type": "@id"}, - "significantLinks": { "@id": "schema:significantLinks", "@type": "@id"}, - "skills": { "@id": "schema:skills"}, - "sku": { "@id": "schema:sku"}, - "slogan": { "@id": "schema:slogan"}, - "smokingAllowed": { "@id": "schema:smokingAllowed"}, - "sodiumContent": { "@id": "schema:sodiumContent"}, - "softwareAddOn": { "@id": "schema:softwareAddOn"}, - "softwareHelp": { "@id": "schema:softwareHelp"}, - "softwareRequirements": { "@id": "schema:softwareRequirements"}, - "softwareVersion": { "@id": "schema:softwareVersion"}, - "source": { "@id": "schema:source"}, - "sourceOrganization": { "@id": "schema:sourceOrganization"}, - "sourcedFrom": { "@id": "schema:sourcedFrom"}, - "spatial": { "@id": "schema:spatial"}, - "spatialCoverage": { "@id": "schema:spatialCoverage"}, - "speakable": { "@id": "schema:speakable", "@type": "@id"}, - "specialCommitments": { "@id": "schema:specialCommitments"}, - "specialOpeningHoursSpecification": { "@id": "schema:specialOpeningHoursSpecification"}, - "specialty": { "@id": "schema:specialty"}, - "speed": { "@id": "schema:speed"}, - "spokenByCharacter": { "@id": "schema:spokenByCharacter"}, - "sponsor": { "@id": "schema:sponsor"}, - "sport": { "@id": "schema:sport"}, - "sportsActivityLocation": { "@id": "schema:sportsActivityLocation"}, - "sportsEvent": { "@id": "schema:sportsEvent"}, - "sportsTeam": { "@id": "schema:sportsTeam"}, - "spouse": { "@id": "schema:spouse"}, - "stage": { "@id": "schema:stage"}, - "stageAsNumber": { "@id": "schema:stageAsNumber"}, - "starRating": { "@id": "schema:starRating"}, - "startDate": { "@id": "schema:startDate", "@type": "Date"}, - "startOffset": { "@id": "schema:startOffset"}, - "startTime": { "@id": "schema:startTime", "@type": "DateTime"}, - "status": { "@id": "schema:status"}, - "steeringPosition": { "@id": "schema:steeringPosition"}, - "step": { "@id": "schema:step"}, - "stepValue": { "@id": "schema:stepValue"}, - "steps": { "@id": "schema:steps"}, - "storageRequirements": { "@id": "schema:storageRequirements"}, - "streetAddress": { "@id": "schema:streetAddress"}, - "strengthUnit": { "@id": "schema:strengthUnit"}, - "strengthValue": { "@id": "schema:strengthValue"}, - "structuralClass": { "@id": "schema:structuralClass"}, - "study": { "@id": "schema:study"}, - "studyDesign": { "@id": "schema:studyDesign"}, - "studyLocation": { "@id": "schema:studyLocation"}, - "studySubject": { "@id": "schema:studySubject"}, - "stupidProperty": { "@id": "schema:stupidProperty"}, - "subEvent": { "@id": "schema:subEvent"}, - "subEvents": { "@id": "schema:subEvents"}, - "subOrganization": { "@id": "schema:subOrganization"}, - "subReservation": { "@id": "schema:subReservation"}, - "subStageSuffix": { "@id": "schema:subStageSuffix"}, - "subStructure": { "@id": "schema:subStructure"}, - "subTest": { "@id": "schema:subTest"}, - "subTrip": { "@id": "schema:subTrip"}, - "subjectOf": { "@id": "schema:subjectOf"}, - "subtitleLanguage": { "@id": "schema:subtitleLanguage"}, - "subtype": { "@id": "schema:subtype"}, - "successorOf": { "@id": "schema:successorOf"}, - "sugarContent": { "@id": "schema:sugarContent"}, - "suggestedAnswer": { "@id": "schema:suggestedAnswer"}, - "suggestedGender": { "@id": "schema:suggestedGender"}, - "suggestedMaxAge": { "@id": "schema:suggestedMaxAge"}, - "suggestedMinAge": { "@id": "schema:suggestedMinAge"}, - "suitableForDiet": { "@id": "schema:suitableForDiet"}, - "superEvent": { "@id": "schema:superEvent"}, - "supersededBy": { "@id": "schema:supersededBy"}, - "supply": { "@id": "schema:supply"}, - "supplyTo": { "@id": "schema:supplyTo"}, - "supportingData": { "@id": "schema:supportingData"}, - "surface": { "@id": "schema:surface"}, - "target": { "@id": "schema:target"}, - "targetCollection": { "@id": "schema:targetCollection"}, - "targetDescription": { "@id": "schema:targetDescription"}, - "targetName": { "@id": "schema:targetName"}, - "targetPlatform": { "@id": "schema:targetPlatform"}, - "targetPopulation": { "@id": "schema:targetPopulation"}, - "targetProduct": { "@id": "schema:targetProduct"}, - "targetUrl": { "@id": "schema:targetUrl", "@type": "@id"}, - "taxID": { "@id": "schema:taxID"}, - "telephone": { "@id": "schema:telephone"}, - "temporal": { "@id": "schema:temporal"}, - "temporalCoverage": { "@id": "schema:temporalCoverage"}, - "termCode": { "@id": "schema:termCode"}, - "termsOfService": { "@id": "schema:termsOfService"}, - "text": { "@id": "schema:text"}, - "thumbnail": { "@id": "schema:thumbnail"}, - "thumbnailUrl": { "@id": "schema:thumbnailUrl", "@type": "@id"}, - "tickerSymbol": { "@id": "schema:tickerSymbol"}, - "ticketNumber": { "@id": "schema:ticketNumber"}, - "ticketToken": { "@id": "schema:ticketToken"}, - "ticketedSeat": { "@id": "schema:ticketedSeat"}, - "timeRequired": { "@id": "schema:timeRequired"}, - "tissueSample": { "@id": "schema:tissueSample"}, - "title": { "@id": "schema:title"}, - "toLocation": { "@id": "schema:toLocation"}, - "toRecipient": { "@id": "schema:toRecipient"}, - "tongueWeight": { "@id": "schema:tongueWeight"}, - "tool": { "@id": "schema:tool"}, - "torque": { "@id": "schema:torque"}, - "totalPaymentDue": { "@id": "schema:totalPaymentDue"}, - "totalPrice": { "@id": "schema:totalPrice"}, - "totalTime": { "@id": "schema:totalTime"}, - "touristType": { "@id": "schema:touristType"}, - "track": { "@id": "schema:track"}, - "trackingNumber": { "@id": "schema:trackingNumber"}, - "trackingUrl": { "@id": "schema:trackingUrl", "@type": "@id"}, - "tracks": { "@id": "schema:tracks"}, - "trailer": { "@id": "schema:trailer"}, - "trailerWeight": { "@id": "schema:trailerWeight"}, - "trainName": { "@id": "schema:trainName"}, - "trainNumber": { "@id": "schema:trainNumber"}, - "transFatContent": { "@id": "schema:transFatContent"}, - "transcript": { "@id": "schema:transcript"}, - "translationOfWork": { "@id": "schema:translationOfWork"}, - "translator": { "@id": "schema:translator"}, - "transmissionMethod": { "@id": "schema:transmissionMethod"}, - "trialDesign": { "@id": "schema:trialDesign"}, - "tributary": { "@id": "schema:tributary"}, - "typeOfBed": { "@id": "schema:typeOfBed"}, - "typeOfGood": { "@id": "schema:typeOfGood"}, - "typicalAgeRange": { "@id": "schema:typicalAgeRange"}, - "typicalTest": { "@id": "schema:typicalTest"}, - "underName": { "@id": "schema:underName"}, - "unitCode": { "@id": "schema:unitCode"}, - "unitText": { "@id": "schema:unitText"}, - "unnamedSourcesPolicy": { "@id": "schema:unnamedSourcesPolicy", "@type": "@id"}, - "unsaturatedFatContent": { "@id": "schema:unsaturatedFatContent"}, - "uploadDate": { "@id": "schema:uploadDate", "@type": "Date"}, - "upvoteCount": { "@id": "schema:upvoteCount"}, - "url": { "@id": "schema:url", "@type": "@id"}, - "urlTemplate": { "@id": "schema:urlTemplate"}, - "usedToDiagnose": { "@id": "schema:usedToDiagnose"}, - "userInteractionCount": { "@id": "schema:userInteractionCount"}, - "usesDevice": { "@id": "schema:usesDevice"}, - "usesHealthPlanIdStandard": { "@id": "schema:usesHealthPlanIdStandard"}, - "validFor": { "@id": "schema:validFor"}, - "validFrom": { "@id": "schema:validFrom", "@type": "Date"}, - "validIn": { "@id": "schema:validIn"}, - "validThrough": { "@id": "schema:validThrough", "@type": "Date"}, - "validUntil": { "@id": "schema:validUntil", "@type": "Date"}, - "value": { "@id": "schema:value"}, - "valueAddedTaxIncluded": { "@id": "schema:valueAddedTaxIncluded"}, - "valueMaxLength": { "@id": "schema:valueMaxLength"}, - "valueMinLength": { "@id": "schema:valueMinLength"}, - "valueName": { "@id": "schema:valueName"}, - "valuePattern": { "@id": "schema:valuePattern"}, - "valueReference": { "@id": "schema:valueReference"}, - "valueRequired": { "@id": "schema:valueRequired"}, - "variableMeasured": { "@id": "schema:variableMeasured"}, - "variablesMeasured": { "@id": "schema:variablesMeasured"}, - "variantCover": { "@id": "schema:variantCover"}, - "vatID": { "@id": "schema:vatID"}, - "vehicleConfiguration": { "@id": "schema:vehicleConfiguration"}, - "vehicleEngine": { "@id": "schema:vehicleEngine"}, - "vehicleIdentificationNumber": { "@id": "schema:vehicleIdentificationNumber"}, - "vehicleInteriorColor": { "@id": "schema:vehicleInteriorColor"}, - "vehicleInteriorType": { "@id": "schema:vehicleInteriorType"}, - "vehicleModelDate": { "@id": "schema:vehicleModelDate", "@type": "Date"}, - "vehicleSeatingCapacity": { "@id": "schema:vehicleSeatingCapacity"}, - "vehicleSpecialUsage": { "@id": "schema:vehicleSpecialUsage"}, - "vehicleTransmission": { "@id": "schema:vehicleTransmission"}, - "vendor": { "@id": "schema:vendor"}, - "verificationFactCheckingPolicy": { "@id": "schema:verificationFactCheckingPolicy", "@type": "@id"}, - "version": { "@id": "schema:version"}, - "video": { "@id": "schema:video"}, - "videoFormat": { "@id": "schema:videoFormat"}, - "videoFrameSize": { "@id": "schema:videoFrameSize"}, - "videoQuality": { "@id": "schema:videoQuality"}, - "volumeNumber": { "@id": "schema:volumeNumber"}, - "warning": { "@id": "schema:warning"}, - "warranty": { "@id": "schema:warranty"}, - "warrantyPromise": { "@id": "schema:warrantyPromise"}, - "warrantyScope": { "@id": "schema:warrantyScope"}, - "webCheckinTime": { "@id": "schema:webCheckinTime", "@type": "DateTime"}, - "weight": { "@id": "schema:weight"}, - "weightTotal": { "@id": "schema:weightTotal"}, - "wheelbase": { "@id": "schema:wheelbase"}, - "width": { "@id": "schema:width"}, - "winner": { "@id": "schema:winner"}, - "wordCount": { "@id": "schema:wordCount"}, - "workExample": { "@id": "schema:workExample"}, - "workFeatured": { "@id": "schema:workFeatured"}, - "workHours": { "@id": "schema:workHours"}, - "workLocation": { "@id": "schema:workLocation"}, - "workPerformed": { "@id": "schema:workPerformed"}, - "workPresented": { "@id": "schema:workPresented"}, - "workTranslation": { "@id": "schema:workTranslation"}, - "workload": { "@id": "schema:workload"}, - "worksFor": { "@id": "schema:worksFor"}, - "worstRating": { "@id": "schema:worstRating"}, - "xpath": { "@id": "schema:xpath"}, - "yearlyRevenue": { "@id": "schema:yearlyRevenue"}, - "yearsInOperation": { "@id": "schema:yearsInOperation"}, - "yield": { "@id": "schema:yield"}, - "http://publications.europa.eu/mdr/eli/index.html": {"@id": "http://publications.europa.eu/mdr/eli/index.html"}, - "httpMethod": { "@id": "schema:httpMethod"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Automotive_Ontology_Working_Group": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Automotive_Ontology_Working_Group"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#FIBO": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#FIBO"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#GLEIF": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#GLEIF"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#IIT-CNR.it": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#IIT-CNR.it"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#MBZ": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#MBZ"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Tourism": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Tourism"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_ActionCollabClass": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_ActionCollabClass"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_DatasetClass": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_DatasetClass"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsClass": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsClass"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsTerms": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsTerms"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_LRMIClass": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_LRMIClass"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_QAStackExchange": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_QAStackExchange"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_WikiDoc": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_WikiDoc"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex"}, - "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews": {"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews"}, - "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#STI_Accommodation_Ontology": {"@id": "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#STI_Accommodation_Ontology"}, - "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP": {"@id": "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP"}, - "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP-draws": {"@id": "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP-draws"} - } -} diff --git a/src/utils/vc/contexts/security_context.js b/src/utils/vc/contexts/security_context.js deleted file mode 100644 index 780f8e78a..000000000 --- a/src/utils/vc/contexts/security_context.js +++ /dev/null @@ -1,63 +0,0 @@ -// TODO: Check if this can be used an extension to https://w3id.org/security/v2 - -export default { - '@context': [{ - '@version': 1.1, - }, 'https://w3id.org/security/v1', { - AesKeyWrappingKey2019: 'sec:AesKeyWrappingKey2019', - DeleteKeyOperation: 'sec:DeleteKeyOperation', - DeriveSecretOperation: 'sec:DeriveSecretOperation', - EcdsaSecp256k1Signature2019: 'sec:EcdsaSecp256k1Signature2019', - EcdsaSecp256r1Signature2019: 'sec:EcdsaSecp256r1Signature2019', - EcdsaSecp256k1VerificationKey2019: 'sec:EcdsaSecp256k1VerificationKey2019', - EcdsaSecp256r1VerificationKey2019: 'sec:EcdsaSecp256r1VerificationKey2019', - Ed25519Signature2018: 'sec:Ed25519Signature2018', - Ed25519VerificationKey2018: 'sec:Ed25519VerificationKey2018', - Sr25519Signature2020: 'sec:Sr25519Signature2020', - Sr25519VerificationKey2020: 'sec:Sr25519VerificationKey2020', - EquihashProof2018: 'sec:EquihashProof2018', - ExportKeyOperation: 'sec:ExportKeyOperation', - GenerateKeyOperation: 'sec:GenerateKeyOperation', - KmsOperation: 'sec:KmsOperation', - RevokeKeyOperation: 'sec:RevokeKeyOperation', - RsaSignature2018: 'sec:RsaSignature2018', - RsaVerificationKey2018: 'sec:RsaVerificationKey2018', - Sha256HmacKey2019: 'sec:Sha256HmacKey2019', - SignOperation: 'sec:SignOperation', - UnwrapKeyOperation: 'sec:UnwrapKeyOperation', - VerifyOperation: 'sec:VerifyOperation', - WrapKeyOperation: 'sec:WrapKeyOperation', - X25519KeyAgreementKey2019: 'sec:X25519KeyAgreementKey2019', - - allowedAction: 'sec:allowedAction', - assertionMethod: { '@id': 'sec:assertionMethod', '@type': '@id', '@container': '@set' }, - authentication: { '@id': 'sec:authenticationMethod', '@type': '@id', '@container': '@set' }, - capability: { '@id': 'sec:capability', '@type': '@id' }, - capabilityAction: 'sec:capabilityAction', - capabilityChain: { '@id': 'sec:capabilityChain', '@type': '@id', '@container': '@list' }, - capabilityDelegation: { '@id': 'sec:capabilityDelegationMethod', '@type': '@id', '@container': '@set' }, - capabilityInvocation: { '@id': 'sec:capabilityInvocationMethod', '@type': '@id', '@container': '@set' }, - caveat: { '@id': 'sec:caveat', '@type': '@id', '@container': '@set' }, - challenge: 'sec:challenge', - ciphertext: 'sec:ciphertext', - controller: { '@id': 'sec:controller', '@type': '@id' }, - delegator: { '@id': 'sec:delegator', '@type': '@id' }, - equihashParameterK: { '@id': 'sec:equihashParameterK', '@type': 'xsd:integer' }, - equihashParameterN: { '@id': 'sec:equihashParameterN', '@type': 'xsd:integer' }, - invocationTarget: { '@id': 'sec:invocationTarget', '@type': '@id' }, - invoker: { '@id': 'sec:invoker', '@type': '@id' }, - jws: 'sec:jws', - keyAgreement: { '@id': 'sec:keyAgreementMethod', '@type': '@id', '@container': '@set' }, - kmsModule: { '@id': 'sec:kmsModule' }, - parentCapability: { '@id': 'sec:parentCapability', '@type': '@id' }, - plaintext: 'sec:plaintext', - proof: { '@id': 'sec:proof', '@type': '@id', '@container': '@graph' }, - proofPurpose: { '@id': 'sec:proofPurpose', '@type': '@vocab' }, - proofValue: 'sec:proofValue', - referenceId: 'sec:referenceId', - unwrappedKey: 'sec:unwrappedKey', - verificationMethod: { '@id': 'sec:verificationMethod', '@type': '@id' }, - verifyData: 'sec:verifyData', - wrappedKey: 'sec:wrappedKey', - }], -}; diff --git a/src/utils/vc/contexts/sphereon-wallet-identity-v1.json b/src/utils/vc/contexts/sphereon-wallet-identity-v1.json deleted file mode 100644 index 65ac305b9..000000000 --- a/src/utils/vc/contexts/sphereon-wallet-identity-v1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "@context": { - "@version": 1.1, - "@protected": true, - "swi": "https://sphereon-opensource.github.io/ssi-mobile-wallet/context/sphereon-wallet-identity-v1#", - "schema": "https://schema.org/", - "SphereonWalletIdentityCredential": "swi:SphereonWalletIdentityCredential", - "id": "@id", - "type": "@type", - "firstName": "swi:firstName", - "lastName": "swi:lastName", - "emailAddress": { - "@id": "swi:emailAddress", - "@type": "schema:email" - } - } -} diff --git a/src/utils/vc/crypto/Sr25519Signature2020.js b/src/utils/vc/crypto/Sr25519Signature2020.js deleted file mode 100644 index 591cf5736..000000000 --- a/src/utils/vc/crypto/Sr25519Signature2020.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Sr25519SigName, Sr25519VerKeyName } from './constants'; -import Sr25519VerificationKey2020 from './Sr25519VerificationKey2020'; -import CustomLinkedDataSignature from './common/CustomLinkedDataSignature'; - -const SUITE_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1'; - -export default class Sr25519Signature2020 extends CustomLinkedDataSignature { - /** - * Creates a new Sr25519Signature2020 instance - * @constructor - * @param {object} config - Configuration options - */ - constructor({ - keypair, verificationMethod, verifier, signer, useProofValue, - } = {}) { - super({ - type: Sr25519SigName, - LDKeyClass: Sr25519VerificationKey2020, - contextUrl: SUITE_CONTEXT_URL, - alg: 'Schnorr', - signer: signer || Sr25519Signature2020.signerFactory(keypair, verificationMethod), - verifier, - useProofValue, - }); - this.requiredKeyType = Sr25519VerKeyName; - } - - /** - * Generate object with `sign` method - * @param keypair - * @param verificationMethod - * @returns {object} - */ - static signerFactory(keypair, verificationMethod) { - return { - id: verificationMethod, - async sign({ data }) { - return keypair.sign(data); - }, - }; - } -} diff --git a/src/utils/vc/crypto/Sr25519VerificationKey2020.js b/src/utils/vc/crypto/Sr25519VerificationKey2020.js deleted file mode 100644 index bda995b98..000000000 --- a/src/utils/vc/crypto/Sr25519VerificationKey2020.js +++ /dev/null @@ -1,53 +0,0 @@ -import b58 from 'bs58'; -import * as base64 from '@juanelas/base64'; -import { u8aToU8a } from '@polkadot/util'; -import { sr25519Verify } from '@polkadot/util-crypto/sr25519'; -import { Sr25519VerKeyName } from './constants'; - -export default class Sr25519VerificationKey2020 { - constructor(publicKey) { - this.publicKey = u8aToU8a(publicKey); - } - - /** - * Construct the public key object from the verification method - * @param verificationMethod - * @returns {Sr25519VerificationKey2020} - */ - static from(verificationMethod) { - if (!verificationMethod.type || verificationMethod.type.indexOf(Sr25519VerKeyName) === -1) { - throw new Error(`verification method should have type ${Sr25519VerKeyName} - got: ${verificationMethod.type}`); - } - - if (verificationMethod.publicKeyBase58) { - return new this(b58.decode(verificationMethod.publicKeyBase58)); - } - - if (verificationMethod.publicKeyBase64) { - return new this(base64.decode(verificationMethod.publicKeyBase64)); - } - - throw new Error(`Unsupported signature encoding for ${Sr25519VerKeyName}`); - } - - /** - * Construct the verifier factory that has the verify method using the current public key - * @returns {object} - */ - verifier() { - return Sr25519VerificationKey2020.verifierFactory(this.publicKey); - } - - /** - * Verifier factory that returns the object with the verify method - * @param publicKey - * @returns {object} - */ - static verifierFactory(publicKey) { - return { - async verify({ data, signature }) { - return sr25519Verify(data, signature, publicKey); - }, - }; - } -} diff --git a/src/utils/vc/schemas/schema-draft-07.js b/src/utils/vc/schemas/schema-draft-07.js deleted file mode 100644 index 4276312d6..000000000 --- a/src/utils/vc/schemas/schema-draft-07.js +++ /dev/null @@ -1,174 +0,0 @@ -/* eslint-disable */ - -export default { - $schema: 'http://json-schema.org/draft-07/schema#', - $id: 'http://json-schema.org/draft-07/schema#', - title: 'Core schema meta-schema', - definitions: { - schemaArray: { - type: 'array', - minItems: 1, - items: { $ref: '#' }, - }, - nonNegativeInteger: { - type: 'integer', - minimum: 0, - }, - nonNegativeIntegerDefault0: { - allOf: [ - { $ref: '#/definitions/nonNegativeInteger' }, - { default: 0 }, - ], - }, - simpleTypes: { - enum: [ - 'array', - 'boolean', - 'integer', - 'null', - 'number', - 'object', - 'string', - ], - }, - stringArray: { - type: 'array', - items: { type: 'string' }, - uniqueItems: true, - default: [], - }, - }, - type: ['object', 'boolean'], - properties: { - $id: { - type: 'string', - format: 'uri-reference', - }, - $schema: { - type: 'string', - format: 'uri', - }, - $ref: { - type: 'string', - format: 'uri-reference', - }, - $comment: { - type: 'string', - }, - title: { - type: 'string', - }, - description: { - type: 'string', - }, - default: true, - readOnly: { - type: 'boolean', - default: false, - }, - writeOnly: { - type: 'boolean', - default: false, - }, - examples: { - type: 'array', - items: true, - }, - multipleOf: { - type: 'number', - exclusiveMinimum: 0, - }, - maximum: { - type: 'number', - }, - exclusiveMaximum: { - type: 'number', - }, - minimum: { - type: 'number', - }, - exclusiveMinimum: { - type: 'number', - }, - maxLength: { $ref: '#/definitions/nonNegativeInteger' }, - minLength: { $ref: '#/definitions/nonNegativeIntegerDefault0' }, - pattern: { - type: 'string', - format: 'regex', - }, - additionalItems: { $ref: '#' }, - items: { - anyOf: [ - { $ref: '#' }, - { $ref: '#/definitions/schemaArray' }, - ], - default: true, - }, - maxItems: { $ref: '#/definitions/nonNegativeInteger' }, - minItems: { $ref: '#/definitions/nonNegativeIntegerDefault0' }, - uniqueItems: { - type: 'boolean', - default: false, - }, - contains: { $ref: '#' }, - maxProperties: { $ref: '#/definitions/nonNegativeInteger' }, - minProperties: { $ref: '#/definitions/nonNegativeIntegerDefault0' }, - required: { $ref: '#/definitions/stringArray' }, - additionalProperties: { $ref: '#' }, - definitions: { - type: 'object', - additionalProperties: { $ref: '#' }, - default: {}, - }, - properties: { - type: 'object', - additionalProperties: { $ref: '#' }, - default: {}, - }, - patternProperties: { - type: 'object', - additionalProperties: { $ref: '#' }, - propertyNames: { format: 'regex' }, - default: {}, - }, - dependencies: { - type: 'object', - additionalProperties: { - anyOf: [ - { $ref: '#' }, - { $ref: '#/definitions/stringArray' }, - ], - }, - }, - propertyNames: { $ref: '#' }, - const: true, - enum: { - type: 'array', - items: true, - minItems: 1, - uniqueItems: true, - }, - type: { - anyOf: [ - { $ref: '#/definitions/simpleTypes' }, - { - type: 'array', - items: { $ref: '#/definitions/simpleTypes' }, - minItems: 1, - uniqueItems: true, - }, - ], - }, - format: { type: 'string' }, - contentMediaType: { type: 'string' }, - contentEncoding: { type: 'string' }, - if: { $ref: '#' }, - then: { $ref: '#' }, - else: { $ref: '#' }, - allOf: { $ref: '#/definitions/schemaArray' }, - anyOf: { $ref: '#/definitions/schemaArray' }, - oneOf: { $ref: '#/definitions/schemaArray' }, - not: { $ref: '#' }, - }, - default: true, -}; diff --git a/tests/example-credential.js b/tests/example-credential.js deleted file mode 100644 index 786a3e90c..000000000 --- a/tests/example-credential.js +++ /dev/null @@ -1,37 +0,0 @@ -export default { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - { - emailAddress: 'https://schema.org/email', - alumniOf: 'https://schema.org/alumniOf', - }, - ], - id: 'uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc', - type: [ - 'VerifiableCredential', - 'AlumniCredential', - ], - issuanceDate: '2020-03-18T19:23:24Z', - credentialSchema: { // this is the schema - id: 'blob:dock:5C78GCA', - type: 'JsonSchemaValidator2018', - }, - credentialSubject: { - id: 'did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi', - emailAddress: 'johnsmith@example.com', - alumniOf: 'Example University', - }, - credentialStatus: { - id: 'rev-reg:dock:0x0194...', - type: 'CredentialStatusList2017', - }, - issuer: 'did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr', - proof: { - type: 'Ed25519Signature2018', - created: '2020-04-22T07:50:13Z', - jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg', - proofPurpose: 'assertionMethod', - verificationMethod: 'did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1', - }, -}; diff --git a/tests/example-schema.js b/tests/example-schema.js deleted file mode 100644 index abc7ff266..000000000 --- a/tests/example-schema.js +++ /dev/null @@ -1,19 +0,0 @@ -export default { - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Alumni', - type: 'object', - properties: { - id: { - type: 'string', - }, - emailAddress: { - type: 'string', - format: 'email', - }, - alumniOf: { - type: 'string', - }, - }, - required: ['emailAddress', 'alumniOf'], - additionalProperties: false, -}; diff --git a/tests/integration/__snapshots__/fees.test.js.snap b/tests/integration/__snapshots__/fees.test.js.snap deleted file mode 100644 index 6e0857371..000000000 --- a/tests/integration/__snapshots__/fees.test.js.snap +++ /dev/null @@ -1,113 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Fees accumulator 1`] = `10`; - -exports[`Fees accumulator 2`] = `10`; - -exports[`Fees accumulator 3`] = `10`; - -exports[`Fees accumulator 4`] = `10`; - -exports[`Fees accumulator 5`] = `10`; - -exports[`Fees accumulator 6`] = `10`; - -exports[`Fees accumulator 7`] = `10`; - -exports[`Fees accumulator 8`] = `10`; - -exports[`Fees accumulator 9`] = `10`; - -exports[`Fees accumulator 10`] = `10`; - -exports[`Fees accumulator 11`] = `10`; - -exports[`Fees accumulator 12`] = `10`; - -exports[`Fees accumulator 13`] = `10`; - -exports[`Fees accumulator 14`] = `10`; - -exports[`Fees accumulator 15`] = `10`; - -exports[`Fees anchors 1`] = `0`; - -exports[`Fees bbsPlus 1`] = `10`; - -exports[`Fees bbsPlus 2`] = `10`; - -exports[`Fees bbsPlus 3`] = `10`; - -exports[`Fees bbsPlus 4`] = `10`; - -exports[`Fees bbsPlus 5`] = `10`; - -exports[`Fees bbsPlus 6`] = `10`; - -exports[`Fees bbsPlus 7`] = `10`; - -exports[`Fees bbsPlus 8`] = `10`; - -exports[`Fees bbsPlus 9`] = `0`; - -exports[`Fees blobs 1`] = `90`; - -exports[`Fees dids 1`] = `0`; - -exports[`Fees dids 2`] = `10`; - -exports[`Fees dids 3`] = `10`; - -exports[`Fees dids 4`] = `10`; - -exports[`Fees dids 5`] = `10`; - -exports[`Fees dids 6`] = `10`; - -exports[`Fees dids 7`] = `10`; - -exports[`Fees dids 8`] = `10`; - -exports[`Fees dids 9`] = `10`; - -exports[`Fees dids 10`] = `10`; - -exports[`Fees dids 11`] = `10`; - -exports[`Fees dids 12`] = `0`; - -exports[`Fees dids 13`] = `10`; - -exports[`Fees dids 14`] = `10`; - -exports[`Fees dids 15`] = `10`; - -exports[`Fees dids 16`] = `10`; - -exports[`Fees dids 17`] = `10`; - -exports[`Fees dids 18`] = `10`; - -exports[`Fees dids 19`] = `10`; - -exports[`Fees dids 20`] = `10`; - -exports[`Fees dids 21`] = `20`; - -exports[`Fees revocation 1`] = `0`; - -exports[`Fees revocation 2`] = `10`; - -exports[`Fees revocation 3`] = `10`; - -exports[`Fees revocation 4`] = `10`; - -exports[`Fees revocation 5`] = `10`; - -exports[`Fees revocation 6`] = `10`; - -exports[`Fees revocation 7`] = `60`; - -exports[`Fees transfers 1`] = `0`; - -exports[`Fees transfers 2`] = `10`; diff --git a/tests/integration/anchor.test.js b/tests/integration/anchor.test.js deleted file mode 100644 index e52847b6c..000000000 --- a/tests/integration/anchor.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import { randomAsU8a } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; -import { DockAPI } from '../../src/index'; - -import { FullNodeEndpoint, TestKeyringOpts, TestAccountURI } from '../test-constants'; -import { getBlock } from '../../src/utils/chain-ops'; - -describe('Anchoring Module', () => { - const dock = new DockAPI(); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - }); - - test('Can create and query anchors', async () => { - const documents = Array(8).fill(undefined).map(() => randomAsU8a(300)); - - // The root is to be written to chain and proofs must be stored. - const [root, proofs] = dock.anchor.batchDocumentsInMerkleTree(documents); - - // Check that the proof is correct - documents.forEach((d, i) => { - const r = dock.anchor.verifyMerkleProofOfDocument(d, proofs[i], root); - expect(r).toBe(true); - }); - - const resp = await dock.anchor.deploy(root, false); - const block = await getBlock(dock.api, u8aToHex(resp.status.asInBlock)); - const blockNumber = await dock.anchor.get(root); - expect(block.header.number.toNumber()).toBe(blockNumber); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); -}); diff --git a/tests/integration/anoncreds/derived-credentials.test.js b/tests/integration/anoncreds/derived-credentials.test.js deleted file mode 100644 index af49768e2..000000000 --- a/tests/integration/anoncreds/derived-credentials.test.js +++ /dev/null @@ -1,788 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import b58 from 'bs58'; -import { hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util'; -import { - initializeWasm, - BoundCheckSnarkSetup, - Accumulator, - PositiveAccumulator, - dockAccumulatorParams, AccumulatorPublicKey, - Encoder, BBDT16MacSecretKey, MEM_CHECK_STR, KBUniversalAccumulator, - MEM_CHECK_KV_STR, - RevocationStatusProtocol, -} from '@docknetwork/crypto-wasm-ts'; -import { InMemoryState, InMemoryKBUniversalState } from '@docknetwork/crypto-wasm-ts/lib/accumulator/in-memory-persistence'; -import stringify from 'json-stringify-deterministic'; -import { DockAPI } from '../../../src'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, - Schemes, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; -import { getProofMatcherDoc, registerNewDIDUsingPair } from '../helpers'; -import { getKeyDoc } from '../../../src/utils/vc/helpers'; -import { - issueCredential, - signPresentation, - verifyPresentation, - verifyCredential, -} from '../../../src/utils/vc'; -import { DockResolver } from '../../../src/resolver'; -import { createPresentation } from '../../create-presentation'; -import AccumulatorModule, { AccumulatorType } from '../../../src/modules/accumulator'; -import { getKeyedProofsFromVerifiedPresentation } from '../../../src/utils/vc/presentations'; -import { deepClone } from '../../../src/utils/common'; - -// TODO: move to fixtures -const id = 'https://ld.dock.io/examples/resident-card-schema.json'; -const residentCardSchema = { - $schema: 'http://json-schema.org/draft-07/schema#', - $id: id, - title: 'Resident Card Example', - type: 'object', - properties: { - // TOOD: fix and restore below for future - // // NOTE: schema here defines context/type to make sure - // // that the string conversion works even with it defined in schema - // '@context': { - // type: 'array', - // }, - // type: { - // type: 'array', - // }, - credentialSubject: { - type: 'object', - properties: { - givenName: { - title: 'Given Name', - type: 'string', - }, - familyName: { - title: 'Family Name', - type: 'string', - }, - lprNumber: { - title: 'LPR Number', - type: 'integer', - minimum: 0, - }, - }, - required: ['givenName', 'familyName', 'lprNumber'], - }, - }, -}; - -const embeddedSchema = { - id, - type: 'JsonSchemaValidator2018', - details: stringify({ jsonSchema: residentCardSchema }), -}; - -describe.each(Schemes)('Derived Credentials', ({ - Name, - Module, - Presentation, - CryptoKeyPair, - VerKey, - getModule, - Context, - derivedToAnoncredsPresentation, -}) => { - const dock = new DockAPI(); - const resolver = new DockResolver(dock); - let account; - let did1; - let pair1; - let chainModule; - let keypair; - let didDocument; - - const holder3DID = DockDid.random(); - // seed used for 3rd holder keys - const holder3KeySeed = randomAsHex(32); - - // TODO: move to fixtures - const credentialJSON = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://w3id.org/citizenship/v1', - Context, - ], - id: 'https://issuer.oidp.uscis.gov/credentials/83627465', - type: ['VerifiableCredential', 'PermanentResidentCard'], - credentialSchema: embeddedSchema, - identifier: '83627465', - name: 'Permanent Resident Card', - description: 'Government of Example Permanent Resident Card.', - issuanceDate: '2019-12-03T12:19:52Z', - expirationDate: '2029-12-03T12:19:52Z', - credentialSubject: { - id: 'did:example:b34ca6cd37bbf23', - type: ['PermanentResident', 'Person'], - givenName: 'JOHN', - familyName: 'SMITH', - lprNumber: 1234, - }, - }; - - // Setup 4 accumulators, 2 with keyed verification and 2 with public key verification - - const posAccumulatorId = randomAsHex(32); - const posAccumState = new InMemoryState(); - let posAccumKeypair; - let posAccumWitness; - - const posKvAccumulatorId = randomAsHex(32); - const posKvAccumState = new InMemoryState(); - let posKvAccumSecretKey; - let posKvAccumWitness; - - const uniAccumulatorId = randomAsHex(32); - const uniAccumState = new InMemoryKBUniversalState(); - let uniAccumKeypair; - let uniAccumWitness; - - const uniKvAccumulatorId = randomAsHex(32); - const uniKvAccumState = new InMemoryKBUniversalState(); - let uniKvAccumSecretKey; - let uniKvAccumWitness; - - let accumMember; - let encodedMember; - - async function writeAccumToChain(accumId, keyId, accumulator) { - let accumulated; - if (accumulator instanceof PositiveAccumulator) { - accumulated = AccumulatorModule.accumulatedAsHex(accumulator.accumulated); - await dock.accumulatorModule.addPositiveAccumulator(accumId, accumulated, [did1, keyId], did1, pair1, { didModule: dock.didModule }, false); - } else { - accumulated = AccumulatorModule.accumulatedAsHex(accumulator.accumulated, AccumulatorType.KBUni); - await dock.accumulatorModule.addKBUniversalAccumulator(accumId, accumulated, [did1, keyId], did1, pair1, { didModule: dock.didModule }, false); - } - const queriedAccum = await dock.accumulatorModule.getAccumulator(accumId, false); - expect(queriedAccum.accumulated).toEqual(accumulated); - } - - beforeAll(async () => { - await initializeWasm(); - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - chainModule = getModule(dock); - account = dock.keyring.addFromUri(TestAccountURI); - - dock.setAccount(account); - pair1 = new DidKeypair(dock.keyring.addFromUri(randomAsHex(32)), 1); - did1 = DockDid.random(); - await registerNewDIDUsingPair(dock, did1, pair1); - - keypair = CryptoKeyPair.generate({ - controller: did1, msgCount: 100, - }); - - if (Name !== 'BBDT16') { - const pk1 = Module.prepareAddPublicKey(u8aToHex(keypair.publicKeyBuffer)); - await chainModule.addPublicKey( - pk1, - did1, - did1, - pair1, - { didModule: dock.did }, - false, - ); - - didDocument = await dock.did.getDocument(did1); - const { publicKey } = didDocument; - expect(publicKey.length).toEqual(2); - expect(publicKey[1].type).toEqual(VerKey); - keypair.id = publicKey[1].id; - } else { - // For KVAC, the public doesn't need to published as its not used in credential or presentation verification (except issuers). - // But the signer still adds a key identifier in the credential to determine which key will be used for verification - keypair.id = 'my-key-id'; - } - - // Register holder DID with sr25519 key - await registerNewDIDUsingPair( - dock, - holder3DID, - new DidKeypair(dock.keyring.addFromUri(holder3KeySeed, null, 'sr25519'), 1), - ); - - const params = dockAccumulatorParams(); - - posAccumKeypair = Accumulator.generateKeypair(params); - const bytes1 = u8aToHex(posAccumKeypair.publicKey.bytes); - const posAccumPk = AccumulatorModule.prepareAddPublicKey(bytes1); - await dock.accumulatorModule.addPublicKey( - posAccumPk, - did1, - pair1, - { didModule: dock.did }, - false, - ); - - // For keyed-verification accumulator, public key is not written on chain. - const posKvAccumKeypair = Accumulator.generateKeypair(params); - - uniAccumKeypair = Accumulator.generateKeypair(params); - const bytes2 = u8aToHex(uniAccumKeypair.publicKey.bytes); - const uniAccumPk = AccumulatorModule.prepareAddPublicKey(bytes2); - await dock.accumulatorModule.addPublicKey( - uniAccumPk, - did1, - pair1, - { didModule: dock.did }, - false, - ); - - // For keyed-verification accumulator, public key is not written on chain. - const uniKvAccumKeypair = Accumulator.generateKeypair(params); - - // All 4 accumulators will have the same member - accumMember = '10'; - encodedMember = Encoder.defaultEncodeFunc()(accumMember); - - // The 2 positive accumulators are pre-filled with the following members and the other 2 have the domain set to these - const members = []; - for (let i = 1; i < 100; i++) { - // Using default encoder since thats what the is used in credential by default. Ideally, the encoder specified in - // the particular schema should be used but for that is the default one - members.push(Encoder.defaultEncodeFunc()(i.toString())); - } - - const accumulator = PositiveAccumulator.initialize(params, posAccumKeypair.secretKey); - await accumulator.addBatch(members, posAccumKeypair.secretKey, posAccumState); - await writeAccumToChain(posAccumulatorId, 1, accumulator); - posAccumWitness = await accumulator.membershipWitness(encodedMember, posAccumKeypair.secretKey, posAccumState); - expect(accumulator.verifyMembershipWitness(encodedMember, posAccumWitness, posAccumKeypair.publicKey, params)).toEqual(true); - - const accumulator1 = PositiveAccumulator.initialize(params, posKvAccumKeypair.secretKey); - await accumulator1.addBatch(members, posKvAccumKeypair.secretKey, posKvAccumState); - // For KV accumulator, keyId is 0 - await writeAccumToChain(posKvAccumulatorId, 0, accumulator1); - posKvAccumWitness = await accumulator1.membershipWitness(encodedMember, posKvAccumKeypair.secretKey, posKvAccumState); - posKvAccumSecretKey = posKvAccumKeypair.secretKey; - - const accumulator2 = await KBUniversalAccumulator.initialize(members, params, uniAccumKeypair.secretKey, uniAccumState); - await accumulator2.add(encodedMember, uniAccumKeypair.secretKey, uniAccumState); - await writeAccumToChain(uniAccumulatorId, 2, accumulator2); - uniAccumWitness = await accumulator2.membershipWitness(encodedMember, uniAccumKeypair.secretKey, uniAccumState); - expect(accumulator2.verifyMembershipWitness(encodedMember, uniAccumWitness, uniAccumKeypair.publicKey, params)).toEqual(true); - - const accumulator3 = await KBUniversalAccumulator.initialize(members, params, uniKvAccumKeypair.secretKey, uniKvAccumState); - await accumulator3.add(encodedMember, uniKvAccumKeypair.secretKey, uniKvAccumState); - // For KV accumulator, keyId is 0 - await writeAccumToChain(uniKvAccumulatorId, 0, accumulator3); - uniKvAccumWitness = await accumulator3.membershipWitness(encodedMember, uniKvAccumKeypair.secretKey, uniKvAccumState); - uniKvAccumSecretKey = uniKvAccumKeypair.secretKey; - }, 30000); - - async function createAndVerifyPresentation(credentials, verifyOptions = {}, accumSecretKey = undefined) { - const holderKey = getKeyDoc( - holder3DID, - new DidKeypair(dock.keyring.addFromUri(holder3KeySeed, null, 'sr25519'), 1), - 'Sr25519VerificationKey2020', - ); - - const presId = `https://example.com/pres/${randomAsHex(32)}`; - const chal = randomAsHex(32); - const domain = 'test domain'; - const presentation = createPresentation(credentials, presId); - - // This is done by the verifier - const reconstructedPres = derivedToAnoncredsPresentation(presentation.verifiableCredential[0]); - const keyedProofs = getKeyedProofsFromVerifiedPresentation(reconstructedPres); - const isKvac = Name === 'BBDT16'; - const isKvacStatus = accumSecretKey ? 1 : 0; - // Keyed proofs only exist for KVAC - expect(keyedProofs.size).toEqual(isKvac || isKvacStatus ? 1 : 0); - if (isKvac) { - // This block is executed by the issuer or anyone having the secret key but not by the verifier - const sk = new BBDT16MacSecretKey(keypair.privateKeyBuffer); - // eslint-disable-next-line jest/no-conditional-expect - expect(keyedProofs.get(0)?.credential?.proof.verify(sk).verified).toEqual(true); - } - if (isKvacStatus) { - // This block is executed by the issuer or anyone having the secret key but not by the verifier - expect(keyedProofs.get(0)?.status?.proof.verify(accumSecretKey).verified).toEqual(true); - } - - expect(presentation).toMatchObject( - // NOTE: json parse+stringify to remove any undefined properties - expect.objectContaining(JSON.parse(JSON.stringify({ - type: ['VerifiablePresentation'], - verifiableCredential: credentials, - id: presId, - }))), - ); - - // NOTE: typically for BBS+ presentations you shouldnt sign it by the holder, but we do it here just to make sure it works - // Verifying this would require knowing the holder's public key which makes the holder linkable and defeats the purpose of BBS+ - const signedPres = await signPresentation( - presentation, - holderKey, - chal, - domain, - resolver, - ); - - expect(signedPres).toMatchObject( - expect.objectContaining({ - type: ['VerifiablePresentation'], - verifiableCredential: credentials, - id: presId, - proof: expect.objectContaining({ - type: 'Sr25519Signature2020', - challenge: chal, - domain, - proofPurpose: 'authentication', - }), - }), - ); - - const result = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - ...verifyOptions, - }); - - expect(result.verified).toBe(true); - expect(result.presentationResult.verified).toBe(true); - expect(result.credentialResults.length).toBe(1); - expect(result.credentialResults[0].verified).toBe(true); - } - - async function getPresentationInstance(credentialStatus) { - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - credentialStatus, - issuer: String(did1), - }; - - const presentationOptions = { - nonce: stringToU8a('noncetest'), - context: 'my context', - }; - - // Create W3C credential - const credential = await issueCredential(issuerKey, unsignedCred); - expect(credential.id).toBeDefined(); - - // Begin to derive a credential from the above issued one - const presentationInstance = new Presentation(); - const idx = await presentationInstance.addCredentialToPresent( - credential, - { resolver }, - ); - - // NOTE: revealing subject type because of JSON-LD processing for this certain credential - // you may not always need to do this depending on your JSON-LD contexts - await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.type.0', - ]); - await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.type.1', - ]); - - return [presentationInstance, presentationOptions]; - } - - test(`For ${Name}, holder creates a derived verifiable credential from a credential with selective disclosure`, async () => { - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - issuer: String(did1), - }; - - const presentationOptions = { - nonce: stringToU8a('noncetest'), - context: 'my context', - }; - - // Create W3C credential - const credential = await issueCredential(issuerKey, unsignedCred); - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject( - expect.objectContaining(getProofMatcherDoc()), - ); - - // Begin to derive a credential from the above issued one - const presentationInstance = new Presentation(); - const idx = await presentationInstance.addCredentialToPresent( - credential, - { resolver }, - ); - - // Reveal subject attributes - presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.lprNumber', - ]); - - // NOTE: revealing subject type because of JSON-LD processing for this certain credential - // you may not always need to do this depending on your JSON-LD contexts - presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.type.0', - ]); - presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.type.1', - ]); - - // Begin to derive a credential from the above issued one - const presentationInstance2 = new Presentation(); - const idx2 = await presentationInstance2.addCredentialToPresent( - credential, - { resolver }, - ); - - // Reveal subject attributes - presentationInstance2.addAttributeToReveal(idx2, [ - 'credentialSubject.lprNumber', - ]); - - // NOTE: revealing subject type because of JSON-LD processing for this certain credential - // you may not always need to do this depending on your JSON-LD contexts - presentationInstance2.addAttributeToReveal(idx2, [ - 'credentialSubject.type.0', - ]); - presentationInstance2.addAttributeToReveal(idx2, [ - 'credentialSubject.type.1', - ]); - - // Derive a W3C Verifiable Credential JSON from the above presentation - const credentials = await presentationInstance.deriveCredentials( - presentationOptions, - ); - expect(credentials.length).toEqual(1); - expect(credentials[0].proof).toBeDefined(); - expect(credentials[0]).toHaveProperty('credentialSubject'); - expect(credentials[0].credentialSubject).toMatchObject( - expect.objectContaining({ - type: unsignedCred.credentialSubject.type, - lprNumber: 1234, - }), - ); - expect(credentials[0].issuer).toEqual(credential.issuer); - expect(credentials[0].credentialSchema.id).toEqual(residentCardSchema.$id); - - // Ensure reconstructing presentation from credential matches - // NOTE: ignoring proof here as itll differ when signed twice as above - const presentation = await presentationInstance2.createPresentation( - presentationOptions, - ); - - // Question: What is the point of this? A single credential cant be converted to a presentation and a presentation - // has other data that credential won't have - const reconstructedPres = derivedToAnoncredsPresentation(credentials[0]); - expect(reconstructedPres.proof).toBeDefined(); - expect({ - ...reconstructedPres, - proof: '', - }).toMatchObject({ ...presentation, proof: '' }); - - // Try to verify the derived credential alone - const credentialResult = await verifyCredential(credentials[0], { - resolver, - }); - expect(credentialResult.verified).toBe(true); - expect(credentialResult.error).toBe(undefined); - - // Modify the credential after issuance, verification should fail - const modifiedCred = deepClone(credentials[0]); - modifiedCred.credentialSubject.lprNumber = 0xdeadbeef; - const credentialResult1 = await verifyCredential(modifiedCred, { - resolver, - }); - expect(credentialResult1.verified).toBe(false); - - // This is done by the verifier - const keyedProofs = getKeyedProofsFromVerifiedPresentation(reconstructedPres); - const isKvac = Name === 'BBDT16'; - // Keyed proofs only exist for KVAC - expect(keyedProofs.size).toEqual(isKvac ? 1 : 0); - if (isKvac) { - // This block is executed by the issuer or anyone having the secret key but not by the verifier - const sk = new BBDT16MacSecretKey(keypair.privateKeyBuffer); - // eslint-disable-next-line jest/no-conditional-expect - expect(keyedProofs.get(0)?.credential?.proof.verify(sk).verified).toEqual(true); - } - // Create a VP and verify it from this credential - await createAndVerifyPresentation(credentials); - }, 30000); - - test(`For ${Name}, persist credential status using VB positive accumulator when deriving`, async () => { - const queriedAccum = await dock.accumulatorModule.getAccumulator(posAccumulatorId, false, true); - const verifAccumulator = PositiveAccumulator.fromAccumulated(AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated)); - - const accumPk = new AccumulatorPublicKey(hexToU8a(queriedAccum.publicKey.bytes)); - expect(verifAccumulator.verifyMembershipWitness(encodedMember, posAccumWitness, accumPk, dockAccumulatorParams())).toEqual(true); - - const credentialStatus = { - id: `dock:accumulator:${posAccumulatorId}`, - type: RevocationStatusProtocol.Vb22, - revocationCheck: MEM_CHECK_STR, - revocationId: accumMember, - }; - const [presentationInstance, presentationOptions] = await getPresentationInstance(credentialStatus); - - presentationInstance.presBuilder.addAccumInfoForCredStatus(0, posAccumWitness, AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated), accumPk); - - // Derive a W3C Verifiable Credential JSON from the above presentation - const credentials = await presentationInstance.deriveCredentials( - presentationOptions, - ); - - expect(credentials.length).toEqual(1); - expect(credentials[0].issuer).toEqual(String(did1)); - expect(credentials[0].credentialStatus).toBeDefined(); - expect(credentials[0].credentialStatus).toEqual({ - ...credentialStatus, - revocationId: undefined, // Because revocation id is never revealed - accumulated: b58.encode(AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated)), - extra: {}, - }); - - const accumulatorPublicKeys = new Map(); - accumulatorPublicKeys.set(0, accumPk); - - // Create a VP and verify it from this credential - await createAndVerifyPresentation(credentials, { - resolver, - accumulatorPublicKeys, - }); - }); - - test(`For ${Name}, persist credential status using VB positive accumulator with keyed-verification when deriving`, async () => { - // No public key exists - const queriedAccum = await dock.accumulatorModule.getAccumulator(posKvAccumulatorId, false, false); - - const credentialStatus = { - id: `dock:accumulator:${posKvAccumulatorId}`, - type: RevocationStatusProtocol.Vb22, - revocationCheck: MEM_CHECK_KV_STR, - revocationId: accumMember, - }; - const [presentationInstance, presentationOptions] = await getPresentationInstance(credentialStatus); - - presentationInstance.presBuilder.addAccumInfoForCredStatus(0, posKvAccumWitness, AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated)); - - // Derive a W3C Verifiable Credential JSON from the above presentation - const credentials = await presentationInstance.deriveCredentials( - presentationOptions, - ); - - expect(credentials.length).toEqual(1); - expect(credentials[0].issuer).toEqual(String(did1)); - expect(credentials[0].credentialStatus).toBeDefined(); - expect(credentials[0].credentialStatus).toEqual({ - ...credentialStatus, - revocationId: undefined, // Because revocation id is never revealed - accumulated: b58.encode(AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated)), - extra: {}, - }); - - // Create a VP and verify it from this credential - await createAndVerifyPresentation(credentials, { - resolver, - }, posKvAccumSecretKey); - }); - - test(`For ${Name}, persist credential status using KB universal accumulator when deriving`, async () => { - const queriedAccum = await dock.accumulatorModule.getAccumulator(uniAccumulatorId, false, true); - const verifAccumulator = KBUniversalAccumulator.fromAccumulated(AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated, AccumulatorType.KBUni)); - - const accumPk = new AccumulatorPublicKey(hexToU8a(queriedAccum.publicKey.bytes)); - expect(verifAccumulator.verifyMembershipWitness(encodedMember, uniAccumWitness, accumPk, dockAccumulatorParams())).toEqual(true); - - const credentialStatus = { - id: `dock:accumulator:${uniAccumulatorId}`, - type: RevocationStatusProtocol.KbUni24, - revocationCheck: MEM_CHECK_STR, - revocationId: accumMember, - }; - const [presentationInstance, presentationOptions] = await getPresentationInstance(credentialStatus); - - presentationInstance.presBuilder.addAccumInfoForCredStatus(0, uniAccumWitness, AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated, AccumulatorType.KBUni)); - - // Derive a W3C Verifiable Credential JSON from the above presentation - const credentials = await presentationInstance.deriveCredentials( - presentationOptions, - ); - - const accAsU8 = AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated, AccumulatorType.KBUni); - expect(credentials.length).toEqual(1); - expect(credentials[0].issuer).toEqual(String(did1)); - expect(credentials[0].credentialStatus).toBeDefined(); - expect(credentials[0].credentialStatus).toEqual({ - ...credentialStatus, - revocationId: undefined, // Because revocation id is never revealed - accumulated: `${b58.encode(accAsU8.toBytes())}`, - extra: {}, - }); - - const accumulatorPublicKeys = new Map(); - accumulatorPublicKeys.set(0, accumPk); - - // Create a VP and verify it from this credential - await createAndVerifyPresentation(credentials, { - resolver, - accumulatorPublicKeys, - }); - }); - - test(`For ${Name}, persist credential status using KB universal accumulator with keyed-verification when deriving`, async () => { - // No public key exists - const queriedAccum = await dock.accumulatorModule.getAccumulator(uniKvAccumulatorId, false, false); - - const credentialStatus = { - id: `dock:accumulator:${uniKvAccumulatorId}`, - type: RevocationStatusProtocol.KbUni24, - revocationCheck: MEM_CHECK_KV_STR, - revocationId: accumMember, - }; - const [presentationInstance, presentationOptions] = await getPresentationInstance(credentialStatus); - - presentationInstance.presBuilder.addAccumInfoForCredStatus(0, uniKvAccumWitness, AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated, AccumulatorType.KBUni)); - - // Derive a W3C Verifiable Credential JSON from the above presentation - const credentials = await presentationInstance.deriveCredentials( - presentationOptions, - ); - - const accAsU8 = AccumulatorModule.accumulatedFromHex(queriedAccum.accumulated, AccumulatorType.KBUni); - expect(credentials.length).toEqual(1); - expect(credentials[0].issuer).toEqual(String(did1)); - expect(credentials[0].credentialStatus).toBeDefined(); - expect(credentials[0].credentialStatus).toEqual({ - ...credentialStatus, - revocationId: undefined, // Because revocation id is never revealed - accumulated: `${b58.encode(accAsU8.toBytes())}`, - extra: {}, - }); - - // Create a VP and verify it from this credential - await createAndVerifyPresentation(credentials, { - resolver, - }, uniKvAccumSecretKey); - }); - - test('Holder creates a derived verifiable credential from a credential with range proofs', async () => { - const provingKeyId = 'provingKeyId'; - const pk = BoundCheckSnarkSetup(); - const provingKey = pk.decompress(); - - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - issuer: String(did1), - }; - - const presentationOptions = { - nonce: stringToU8a('noncetest'), - context: 'my context', - }; - - // Create W3C credential - const credential = await issueCredential(issuerKey, unsignedCred); - - // Begin to derive a credential from the above issued one - const presentationInstance = new Presentation(); - const idx = await presentationInstance.addCredentialToPresent( - credential, - { resolver }, - ); - - // NOTE: revealing subject type because of JSON-LD processing for this certain credential - // you may not always need to do this depending on your JSON-LD contexts - await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.type.0', - ]); - await presentationInstance.addAttributeToReveal(idx, [ - 'credentialSubject.type.1', - ]); - - // Enforce LPR number to be between values as well as revealed - // NOTE: unlike other tests, we cannot "reveal" this value and enforce bounds at the same time! - presentationInstance.presBuilder.enforceBounds( - idx, - 'credentialSubject.lprNumber', - 1233, - 1235, - provingKeyId, - provingKey, - ); - - // Enforce issuance date to be between values - // NOTE: we dont need to set proving key value here (must still set ID though!) as its done above, should pass undefined - presentationInstance.presBuilder.enforceBounds( - idx, - 'issuanceDate', - new Date('2019-10-01'), - new Date('2020-01-01'), - provingKeyId, - undefined, - ); - - // Derive a W3C Verifiable Credential JSON from the above presentation - const credentials = await presentationInstance.deriveCredentials( - presentationOptions, - ); - expect(credentials.length).toEqual(1); - expect(credentials[0].proof).toBeDefined(); - expect(credentials[0].issuer).toEqual(credential.issuer); - expect(credentials[0].proof.bounds).toBeDefined(); - expect(credentials[0].proof.bounds).toEqual({ - issuanceDate: [{ - min: 1569888000000, - max: 1577836800000, - paramId: 'provingKeyId', - protocol: 'LegoGroth16', - }], - credentialSubject: { - lprNumber: [{ - min: 1233, - max: 1235, - paramId: 'provingKeyId', - protocol: 'LegoGroth16', - }], - }, - }); - expect(credentials[0]).toHaveProperty('credentialSubject'); - expect(credentials[0].credentialSubject).toMatchObject( - expect.objectContaining({ - type: unsignedCred.credentialSubject.type, - }), - ); - - const reconstructedPres = derivedToAnoncredsPresentation(credentials[0]); - expect(reconstructedPres.proof).toBeDefined(); - expect(reconstructedPres.spec.credentials[0].bounds).toEqual(credentials[0].proof.bounds); - - // Setup predicate params with the verifying key for range proofs - const predicateParams = new Map(); - predicateParams.set(provingKeyId, pk.getVerifyingKey()); - - // Try to verify the derived credential alone - const credentialResult = await verifyCredential(credentials[0], { - resolver, - predicateParams, - }); - if (credentialResult.error) { - console.log('credentialResult.error', JSON.stringify(credentialResult.error, null, 2)); - } - expect(credentialResult.error).toBe(undefined); - expect(credentialResult.verified).toBe(true); - - // Create a VP and verify it from this credential - await createAndVerifyPresentation(credentials, { predicateParams }); - }, 60000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); -}); diff --git a/tests/integration/anoncreds/issuing.test.js b/tests/integration/anoncreds/issuing.test.js deleted file mode 100644 index e169cbb9f..000000000 --- a/tests/integration/anoncreds/issuing.test.js +++ /dev/null @@ -1,316 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; -import { - DefaultSchemaParsingOpts, CredentialBuilder, CredentialSchema, initializeWasm, EMPTY_SCHEMA_ID, -} from '@docknetwork/crypto-wasm-ts'; -import stringify from 'json-stringify-deterministic'; -import { DockAPI } from '../../../src'; -import { DidKeypair, DockDid } from '../../../src/did'; -import { DockResolver } from '../../../src/resolver'; -import { - registerNewDIDUsingPair, - getCredMatcherDoc, - getProofMatcherDoc, -} from '../helpers'; -import { issueCredential, verifyCredential } from '../../../src/utils/vc/index'; -import { getKeyDoc } from '../../../src/utils/vc/helpers'; -import { getJsonSchemaFromCredential } from '../../../src/utils/vc/credentials'; -import { getResidentCardCredentialAndSchema, setupExternalSchema } from './utils'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, - Schemes, -} from '../../test-constants'; -import defaultDocumentLoader from '../../../src/utils/vc/document-loader'; -import DockCryptoSignature from '../../../src/utils/vc/crypto/common/DockCryptoSignature'; - -describe.each(Schemes)('Issuance', ({ - Name, - Module, - Context, - CryptoKeyPair, - getModule, - VerKey, - SigType, -}) => { - const dock = new DockAPI(); - const resolver = new DockResolver(dock); - let account; - const did1 = DockDid.random(); - let pair1; - let chainModule; - let keypair; - - const [credentialJSON, residentCardSchema] = getResidentCardCredentialAndSchema(Context); - - beforeAll(async () => { - await initializeWasm(); - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - chainModule = getModule(dock); - account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - pair1 = new DidKeypair(dock.keyring.addFromUri(randomAsHex(32)), 1); - - await registerNewDIDUsingPair(dock, did1, pair1); - - keypair = CryptoKeyPair.generate({ - controller: did1, - msgCount: 100, - }); - - if (Name !== 'BBDT16') { - // Setup public key on blockchain - const pk1 = Module.prepareAddPublicKey(u8aToHex(keypair.publicKeyBuffer)); - await chainModule.addPublicKey( - pk1, - did1, - did1, - pair1, - { didModule: dock.did }, - false, - ); - - const didDocument = await dock.did.getDocument(did1); - const { publicKey } = didDocument; - - expect(publicKey.length).toEqual(2); - expect(publicKey[1].type).toEqual(VerKey); - - keypair.id = publicKey[1].id; - } else { - // For KVAC, the public doesn't need to published as its not used in credential or presentation verification (except issuers). - // But the signer still adds a key identifier in the credential to determine which key will be used for verification - keypair.id = 'my-key-id'; - } - }, 20000); - - test(`Can issue+verify a ${Name} credential with external schema reference`, async () => { - const [externalSchemaEncoded, schemaId] = await setupExternalSchema(residentCardSchema, 'Resident Card Example', did1, pair1, dock); - - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - issuer: String(did1), - }; - unsignedCred.credentialSchema = externalSchemaEncoded; - - // The schema will be fetched from the blockchain before issuing - const credential = await issueCredential(issuerKey, unsignedCred, true, defaultDocumentLoader(resolver)); - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc(unsignedCred, did1, issuerKey.id, SigType), - ), - ); - - // Get JSON schema from the credential - const fullSchema = getJsonSchemaFromCredential(credential, true); - const externalSchema = getJsonSchemaFromCredential(credential, false); - expect(externalSchema.$id).toEqual(schemaId); - expect(fullSchema.$id).toEqual(residentCardSchema.$id); - expect(externalSchema.properties).not.toBeDefined(); - // properties don't match exactly because some are generated while signing - expect(fullSchema.properties.credentialSubject.properties).toMatchObject( - expect.objectContaining( - residentCardSchema.properties.credentialSubject.properties, - ), - ); - - // Ensure extra properties from crypto-wasm-ts are assigned to schema object - expect(credential.cryptoVersion).toEqual(CredentialBuilder.VERSION); - expect(credential.credentialSchema.version).toEqual(CredentialSchema.VERSION); - expect(credential.credentialSchema.id).toEqual(schemaId); - const details = JSON.parse(credential.credentialSchema.details); - expect(details.parsingOptions).toEqual({ - useDefaults: false, - defaultMinimumInteger: -4294967295, - defaultMinimumDate: -17592186044415, - defaultDecimalPlaces: 0, - }); - expect(details.fullJsonSchema).toBeDefined(); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject( - expect.objectContaining(getProofMatcherDoc()), - ); - }, 30000); - - test(`Can issue+verify a ${Name} credential with embedded schema`, async () => { - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - issuer: String(did1), - }; - - const credential = await issueCredential(issuerKey, unsignedCred); - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc(unsignedCred, did1, issuerKey.id, SigType), - ), - ); - - const fullSchema = getJsonSchemaFromCredential(credential, true); - const externalSchema = getJsonSchemaFromCredential(credential, false); - expect(externalSchema.$id).toEqual(residentCardSchema.$id); - expect(fullSchema.$id).toEqual(residentCardSchema.$id); - expect(externalSchema.properties).toBeDefined(); - // properties don't match exactly because some are generated while signing - expect(fullSchema.properties.credentialSubject.properties).toMatchObject( - expect.objectContaining( - residentCardSchema.properties.credentialSubject.properties, - ), - ); - expect(externalSchema.properties.credentialSubject.properties).toMatchObject( - expect.objectContaining( - residentCardSchema.properties.credentialSubject.properties, - ), - ); - - // Ensure extra properties from crypto-wasm-ts are assigned to schema object - expect(credential.cryptoVersion).toEqual(CredentialBuilder.VERSION); - expect(credential.credentialSchema.version).toEqual(CredentialSchema.VERSION); - expect(credential.credentialSchema.id).toEqual(residentCardSchema.$id); - const details = JSON.parse(credential.credentialSchema.details); - expect(details.parsingOptions).toEqual({ - useDefaults: false, - defaultMinimumInteger: -4294967295, - defaultMinimumDate: -17592186044415, - defaultDecimalPlaces: 0, - }); - expect(details.fullJsonSchema).not.toBeDefined(); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject( - expect.objectContaining(getProofMatcherDoc()), - ); - }, 30000); - - test(`Can issue+verify a ${Name} credential with default schema`, async () => { - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - issuer: String(did1), - }; - delete unsignedCred.credentialSchema; - - const credential = await issueCredential(issuerKey, unsignedCred); - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc(unsignedCred, did1, issuerKey.id, SigType), - ), - ); - - const fullSchema = getJsonSchemaFromCredential(credential, true); - const externalSchema = getJsonSchemaFromCredential(credential, false); - // These won't be defined as the whole schema was autogenerated - expect(externalSchema.$id).not.toBeDefined(); - expect(fullSchema.$id).not.toBeDefined(); - expect(credential.credentialSchema.id).toEqual(EMPTY_SCHEMA_ID); - - for (const props of [fullSchema.properties.credentialSubject.properties, externalSchema.properties.credentialSubject.properties]) { - // properties don't match exactly because some are generated while signing - expect(residentCardSchema.properties.credentialSubject.properties.familyName).toMatchObject( - expect.objectContaining( - props.familyName, - ), - ); - expect(residentCardSchema.properties.credentialSubject.properties.givenName).toMatchObject( - expect.objectContaining( - props.givenName, - ), - ); - } - - // Ensure schema was now defined, added by crypto-wasm-ts - expect(credential.cryptoVersion).toEqual(CredentialBuilder.VERSION); - expect(credential.credentialSchema).toBeDefined(); - expect(credential.credentialSchema.version).toEqual(CredentialSchema.VERSION); - const details = JSON.parse(credential.credentialSchema.details); - expect(details.parsingOptions).toEqual({ - useDefaults: false, - defaultMinimumInteger: -4294967295, - defaultMinimumDate: -17592186044415, - defaultDecimalPlaces: 0, - }); - expect(details.fullJsonSchema).not.toBeDefined(); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject( - expect.objectContaining(getProofMatcherDoc()), - ); - }, 30000); - - test(`Can issue+verify a ${Name} credential with blank schema and custom parsingOptions`, async () => { - const parsingOptions = { - ...DefaultSchemaParsingOpts, - defaultDecimalPlaces: 5, - useDefaults: true, - }; - - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const unsignedCred = { - ...credentialJSON, - issuer: String(did1), - }; - - unsignedCred.credentialSchema = { - id: '', - type: 'JsonSchemaValidator2018', - details: stringify({ - parsingOptions, - }), - }; - - const credential = await issueCredential(issuerKey, unsignedCred); - - // Ensure schema was now defined, added by crypto-wasm-ts - const details = JSON.parse(credential.credentialSchema.details); - expect(details.parsingOptions).toEqual(parsingOptions); - expect(details.fullJsonSchema).not.toBeDefined(); - expect(credential.credentialSchema.id).toEqual(EMPTY_SCHEMA_ID); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject( - expect.objectContaining(getProofMatcherDoc()), - ); - }, 30000); - - test(`Can issue+verify a ${Name} credential with embedded schema and custom parsingOptions`, async () => { - const parsingOptions = { - ...DefaultSchemaParsingOpts, - defaultDecimalPlaces: 5, - useDefaults: true, - }; - - const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id); - const schemaWithGivenParsingOptions = DockCryptoSignature.withUpdatedParsingOptions(credentialJSON.credentialSchema, parsingOptions); - const unsignedCred = { - ...credentialJSON, - credentialSchema: schemaWithGivenParsingOptions, - issuer: String(did1), - }; - - expect(unsignedCred.credentialSchema.id).toBeDefined(); - expect(unsignedCred.credentialSchema.id).not.toEqual(''); - - const credential = await issueCredential(issuerKey, unsignedCred); - - // Ensure schema was now defined, added by crypto-wasm-ts - const details = JSON.parse(credential.credentialSchema.details); - expect(details.parsingOptions).toEqual(parsingOptions); - expect(details.fullJsonSchema).not.toBeDefined(); - expect(credential.credentialSchema.id).toEqual(residentCardSchema.$id); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject( - expect.objectContaining(getProofMatcherDoc()), - ); - }, 30000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); -}); diff --git a/tests/integration/anoncreds/scheme.test.js b/tests/integration/anoncreds/scheme.test.js deleted file mode 100644 index d5b26fc91..000000000 --- a/tests/integration/anoncreds/scheme.test.js +++ /dev/null @@ -1,363 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { hexToU8a, u8aToHex, stringToHex } from '@polkadot/util'; -import { initializeWasm } from '@docknetwork/crypto-wasm-ts'; -import { DockAPI } from '../../../src'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, - Schemes, -} from '../../test-constants'; -import { DockDid, DidKeypair } from '../../../src/did'; - -import { registerNewDIDUsingPair } from '../helpers'; - -const addParticipantIdIfNotPresent = (key) => { - if (!('participantId' in key)) { - key.participantId = null; - } - return key; -}; - -for (const { - Name, - Module, - getModule, - KeyPair, - SignatureParams, - VerKey, - getParamsByDid, - getPublicKeyWithParamsByStorageKey, - getPublicKeysByDid, -} of Schemes) { - const skipIfKvac = Name === 'BBDT16' ? describe.skip : describe; - skipIfKvac(`${Name} Module`, () => { - const dock = new DockAPI(); - let account; - let did1; - let did2; - let pair1; - let pair2; - let chainModule; - const chainModuleClass = Module; - - const seed1 = randomAsHex(32); - const seed2 = randomAsHex(32); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - chainModule = getModule(dock); - account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - pair2 = new DidKeypair(dock.keyring.addFromUri(seed2), 1); - did1 = DockDid.random(); - did2 = DockDid.random(); - await registerNewDIDUsingPair(dock, did1, pair1); - await registerNewDIDUsingPair(dock, did2, pair2); - await initializeWasm(); - }, 20000); - - test('Can create new params', async () => { - let label = stringToHex('test-params-label'); - let params = SignatureParams.generate(10, hexToU8a(label)); - const bytes1 = u8aToHex(params.toBytes()); - const params1 = chainModuleClass.prepareAddParameters( - bytes1, - undefined, - label, - ); - await chainModule.addParams( - params1, - did1, - pair1, - { didModule: dock.did }, - false, - ); - - const paramsWritten1 = await chainModule.getLastParamsWritten(did1); - expect(paramsWritten1.bytes).toEqual(params1.bytes); - expect(paramsWritten1.label).toEqual(params1.label); - const allParams = await getParamsByDid(dock.api, DockDid.from(did1)); - expect(Object.values(allParams.toJSON())).toEqual([params1]); - - const queriedParams1 = await chainModule.getParams(did1, 1); - expect(paramsWritten1).toEqual(queriedParams1); - - params = SignatureParams.generate(20); - const bytes2 = u8aToHex(params.toBytes()); - const params2 = chainModuleClass.prepareAddParameters(bytes2); - await chainModule.addParams( - params2, - did2, - pair2, - { didModule: dock.did }, - false, - ); - const paramsWritten2 = await chainModule.getLastParamsWritten(did2); - expect(paramsWritten2.bytes).toEqual(params2.bytes); - expect(paramsWritten2.label).toBe(null); - - const queriedParams2 = await chainModule.getParams(did2, 1); - expect(paramsWritten2).toEqual(queriedParams2); - - label = stringToHex('test-params-label-2'); - params = SignatureParams.generate(23, hexToU8a(label)); - const bytes3 = u8aToHex(params.toBytes()); - const params3 = chainModuleClass.prepareAddParameters( - bytes3, - undefined, - label, - ); - await chainModule.addParams( - params3, - did1, - pair1, - { didModule: dock.did }, - false, - ); - const paramsWritten3 = await chainModule.getLastParamsWritten(did1); - expect(paramsWritten3.bytes).toEqual(params3.bytes); - expect(paramsWritten3.label).toBe(params3.label); - - const queriedParams3 = await chainModule.getParams(did1, 2); - expect(paramsWritten3).toEqual(queriedParams3); - - const paramsByDid1 = await chainModule.getAllParamsByDid(did1); - expect(paramsByDid1[0]).toEqual(paramsWritten1); - expect(paramsByDid1[1]).toEqual(paramsWritten3); - - const paramsByDid2 = await chainModule.getAllParamsByDid(did2); - expect(paramsByDid2[0]).toEqual(paramsWritten2); - }, 30000); - - test('Can create public keys', async () => { - const params = SignatureParams.generate(5); - let keypair = KeyPair.generate(params); - const bytes1 = u8aToHex(keypair.publicKey.bytes); - const pk1 = chainModuleClass.prepareAddPublicKey(bytes1); - await chainModule.addPublicKey( - pk1, - did1, - did1, - pair1, - { didModule: dock.did }, - false, - ); - const queriedPk1 = await chainModule.getPublicKey(did1, 2); - expect(queriedPk1.bytes).toEqual(pk1.bytes); - expect(queriedPk1.paramsRef).toBe(null); - - const queriedParams1 = await chainModule.getParams(did1, 1); - const params1Val = SignatureParams.valueFromBytes( - hexToU8a(queriedParams1.bytes), - ); - const params1 = new SignatureParams( - params1Val, - hexToU8a(queriedParams1.label), - ); - keypair = KeyPair.generate(params1); - const bytes2 = u8aToHex(keypair.publicKey.bytes); - const pk2 = chainModuleClass.prepareAddPublicKey(bytes2, undefined, [ - did1, - 1, - ]); - await chainModule.addPublicKey( - pk2, - did2, - did2, - pair2, - { didModule: dock.did }, - false, - ); - const queriedPk2 = await chainModule.getPublicKey(did2, 2); - expect(queriedPk2.bytes).toEqual(pk2.bytes); - expect(queriedPk2.paramsRef).toEqual([DockDid.from(did1), 1]); - const keyWithParams = await getPublicKeyWithParamsByStorageKey(dock.api, [ - DockDid.from(did2).asDid, - 2, - ]); - const jsonKeyWithParams = keyWithParams.toJSON(); - addParticipantIdIfNotPresent(jsonKeyWithParams[0]); - expect(jsonKeyWithParams).toEqual([queriedPk2, queriedParams1]); - - const queriedPk2WithParams = await chainModule.getPublicKey( - did2, - 2, - true, - ); - expect(queriedPk2WithParams.params).toEqual(queriedParams1); - - const queriedParams2 = await chainModule.getParams(did1, 2); - const params2Val = SignatureParams.valueFromBytes( - hexToU8a(queriedParams2.bytes), - ); - const params2 = new SignatureParams( - params2Val, - hexToU8a(queriedParams2.label), - ); - keypair = KeyPair.generate(params2); - const bytes3 = u8aToHex(keypair.publicKey.bytes); - const pk3 = chainModuleClass.prepareAddPublicKey(bytes3, undefined, [ - did1, - 2, - ]); - await chainModule.addPublicKey( - pk3, - did2, - did2, - pair2, - { didModule: dock.did }, - false, - ); - - const queriedPk3 = await chainModule.getPublicKey(did2, 3); - expect(queriedPk3.bytes).toEqual(pk3.bytes); - expect(queriedPk3.paramsRef).toEqual([DockDid.from(did1), 2]); - - const queriedPk3WithParams = await chainModule.getPublicKey( - did2, - 3, - true, - ); - expect(queriedPk3WithParams.params).toEqual(queriedParams2); - const allPks = await getPublicKeysByDid(dock.api, DockDid.from(did2)); - expect( - Object.values(allPks.toJSON()).map((keyWithParams) => { - addParticipantIdIfNotPresent(keyWithParams[0]); - return keyWithParams; - }), - ).toEqual([ - [queriedPk2, queriedParams1], - [queriedPk3, queriedParams2], - ]); - }, 30000); - - test('Get public keys with DID resolution', async () => { - const document1 = await dock.did.getDocument(did1, { - getOffchainSigKeys: true, - }); - expect(document1.publicKey.length).toEqual(2); - expect(document1.assertionMethod.length).toEqual(2); - expect(document1.publicKey[1].id.endsWith('#keys-2')).toEqual(true); - expect(document1.publicKey[1].type).toEqual(VerKey); - expect(document1.assertionMethod[1].endsWith('#keys-2')).toEqual(true); - - const document2 = await dock.did.getDocument(did2, { - getOffchainSigKeys: true, - }); - expect(document2.publicKey.length).toEqual(3); - expect(document2.assertionMethod.length).toEqual(3); - expect(document2.publicKey[1].id.endsWith('#keys-2')).toEqual(true); - expect(document2.publicKey[1].type).toEqual(VerKey); - expect(document2.publicKey[2].id.endsWith('#keys-3')).toEqual(true); - expect(document2.publicKey[2].type).toEqual(VerKey); - expect(document2.assertionMethod[1].endsWith('#keys-2')).toEqual(true); - expect(document2.assertionMethod[2].endsWith('#keys-3')).toEqual(true); - }); - - test('Can remove public keys and params', async () => { - await chainModule.removePublicKey( - 2, - did1, - did1, - pair1, - { didModule: dock.did }, - false, - ); - const pk1 = await chainModule.getPublicKey(did1, 2); - expect(pk1).toEqual(null); - - const document1 = await dock.did.getDocument(did1, { - getOffchainSigKeys: true, - }); - expect(document1.publicKey.length).toEqual(1); - expect(document1.assertionMethod.length).toEqual(1); - expect(document1.publicKey[0].id.endsWith('#keys-1')).toEqual(true); - expect(document1.publicKey[0].type).not.toEqual(VerKey); - expect(document1.assertionMethod[0].endsWith('#keys-1')).toEqual(true); - - await chainModule.removeParams( - 1, - did1, - pair1, - { didModule: dock.did }, - false, - ); - const params1 = await chainModule.getParams(did1, 1); - expect(params1).toEqual(null); - - await expect(chainModule.getPublicKey(did2, 2, true)).rejects.toThrow(); - - await chainModule.removePublicKey( - 2, - did2, - did2, - pair2, - { didModule: dock.did }, - false, - ); - const pk2 = await chainModule.getPublicKey(did2, 2); - expect(pk2).toEqual(null); - - let document2 = await dock.did.getDocument(did2, { - getOffchainSigKeys: true, - }); - expect(document2.publicKey.length).toEqual(2); - expect(document2.assertionMethod.length).toEqual(2); - expect(document2.publicKey[0].id.endsWith('#keys-1')).toEqual(true); - expect(document2.publicKey[0].type).not.toEqual(VerKey); - expect(document2.assertionMethod[0].endsWith('#keys-1')).toEqual(true); - expect(document2.publicKey[1].id.endsWith('#keys-3')).toEqual(true); - expect(document2.publicKey[1].type).toEqual(VerKey); - expect(document2.assertionMethod[1].endsWith('#keys-3')).toEqual(true); - - await chainModule.removePublicKey( - 3, - did2, - did2, - pair2, - { didModule: dock.did }, - false, - ); - const pk3 = await chainModule.getPublicKey(did2, 3); - expect(pk3).toEqual(null); - - document2 = await dock.did.getDocument(did2, { - getOffchainSigKeys: true, - }); - expect(document2.publicKey.length).toEqual(1); - expect(document2.assertionMethod.length).toEqual(1); - expect(document2.publicKey[0].id.endsWith('#keys-1')).toEqual(true); - expect(document2.publicKey[0].type).not.toEqual(VerKey); - expect(document2.assertionMethod[0].endsWith('#keys-1')).toEqual(true); - - await chainModule.removeParams( - 2, - did1, - pair1, - { didModule: dock.did }, - false, - ); - const params2 = await chainModule.getParams(did1, 2); - expect(params2).toEqual(null); - - await chainModule.removeParams( - 1, - did2, - pair2, - { didModule: dock.did }, - false, - ); - const params3 = await chainModule.getParams(did2, 1); - expect(params3).toEqual(null); - }, 50000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - }); -} diff --git a/tests/integration/blob.test.js b/tests/integration/blob.test.js deleted file mode 100644 index dff836849..000000000 --- a/tests/integration/blob.test.js +++ /dev/null @@ -1,162 +0,0 @@ -import { u8aToString, u8aToHex } from '@polkadot/util'; -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockAPI } from '../../src/index'; - -import { DockDid, DidKeypair } from '../../src/did'; -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; -import { DockBlobIdByteSize, BLOB_MAX_BYTE_SIZE } from '../../src/modules/blob'; -import { registerNewDIDUsingPair } from './helpers'; - -let account; -let pair; -let dockDID; -let blobId; - -function errorInResult(result) { - try { - return result.events[0].event.data[0].toJSON().Module.error === 1; - } catch (e) { - return false; - } -} - -describe.skip('Blob Module', () => { - const dock = new DockAPI(); - - // Generate first key with this seed. The key type is Sr25519 - const firstKeySeed = randomAsHex(32); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - pair = DidKeypair.fromApi(dock, { seed: firstKeySeed }); - dockDID = DockDid.random(); - await registerNewDIDUsingPair(dock, DockDid.from(dockDID), pair); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - beforeEach(async () => { - blobId = randomAsHex(DockBlobIdByteSize); - }, 30000); - - test('Can create and read a JSON Blob.', async () => { - const blobJSON = { - jsonBlob: true, - }; - const blob = { - id: blobId, - blob: blobJSON, - }; - const result = await dock.blob.new(blob, dockDID, pair, dock, false); - - expect(!!result).toBe(true); - - const chainBlob = await dock.blob.get(blobId); - expect(!!chainBlob).toBe(true); - expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); - expect(chainBlob[1]).toEqual(blobJSON); - }, 30000); - - test('Can create and read a string Blob.', async () => { - const blobHex = 'my string'; - const blob = { - id: blobId, - blob: blobHex, - }; - const result = await dock.blob.new(blob, dockDID, pair, dock, false); - - expect(!!result).toBe(true); - - const chainBlob = await dock.blob.get(blobId); - expect(!!chainBlob).toBe(true); - expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); - expect(u8aToString(chainBlob[1])).toEqual(blobHex); - }, 30000); - - test('Can create and read a hex Blob.', async () => { - const blobHex = randomAsHex(32); - const blob = { - id: blobId, - blob: blobHex, - }; - - const result = await dock.blob.new(blob, dockDID, pair, dock, false); - - expect(!!result).toBe(true); - - const chainBlob = await dock.blob.get(blobId); - expect(!!chainBlob).toBe(true); - expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); - expect(u8aToHex(chainBlob[1])).toEqual(blobHex); - }, 30000); - - test('Can create and read a Vector Blob.', async () => { - const blobVect = new Uint8Array([1, 2, 3]); - const blob = { - id: blobId, - blob: blobVect, - }; - - const result = await dock.blob.new(blob, dockDID, pair, dock, false); - - expect(!!result).toBe(true); - - const chainBlob = await dock.blob.get(blobId); - expect(!!chainBlob).toBe(true); - expect(chainBlob[0]).toEqual(DockDid.from(dockDID)); - expect(chainBlob[1]).toEqual(blobVect); - }, 30000); - - test('Fails to write blob with size greater than allowed.', async () => { - const blobHex = randomAsHex(BLOB_MAX_BYTE_SIZE + 1); // Max size is 1024 - const blob = { - id: blobId, - blob: blobHex, - }; - await expect( - dock.blob.new(blob, dockDID, pair, dock, false), - ).rejects.toThrow(); - - await expect(dock.blob.get(blobId)).rejects.toThrowError('does not exist'); - }, 30000); - - test('Fails to write blob with id already used.', async () => { - const blobHexFirst = randomAsHex(12); - let blob = { - id: blobId, - blob: blobHexFirst, - }; - const resultFirst = await dock.blob.new(blob, dockDID, pair, dock, false); - - expect(!!resultFirst).toBe(true); - expect(errorInResult(resultFirst)).toBe(false); - - blob = { - id: blobId, - blob: randomAsHex(123), - }; - - await expect( - dock.blob.new(blob, dockDID, pair, dock, false), - ).rejects.toThrow(); - }, 60000); - - test('Should throw error when cannot read blob with given id from chain.', async () => { - const nonExistentBlobId = randomAsHex(DockBlobIdByteSize); - await expect(dock.blob.get(nonExistentBlobId)).rejects.toThrowError( - 'does not exist', - ); - }, 30000); -}); diff --git a/tests/integration/credential-revocation.test.js b/tests/integration/credential-revocation.test.js deleted file mode 100644 index e71890dab..000000000 --- a/tests/integration/credential-revocation.test.js +++ /dev/null @@ -1,194 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; -import { DockAPI } from '../../src/index'; -import { - issueCredential, - signPresentation, - verifyCredential, - verifyPresentation, - expandJSONLD, -} from '../../src/utils/vc/index'; - -import { DockResolver } from '../../src/resolver'; -import { createPresentation } from '../create-presentation'; - -import { - OneOfPolicy, - getDockRevIdFromCredential, -} from '../../src/utils/revocation'; -import { getUnsignedCred, registerNewDIDUsingPair } from './helpers'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import { - DockDid, - DidKeypair, - DockDidOrDidMethodKey, -} from '../../src/did'; -import { - addRevRegIdToCredential, - getPrivateStatus, -} from '../../src/utils/vc/credentials'; -import { getPrivateStatuses } from '../../src/utils/vc/presentations'; - -const credId = 'A large credential id with size > 32 bytes'; - -describe('Credential revocation with issuer as the revocation authority', () => { - const dockAPI = new DockAPI(); - const resolver = new DockResolver(dockAPI); - - // Create a random registry id - const registryId = randomAsHex(32); - - // Register a new DID for issuer - const issuerDID = DockDid.random(); - const issuerSeed = randomAsHex(32); - - // Register a new DID for holder - const holderDID = DockDid.random(); - const holderSeed = randomAsHex(32); - - let issuerKey; - let issuerKeyPair; - let credential; - let expanded; - let revId; - - beforeAll(async () => { - await dockAPI.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - // The keyring should be initialized before any test begins as this suite is testing revocation - const account = dockAPI.keyring.addFromUri(TestAccountURI); - dockAPI.setAccount(account); - - // Register issuer DID - issuerKeyPair = DidKeypair.fromApi(dockAPI, { seed: issuerSeed }); - await registerNewDIDUsingPair(dockAPI, issuerDID, issuerKeyPair); - - // Register holder DID - const pair1 = DidKeypair.fromApi(dockAPI, { seed: holderSeed }); - await registerNewDIDUsingPair(dockAPI, holderDID, pair1); - - // Create a new policy - const policy = new OneOfPolicy(); - policy.addOwner(DockDidOrDidMethodKey.from(issuerDID)); - - // Add a new revocation registry with above policy - await dockAPI.revocation.newRegistry(registryId, policy, false, false); - - let unsignedCred = getUnsignedCred(credId, holderDID); - - // Issuer issues the credential with a given registry id for revocation - unsignedCred = addRevRegIdToCredential(unsignedCred, registryId); - - issuerKey = getKeyDoc( - issuerDID, - issuerKeyPair, - 'Ed25519VerificationKey2018', - ); - credential = await issueCredential(issuerKey, unsignedCred); - - expanded = await expandJSONLD(credential); - revId = getDockRevIdFromCredential(expanded); - }, 60000); - - afterAll(async () => { - await dockAPI.disconnect(); - }, 10000); - - test('Issuer can issue a revocable credential and holder can verify it successfully when it is not revoked else the verification fails', async () => { - // The credential verification should pass as the credential has not been revoked. - const result = await verifyCredential(credential, { - resolver, - compactProof: true, - }); - expect(result.verified).toBe(true); - expect(getPrivateStatus(credential)).not.toBeDefined(); - - // Revoke the credential - await dockAPI.revocation.revokeCredentialWithOneOfPolicy( - registryId, - revId, - issuerDID, - issuerKeyPair, - { didModule: dockAPI.did }, - false, - ); - - // The credential verification should fail as the credential has been revoked. - const result1 = await verifyCredential(credential, { - resolver, - compactProof: true, - }); - - expect(result1.verified).toBe(false); - expect(result1.error).toBe('Revocation check failed'); - }, 50000); - - test('Holder can create a presentation and verifier can verify it successfully when it is not revoked else the verification fails', async () => { - // The previous test revokes credential so unrevoke it. Its fine if the previous test is not run as unrevoking does not - // throw error if the credential is not revoked. - await dockAPI.revocation.unrevokeCredentialWithOneOfPolicy( - registryId, - revId, - issuerDID, - issuerKeyPair, - { didModule: dockAPI.did }, - false, - ); - - const holderKey = getKeyDoc( - holderDID, - dockAPI.keyring.addFromUri(holderSeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - - // Create presentation for unrevoked credential - const presId = `https://pres.com/${randomAsHex(32)}`; - const chal = randomAsHex(32); - const domain = 'test domain'; - const presentation = createPresentation(credential, presId); - const signedPres = await signPresentation( - presentation, - holderKey, - chal, - domain, - resolver, - ); - - // As the credential is unrevoked, the presentation should verify successfully. - const result = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - compactProof: true, - }); - expect(result.verified).toBe(true); - expect(getPrivateStatuses(signedPres)[0]).not.toBeDefined(); - - // Revoke credential - await dockAPI.revocation.revokeCredentialWithOneOfPolicy( - registryId, - revId, - issuerDID, - issuerKeyPair, - { didModule: dockAPI.did }, - false, - ); - - // As the credential is revoked, the presentation should verify successfully. - const result1 = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - compactProof: true, - }); - expect(result1.verified).toBe(false); - }, 60000); -}); diff --git a/tests/integration/custom-nonce.test.js b/tests/integration/custom-nonce.test.js deleted file mode 100644 index 40d0210b0..000000000 --- a/tests/integration/custom-nonce.test.js +++ /dev/null @@ -1,541 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { hexToU8a, stringToHex, u8aToHex } from '@polkadot/util'; -import { - Accumulator, - initializeWasm, - BBSPlusKeypairG2, - BBSPlusSignatureParamsG1, -} from '@docknetwork/crypto-wasm-ts'; -import { DockAPI, PublicKeySecp256k1 } from '../../src'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../test-constants'; -import { DockDid, NoDIDError, DidKeypair } from '../../src/did'; -import { registerNewDIDUsingPair } from './helpers'; -import { generateEcdsaSecp256k1Keypair } from '../../src/utils/misc'; -import { DidKey, VerificationRelationship } from '../../src/public-keys'; -import { ServiceEndpointType } from '../../src/modules/did/service-endpoint'; -import { DockBlobIdByteSize } from '../../src/modules/blob'; -import BBSPlusModule from '../../src/modules/bbs-plus'; -import AccumulatorModule from '../../src/modules/accumulator'; -import { OneOfPolicy } from '../../src/utils/revocation'; - -describe('Custom nonce', () => { - const dock = new DockAPI(); - - const did1 = DockDid.random(); - const did2 = DockDid.random(); - - const seed1 = randomAsHex(32); - const seed2 = randomAsHex(32); - - /** - * Send batch of transactions - * @param txs - * @returns {Promise} - */ - async function sendBatch(txs) { - const txBatch = dock.api.tx.utility.batch(txs); - const signedExtrinsic = await dock.signExtrinsic(txBatch); - await dock.send(signedExtrinsic, false); - } - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - const pair = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - await registerNewDIDUsingPair(dock, did1, pair); - await initializeWasm(); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Add key, controller, service endpoint, blob, BBS+ params and keys and accumulator in a batch', async () => { - const nonce = await dock.didModule.getNonceForDid(DockDid.from(did1)); - - const pair = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - const txs = []; - - // Add key - const pair1 = generateEcdsaSecp256k1Keypair(seed2); - const publicKey = PublicKeySecp256k1.fromKeyringPair(pair1); - const verRels = new VerificationRelationship(); - verRels.setAssertion(); - const didKey = new DidKey(publicKey, verRels); - const tx1 = await dock.did.createAddKeysTx( - [didKey], - did1, - did1, - pair, - nonce + 1, - ); - txs.push(tx1); - - // Add controller - const tx2 = await dock.did.createAddControllersTx( - [did2], - did1, - did1, - pair, - nonce + 2, - ); - txs.push(tx2); - - // Add service endpoint - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - const spId = randomAsHex(10); - const origins = [randomAsHex(50), randomAsHex(70)]; - const tx3 = await dock.did.createAddServiceEndpointTx( - spId, - spType, - origins, - did1, - did1, - pair, - nonce + 3, - ); - txs.push(tx3); - - // Add a blob - const blobHex = randomAsHex(100); - const blobId = randomAsHex(DockBlobIdByteSize); - const blob = { - id: blobId, - blob: blobHex, - }; - const tx4 = await dock.blob.createNewTx(blob, did1, pair, { - nonce: nonce + 4, - }); - txs.push(tx4); - - // Add BBS+ params and keys - const label = stringToHex('test-label'); - const params = BBSPlusSignatureParamsG1.generate(10, hexToU8a(label)); - const addParams = BBSPlusModule.prepareAddParameters( - u8aToHex(params.toBytes()), - undefined, - label, - ); - const tx5 = await dock.bbsPlusModule.createAddParamsTx( - addParams, - did1, - pair, - { nonce: nonce + 5 }, - ); - txs.push(tx5); - - const keypair = BBSPlusKeypairG2.generate(params); - const pk = BBSPlusModule.prepareAddPublicKey( - u8aToHex(keypair.publicKey.bytes), - undefined, - [did1, 1], - ); - const tx6 = await dock.bbsPlusModule.createAddPublicKeyTx( - pk, - did1, - did1, - pair, - { nonce: nonce + 6 }, - ); - txs.push(tx6); - - // Add accumulator params and keys - const params1 = Accumulator.generateParams(hexToU8a(label)); - const addParams1 = AccumulatorModule.prepareAddParameters( - u8aToHex(params1.bytes), - undefined, - label, - ); - const tx7 = await dock.accumulatorModule.createAddParamsTx( - addParams1, - did1, - pair, - { nonce: nonce + 7 }, - ); - txs.push(tx7); - - const keypair1 = Accumulator.generateKeypair(params1); - const pk1 = AccumulatorModule.prepareAddPublicKey( - u8aToHex(keypair1.publicKey.bytes), - undefined, - [did1, 1], - ); - const tx8 = await dock.accumulatorModule.createAddPublicKeyTx( - pk1, - did1, - pair, - { nonce: nonce + 8 }, - ); - txs.push(tx8); - - // Add accumulators - const id1 = randomAsHex(32); - const accumulated1 = randomAsHex(100); - const tx9 = await dock.accumulatorModule.createAddPositiveAccumulatorTx( - id1, - accumulated1, - [did1, 1], - did1, - pair, - { nonce: nonce + 9 }, - ); - txs.push(tx9); - - const id2 = randomAsHex(32); - const accumulated2 = randomAsHex(100); - const maxSize = 100000; - const tx10 = await dock.accumulatorModule.createAddUniversalAccumulatorTx( - id2, - accumulated2, - [did1, 1], - maxSize, - did1, - pair, - { nonce: nonce + 10 }, - ); - txs.push(tx10); - - // Send batch of transactions - await sendBatch(txs); - - // Check results of all transactions - const dk = await dock.did.getDidKey(did1, 2); - expect(dk.publicKey).toEqual(publicKey); - - await expect(dock.did.isController(did1, did2)).resolves.toEqual(true); - - const sp = await dock.did.getServiceEndpoint(did1, spId); - expect(sp.type).toEqual(spType); - expect(sp.origins).toEqual(origins); - - const chainBlob = await dock.blob.get(blobId); - expect(!!chainBlob).toBe(true); - expect(u8aToHex(chainBlob[1])).toEqual(blobHex); - - const queriedParams = await dock.bbsPlusModule.getParams(did1, 1); - expect(queriedParams.bytes).toEqual(addParams.bytes); - expect(queriedParams.label).toEqual(addParams.label); - - const queriedPk = await dock.bbsPlusModule.getPublicKey(did1, 3); - expect(queriedPk.bytes).toEqual(pk.bytes); - expect(queriedPk.paramsRef).toEqual([DockDid.from(did1), 1]); - - const queriedParams1 = await dock.accumulatorModule.getParams(did1, 1); - expect(queriedParams1.bytes).toEqual(addParams1.bytes); - expect(queriedParams1.label).toEqual(addParams1.label); - - const queriedPk1 = await dock.accumulatorModule.getPublicKey(did1, 1); - expect(queriedPk1.bytes).toEqual(pk1.bytes); - expect(queriedPk1.paramsRef).toEqual([DockDid.from(did1), 1]); - - const accum1 = await dock.accumulatorModule.getAccumulator(id1, true); - expect(accum1.type).toEqual('positive'); - expect(accum1.accumulated).toEqual(accumulated1); - expect(accum1.keyRef).toEqual([DockDid.from(did1), 1]); - - const accum2 = await dock.accumulatorModule.getAccumulator(id2, true); - expect(accum2.type).toEqual('universal'); - expect(accum2.accumulated).toEqual(accumulated2); - expect(accum2.keyRef).toEqual([DockDid.from(did1), 1]); - expect(accum1.created).toEqual(accum2.created); - expect(accum1.lastModified).toEqual(accum2.lastModified); - }, 20000); - - test('Add 3 registries and submit revocations for all in a batch', async () => { - const owners = new Set(); - owners.add(did1); - - const [revokeIds1, revokeIds2, revokeIds3] = [1, 2, 3].map((_) => { - const r = new Set(); - r.add(randomAsHex(32)); - r.add(randomAsHex(32)); - r.add(randomAsHex(32)); - return r; - }); - - // Create registries - const policy = new OneOfPolicy(owners); - const registryId1 = randomAsHex(32); - const registryId2 = randomAsHex(32); - const registryId3 = randomAsHex(32); - await dock.revocation.newRegistry(registryId1, policy, false, false); - await dock.revocation.newRegistry(registryId2, policy, false, false); - await dock.revocation.newRegistry(registryId3, policy, false, false); - - const pair = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - let currentNonce = await dock.didModule.getNonceForDid(DockDid.from(did1)); - let txs = []; - - // Revoke from all 3 registries in the same transaction batch - for (const [regId, revs, nonce] of [ - [registryId1, revokeIds1, currentNonce + 1], - [registryId2, revokeIds2, currentNonce + 2], - [registryId3, revokeIds3, currentNonce + 3], - ]) { - const [revoke, sig, computedNonce] = await dock.revocation.createSignedRevoke(regId, revs, did1, pair, { - nonce, - }); - expect(computedNonce).toEqual(nonce); - const tx = await dock.revocation.createRevokeTx(revoke, [{ nonce, sig }]); - txs.push(tx); - } - - // Send batch of transactions - await sendBatch(txs); - - // Check results of transactions - for (const [regId, revs] of [ - [registryId1, revokeIds1], - [registryId2, revokeIds2], - [registryId3, revokeIds3], - ]) { - const reg = await dock.revocation.getRevocationRegistry(regId); - expect(reg.policy.isOneOf).toBe(true); - for (const rev of revs) { - const revocationStatus = await dock.revocation.getIsRevoked(regId, rev); - expect(revocationStatus).toBe(true); - } - } - - // Remove from all 3 registries in the same transaction batch - currentNonce = await dock.didModule.getNonceForDid(DockDid.from(did1)); - txs = []; - for (const [regId, nonce] of [ - [registryId1, currentNonce + 1], - [registryId2, currentNonce + 2], - [registryId3, currentNonce + 3], - ]) { - const [remove, sig, computedNonce] = await dock.revocation.createSignedRemove(regId, did1, pair, { nonce }); - expect(computedNonce).toEqual(nonce); - const tx = await dock.revocation.createRemoveRegistryTx(remove, [ - { nonce, sig }, - ]); - txs.push(tx); - } - - // Send batch of transactions - await sendBatch(txs); - - // Check results of transactions - for (const regId of [registryId1, registryId2, registryId3]) { - await expect( - dock.revocation.getRevocationRegistry(regId), - ).rejects.toThrow(/Could not find revocation registry/); - } - }, 30000); - - test('Add keys, service endpoints and remove several DIDs in a batch', async () => { - // Create many DIDs with did1 as their controller - const did3 = DockDid.random(); - const did4 = DockDid.random(); - const did5 = DockDid.random(); - const seed3 = randomAsHex(32); - const seed4 = randomAsHex(32); - const seed5 = randomAsHex(32); - - let vr = new VerificationRelationship(); - vr.setAuthentication(); - - const pair3 = new DidKeypair(dock.keyring.addFromUri(seed3), 1); - const pair4 = new DidKeypair(dock.keyring.addFromUri(seed4), 1); - const pair5 = new DidKeypair(dock.keyring.addFromUri(seed5), 1); - await registerNewDIDUsingPair(dock, did3, pair3, vr, [did1]); - await registerNewDIDUsingPair(dock, did4, pair4, vr, [did1]); - await registerNewDIDUsingPair(dock, did5, pair5, vr, [did1]); - - const pair = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - - let nonce = await dock.didModule.getNonceForDid(DockDid.from(did1)); - let txs = []; - - // Add a key and a service endpoint to each DID - vr = new VerificationRelationship(); - vr.setAssertion(); - const tx1 = await dock.did.createAddKeysTx( - [new DidKey(pair3.publicKey(), vr)], - did3, - did1, - pair, - nonce + 1, - ); - txs.push(tx1); - const tx2 = await dock.did.createAddKeysTx( - [new DidKey(pair4.publicKey(), vr)], - did4, - did1, - pair, - nonce + 2, - ); - txs.push(tx2); - const tx3 = await dock.did.createAddKeysTx( - [new DidKey(pair5.publicKey(), vr)], - did5, - did1, - pair, - nonce + 3, - ); - txs.push(tx3); - - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - const origins = [ - [randomAsHex(50), randomAsHex(70)], - [randomAsHex(50), randomAsHex(70)], - [randomAsHex(50), randomAsHex(70)], - ]; - const spId3 = randomAsHex(10); - const spId4 = randomAsHex(10); - const spId5 = randomAsHex(10); - const tx4 = await dock.did.createAddServiceEndpointTx( - spId3, - spType, - origins[0], - did3, - did1, - pair, - nonce + 4, - ); - txs.push(tx4); - const tx5 = await dock.did.createAddServiceEndpointTx( - spId4, - spType, - origins[1], - did4, - did1, - pair, - nonce + 5, - ); - txs.push(tx5); - const tx6 = await dock.did.createAddServiceEndpointTx( - spId5, - spType, - origins[2], - did5, - did1, - pair, - nonce + 6, - ); - txs.push(tx6); - - // Send batch of transactions - await sendBatch(txs); - - // Check results of all transactions - await expect(dock.did.getDidKey(did3, 2)).resolves.toEqual( - new DidKey(pair3.publicKey(), vr), - ); - await expect(dock.did.getDidKey(did4, 2)).resolves.toEqual( - new DidKey(pair4.publicKey(), vr), - ); - await expect(dock.did.getDidKey(did5, 2)).resolves.toEqual( - new DidKey(pair5.publicKey(), vr), - ); - await expect(dock.did.getServiceEndpoint(did3, spId3)).resolves.toEqual({ - type: spType, - origins: origins[0], - }); - await expect(dock.did.getServiceEndpoint(did4, spId4)).resolves.toEqual({ - type: spType, - origins: origins[1], - }); - await expect(dock.did.getServiceEndpoint(did5, spId5)).resolves.toEqual({ - type: spType, - origins: origins[2], - }); - - // Each DID adds 2 blobs - const nonce3 = await dock.didModule.getNonceForDid(DockDid.from(did3)); - const nonce4 = await dock.didModule.getNonceForDid(DockDid.from(did4)); - const nonce5 = await dock.didModule.getNonceForDid(DockDid.from(did5)); - txs = []; - - const [ - [blobId1, blobHex1, blob1], - [blobId2, blobHex2, blob2], - [blobId3, blobHex3, blob3], - [blobId4, blobHex4, blob4], - [blobId5, blobHex5, blob5], - [blobId6, blobHex6, blob6], - ] = [1, 2, 3, 4, 5, 6].map((_) => { - const bh = randomAsHex(100); - const bi = randomAsHex(DockBlobIdByteSize); - const b = { - id: bi, - blob: bh, - }; - return [bi, bh, b]; - }); - const tx7 = await dock.blob.createNewTx(blob1, did3, pair3, { - nonce: nonce3 + 1, - }); - const tx8 = await dock.blob.createNewTx(blob2, did3, pair3, { - nonce: nonce3 + 2, - }); - txs.push(tx7); - txs.push(tx8); - - const tx9 = await dock.blob.createNewTx(blob3, did4, pair4, { - nonce: nonce4 + 1, - }); - const tx10 = await dock.blob.createNewTx(blob4, did4, pair4, { - nonce: nonce4 + 2, - }); - txs.push(tx9); - txs.push(tx10); - - const tx11 = await dock.blob.createNewTx(blob5, did5, pair5, { - nonce: nonce5 + 1, - }); - const tx12 = await dock.blob.createNewTx(blob6, did5, pair5, { - nonce: nonce5 + 2, - }); - txs.push(tx11); - txs.push(tx12); - - // Send batch of transactions - await sendBatch(txs); - - // Check results - for (const [d, bi, bh] of [ - [did3, blobId1, blobHex1], - [did3, blobId2, blobHex2], - [did4, blobId3, blobHex3], - [did4, blobId4, blobHex4], - [did5, blobId5, blobHex5], - [did5, blobId6, blobHex6], - ]) { - const chainBlob = await dock.blob.get(bi); - expect(!!chainBlob).toBe(true); - expect(u8aToHex(chainBlob[1])).toEqual(bh); - expect(chainBlob[0]).toEqual(DockDid.from(d)); - } - - // Remove all DIDs in a batch - nonce = await dock.didModule.getNonceForDid(DockDid.from(did1)); - txs = []; - - const tx13 = await dock.did.createRemoveTx(did3, did1, pair, nonce + 1); - txs.push(tx13); - const tx14 = await dock.did.createRemoveTx(did4, did1, pair, nonce + 2); - txs.push(tx14); - const tx15 = await dock.did.createRemoveTx(did5, did1, pair, nonce + 3); - txs.push(tx15); - - // Send batch of transactions - await sendBatch(txs); - - // Check results - await expect(dock.did.getDocument(did3)).rejects.toThrow(NoDIDError); - await expect(dock.did.getDocument(did4)).rejects.toThrow(NoDIDError); - await expect(dock.did.getDocument(did5)).rejects.toThrow(NoDIDError); - }, 40000); -}); diff --git a/tests/integration/did/controllers.test.js b/tests/integration/did/controllers.test.js deleted file mode 100644 index 4daf10ef5..000000000 --- a/tests/integration/did/controllers.test.js +++ /dev/null @@ -1,291 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { DockAPI } from '../../../src'; -import { DockDid, NoDIDError, DidKeypair } from '../../../src/did'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../../test-constants'; -import { getPublicKeyFromKeyringPair } from '../../../src/utils/misc'; -import { DidKey, VerificationRelationship } from '../../../src/public-keys'; -import { checkVerificationMethods } from '../helpers'; - -describe('DID controllers', () => { - const dock = new DockAPI(); - - const dockDid1 = DockDid.random(); - - // This DID will be controlled by itself and dockDid1 - const dockDid2 = DockDid.random(); - - // This DID will not control itself but will be controlled by dockDid1 and dockDid2 - const dockDid3 = DockDid.random(); - - const seed1 = randomAsHex(32); - const seed2 = randomAsHex(32); - const seed3 = randomAsHex(32); - const seed4 = randomAsHex(32); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Create self controlled DIDs', async () => { - const pair1 = dock.keyring.addFromUri(seed1); - const publicKey1 = getPublicKeyFromKeyringPair(pair1); - const verRels1 = new VerificationRelationship(); - const didKey1 = new DidKey(publicKey1, verRels1); - await dock.did.new(dockDid1, [didKey1], [], false); - - const pair2 = dock.keyring.addFromUri(seed2); - const publicKey2 = getPublicKeyFromKeyringPair(pair2); - const verRels2 = new VerificationRelationship(); - const didKey2 = new DidKey(publicKey2, verRels2); - await dock.did.new(dockDid2, [didKey2], [dockDid1], false); - - const didDetail1 = await dock.did.getOnchainDidDetail(dockDid1.asDid); - expect(didDetail1.lastKeyId).toBe(1); - expect(didDetail1.activeControllerKeys).toBe(1); - expect(didDetail1.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid1, dockDid1)).resolves.toEqual( - true, - ); - - const didDetail2 = await dock.did.getOnchainDidDetail(dockDid2.asDid); - expect(didDetail2.lastKeyId).toBe(1); - expect(didDetail2.activeControllerKeys).toBe(1); - expect(didDetail2.activeControllers).toBe(2); - await expect(dock.did.isController(dockDid2, dockDid2)).resolves.toEqual( - true, - ); - await expect(dock.did.isController(dockDid2, dockDid1)).resolves.toEqual( - true, - ); - - for (const [newSeed, signer, pair, keyCount] of [ - [seed3, dockDid1, pair1, 2], - [seed4, dockDid2, pair2, 3], - ]) { - const newPair = dock.keyring.addFromUri(newSeed); - const publicKey = getPublicKeyFromKeyringPair(newPair); - const verRels = new VerificationRelationship(); - verRels.setAssertion(); - const didKey = new DidKey(publicKey, verRels); - - await dock.did.addKeys( - [didKey], - dockDid2, - signer, - new DidKeypair(pair, 1), - ); - const didDetail = await dock.did.getOnchainDidDetail(dockDid2.asDid); - expect(didDetail.lastKeyId).toBe(keyCount); - expect(didDetail.activeControllerKeys).toBe(1); - expect(didDetail.activeControllers).toBe(2); - } - }, 60000); - - test('Get DID documents', async () => { - const doc1 = await dock.did.getDocument(dockDid1); - expect(doc1.controller.length).toEqual(1); - - checkVerificationMethods(dockDid1, doc1, 1, 0); - - expect(doc1.authentication.length).toEqual(1); - expect(doc1.authentication[0]).toEqual(`${dockDid1}#keys-1`); - expect(doc1.assertionMethod.length).toEqual(1); - expect(doc1.assertionMethod[0]).toEqual(`${dockDid1}#keys-1`); - expect(doc1.capabilityInvocation.length).toEqual(1); - expect(doc1.capabilityInvocation[0]).toEqual(`${dockDid1}#keys-1`); - - const doc2 = await dock.did.getDocument(dockDid2); - expect(doc2.controller.length).toEqual(2); - - checkVerificationMethods(dockDid2, doc2, 3, 0); - checkVerificationMethods(dockDid2, doc2, 3, 1); - checkVerificationMethods(dockDid2, doc2, 3, 2); - - expect(doc2.authentication.length).toEqual(1); - expect(doc2.authentication[0]).toEqual(`${dockDid2}#keys-1`); - expect(doc2.assertionMethod.length).toEqual(3); - expect(doc2.assertionMethod[0]).toEqual(`${dockDid2}#keys-1`); - expect(doc2.assertionMethod[1]).toEqual(`${dockDid2}#keys-2`); - expect(doc2.assertionMethod[2]).toEqual(`${dockDid2}#keys-3`); - expect(doc2.capabilityInvocation.length).toEqual(1); - expect(doc2.capabilityInvocation[0]).toEqual(`${dockDid2}#keys-1`); - }, 10000); - - test('Create DID controlled by other', async () => { - await dock.did.new(dockDid3, [], [dockDid1], false); - - const didDetail1 = await dock.did.getOnchainDidDetail(dockDid3.asDid); - expect(didDetail1.lastKeyId).toBe(0); - expect(didDetail1.activeControllerKeys).toBe(0); - expect(didDetail1.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid3, dockDid3)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid3, dockDid1)).resolves.toEqual( - true, - ); - }); - - test('Get DID document', async () => { - const doc3 = await dock.did.getDocument(dockDid3); - expect(doc3.controller.length).toEqual(1); - checkVerificationMethods(dockDid3, doc3, 0); - expect(doc3.authentication).not.toBeDefined(); - expect(doc3.assertionMethod).not.toBeDefined(); - expect(doc3.capabilityInvocation).not.toBeDefined(); - }, 10000); - - test('Add keys and more controllers to a DID by its other controller', async () => { - const pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - - // Add key to the DID using its controller - const pair3 = dock.keyring.addFromUri(seed3); - const publicKey1 = getPublicKeyFromKeyringPair(pair3); - const verRels1 = new VerificationRelationship(); - verRels1.setAuthentication(); - const didKey3 = new DidKey(publicKey1, verRels1); - - await dock.did.addKeys([didKey3], dockDid3, dockDid1, pair1); - - let didDetail = await dock.did.getOnchainDidDetail(dockDid3.asDid); - expect(didDetail.lastKeyId).toBe(1); - expect(didDetail.activeControllerKeys).toBe(0); - expect(didDetail.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid3, dockDid3)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid3, dockDid1)).resolves.toEqual( - true, - ); - - const dk1 = await dock.did.getDidKey(dockDid3, 1); - expect(dk1.publicKey).toEqual(publicKey1); - expect(dk1.verRels.isAuthentication()).toEqual(true); - expect(dk1.verRels.isAssertion()).toEqual(false); - expect(dk1.verRels.isCapabilityInvocation()).toEqual(false); - expect(dk1.verRels.isKeyAgreement()).toEqual(false); - - // Add another controller to the DID using its existing controller - await dock.did.addControllers([dockDid2], dockDid3, dockDid1, pair1); - - didDetail = await dock.did.getOnchainDidDetail(dockDid3.asDid); - expect(didDetail.lastKeyId).toBe(1); - expect(didDetail.activeControllerKeys).toBe(0); - expect(didDetail.activeControllers).toBe(2); - await expect(dock.did.isController(dockDid3, dockDid3)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid3, dockDid1)).resolves.toEqual( - true, - ); - await expect(dock.did.isController(dockDid3, dockDid2)).resolves.toEqual( - true, - ); - }); - - test('Get DID document after update', async () => { - const doc3 = await dock.did.getDocument(dockDid3); - expect(doc3.controller.length).toEqual(2); - // expect(doc3.verificationMethod.length).toEqual(1); - checkVerificationMethods(dockDid3, doc3, 1, 0); - expect(doc3.authentication.length).toEqual(1); - expect(doc3.authentication[0]).toEqual(`${dockDid3}#keys-1`); - expect(doc3.assertionMethod).not.toBeDefined(); - expect(doc3.capabilityInvocation).not.toBeDefined(); - }, 10000); - - test('Remove existing controllers from a DID by its controller', async () => { - const pair2 = new DidKeypair(dock.keyring.addFromUri(seed2), 1); - await dock.did.removeControllers([dockDid1], dockDid3, dockDid2, pair2); - - const didDetail = await dock.did.getOnchainDidDetail(dockDid3.asDid); - expect(didDetail.lastKeyId).toBe(1); - expect(didDetail.activeControllerKeys).toBe(0); - expect(didDetail.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid3, dockDid3)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid3, dockDid1)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid3, dockDid2)).resolves.toEqual( - true, - ); - }); - - test('Remove DID using its controller', async () => { - const pair2 = new DidKeypair(dock.keyring.addFromUri(seed2), 1); - await dock.did.remove(dockDid3, dockDid2, pair2); - await expect(dock.did.getDocument(dockDid3)).rejects.toThrow(NoDIDError); - await expect(dock.did.getOnchainDidDetail(dockDid3.asDid)).rejects.toThrow( - NoDIDError, - ); - await expect(dock.did.getDidKey(dockDid3, 1)).rejects.toThrow(); - await expect(dock.did.isController(dockDid3, dockDid2)).resolves.toEqual( - false, - ); - }); - - test('Add and remove multiple controllers', async () => { - const pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - const pair2 = new DidKeypair(dock.keyring.addFromUri(seed2), 1); - - const dockDid4 = DockDid.random(); - - await dock.did.addControllers( - [dockDid3, dockDid4], - dockDid2, - dockDid1, - pair1, - ); - - let didDetail = await dock.did.getOnchainDidDetail(dockDid2.asDid); - expect(didDetail.activeControllers).toBe(4); - await expect(dock.did.isController(dockDid2, dockDid1)).resolves.toEqual( - true, - ); - await expect(dock.did.isController(dockDid2, dockDid2)).resolves.toEqual( - true, - ); - await expect(dock.did.isController(dockDid2, dockDid3)).resolves.toEqual( - true, - ); - await expect(dock.did.isController(dockDid2, dockDid4)).resolves.toEqual( - true, - ); - - await dock.did.removeControllers( - [dockDid1, dockDid3, dockDid4], - dockDid2, - dockDid2, - pair2, - ); - didDetail = await dock.did.getOnchainDidDetail(dockDid2.asDid); - expect(didDetail.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid2, dockDid1)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid2, dockDid2)).resolves.toEqual( - true, - ); - await expect(dock.did.isController(dockDid2, dockDid3)).resolves.toEqual( - false, - ); - await expect(dock.did.isController(dockDid2, dockDid4)).resolves.toEqual( - false, - ); - }); -}); diff --git a/tests/integration/did/did-basic.test.js b/tests/integration/did/did-basic.test.js deleted file mode 100644 index ae75b615e..000000000 --- a/tests/integration/did/did-basic.test.js +++ /dev/null @@ -1,147 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockAPI } from '../../../src'; -import { ATTESTS_IRI } from '../../../src/modules/did'; - -import { - DockDid, - NoDIDError, - NoOffchainDIDError, - DidKeypair, -} from '../../../src/did'; -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../../test-constants'; -import { VerificationRelationship, DidKey } from '../../../src/public-keys'; -import { checkVerificationMethods } from '../helpers'; - -describe('Basic DID tests', () => { - const dock = new DockAPI(); - - // Generate a random DID - const dockDid = DockDid.random(); - let typedDid; - let hexDid; - - // Generate first key with this seed. The key type is Sr25519 - const seed = randomAsHex(32); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - typedDid = DockDid.from(dockDid); - hexDid = typedDid.asDid; - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Has keyring and account', () => { - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - expect(!!dock.keyring).toBe(true); - expect(!!dock.account).toBe(true); - }); - - test('Can create a DID', async () => { - // DID does not exist - await expect(dock.did.getOnchainDidDetail(hexDid)).rejects.toThrow( - NoDIDError, - ); - - const pair = new DidKeypair(dock.keyring.addFromUri(seed)); - const publicKey = pair.publicKey(); - - const verRels = new VerificationRelationship(); - const didKey = new DidKey(publicKey, verRels); - - await dock.did.new(dockDid, [didKey], [], false); - const didDetail = await dock.did.getOnchainDidDetail(hexDid); - expect(didDetail.lastKeyId).toBe(1); - expect(didDetail.activeControllerKeys).toBe(1); - expect(didDetail.activeControllers).toBe(1); - await expect(dock.did.isController(dockDid, dockDid)).resolves.toEqual( - true, - ); - - // DID cannot be fetched as off-chain DID - await expect(dock.did.getOffchainDidDetail(hexDid)).rejects.toThrow( - NoOffchainDIDError, - ); - }, 30000); - - test('Get key for DID', async () => { - const dk = await dock.did.getDidKey(dockDid, 1); - const pair = new DidKeypair(dock.keyring.addFromUri(seed)); - expect(dk.publicKey).toEqual(pair.publicKey()); - expect(dk.verRels.isAuthentication()).toEqual(true); - expect(dk.verRels.isAssertion()).toEqual(true); - expect(dk.verRels.isCapabilityInvocation()).toEqual(true); - expect(dk.verRels.isKeyAgreement()).toEqual(false); - }); - - test('Can get a DID document', async () => { - function check(doc) { - expect(!!doc).toBe(true); - expect(doc.controller.length).toEqual(1); - checkVerificationMethods(dockDid, doc, 1, 0); - expect(doc.authentication.length).toEqual(1); - expect(doc.authentication[0]).toEqual(`${dockDid}#keys-1`); - expect(doc.assertionMethod.length).toEqual(1); - expect(doc.assertionMethod[0]).toEqual(`${dockDid}#keys-1`); - expect(doc.capabilityInvocation.length).toEqual(1); - expect(doc.capabilityInvocation[0]).toEqual(`${dockDid}#keys-1`); - } - - const doc = await dock.did.getDocument(dockDid); - check(doc); - - // The same checks should pass when passing the flag for keys - const doc1 = await dock.did.getDocument(dockDid, { - getOffchainSigKeys: false, - }); - check(doc1); - - const doc2 = await dock.did.getDocument(dockDid, { - getOffchainSigKeys: true, - }); - check(doc2); - }, 10000); - - test('Can attest with a DID', async () => { - const priority = 1; - const iri = 'my iri'; - const pair = new DidKeypair(dock.keyring.addFromUri(seed), 1); - - await dock.did.setClaim(priority, iri, dockDid, pair, undefined, false); - - const att = await dock.did.getAttests(typedDid); - expect(att).toEqual(iri); - - // Get document to verify the claim is there - const didDocument = await dock.did.getDocument(dockDid); - - // Verify attests property exists - expect(didDocument[ATTESTS_IRI]).toEqual(iri); - }, 30000); - - test('Can remove DID', async () => { - const pair = new DidKeypair(dock.keyring.addFromUri(seed), 1); - await dock.did.remove(dockDid, dockDid, pair, undefined, false); - // DID removed - await expect(dock.did.getDocument(dockDid)).rejects.toThrow(NoDIDError); - await expect(dock.did.getOnchainDidDetail(hexDid)).rejects.toThrow( - NoDIDError, - ); - await expect(dock.did.getDidKey(dockDid, 1)).rejects.toThrow(); - await expect(dock.did.isController(dockDid, dockDid)).resolves.toEqual( - false, - ); - }); -}); diff --git a/tests/integration/did/did-key.test.js b/tests/integration/did/did-key.test.js deleted file mode 100644 index 5d3395c8a..000000000 --- a/tests/integration/did/did-key.test.js +++ /dev/null @@ -1,116 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockAPI } from '../../../src'; -import { - NoDIDError, - DidKeypair, - DidMethodKey, - DockDidOrDidMethodKey, -} from '../../../src/did'; -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../../test-constants'; - -describe('Basic DID tests', () => { - const dock = new DockAPI(); - - // Generate a random DID - const testDidMethodKeySeed1 = randomAsHex(32); - let testDidMethodKeyPair1; - let testDidMethodKey1; - - let testDidMethodKeyPair2; - let testDidMethodKey2; - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - testDidMethodKeyPair1 = new DidKeypair( - dock.keyring.addFromUri(testDidMethodKeySeed1, null, 'ed25519'), - ); - testDidMethodKey1 = new DidMethodKey(testDidMethodKeyPair1.publicKey()); - - testDidMethodKeyPair2 = DidKeypair.randomSecp256k1(); - testDidMethodKey2 = DidMethodKey.fromKeypair(testDidMethodKeyPair2); - - await dock.did.newDidMethodKey(testDidMethodKey1.asDidMethodKey, false); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Can create a did:key', async () => { - // DID does not exist - await expect( - dock.did.getDidMethodKeyDetail(testDidMethodKey2.asDidMethodKey), - ).rejects.toThrow(NoDIDError); - - await dock.did.newDidMethodKey(testDidMethodKey2.asDidMethodKey, false); - const { nonce } = await dock.did.getDidMethodKeyDetail( - testDidMethodKey2.asDidMethodKey, - ); - expect(nonce).toBeGreaterThan(1); - expect(testDidMethodKey2.toString().startsWith('did:key:z')).toBe(true); - }, 30000); - - test('Can attest with a DID', async () => { - const priority = 1; - const iri = 'my iri'; - - await dock.did.setClaim( - priority, - iri, - testDidMethodKey1, - testDidMethodKeyPair1, - undefined, - false, - ); - - const att1 = await dock.did.getAttests(testDidMethodKey1); - expect(att1).toEqual(iri); - - await dock.did.setClaim( - priority, - iri, - testDidMethodKey2, - testDidMethodKeyPair2, - undefined, - false, - ); - - const att2 = await dock.did.getAttests(testDidMethodKey2); - expect(att2).toEqual(iri); - }, 30000); - - test('Conversion works properly (including SS58 format)', () => { - const substrateDid1 = dock.api.createType( - 'DidOrDidMethodKey', - testDidMethodKey1, - ); - expect(DockDidOrDidMethodKey.from(substrateDid1)).toEqual( - testDidMethodKey1, - ); - expect(testDidMethodKey1).toEqual( - DockDidOrDidMethodKey.from(testDidMethodKey1), - ); - - const substrateDid2 = dock.api.createType( - 'DidOrDidMethodKey', - testDidMethodKey2, - ); - expect(DockDidOrDidMethodKey.from(substrateDid2)).toEqual( - testDidMethodKey2, - ); - expect(testDidMethodKey2).toEqual( - DockDidOrDidMethodKey.from(testDidMethodKey2), - ); - }); -}); diff --git a/tests/integration/did/offchain-did.test.js b/tests/integration/did/offchain-did.test.js deleted file mode 100644 index 994b2d15f..000000000 --- a/tests/integration/did/offchain-did.test.js +++ /dev/null @@ -1,76 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { u8aToHex } from '@polkadot/util'; -import { DockAPI } from '../../../src'; -import { DockDid, NoDIDError, NoOnchainDIDError } from '../../../src/did'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../../test-constants'; -import { OffChainDidDocRef } from '../../../src/modules/did'; - -describe('Off-chain DIDs', () => { - const dock = new DockAPI(); - - // Generate a random DID - const dockDID = DockDid.random(); - - const firstDocRef = randomAsHex(100); - const secondDocRef = randomAsHex(110); - const thirdDocRef = randomAsHex(89); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Can create an off-chain DID', async () => { - // DID does not exist - await expect(dock.did.getOffchainDidDetail(dockDID.asDid)).rejects.toThrow( - NoDIDError, - ); - - const docRef = OffChainDidDocRef.cid(firstDocRef); - await dock.did.newOffchain(dockDID, docRef, false); - const didDetail = await dock.did.getOffchainDidDetail(dockDID.asDid); - expect(didDetail.docRef).toEqual(docRef); - expect(didDetail.accountId).toEqual(u8aToHex(dock.account.addressRaw)); - - // DID cannot be fetched as on-chain DID - await expect(dock.did.getOnchainDidDetail(dockDID.asDid)).rejects.toThrow( - NoOnchainDIDError, - ); - }); - - test('Can update DIDDoc reference for the DID to URL', async () => { - const docRef = OffChainDidDocRef.url(secondDocRef); - await dock.did.setOffchainDidRef(dockDID, docRef, false); - const didDetail = await dock.did.getOffchainDidDetail(dockDID.asDid); - expect(didDetail.docRef).toEqual(docRef); - expect(didDetail.accountId).toEqual(u8aToHex(dock.account.addressRaw)); - }); - - test('Can update DIDDoc reference for the DID to Custom', async () => { - const docRef = OffChainDidDocRef.custom(thirdDocRef); - await dock.did.setOffchainDidRef(dockDID, docRef, false); - const didDetail = await dock.did.getOffchainDidDetail(dockDID.asDid); - expect(didDetail.docRef).toEqual(docRef); - expect(didDetail.accountId).toEqual(u8aToHex(dock.account.addressRaw)); - }); - - test('Can remove the DID', async () => { - await dock.did.removeOffchainDid(dockDID, false); - await expect(dock.did.getOffchainDidDetail(dockDID.asDid)).rejects.toThrow( - NoDIDError, - ); - }); -}); diff --git a/tests/integration/did/service-endpoint.test.js b/tests/integration/did/service-endpoint.test.js deleted file mode 100644 index e5fc8837e..000000000 --- a/tests/integration/did/service-endpoint.test.js +++ /dev/null @@ -1,193 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; -import { DockAPI } from '../../../src'; -import { DockDid, NoDIDError, DidKeypair } from '../../../src/did'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../../test-constants'; -import { DidKey, VerificationRelationship } from '../../../src/public-keys'; -import { ServiceEndpointType } from '../../../src/modules/did/service-endpoint'; - -describe('DID service endpoints', () => { - const encoder = new TextEncoder(); - - const dock = new DockAPI(); - - const dockDid1 = DockDid.random(); - - // This DID will not be controlled by itself - const dockDid2 = DockDid.random(); - - const seed1 = randomAsHex(32); - const seed2 = randomAsHex(32); - - const spId1Text = `${dockDid1}#linked-domain-1`; - const spId2Text = `${dockDid2}#linked-domain-1`; - const spId3Text = `${dockDid2}#linked-domain-2`; - const spId1 = u8aToHex(encoder.encode(spId1Text)); - const spId2 = u8aToHex(encoder.encode(spId2Text)); - const spId3 = u8aToHex(encoder.encode(spId3Text)); - - const origins1Text = ['https://foo.example.com']; - const origins2Text = [ - 'https://foo.example.com', - 'https://bar.example.com', - 'https://baz.example.com', - ]; - const origins3Text = ['https://biz.example.com']; - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Create DIDs and add service endpoint', async () => { - const pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - const publicKey1 = pair1.publicKey(); - const didKey1 = new DidKey(publicKey1, new VerificationRelationship()); - - await dock.did.new(dockDid1, [didKey1], [], false); - - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - - // `dockDid1` adds service endpoint for itself - const origins1 = origins1Text.map((u) => u8aToHex(encoder.encode(u))); - await dock.did.addServiceEndpoint( - spId1, - spType, - origins1, - dockDid1, - dockDid1, - pair1, - undefined, - false, - ); - - const sp = await dock.did.getServiceEndpoint(dockDid1, spId1); - expect(sp.type).toEqual(spType); - expect(sp.origins).toEqual(origins1); - - const pair2 = new DidKeypair(dock.keyring.addFromUri(seed2), 1); - const publicKey2 = pair2.publicKey(); - const vr = new VerificationRelationship(); - vr.setAssertion(); - const didKey2 = new DidKey(publicKey2, vr); - - await dock.did.new(dockDid2, [didKey2], [dockDid1], false); - - // `dockDid1` adds service endpoint to `dockDid2` - const origins2 = origins2Text.map((u) => u8aToHex(encoder.encode(u))); - await dock.did.addServiceEndpoint( - spId2, - spType, - origins2, - dockDid2, - dockDid1, - pair1, - undefined, - false, - ); - - const sp1 = await dock.did.getServiceEndpoint(dockDid2, spId2); - expect(sp1.type).toEqual(spType); - expect(sp1.origins).toEqual(origins2); - }, 3e4); - - test('Get DID document with service endpoints', async () => { - const [doc1, doc2] = await Promise.all([ - dock.did.getDocument(dockDid1), - dock.did.getDocument(dockDid2), - ]); - expect(doc1.service.length).toEqual(1); - expect(doc1.service[0].id).toEqual(spId1Text); - expect(doc1.service[0].type).toEqual('LinkedDomains'); - expect(doc1.service[0].serviceEndpoint).toEqual(origins1Text); - - expect(doc2.service.length).toEqual(1); - expect(doc2.service[0].id).toEqual(spId2Text); - expect(doc2.service[0].type).toEqual('LinkedDomains'); - expect(doc2.service[0].serviceEndpoint).toEqual(origins2Text); - }, 3e4); - - test('Add another service endpoint', async () => { - const pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - const origins = origins3Text.map((u) => u8aToHex(encoder.encode(u))); - await dock.did.addServiceEndpoint( - spId3, - spType, - origins, - dockDid2, - dockDid1, - pair1, - undefined, - false, - ); - const sp = await dock.did.getServiceEndpoint(dockDid2, spId3); - expect(sp.type).toEqual(spType); - expect(sp.origins).toEqual(origins); - }, 3e4); - - test('Get DID document with multiple service endpoints', async () => { - const doc = await dock.did.getDocument(dockDid2); - expect(doc.service.length).toEqual(2); - expect(doc.service[0].type).toEqual('LinkedDomains'); - expect(doc.service[1].type).toEqual('LinkedDomains'); - expect( - (doc.service[0].id === spId2Text && doc.service[1].id === spId3Text) - || (doc.service[0].id === spId3Text && doc.service[1].id === spId2Text), - ).toBe(true); - - expect( - (JSON.stringify(doc.service[0].serviceEndpoint) - === JSON.stringify(origins2Text) - && JSON.stringify(doc.service[1].serviceEndpoint) - === JSON.stringify(origins3Text)) - || (JSON.stringify(doc.service[0].serviceEndpoint) - === JSON.stringify(origins3Text) - && JSON.stringify(doc.service[1].serviceEndpoint) - === JSON.stringify(origins2Text)), - ).toBe(true); - }); - - test('Remove service endpoint', async () => { - const pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - // `dockDid1` removes service endpoint of `dockDid2` - await dock.did.removeServiceEndpoint( - spId2, - dockDid2, - dockDid1, - pair1, - undefined, - false, - ); - await expect( - dock.did.getServiceEndpoint(dockDid2, spId2), - ).rejects.toThrow(); - }, 3e4); - - test('Removing DID removes service endpoint as well', async () => { - const pair1 = new DidKeypair(dock.keyring.addFromUri(seed1), 1); - - await dock.did.remove(dockDid1, dockDid1, pair1); - - await expect(dock.did.getOnchainDidDetail(dockDid1.asDid)).rejects.toThrow( - NoDIDError, - ); - await expect( - dock.did.getServiceEndpoint(dockDid1, spId1), - ).rejects.toThrow(); - }, 3e4); -}); diff --git a/tests/integration/dock-sdk.test.js b/tests/integration/dock-sdk.test.js deleted file mode 100644 index 63375f3b3..000000000 --- a/tests/integration/dock-sdk.test.js +++ /dev/null @@ -1,32 +0,0 @@ -import { DockAPI } from '../../src/index'; -import { FullNodeEndpoint } from '../test-constants'; - -describe('Config on NodeJS environment', () => { - test('Is running in NodeJS environment', () => { - expect(typeof window !== 'undefined').toBeFalsy(); - }); -}); - -describe('Dock API', () => { - const dock = new DockAPI(); - - test('Can connect to node', async () => { - await dock.init({ - address: FullNodeEndpoint, - }); - expect(!!dock.api).toBe(true); - }); - - test('Has DID Module', () => { - expect(!!dock.did).toBe(true); - }); - - test('Has Revocation Module', () => { - expect(!!dock.revocation).toBe(true); - }); - - test('Can disconnect from node', async () => { - await dock.disconnect(); - expect(!!dock.api).toBe(false); - }); -}); diff --git a/tests/integration/eth/erc20.test.js b/tests/integration/eth/erc20.test.js deleted file mode 100644 index 2290a95aa..000000000 --- a/tests/integration/eth/erc20.test.js +++ /dev/null @@ -1,67 +0,0 @@ -import { bnToBn } from '@polkadot/util'; - -import { ERC20_BYTECODE, ERC20_ABI } from '../../../scripts/eth/bytecodes-and-abis'; -import { - deployContract, endowEVMAddressWithDefault, - getTestEVMAccountsFromWeb3, getTokenBalance, getWeb3, sendTokens, -} from '../../../scripts/eth/helpers'; - -import { - FullNodeEndpoint, TestAccountURI, MinGasPrice, MaxGas, FullNodeTCPEndpoint, -} from '../../test-constants'; -import { defaultEVMAccountEndowment } from '../helpers'; - -describe('Deploy an ERC-20 contract and transfer ERC-20 tokens', () => { - let alice; - let bob; - const web3 = getWeb3(FullNodeTCPEndpoint); - - beforeAll(async () => { - const [a, b] = getTestEVMAccountsFromWeb3(web3); - alice = a; - bob = b; - await endowEVMAddressWithDefault(alice.address, defaultEVMAccountEndowment(), FullNodeEndpoint, TestAccountURI); - await endowEVMAddressWithDefault(bob.address, defaultEVMAccountEndowment(), FullNodeEndpoint, TestAccountURI); - }); - - afterAll(async () => { - await web3.currentProvider.disconnect(); - }, 10000); - - test('Deploy contract and transfer tokens', async () => { - const decimals = web3.utils.toBN(18); - const supply = web3.utils.toBN(10000); - const transferAmount = web3.utils.toBN(100); - const supplyValue = supply.mul(web3.utils.toBN(10).pow(decimals)); - const transferValue = transferAmount.mul(web3.utils.toBN(10).pow(decimals)); - - const aliceBal0 = await web3.eth.getBalance(alice.address); - - // Deploy contract - const argsABI = web3.eth.abi.encodeParameters(['uint256'], [supplyValue]); - const contractBytecode = ERC20_BYTECODE + argsABI.slice(2); - const contractAddr = await deployContract(web3, alice, contractBytecode, 0, MinGasPrice, MaxGas); - - // Alice's balance should decrease due to contract deployment fees - const aliceBal1 = await web3.eth.getBalance(alice.address); - expect(bnToBn(aliceBal0).gt(bnToBn(aliceBal1))).toBeTruthy(); - - const aliceErcBal0 = await getTokenBalance(web3, contractAddr, ERC20_ABI, alice.address); - const bobErcBal0 = await getTokenBalance(web3, contractAddr, ERC20_ABI, bob.address); - - // Transfer ERC-20 tokens - await sendTokens(web3, alice, contractAddr, ERC20_ABI, bob.address, transferValue, MinGasPrice, MaxGas); - - const aliceErcBal1 = await getTokenBalance(web3, contractAddr, ERC20_ABI, alice.address); - const bobErcBal1 = await getTokenBalance(web3, contractAddr, ERC20_ABI, bob.address); - - // Bob's ERC-20 balance should increase - expect(bnToBn(bobErcBal1).gt(bnToBn(bobErcBal0))).toBeTruthy(); - // Alice's ERC-20 balance should decrease - expect(bnToBn(aliceErcBal0).gt(bnToBn(aliceErcBal1))).toBeTruthy(); - - // Alice's balance should decrease due to token transfer fees - const aliceBal2 = await web3.eth.getBalance(alice.address); - expect(bnToBn(aliceBal1).gt(bnToBn(aliceBal2))).toBeTruthy(); - }, 20000); -}); diff --git a/tests/integration/eth/fiat-pricing-dummy.test.js b/tests/integration/eth/fiat-pricing-dummy.test.js deleted file mode 100644 index a8915581f..000000000 --- a/tests/integration/eth/fiat-pricing-dummy.test.js +++ /dev/null @@ -1,86 +0,0 @@ -import { - getTestEVMAccountsFromWeb3, endowEVMAddressWithDefault, sendEVMTxn, deployContract, getWeb3, -} from '../../../scripts/eth/helpers'; -import { - DUMMY_AGGREGATOR_BYTECODE, DUMMY_AGGREGATOR_ABI, DUMMY_PROXY_BYTECODE, DUMMY_PROXY_ABI, -} from '../../../scripts/eth/bytecodes-and-abis'; - -import { - FullNodeEndpoint, TestAccountURI, MinGasPrice, MaxGas, FullNodeTCPEndpoint, -} from '../../test-constants'; -import { defaultEVMAccountEndowment } from '../helpers'; - -describe('Deploy a dummy aggregator and a proxy contract', () => { - let alice; - const web3 = getWeb3(FullNodeTCPEndpoint); - - beforeAll(async () => { - const [a] = getTestEVMAccountsFromWeb3(web3); - alice = a; - await endowEVMAddressWithDefault(alice.address, defaultEVMAccountEndowment(), FullNodeEndpoint, TestAccountURI); - }, 15000); - - afterAll(async () => { - await web3.currentProvider.disconnect(); - }, 10000); - - test('It works', async () => { - // Constructor arguments for the aggregator contract - const argsABI = web3.eth.abi.encodeParameters(['uint80', 'int256', 'uint256', 'uint256', 'uint80'], [10, 15, 1200, 1200, 10]); - expect(argsABI).toEqual('0x000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000000a'); - - // Deploy aggregator contract - const aggregatorContractBytecode = DUMMY_AGGREGATOR_BYTECODE + argsABI.slice(2); - const aggregatorAddress = await deployContract(web3, alice, aggregatorContractBytecode, 0, MinGasPrice, MaxGas); - - // Prepare proxy contract constructor arguments and deploy it - const proxyArgsABI = web3.eth.abi.encodeParameters(['address'], [aggregatorAddress]).slice(2); - const proxyAddress = await deployContract(web3, alice, DUMMY_PROXY_BYTECODE + proxyArgsABI, 0, MinGasPrice, MaxGas); - - const proxyContract = new web3.eth.Contract(DUMMY_PROXY_ABI, proxyAddress); - - // Fetch current aggregator address from proxy - const aggrFromProxyAddr = await proxyContract.methods.aggregator().call(); - const aggrFromProxyContract = new web3.eth.Contract(DUMMY_AGGREGATOR_ABI, aggrFromProxyAddr); - - // Latest round data should match what was passed in the constructor - let latestRoundData = await aggrFromProxyContract.methods.latestRoundData().call(); - expect(latestRoundData['0']).toEqual('10'); - expect(latestRoundData['1']).toEqual('15'); - expect(latestRoundData['2']).toEqual('1200'); - expect(latestRoundData['3']).toEqual('1200'); - expect(latestRoundData['4']).toEqual('10'); - let answer = await aggrFromProxyContract.methods.answer().call(); - expect(answer).toEqual('15'); - - // Update round data - let setCallAbi = aggrFromProxyContract.methods.setData(11, 25, 1300, 1300, 10).encodeABI(); - expect(setCallAbi).toEqual('0x6444bd16000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000005140000000000000000000000000000000000000000000000000000000000000514000000000000000000000000000000000000000000000000000000000000000a'); - await sendEVMTxn(web3, alice, aggrFromProxyAddr, setCallAbi, 0, MinGasPrice, MaxGas); - - // Latest round data should match what was set in the last call - latestRoundData = await aggrFromProxyContract.methods.latestRoundData().call(); - expect(latestRoundData['0']).toEqual('11'); - expect(latestRoundData['1']).toEqual('25'); - expect(latestRoundData['2']).toEqual('1300'); - expect(latestRoundData['3']).toEqual('1300'); - expect(latestRoundData['4']).toEqual('10'); - answer = await aggrFromProxyContract.methods.answer().call(); - expect(answer).toEqual('25'); - - // Update round data again - setCallAbi = aggrFromProxyContract.methods.setData(12, 30, 1400, 1400, 11).encodeABI(); - expect(setCallAbi).toEqual('0x6444bd16000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000005780000000000000000000000000000000000000000000000000000000000000578000000000000000000000000000000000000000000000000000000000000000b'); - await sendEVMTxn(web3, alice, aggrFromProxyAddr, setCallAbi, 0, MinGasPrice, MaxGas); - - // Latest round data should match what was set in the last call - latestRoundData = await aggrFromProxyContract.methods.latestRoundData().call(); - expect(latestRoundData['0']).toEqual('12'); - expect(latestRoundData['1']).toEqual('30'); - expect(latestRoundData['2']).toEqual('1400'); - expect(latestRoundData['3']).toEqual('1400'); - expect(latestRoundData['4']).toEqual('11'); - answer = await aggrFromProxyContract.methods.answer().call(); - expect(answer).toEqual('30'); - }, 40000); -}); diff --git a/tests/integration/eth/native-balance-to-eth.test.js b/tests/integration/eth/native-balance-to-eth.test.js deleted file mode 100644 index 41505daa0..000000000 --- a/tests/integration/eth/native-balance-to-eth.test.js +++ /dev/null @@ -1,119 +0,0 @@ -import { bnToBn } from '@polkadot/util'; -import { - getTestEVMAccountsFromWeb3, getWeb3, sendTokensToEVMAddress, -} from '../../../scripts/eth/helpers'; - -import { DockAPI } from '../../../src/index'; - -import { getBalance } from '../../../src/utils/chain-ops'; -import { - endowEVMAddress, - evmAddrToSubstrateAddr, substrateAddrToEVMAddr, -} from '../../../src/utils/evm-utils'; - -import { - FullNodeEndpoint, TestKeyringOpts, TestAccountURI, MinGasPrice, MaxGas, FullNodeTCPEndpoint, -} from '../../test-constants'; -import { defaultEVMAccountEndowment } from '../helpers'; - -describe('Transfer native Dock tokens to an EVM account and withdraw it back to native account', () => { - const dock = new DockAPI(); - const web3 = getWeb3(FullNodeTCPEndpoint); - let carol; - let jacob; - // 100 tokens - const transferAmount = 100000000; - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - // Create a EVM account Carol - const [, , c] = getTestEVMAccountsFromWeb3(web3); - carol = c; - jacob = dock.keyring.addFromUri(TestAccountURI); - }); - - afterAll(async () => { - await dock.disconnect(); - await web3.currentProvider.disconnect(); - }, 10000); - - test('Send native tokens to EVM address', async () => { - // Jacob has Dock tokens and will send tokens to Carol. - - // Carol's native address - const carolSubsAddr = evmAddrToSubstrateAddr(carol.address); - - const carolNatBal0 = await getBalance(dock.api, carolSubsAddr, false); - const carolWeb3Bal0 = await web3.eth.getBalance(carol.address); - console.log(`Balance of Carol's address using web3: ${carolWeb3Bal0}`); - console.log(`Balance of Carol's address using polkadot-js: ${carolNatBal0}`); - expect([+carolWeb3Bal0 + (+carolNatBal0 !== 0 && 500), +carolWeb3Bal0]).toContain(carolNatBal0); - - // Setup Jacob as sender - dock.setAccount(jacob); - const jacobBal0 = await getBalance(dock.api, jacob.address, false); - - // Send tokens to Carol's EVM address. - await endowEVMAddress(dock, carol.address, defaultEVMAccountEndowment()); - - const carolNatBal1 = await getBalance(dock.api, carolSubsAddr, false); - const carolWeb3Bal1 = await web3.eth.getBalance(carol.address); - expect([+carolWeb3Bal1 + 500, +carolWeb3Bal1]).toContain(carolNatBal1); - console.log(`Balance of Carol's address using web3: ${carolWeb3Bal1}`); - console.log(`Balance of Carol's address using polkadot-js: ${carolNatBal1}`); - - // Carol's balance should increase - expect(bnToBn(carolNatBal1).gt(bnToBn(carolNatBal0))).toBeTruthy(); - - // Jacob's balance should decrease - const jacobBal1 = await getBalance(dock.api, jacob.address, false); - expect(bnToBn(jacobBal1).lt(bnToBn(jacobBal0))).toBeTruthy(); - }, 20000); - - test('Send tokens from EVM address to another EVM address derived from a native address', async () => { - // Carol sends tokens from her EVM address to an intermediate EVM address created by Jacob - - // Jacob's intermediate EVM address - const intermediateAddress = substrateAddrToEVMAddr(jacob.address); - - const jacobNatBal0 = await getBalance(dock.api, jacob.address, false); - const intermBal0 = await web3.eth.getBalance(intermediateAddress); - console.log(`Balance of the intermediate address using web3: ${intermBal0}`); - console.log(`Balance of Jacob's address using polkadot-js: ${jacobNatBal0}`); - - // Carol sends tokens to the intermediate EVM address - await sendTokensToEVMAddress(web3, carol, intermediateAddress, transferAmount, MinGasPrice, MaxGas); - - const intermBal1 = await web3.eth.getBalance(intermediateAddress); - console.log(`Balance of the intermediate address using web3: ${intermBal1}`); - - // intermediate address's balance should increase - expect(bnToBn(intermBal1).gt(bnToBn(intermBal0))).toBeTruthy(); - - // Jacob's Native balance does not change - const jacobNatBal1 = await getBalance(dock.api, jacob.address, false); - console.log(`Balance of Jacob's address using polkadot-js: ${jacobNatBal1}`); - expect(jacobNatBal1).toEqual(jacobNatBal0); - }, 20000); - - test('Withdraw tokens from EVM address to a native address', async () => { - // Withdraw from the intermediate address of Jacob to his native address - - // Jacob's intermediate EVM address - const intermediateAddress = substrateAddrToEVMAddr(jacob.address); - - const jacobNatBal0 = await getBalance(dock.api, jacob.address, false); - const intermBal0 = await web3.eth.getBalance(intermediateAddress); - - const withdraw = dock.api.tx.evm.withdraw(intermediateAddress, transferAmount); - await dock.signAndSend(withdraw, false); - - const jacobNatBal1 = await getBalance(dock.api, jacob.address, false); - const intermBal1 = await web3.eth.getBalance(intermediateAddress); - expect(bnToBn(jacobNatBal1).gt(bnToBn(jacobNatBal0))).toBeTruthy(); - expect(bnToBn(intermBal0).gt(bnToBn(intermBal1))).toBeTruthy(); - }, 20000); -}); diff --git a/tests/integration/eth/storage-reader.test.js b/tests/integration/eth/storage-reader.test.js deleted file mode 100644 index 5c87c86ed..000000000 --- a/tests/integration/eth/storage-reader.test.js +++ /dev/null @@ -1,166 +0,0 @@ -import { bnToBn } from '@polkadot/util'; -import * as $ from 'parity-scale-codec'; -import { DockAPI } from '../../../src/index'; -import { - PALLET_STORAGE_ACCESSOR_BYTECODE, - PALLET_STORAGE_ACCESSOR_ABI, - PALLET_STORAGE_ACCESSOR_DEPLOYED_BYTECODE, -} from '../../../scripts/eth/bytecodes-and-abis'; -import { - deployContract, - endowEVMAddressWithDefault, - getTestEVMAccountsFromWeb3, - getWeb3, -} from '../../../scripts/eth/helpers'; - -import { - TestKeyringOpts, - FullNodeEndpoint, - TestAccountURI, - MinGasPrice, - MaxGas, - FullNodeTCPEndpoint, -} from '../../test-constants'; -import { defaultEVMAccountEndowment } from '../helpers'; - -describe('Deploy a `PalletStorageAccessor` contract and read storage using its methods', () => { - let alice; - let bob; - let contractAddress; - const web3 = getWeb3(FullNodeTCPEndpoint); - const dock = new DockAPI(); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - const [a, b] = getTestEVMAccountsFromWeb3(web3); - alice = a; - bob = b; - await endowEVMAddressWithDefault( - alice.address, - defaultEVMAccountEndowment(), - FullNodeEndpoint, - TestAccountURI, - ); - await endowEVMAddressWithDefault( - bob.address, - defaultEVMAccountEndowment(), - FullNodeEndpoint, - TestAccountURI, - ); - }); - - beforeAll(async () => { - const aliceBal0 = await web3.eth.getBalance(alice.address); - - // Deploy contract - const contractBytecode = PALLET_STORAGE_ACCESSOR_BYTECODE; // + argsABI.slice(2); - contractAddress = await deployContract( - web3, - alice, - contractBytecode, - 0, - MinGasPrice, - MaxGas, - ); - - // Alice's balance should decrease due to contract deployment fees - const aliceBal1 = await web3.eth.getBalance(alice.address); - expect(bnToBn(aliceBal0).gt(bnToBn(aliceBal1))).toBeTruthy(); - }); - - afterAll(async () => { - await web3.currentProvider.disconnect(); - await dock.disconnect(); - }, 1000); - - test('Should read a `Plain` value using `MetaStorageReader`', async () => { - const contract = new web3.eth.Contract( - PALLET_STORAGE_ACCESSOR_ABI, - contractAddress, - ); - - const [{ 0: success, 1: rawData }, { block }] = await Promise.all([ - contract.methods - .getStorage('System', 'Number', 0, '0x', '0x') - .call(), - dock.api.rpc.chain.getBlock(), - ]); - - expect(success).toBe(true); - const buffer = Buffer.from(rawData.slice(2), 'hex'); - const [found, ...data] = Array.from(buffer); - const blockNumber = $.u32.decode(new Uint8Array(data)).toFixed(); - expect(!!found).toBe(true); - expect(+blockNumber).toBe(+block.header.number); - }, 2000); - - test('Should return correct output for non-existent value read using `MetaStorageReader`', async () => { - const contract = new web3.eth.Contract( - PALLET_STORAGE_ACCESSOR_ABI, - contractAddress, - ); - - const { 0: success, 1: rawData } = await contract.methods - .getStorage('A', 'Number', 1, contractAddress, '0x') - .call(); - expect(success).toBe(false); - expect(rawData).toBe(null); - }, 2000); - - test('Should read value with offset using `MetaStorageReader`', async () => { - const contract = new web3.eth.Contract( - PALLET_STORAGE_ACCESSOR_ABI, - contractAddress, - ); - - const { 0: success, 1: rawData } = await contract.methods - .getStorageWithOffset( - 'EVM', - 'AccountCodes', - 1, - contractAddress, - '0x', - 100, - ) - .call(); - - expect(success).toBe(true); - const buffer = Buffer.from(rawData.slice(2), 'hex'); - const [found, ...data] = Array.from(buffer); - const code = Array.from(data); - expect(!!found).toBe(true); - expect(code).toEqual( - Array.from( - Buffer.from(PALLET_STORAGE_ACCESSOR_DEPLOYED_BYTECODE.slice(2), 'hex'), - ).slice(98), - ); - }, 2000); - - test('Should read value using `RawStorageReader`', async () => { - const contract = new web3.eth.Contract( - PALLET_STORAGE_ACCESSOR_ABI, - contractAddress, - ); - const key = new Uint8Array([ - 38, 170, 57, 78, 234, 86, 48, 224, 124, 72, 174, 12, 149, 88, 206, 247, 2, - 165, 193, 177, 154, 183, 160, 79, 83, 108, 81, 154, 202, 73, 131, 172, - ]); - - const [{ 0: success, 1: rawData }, { block }] = await Promise.all([ - contract.methods - .getStorageRaw(key) - .call(), - dock.api.rpc.chain.getBlock(), - ]); - - expect(success).toBe(true); - const buffer = Buffer.from(rawData.slice(2), 'hex'); - const [found, ...data] = Array.from(buffer); - const blockNumber = $.u32.decode(new Uint8Array(data)).toFixed(); - expect(!!found).toBe(true); - expect(+blockNumber).toBe(+block.header.number); - }, 2000); -}); diff --git a/tests/integration/eth/using-ethers.test.js b/tests/integration/eth/using-ethers.test.js deleted file mode 100644 index d4e0f7430..000000000 --- a/tests/integration/eth/using-ethers.test.js +++ /dev/null @@ -1,65 +0,0 @@ -import { ethers, ContractFactory } from 'ethers'; -import { - endowEVMAddressWithDefault, - getEthers, - getTestEVMAccountsFromEthers, -} from '../../../scripts/eth/helpers'; -import { ERC20_BYTECODE, ERC20_ABI } from '../../../scripts/eth/bytecodes-and-abis'; - -import { - FullNodeTCPEndpoint, TestAccountURI, MinGasPrice, MaxGas, FullNodeEndpoint, -} from '../../test-constants'; -import { defaultEVMAccountEndowment } from '../helpers'; - -async function deploy(signer, supply) { - const factory = new ContractFactory(ERC20_ABI, ERC20_BYTECODE, signer); - - const contract = await factory.deploy(supply, { - value: 0, - gasPrice: parseInt(MinGasPrice, 10), - gasLimit: parseInt(MaxGas, 10), - }); - - console.log(`Contract deployed at ${contract.address}`); - return contract.address; -} - -describe('Deploy an ERC-20 contract and transfer ERC-20 tokens', () => { - let alice; - let bob; - const ethersProvider = getEthers(FullNodeTCPEndpoint); - - beforeAll(async () => { - const [a, b] = getTestEVMAccountsFromEthers(ethersProvider); - alice = a; - bob = b; - await endowEVMAddressWithDefault(alice.address, defaultEVMAccountEndowment(), FullNodeEndpoint, TestAccountURI); - await endowEVMAddressWithDefault(bob.address, defaultEVMAccountEndowment(), FullNodeEndpoint, TestAccountURI); - }); - - test('Deploy contract and transfer tokens', async () => { - // NOTE: This test is not checking any balance changes. Most likely there is some issue with the Frontier implementation - // as the logic is straightforward and the same works with web3 - const supply = 10000; - const transferAmount = 100; - - const aliceBal0 = await ethersProvider.getBalance(alice.address); - const contractAddr = await deploy(alice, supply); - const aliceBal1 = await ethersProvider.getBalance(alice.address); - // expect(aliceBal0.gt(aliceBal1)).toBeTruthy(); - - const contract = new ethers.Contract(contractAddr, ERC20_ABI, ethersProvider); - - // const aliceErcBal0 = await contract.balanceOf(alice.address); - // const bobErcBal0 = await contract.balanceOf(bob.address); - - const receipt = await contract.connect(alice).transfer(bob.address, transferAmount, { gasLimit: parseInt(MaxGas, 10), gasPrice: parseInt(MinGasPrice, 10), from: alice.address }); - console.log(receipt); - - // const aliceErcBal1 = await contract.balanceOf(alice.address); - // const bobErcBal1 = await contract.balanceOf(bob.address); - - // expect(aliceErcBal0.gt(aliceErcBal1)).toBeTruthy(); - // expect(bobErcBal1.gt(bobErcBal0)).toBeTruthy(); - }, 20000); -}); diff --git a/tests/integration/fees.test.js b/tests/integration/fees.test.js deleted file mode 100644 index c2b8cf458..000000000 --- a/tests/integration/fees.test.js +++ /dev/null @@ -1,640 +0,0 @@ -import { BTreeSet } from '@polkadot/types'; -import { - Accumulator, - AccumulatorParams, - initializeWasm, - BBSPlusKeypairG2, - PositiveAccumulator, - BBSPlusSignatureParamsG1, - VBWitnessUpdateInfo, -} from '@docknetwork/crypto-wasm-ts'; -import { - BN, hexToU8a, stringToHex, u8aToHex, -} from '@polkadot/util'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { DockAPI } from '../../src/index'; -import { DockDid } from '../../src/did'; -import { createDidPair, getBalance } from './helpers'; -import { - createRandomRegistryId, - OneOfPolicy, -} from '../../src/utils/revocation'; -import { BLOB_MAX_BYTE_SIZE } from '../../src/modules/blob'; -import { ServiceEndpointType } from '../../src/modules/did/service-endpoint'; -import BBSPlusModule from '../../src/modules/bbs-plus'; -import AccumulatorModule from '../../src/modules/accumulator'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, - TestAccountCouncilMemberURI, -} from '../test-constants'; - -// TODO: Unskip this test -describe.skip('Fees', () => { - const dock = new DockAPI(); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - await initializeWasm(); - }); - - beforeEach(() => { - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - }); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - const withPaidFeeAssertion = async ( - sendTx, - assert, - applyToBefore = Object.create(null), - ) => { - const { address } = dock.getAccount(); - - const before = await getBalance(dock.api, address); - const result = await sendTx(); - const after = await getBalance(dock.api, address); - - // Compare free balances with `10 DOCK` precision - assert(Math.round((before.free - after.free) / 1e7) * 10); - - for (const prop of ['feeFrozen', 'reserved', 'miscFrozen']) { - const beforeProp = applyToBefore[prop] - ? applyToBefore[prop](before[prop]) - : before[prop]; - - expect([prop, '=', after[prop].toString()]).toEqual([ - prop, - '=', - beforeProp.toString(), - ]); - } - - return result; - }; - - const withPaidFeeMatchingSnapshot = (sendTx, applyToBefore) => withPaidFeeAssertion( - sendTx, - (fee) => expect(fee).toMatchSnapshot(), - applyToBefore, - ); - - const throwingWithPaidFeeAssertion = async ( - sendTx, - assert, - applyToBefore, - ) => { - let throwed = false; - await withPaidFeeAssertion( - async () => { - try { - await sendTx(); - } catch { - throwed = true; - } - }, - assert, - applyToBefore, - ); - expect(throwed).toBe(true); - }; - - test('dids', async () => { - const [did, pair, didKey] = createDidPair(dock); - - await withPaidFeeMatchingSnapshot(() => dock.did.new(did, [didKey], [], false, undefined, false)); - - // Add DID key with all verification relationships - const [, , dk1] = createDidPair(dock); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk1], did, did, pair, undefined, false)); - - // Add DID key with only 1 verification relationship - const [, , dk2] = createDidPair(dock); - dk2.verRels.setAuthentication(); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk2], did, did, pair, undefined, false)); - - // Add DID key with only 2 verification relationships - const [, , dk3] = createDidPair(dock); - dk3.verRels.setAuthentication(); - dk3.verRels.setAssertion(); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk3], did, did, pair, undefined, false)); - - // Add DID key with 3 verification relationships - const [, , dk4] = createDidPair(dock); - dk4.verRels.setAuthentication(); - dk4.verRels.setAssertion(); - dk4.verRels.setCapabilityInvocation(); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk4], did, did, pair, undefined, false)); - - // Add 2 DID keys with only 1 verification relationship - const [, , dk5] = createDidPair(dock); - const [, , dk6] = createDidPair(dock); - dk5.verRels.setAuthentication(); - dk6.verRels.setCapabilityInvocation(); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk5, dk6], did, did, pair, undefined, false)); - - // Add 3 DID keys with only 1 verification relationship - const [, , dk7] = createDidPair(dock); - const [, , dk8] = createDidPair(dock); - const [, , dk9] = createDidPair(dock); - dk7.verRels.setAuthentication(); - dk8.verRels.setCapabilityInvocation(); - dk9.verRels.setAssertion(); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk7, dk8, dk9], did, did, pair, 1, undefined, false)); - - const newControllers = [ - DockDid.random(), - DockDid.random(), - DockDid.random(), - ]; - // Add 1 controller - await withPaidFeeMatchingSnapshot(() => dock.did.addControllers( - [newControllers[0]], - did, - did, - pair, - 1, - undefined, - false, - )); - - // Add 2 controllers - await withPaidFeeMatchingSnapshot(() => dock.did.addControllers( - [newControllers[1], newControllers[2]], - did, - did, - pair, - 1, - undefined, - false, - )); - - const spType = new ServiceEndpointType(); - spType.setLinkedDomains(); - const spId1 = randomAsHex(10); - const spId2 = randomAsHex(20); - const origins1 = [randomAsHex(100)]; - const origins2 = [randomAsHex(100), randomAsHex(100)]; - // Add 1 service endpoint with 1 origin - await withPaidFeeMatchingSnapshot(() => dock.did.addServiceEndpoint( - spId1, - spType, - origins1, - did, - did, - pair, - 1, - undefined, - false, - )); - - // Add 1 service endpoint with 2 origins - await withPaidFeeMatchingSnapshot(() => dock.did.addServiceEndpoint( - spId2, - spType, - origins2, - did, - did, - pair, - 1, - undefined, - false, - )); - - // Adding a new DID which doesn't control itself but controlled by one other controller - const [did1] = createDidPair(dock); - await withPaidFeeMatchingSnapshot(() => dock.did.new(did1, [], [did], false)); - - // Adding a new DID which doesn't control itself but controlled by 2 other controllers - const [did2] = createDidPair(dock); - await withPaidFeeMatchingSnapshot(() => dock.did.new(did2, [], [did, did1], false)); - - // Adding a new DID which doesn't control itself but has a key and controlled by one other controller - const [did3, , dk_] = createDidPair(dock); - await withPaidFeeMatchingSnapshot(() => dock.did.new(did3, [dk_], [did], false)); - - // Add DID key with all verification relationships to a DID that doesn't control itself - const [, , dk__] = createDidPair(dock); - await withPaidFeeMatchingSnapshot(() => dock.did.addKeys([dk__], did1, did, pair, undefined, false)); - - // Removing 1 key - await withPaidFeeMatchingSnapshot(() => dock.did.removeKeys([2], did, did, pair, undefined, false)); - - // Removing 2 keys - await withPaidFeeMatchingSnapshot(() => dock.did.removeKeys([3, 4], did, did, pair, undefined, false)); - - // Removing 1 controller - await withPaidFeeMatchingSnapshot(() => dock.did.removeControllers( - [newControllers[0]], - did, - did, - pair, - 1, - undefined, - false, - )); - - // Removing 2 controllers - await withPaidFeeMatchingSnapshot(() => dock.did.removeControllers( - [newControllers[1], newControllers[2]], - did, - did, - pair, - 1, - undefined, - false, - )); - - // Removing 1 service endpoint - await withPaidFeeMatchingSnapshot(() => dock.did.removeServiceEndpoint( - spId1, - did, - did, - pair, - 1, - undefined, - false, - )); - - // Remove DID - await withPaidFeeMatchingSnapshot(() => dock.did.remove(did, did, pair, undefined, false)); - }, 40000); - - test('revocation', async () => { - const [did, pair, dk] = createDidPair(dock); - await dock.did.new(did, [dk], [], false); - - const registryId = createRandomRegistryId(); - // Create owners - const owners = new Set(); - owners.add(did); - - const policy = new OneOfPolicy(owners); - await withPaidFeeMatchingSnapshot(() => dock.revocation.newRegistry(registryId, policy, false, false)); - - let revokeIds; - for (const count of [1, 2, 3, 5, 10]) { - revokeIds = new BTreeSet(dock.api.registry, 'RevokeId'); - for (let i = 0; i < count; i++) { - revokeIds.add(randomAsHex(32)); - } - - const [update, sig, nonce] = await dock.revocation.createSignedRevoke( - registryId, - revokeIds, - did, - pair, - 1, - { didModule: dock.did }, - ); - const revTx = dock.revocation.createRevokeTx(update, [{ nonce, sig }]); - - await withPaidFeeMatchingSnapshot(async () => { - await dock.signAndSend(revTx, false); - }); - } - - const [update, sig, nonce] = await dock.revocation.createSignedRemove( - registryId, - did, - pair, - 1, - { didModule: dock.did }, - ); - const revTx = dock.revocation.createRemoveRegistryTx(update, [ - { nonce, sig }, - ]); - - await withPaidFeeMatchingSnapshot(() => dock.signAndSend(revTx, false)); - }, 40000); - - test('anchors', async () => { - const anc = randomAsHex(32); - await withPaidFeeMatchingSnapshot(() => dock.anchor.deploy(anc, false)); - }, 30000); - - test('blobs', async () => { - const [did, pair, dk] = createDidPair(dock); - await dock.did.new(did, [dk], [], false); - - const blobId = randomAsHex(32); - const blob = { - id: blobId, - blob: randomAsHex(BLOB_MAX_BYTE_SIZE), - }; - await withPaidFeeMatchingSnapshot(() => dock.blob.new(blob, did, pair, { didModule: dock.did }, false)); - }, 30000); - - test('bbsPlus', async () => { - const [did, pair, dk] = createDidPair(dock); - await dock.did.new(did, [dk], [], false); - - const label = stringToHex('My BBS+ params'); - - // Add params with different attribute sizes - for (const attributeCount of [10, 11, 12, 13, 14, 15]) { - const bytes = u8aToHex( - BBSPlusSignatureParamsG1.generate( - attributeCount, - hexToU8a(label), - ).toBytes(), - ); - const params = BBSPlusModule.prepareAddParameters( - bytes, - undefined, - label, - ); - await withPaidFeeMatchingSnapshot(async () => { - await dock.bbsPlusModule.addParams( - params, - did, - pair, - 1, - { didModule: dock.did }, - false, - ); - }); - } - - // Add a public key - const kp = BBSPlusKeypairG2.generate( - BBSPlusSignatureParamsG1.generate(10, hexToU8a(label)), - ); - const pk = BBSPlusModule.prepareAddPublicKey( - u8aToHex(kp.publicKey.bytes), - undefined, - [did, 1], - ); - await withPaidFeeMatchingSnapshot(() => dock.bbsPlusModule.addPublicKey( - pk, - did, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - - // Remove public key - await withPaidFeeMatchingSnapshot(() => dock.bbsPlusModule.removePublicKey( - 2, - did, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - - // Remove params - await withPaidFeeMatchingSnapshot(() => dock.bbsPlusModule.removeParams( - 1, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - }, 30000); - - test('accumulator', async () => { - const [did, pair, dk] = createDidPair(dock); - await dock.did.new(did, [dk], [], false); - - const label = stringToHex('My Accumulator params'); - const bytes = u8aToHex(Accumulator.generateParams(hexToU8a(label)).bytes); - const params = AccumulatorModule.prepareAddParameters( - bytes, - undefined, - label, - ); - await withPaidFeeMatchingSnapshot(() => dock.accumulatorModule.addParams( - params, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - - const kp = Accumulator.generateKeypair( - new AccumulatorParams(hexToU8a(params.bytes)), - ); - - const pk = AccumulatorModule.prepareAddPublicKey( - u8aToHex(kp.publicKey.bytes), - undefined, - [did, 1], - ); - await withPaidFeeMatchingSnapshot(() => dock.accumulatorModule.addPublicKey( - pk, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - - const accumulatorPos = PositiveAccumulator.initialize( - new AccumulatorParams(hexToU8a(params.bytes)), - kp.secretKey, - ); - const accumulatorIdPos = randomAsHex(32); - const accumulatedPos = u8aToHex(accumulatorPos.accumulated); - await withPaidFeeMatchingSnapshot(() => dock.accumulatorModule.addPositiveAccumulator( - accumulatorIdPos, - accumulatedPos, - [did, 1], - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - - const accumulatorIdUni = randomAsHex(32); - const accumulatedUni = u8aToHex(accumulatorPos.accumulated); - await withPaidFeeMatchingSnapshot(() => dock.accumulatorModule.addUniversalAccumulator( - accumulatorIdUni, - accumulatedUni, - [did, 1], - 10000, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - - const start = 10; - // The following isn't correct logically but is good enough for getting transaction pricing - const accumulated = u8aToHex(accumulatorPos.accumulated); - for (let i = 1; i <= 5; i++) { - const members = []; - for (let j = 0; j < i; j++) { - const member = Accumulator.encodePositiveNumberAsAccumulatorMember( - start * 10 * i + j, - ); - members.push(member); - } - let witUpd = u8aToHex( - VBWitnessUpdateInfo.new( - hexToU8a(accumulated), - members, - [], - kp.secretKey, - ).value, - ); - await withPaidFeeMatchingSnapshot(async () => { - await dock.accumulatorModule.updateAccumulator( - accumulatorIdPos, - accumulated, - { - additions: members.map((m) => u8aToHex(m)), - witnessUpdateInfo: witUpd, - }, - did, - pair, - 1, - { didModule: dock.did }, - false, - ); - }); - - witUpd = u8aToHex( - VBWitnessUpdateInfo.new( - hexToU8a(accumulated), - [], - members, - kp.secretKey, - ).value, - ); - - await withPaidFeeMatchingSnapshot(async () => { - await dock.accumulatorModule.updateAccumulator( - accumulatorIdPos, - accumulated, - { - removals: members.map((m) => u8aToHex(m)), - witnessUpdateInfo: witUpd, - }, - did, - pair, - 1, - { didModule: dock.did }, - false, - ); - }); - } - - await withPaidFeeMatchingSnapshot(() => dock.accumulatorModule.removeAccumulator( - accumulatorIdPos, - did, - pair, - 1, - { didModule: dock.did }, - false, - )); - }, 30000); - - test('transfers', async () => { - const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; - - await withPaidFeeMatchingSnapshot(() => dock.signAndSend(dock.api.tx.balances.transfer(BOB, 100), false)); - - const txs = Array(3).fill(dock.api.tx.balances.transfer(BOB, 100)); - - const txBatch = dock.api.tx.utility.batch(txs); - - await withPaidFeeMatchingSnapshot(() => dock.signAndSend(txBatch, false)); - }, 30000); - - test('democracy.notePreimage', async () => { - const runtimeVersion = await dock.api.rpc.state.getRuntimeVersion(); - const specVersion = runtimeVersion.specVersion.toNumber(); - - if (specVersion < 44) { - return; - } - - const preimage = randomAsHex(2e6); - - // First, send a whitelist transaction. It should have a 40K DOCK deposit and a 5K DOCK fee. - await withPaidFeeAssertion( - () => dock.signAndSend(dock.api.tx.democracy.notePreimage(preimage), false), - (fee) => expect(fee).toBe(45020), - { - // 40K DOCK per deposit - reserved: (before) => before.add(new BN(4e10)), - }, - ); - - // Second, attempt to execute a transaction that will fail (preimage already exists). The result total fee will be around 20K, with no deposit. - await throwingWithPaidFeeAssertion( - () => dock.signAndSend(dock.api.tx.democracy.notePreimage(preimage), false), - (fee) => expect(fee).toBe(20020), - ); - }, 30000); - - test('democracy.notePreimageOperational', async () => { - const runtimeVersion = await dock.api.rpc.state.getRuntimeVersion(); - const specVersion = runtimeVersion.specVersion.toNumber(); - - if (specVersion < 44) { - return; - } - - const preimage = randomAsHex(4e6); - const stashAccount = dock.keyring.addFromUri( - TestAccountCouncilMemberURI, - null, - 'sr25519', - ); - dock.setAccount(stashAccount); - - // First, send a whitelist transaction. It should have a 80K DOCK deposit and a 10K DOCK fee. - await withPaidFeeAssertion( - () => dock.signAndSend( - dock.api.tx.council.execute( - dock.api.tx.democracy.notePreimageOperational(preimage), - preimage.length, - ), - false, - ), - (fee) => expect(fee).toBe(90120), - { - // 80K DOCK per deposit - reserved: (before) => before.add(new BN(8e10)), - }, - ); - - // Second, attempt to execute a transaction that will fail implicitly (preimage already exists). The result total fee will be around 20K, with no deposit. - await withPaidFeeAssertion( - () => dock.signAndSend( - dock.api.tx.council.execute( - dock.api.tx.democracy.notePreimageOperational(preimage), - preimage.length, - ), - false, - ), - (fee) => expect(fee).toBe(40120), - ); - - // Finally, attempt to execute a transaction that will explicitly fail (bad origin). The result total fee will be around 40K, no deposit. - await throwingWithPaidFeeAssertion( - () => dock.signAndSend( - dock.api.tx.democracy.notePreimageOperational(preimage), - false, - ), - (fee) => expect(fee).toBe(40040), - ); - }, 30000); -}); diff --git a/tests/integration/issuing.test.js b/tests/integration/issuing.test.js deleted file mode 100644 index c890ef3e6..000000000 --- a/tests/integration/issuing.test.js +++ /dev/null @@ -1,261 +0,0 @@ -// Mock fetch -import { randomAsHex } from '@polkadot/util-crypto'; -import mockFetch from '../mocks/fetch'; - -import { DockDid, DidKeypair } from '../../src/did'; - -import { DockAPI } from '../../src/index'; -import { DockResolver } from '../../src/resolver'; - -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../test-constants'; -import { - getCredMatcherDoc, - getProofMatcherDoc, - getUnsignedCred, - registerNewDIDUsingPair, -} from './helpers'; -import { generateEcdsaSecp256k1Keypair } from '../../src/utils/misc'; -import { issueCredential, verifyCredential } from '../../src/utils/vc/index'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; - -mockFetch(); - -// 1st issuer's DID. -const issuer1DID = DockDid.random(); -// seed used for 1st issuer keys -const issuer1KeySeed = randomAsHex(32); - -// 2nd issuer's DID. -const issuer2DID = DockDid.random(); -// entropy used for 2nd issuer keys -const issuer2KeyEntropy = randomAsHex(32); - -const issuer3DID = DockDid.random(); -// seed used for 3rd issuer keys -const issuer3KeySeed = randomAsHex(32); - -const holderDID = DockDid.random(); - -const credId = randomAsHex(32); - -const unsignedCred = getUnsignedCred(credId, holderDID); - -describe('Verifiable Credential issuance where issuer has a Dock DID', () => { - const dock = new DockAPI(); - const resolver = new DockResolver(dock); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - // The keyring should be initialized before any test begins as this suite is testing revocation - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // The DIDs should be written before any test begins - - // DID with ed25519 key - const pair1 = new DidKeypair( - dock.keyring.addFromUri(issuer1KeySeed, null, 'ed25519'), - 1, - ); - await registerNewDIDUsingPair(dock, issuer1DID, pair1); - - // DID with secp key - const pair2 = new DidKeypair( - generateEcdsaSecp256k1Keypair(issuer2KeyEntropy), - 1, - ); - await registerNewDIDUsingPair(dock, issuer2DID, pair2); - - // DID with sr25519 key - const pair3 = new DidKeypair( - dock.keyring.addFromUri(issuer3KeySeed, null, 'sr25519'), - 1, - ); - await registerNewDIDUsingPair(dock, issuer3DID, pair3); - }, 60000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Issue a verifiable credential with ed25519 key and verify it (2018)', async () => { - const issuerKey = getKeyDoc( - issuer1DID, - dock.keyring.addFromUri(issuer1KeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - const credential = await issueCredential(issuerKey, unsignedCred); - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc( - unsignedCred, - issuer1DID, - issuerKey.id, - 'Ed25519Signature2018', - ), - ), - ); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject(expect.objectContaining(getProofMatcherDoc())); - }, 40000); - - test('Issue a verifiable credential with ed25519 key and verify it (2020)', async () => { - const issuerKey = getKeyDoc( - issuer1DID, - dock.keyring.addFromUri(issuer1KeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2020', - ); - const credential = await issueCredential(issuerKey, unsignedCred); - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc( - unsignedCred, - issuer1DID, - issuerKey.id, - 'Ed25519Signature2020', - ), - ), - ); - - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject(expect.objectContaining(getProofMatcherDoc())); - }, 40000); - - test('Issue a verifiable credential with secp256k1 key and verify it', async () => { - const issuerKey = getKeyDoc( - issuer2DID, - generateEcdsaSecp256k1Keypair(issuer2KeyEntropy), - 'EcdsaSecp256k1VerificationKey2019', - ); - const credential = await issueCredential(issuerKey, unsignedCred); - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc( - unsignedCred, - issuer2DID, - issuerKey.id, - 'EcdsaSecp256k1Signature2019', - ), - ), - ); - const result = await verifyCredential(credential, { resolver }); - expect(result).toMatchObject(expect.objectContaining(getProofMatcherDoc())); - }, 40000); - - test('Issue a verifiable credential with sr25519 key and verify it', async () => { - const issuerKey = getKeyDoc( - issuer3DID, - dock.keyring.addFromUri(issuer3KeySeed, null, 'sr25519'), - 'Sr25519VerificationKey2020', - ); - const credential = await issueCredential(issuerKey, unsignedCred); - - expect(credential).toMatchObject( - expect.objectContaining( - getCredMatcherDoc( - unsignedCred, - issuer3DID, - issuerKey.id, - 'Sr25519Signature2020', - ), - ), - ); - - const result = await verifyCredential(credential, { resolver }); - - expect(result).toMatchObject(expect.objectContaining(getProofMatcherDoc())); - }, 40000); - - test('(JWT) Issue a verifiable credential with ed25519 key and verify it (2018)', async () => { - const issuerKey = getKeyDoc( - issuer1DID, - dock.keyring.addFromUri(issuer1KeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - const credential = await issueCredential( - issuerKey, - unsignedCred, - true, - null, - null, - null, - null, - false, - 'jwt', - ); - const result = await verifyCredential(credential, { resolver }); - expect(result.verified).toBeTruthy(); - }, 40000); - - test('(JWT) Issue a verifiable credential with ed25519 key and verify it (2020)', async () => { - const issuerKey = getKeyDoc( - issuer1DID, - dock.keyring.addFromUri(issuer1KeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2020', - ); - const credential = await issueCredential( - issuerKey, - unsignedCred, - true, - null, - null, - null, - null, - false, - 'jwt', - ); - const result = await verifyCredential(credential, { resolver }); - expect(result.verified).toBeTruthy(); - }, 40000); - - test('(JWT) Issue a verifiable credential with secp256k1 key and verify it', async () => { - const issuerKey = getKeyDoc( - issuer2DID, - generateEcdsaSecp256k1Keypair(issuer2KeyEntropy), - 'EcdsaSecp256k1VerificationKey2019', - ); - const credential = await issueCredential( - issuerKey, - unsignedCred, - true, - null, - null, - null, - null, - false, - 'jwt', - ); - const result = await verifyCredential(credential, { resolver }); - expect(result.verified).toBeTruthy(); - }, 40000); - - test('(JWT) Issue a verifiable credential with sr25519 key and verify it', async () => { - const issuerKey = getKeyDoc( - issuer3DID, - dock.keyring.addFromUri(issuer3KeySeed, null, 'sr25519'), - 'Sr25519VerificationKey2020', - ); - const credential = await issueCredential( - issuerKey, - unsignedCred, - true, - null, - null, - null, - null, - false, - 'jwt', - ); - const result = await verifyCredential(credential, { resolver }); - expect(result.verified).toBeTruthy(); - }, 40000); -}); diff --git a/tests/integration/master.test.js b/tests/integration/master.test.js deleted file mode 100644 index 3f82ccc78..000000000 --- a/tests/integration/master.test.js +++ /dev/null @@ -1,302 +0,0 @@ -import { Keyring } from '@polkadot/api'; -import { cryptoWaitReady, randomAsU8a } from '@polkadot/util-crypto'; -import { assert, u8aToHex, stringToU8a } from '@polkadot/util'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../test-constants'; -import { DockAPI } from '../../src'; -import { - getSignatureFromKeyringPair, - getStateChange, -} from '../../src/utils/misc'; -import { createDidSig } from '../../src/did'; - -const ALICE_DID = u8aToHex( - stringToU8a('Alice\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), -); -const BOB_DID = u8aToHex( - stringToU8a('Bob\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), -); -const CHARLIE_DID = u8aToHex( - stringToU8a('Charlie\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), -); -const ALICE_SK = u8aToHex( - stringToU8a('Alicesk\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), -); -const BOB_SK = u8aToHex( - stringToU8a('Bobsk\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), -); -const CHARLIE_SK = u8aToHex( - stringToU8a('Charliesk\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), -); - -describe.skip('Master Module', () => { - // node client - let nc; - let systemModule; - let sudoModule; - let masterModule; - let masterQuery; - - beforeAll(async () => { - nc = await connect(); - systemModule = nc.api.tx.system; - sudoModule = nc.api.tx.sudo; - masterModule = nc.api.tx.master; - masterQuery = nc.api.query.master; - }, 40000); - - afterAll(async () => { - await nc.disconnect(); - }, 10000); - - async function getStorage(key) { - return nc.api.rpc.state.getStorage(key); - } - - test('control: set and get bytes as sudo', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - const sudocall = sudoModule.sudo(systemModule.setStorage([[key, val]])); - await signSendTx(sudocall); - const bs = (await getStorage(key)).unwrap(); - expect(u8aToHex(bs)).toEqual(val); - }, 20000); - - test('Root call with no votes', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - await masterSetStorage(nc, systemModule, masterModule, key, val, []); - const sto = await getStorage(key); - assert(sto.isNone, 'storage item should not have been set'); - }, 20000); - - test('Root call with invalid votes', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - const did_to_key = [ - [ALICE_DID, await keypair(u8aToHex(randomAsU8a(32)))], - [CHARLIE_DID, await keypair(u8aToHex(randomAsU8a(32)))], - ]; - await masterSetStorage( - nc, - systemModule, - masterModule, - key, - val, - did_to_key, - ); - const sto = await getStorage(key); - assert(sto.isNone, 'storage item should not have been set'); - }, 20000); - - test('Root call with valid votes', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - const did_to_key = [ - [ALICE_DID, await keypair(ALICE_SK)], - [CHARLIE_DID, await keypair(CHARLIE_SK)], - ]; - await masterSetStorage( - nc, - systemModule, - masterModule, - key, - val, - did_to_key, - ); - const sto = await getStorage(key); - const u8a = sto.unwrap(); - expect(u8aToHex(u8a)).toEqual(val); - }, 20000); - - test('Root call with valid votes but insufficient vote count', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - const did_to_key = [[ALICE_DID, await keypair(ALICE_SK)]]; - await masterSetStorage( - nc, - systemModule, - masterModule, - key, - val, - did_to_key, - ); - const sto = await getStorage(key); - assert(sto.isNone, 'storage item should not have been set'); - }, 20000); - - test('Root call with valid votes and oversufficient vote count', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - const did_to_key = [ - [ALICE_DID, await keypair(ALICE_SK)], - [BOB_DID, await keypair(BOB_SK)], - [CHARLIE_DID, await keypair(CHARLIE_SK)], - ]; - await masterSetStorage( - nc, - systemModule, - masterModule, - key, - val, - did_to_key, - ); - const sto = await getStorage(key); - const u8a = sto.unwrap(); - expect(u8aToHex(u8a)).toEqual(val); - }, 20000); - - test('Root call with votes not sorted lexically', async () => { - const key = u8aToHex(randomAsU8a(32)); - const val = u8aToHex(randomAsU8a(32)); - const did_to_key = [ - [BOB_DID, await keypair(BOB_SK)], - [ALICE_DID, await keypair(ALICE_SK)], - ]; - await masterSetStorage( - nc, - systemModule, - masterModule, - key, - val, - did_to_key, - ); - const sto = await getStorage(key); - const u8a = sto.unwrap(); - expect(u8aToHex(u8a)).toEqual(val); - }, 20000); - - test('Use a master call to modify master membership.', async () => { - const fourth_did = u8aToHex(randomAsU8a(32)); - const newMembership = nc.api.createType('Membership', { - members: sortedSet([ALICE_DID, BOB_DID, CHARLIE_DID, fourth_did]), - voteRequirement: 2, - }); - - // master members are not yet set - expect((await masterQuery.members()).toU8a()).not.toEqual( - newMembership.toU8a(), - ); - - const call = masterModule.setMembers(newMembership); - const votes = await allVote(nc, call, [ - [BOB_DID, await keypair(BOB_SK)], - [ALICE_DID, await keypair(ALICE_SK)], - ]); - await signSendTx(masterModule.execute(call, votes)); - - // master members were set - expect((await masterQuery.members()).toU8a()).toEqual( - newMembership.toU8a(), - ); - }, 20000); -}); - -// connect to running node -async function connect() { - const dock = new DockAPI(); - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - return dock; -} - -// Load a sr25519 keypair from secret, secret may be "0x" prefixed hex seed -// or seed phrase or "//DevKey/Derivation/Path". -async function keypair(seed) { - await cryptoWaitReady(); - const keyring = new Keyring({ type: 'sr25519' }); - return keyring.addFromUri(seed); -} - -/// sign extrinsic as test account, submit it and wait for it to finalize -async function signSendTx(extrinsic) { - const key = await keypair(TestAccountURI); // getTestAccountKey(); - await extrinsic.signAsync(key); - - return new Promise((resolve, reject) => { - try { - let unsubFunc = null; - return extrinsic - .send(({ events = [], status }) => { - if (status.isInBlock) { - unsubFunc(); - resolve({ - events, - status, - }); - } - }) - .catch((error) => { - reject(error); - }) - .then((unsub) => { - unsubFunc = unsub; - }); - } catch (error) { - reject(error); - } - - return this; - }); -} - -async function masterSetStorage( - nc, // node client - systemModule, - masterModule, - key, // hex encoded bytes - val, // hex encoded bytes - did_to_key, // list of [did, key] pairs with which to vote. dids are hex encoded -) { - assert(key.startsWith('0x'), 'should prefixed with 0x'); - assert(val.startsWith('0x'), 'should prefixed with 0x'); - - const call = systemModule.setStorage([[key, val]]); // this is a root-only extrinsic - const votes = await allVote(nc, call, did_to_key); - await signSendTx(masterModule.execute(call, votes)); -} - -/// lexically sorted set of elements. -function sortedSet(list) { - const ret = new Set(); - for (const s of list) { - ret.add(s); - } - const sorted = [...ret]; - sorted.sort(); - return sorted; -} - -/// helper func -/// sign the call as a StateChange::MasterVote using all provided [did, key] pairs -/// return the complete proof of master authorization as the on-chain "PMAuth" type -/// the votes are sorted as lexically as the chain expects -async function allVote( - nc, // node client - proposal, // the extrinsic to be run as root - did_to_key, // list of [did, key] pairs with which to vote. dids are hex encoded -) { - for (const [did, _key] of did_to_key) { - assert(did.startsWith('0x'), 'should prefixed with 0x'); - assert(did.length === 66, 'should be 32 bytes'); - } - - const encodedProposal = [...nc.api.createType('Call', proposal).toU8a()]; - const roundNo = await nc.api.query.master.round(); - - const votes = []; - for (const [did, key] of did_to_key) { - const nonce = await nc.didModule.getNextNonceForDid(DockDid.from(did)); - const vote = { nonce, data: { proposal: encodedProposal, roundNo } }; - const encodedStateChange = getStateChange(nc.api, 'MasterVote', vote); - const signature = getSignatureFromKeyringPair(key, encodedStateChange); - const didSig = createDidSig(DockDid.from(did), 1, signature); - votes.push({ sig: didSig, nonce }); - } - return votes; -} diff --git a/tests/integration/presenting.test.js b/tests/integration/presenting.test.js deleted file mode 100644 index 61b98b50d..000000000 --- a/tests/integration/presenting.test.js +++ /dev/null @@ -1,283 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockDid, DidKeypair } from '../../src/did'; - -import { DockAPI } from '../../src/index'; -import { DockResolver } from '../../src/resolver'; - -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; -import { getUnsignedCred, registerNewDIDUsingPair } from './helpers'; -import { generateEcdsaSecp256k1Keypair } from '../../src/utils/misc'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import { - issueCredential, - isVerifiedCredential, - signPresentation, - verifyPresentation, -} from '../../src/utils/vc/index'; -import { createPresentation } from '../create-presentation'; - -// Issuer's DID. -const issuerDID = DockDid.random(); -// seed used for issuer keys -const issuerKeySeed = randomAsHex(32); - -const holder1DID = DockDid.random(); -// seed used for 1st holder keys -const holder1KeySeed = randomAsHex(32); - -const holder2DID = DockDid.random(); -// entropy used for 2nd holder keys -const holder2KeyEntropy = randomAsHex(32); - -const holder3DID = DockDid.random(); -// seed used for 3rd holder keys -const holder3KeySeed = randomAsHex(32); - -const credId1 = randomAsHex(32); -const credId2 = randomAsHex(32); -const credId3 = randomAsHex(32); -const credId4 = randomAsHex(32); - -let cred1; -let cred2; -let cred3; -let cred4; - -describe('Verifiable Presentation where both issuer and holder have a Dock DID', () => { - const dock = new DockAPI(); - const resolver = new DockResolver(dock); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - // The keyring should be initialized before any test begins as this suite is testing revocation - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // The DIDs should be written before any test begins - - // Register issuer DID with ed25519 key - const pair1 = new DidKeypair( - dock.keyring.addFromUri(issuerKeySeed, null, 'ed25519'), - 1, - ); - await registerNewDIDUsingPair(dock, issuerDID, pair1); - - // Register holder DID with ed25519 key - const pair2 = new DidKeypair( - dock.keyring.addFromUri(holder1KeySeed, null, 'ed25519'), - 1, - ); - await registerNewDIDUsingPair(dock, holder1DID, pair2); - - // Register holder DID with secp key - const pair3 = new DidKeypair( - generateEcdsaSecp256k1Keypair(holder2KeyEntropy), - 1, - ); - await registerNewDIDUsingPair(dock, holder2DID, pair3); - - // Register holder DID with sr25519 key - const pair4 = new DidKeypair( - dock.keyring.addFromUri(holder3KeySeed, null, 'sr25519'), - 1, - ); - await registerNewDIDUsingPair(dock, holder3DID, pair4); - - const issuerKeyDoc = getKeyDoc( - issuerDID, - dock.keyring.addFromUri(issuerKeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - - // Issuer issues credential with id `credId1` to holder with DID `holder1DID` - cred1 = await issueCredential( - issuerKeyDoc, - getUnsignedCred(credId1, holder1DID), - ); - - // Issuer issues credential with id `credId2` to holder with DID `holder2DID` - cred2 = await issueCredential( - issuerKeyDoc, - getUnsignedCred(credId2, holder2DID), - ); - - // Issuer issues credential with id `credId3` to holder with DID `holder3DID` - cred3 = await issueCredential( - issuerKeyDoc, - getUnsignedCred(credId3, holder3DID), - ); - - // Issuer issues credential with id `credId4` to holder with DID `holder3DID` - cred4 = await issueCredential( - issuerKeyDoc, - getUnsignedCred(credId4, holder3DID), - ); - }, 90000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Holder creates a verifiable presentation with single credential and verifier verifies it', async () => { - const holder1Key = getKeyDoc( - holder1DID, - dock.keyring.addFromUri(holder1KeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - const holder2Key = getKeyDoc( - holder2DID, - generateEcdsaSecp256k1Keypair(holder2KeyEntropy), - 'EcdsaSecp256k1VerificationKey2019', - ); - const holder3Key = getKeyDoc( - holder3DID, - dock.keyring.addFromUri(holder3KeySeed, null, 'sr25519'), - 'Sr25519VerificationKey2020', - ); - const holder4Key = getKeyDoc( - holder1DID, - dock.keyring.addFromUri(holder1KeySeed, null, 'ed25519'), - 'Ed25519VerificationKey2020', - ); - - for (const elem of [ - [cred1, 'Ed25519Signature2018', holder1Key], - [cred2, 'EcdsaSecp256k1Signature2019', holder2Key], - [cred3, 'Sr25519Signature2020', holder3Key], - [cred4, 'Ed25519Signature2020', holder4Key], - ]) { - const cred = elem[0]; - const sigType = elem[1]; - const holderKey = elem[2]; - - const res = await isVerifiedCredential(cred, { - resolver, - }); - expect(res).toBe(true); - - const presId = `https://pres.com/${randomAsHex(32)}`; - const chal = randomAsHex(32); - const domain = 'test domain'; - const presentation = createPresentation(cred, presId); - - expect(presentation).toMatchObject( - expect.objectContaining({ - type: ['VerifiablePresentation'], - verifiableCredential: [cred], - id: presId, - }), - ); - - const signedPres = await signPresentation( - presentation, - holderKey, - chal, - domain, - resolver, - ); - - expect(signedPres).toMatchObject( - expect.objectContaining({ - type: ['VerifiablePresentation'], - verifiableCredential: [cred], - id: presId, - proof: expect.objectContaining({ - type: sigType, - challenge: chal, - domain, - proofPurpose: 'authentication', - }), - }), - ); - - const result = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - }); - - expect(result.verified).toBe(true); - expect(result.presentationResult.verified).toBe(true); - expect(result.credentialResults.length).toBe(1); - expect(result.credentialResults[0].verified).toBe(true); - } - }, 70000); - - test('Holder creates a verifiable presentation with 2 credentials and verifier verifies it', async () => { - const holder3Key = getKeyDoc( - holder3DID, - dock.keyring.addFromUri(holder3KeySeed, null, 'sr25519'), - 'Sr25519VerificationKey2020', - ); - - const res = await isVerifiedCredential(cred3, { - resolver, - compactProof: true, - }); - expect(res).toBe(true); - - const res1 = await isVerifiedCredential(cred4, { - resolver, - compactProof: true, - }); - expect(res1).toBe(true); - - const presId = `https://pres.com/${randomAsHex(32)}`; - const chal = randomAsHex(32); - const domain = 'test domain'; - - const presentation = createPresentation([cred3, cred4], presId); - - expect(presentation).toMatchObject( - expect.objectContaining({ - type: ['VerifiablePresentation'], - verifiableCredential: [cred3, cred4], - id: presId, - }), - ); - - const signedPres = await signPresentation( - presentation, - holder3Key, - chal, - domain, - resolver, - ); - - expect(signedPres).toMatchObject( - expect.objectContaining({ - type: ['VerifiablePresentation'], - verifiableCredential: [cred3, cred4], - id: presId, - proof: expect.objectContaining({ - type: 'Sr25519Signature2020', - challenge: chal, - domain, - proofPurpose: 'authentication', - }), - }), - ); - - const result = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - }); - - // Verifier checks that both credential and presentation are correct. - expect(result.verified).toBe(true); - expect(result.presentationResult.verified).toBe(true); - expect(result.credentialResults.length).toBe(2); - expect(result.credentialResults[0].verified).toBe(true); - expect(result.credentialResults[1].verified).toBe(true); - }, 60000); -}); diff --git a/tests/integration/private-status-list-credential.test.js b/tests/integration/private-status-list-credential.test.js deleted file mode 100644 index 759c68c80..000000000 --- a/tests/integration/private-status-list-credential.test.js +++ /dev/null @@ -1,263 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { DockAPI } from '../../src'; -import { DockResolver } from '../../src/resolver'; -import { DockDid, DidKeypair } from '../../src/did'; -import { - FullNodeEndpoint, - TestAccountURI, - TestKeyringOpts, -} from '../test-constants'; -import { getUnsignedCred, registerNewDIDUsingPair } from './helpers'; -import { - issueCredential, - signPresentation, - verifyCredential, - verifyPresentation, -} from '../../src/utils/vc'; -import defaultDocumentLoader from '../../src/utils/vc/document-loader'; -import PrivateStatusList2021Credential from '../../src/status-list-credential/private-status-list2021-credential'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import { - addPrivateStatusListEntryToCredential, - getPrivateStatus, - verifyPrivateStatus, -} from '../../src/utils/vc/credentials'; -import { createPresentation } from '../create-presentation'; -import { getPrivateStatuses } from '../../src/utils/vc/presentations'; - -const termsOfUseCtx = { - '@context': { - details: { - '@id': 'https://ld.dock.io/security#details', - '@context': { - id: '@id', - price: 'https://schema.org/price', - currency: 'https://schema.org/priceCurrency', - }, - }, - }, -}; - -describe('PrivateStatusList2021Credential', () => { - const dockAPI = new DockAPI(); - const resolver = new DockResolver(dockAPI); - - // Create a random status list id - const statusListCredentialId = randomAsHex(32); - const statusListCredentialIndex = (Math.random() * 10e3) | 0; - - // Register a new DID for issuer - const issuerDID = DockDid.random(); - const issuerSeed = randomAsHex(32); - - // Register a new DID for holder - const holderDID = DockDid.random(); - const holderSeed = randomAsHex(32); - - const credId = 'test_cred'; - - let issuerKey; - let issuerKeyPair; - let privateStatusListCredential; - let credential; - - beforeAll(async () => { - await dockAPI.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - // The keyring should be initialized before any test begins as this suite is testing revocation - const account = dockAPI.keyring.addFromUri(TestAccountURI); - dockAPI.setAccount(account); - - // Register issuer DID - issuerKeyPair = new DidKeypair( - dockAPI.keyring.addFromUri(issuerSeed, null, 'ed25519'), - 1, - ); - await registerNewDIDUsingPair(dockAPI, issuerDID, issuerKeyPair); - - // Register holder DID - const pair1 = new DidKeypair( - dockAPI.keyring.addFromUri(holderSeed, null, 'ed25519'), - 1, - ); - await registerNewDIDUsingPair(dockAPI, holderDID, pair1); - - issuerKey = getKeyDoc( - issuerDID, - issuerKeyPair, - 'Ed25519VerificationKey2018', - ); - - privateStatusListCredential = await PrivateStatusList2021Credential.create( - issuerKey, - statusListCredentialId, - { statusPurpose: 'suspension' }, - ); - }, 60000); - - test('Issuer can issue a revocable credential and holder can verify it successfully when it is not revoked else the verification fails', async () => { - let unsignedCred = getUnsignedCred(credId, holderDID, [ - 'https://ld.dock.io/private-status-list-21', - termsOfUseCtx, - ]); - - // Adding payment terms to the credential. This isn't mandatory as it could be communicated out of band. - unsignedCred.termsOfUse = [ - { - type: 'Payment', - details: { - price: 10, - currency: 'USD', - }, - }, - ]; - - expect(() => addPrivateStatusListEntryToCredential( - unsignedCred, - statusListCredentialId, - statusListCredentialIndex, - 'wrongPurpose', - )).toThrow(); - - // Issuer issues the credential with a given status list id for revocation - unsignedCred = addPrivateStatusListEntryToCredential( - unsignedCred, - statusListCredentialId, - statusListCredentialIndex, - 'suspension', - ); - - credential = await issueCredential( - issuerKey, - unsignedCred, - undefined, - defaultDocumentLoader(resolver), - ); - - // The credential is verifiable successfully - const { verified } = await verifyCredential(credential, { - resolver, - compactProof: true, - }); - expect(verified).toEqual(true); - - // Holder gets the status info from the credential - const status = getPrivateStatus(credential); - - // The status is given to a party capable of checking revocation. Revocation check passes. - const { verified: v } = await verifyPrivateStatus( - status, - privateStatusListCredential, - { - documentLoader: defaultDocumentLoader(resolver), - expectedIssuer: credential.issuer, - }, - ); - expect(v).toEqual(true); - - // Revoke credential - await privateStatusListCredential.update(issuerKey, { - revokeIndices: [statusListCredentialIndex], - }); - - // // The credential can still be verified after revoking - const { verified: v1 } = await verifyCredential(credential, { - resolver, - compactProof: true, - }); - expect(v1).toEqual(true); - - // The revocation check fails now - const { verified: v2 } = await verifyPrivateStatus( - status, - privateStatusListCredential, - { - documentLoader: defaultDocumentLoader(resolver), - expectedIssuer: credential.issuer, - }, - ); - expect(v2).toEqual(false); - }); - - test('Holder can create a presentation and verifier can verify it successfully when it is not revoked else the verification fails', async () => { - await privateStatusListCredential.update(issuerKey, { - unsuspendIndices: [statusListCredentialIndex], - }); - - const holderKey = getKeyDoc( - holderDID, - new DidKeypair( - dockAPI.keyring.addFromUri(holderSeed, null, 'ed25519'), - 1, - ), - 'Ed25519VerificationKey2018', - ); - - // Create presentation for unsuspended credential - const presId = `https://pres.com/${randomAsHex(32)}`; - const chal = randomAsHex(32); - const domain = 'test domain'; - const presentation = createPresentation(credential, presId); - const signedPres = await signPresentation( - presentation, - holderKey, - chal, - domain, - resolver, - ); - - const { verified } = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - compactProof: true, - }); - expect(verified).toBe(true); - - // Get statuses from presentation - const statuses = getPrivateStatuses(signedPres); - - // The status will be verified by the parties in charge of revocation and these can be distinct - const { verified: v } = await verifyPrivateStatus( - statuses[0], - privateStatusListCredential, - { - documentLoader: defaultDocumentLoader(resolver), - expectedIssuer: credential.issuer, - }, - ); - expect(v).toEqual(true); - - // Revoke credential - await privateStatusListCredential.update(issuerKey, { - revokeIndices: [statusListCredentialIndex], - }); - - // Presentation can still be verified - const { verified: v1 } = await verifyPresentation(signedPres, { - challenge: chal, - domain, - resolver, - compactProof: true, - }); - expect(v1).toBe(true); - - // Status check fails now. - const { verified: v2 } = await verifyPrivateStatus( - statuses[0], - privateStatusListCredential, - { - documentLoader: defaultDocumentLoader(resolver), - expectedIssuer: credential.issuer, - }, - ); - expect(v2).toEqual(false); - }); - - afterAll(async () => { - await dockAPI.disconnect(); - }, 10000); -}); diff --git a/tests/integration/resolvers.test.js b/tests/integration/resolvers.test.js deleted file mode 100644 index b1c2ea684..000000000 --- a/tests/integration/resolvers.test.js +++ /dev/null @@ -1,131 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; -import { DockResolver, DockStatusList2021Resolver } from '../../src/resolver'; -import { DockDid, DidKeypair } from '../../src/did'; - -import { DockAPI } from '../../src/index'; - -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; - -import { OneOfPolicy } from '../../src/utils/revocation'; -import { registerNewDIDUsingPair } from './helpers'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import StatusList2021Credential from '../../src/status-list-credential/status-list2021-credential'; -import dockDidResolver from '../../src/resolver/did/dock-did-resolver'; - -describe('Resolvers', () => { - const dock = new DockAPI(); - let pair; - - // Create a random status list id - const statusListCredId = randomAsHex(32); - let statusListCred; - - // Create a new owner DID, the DID will be registered on the network and own the status list - const ownerDID = DockDid.random(); - const ownerSeed = randomAsHex(32); - let ownerKey; - - // Create owners - const owners = new Set(); - - // Create a status list policy - let policy; - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - owners.add(ownerDID); - policy = new OneOfPolicy(owners); - - ownerKey = getKeyDoc( - ownerDID, - dock.keyring.addFromUri(ownerSeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - - // The keyring should be initialized before any test begins as this suite is testing statusListCredentialModule - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // Thees DIDs should be written before any test begins - pair = DidKeypair.fromApi(dock, { - seed: ownerSeed, - keypairType: 'sr25519', - }); - - // The controller is same as the DID - await registerNewDIDUsingPair(dock, ownerDID, pair); - - statusListCred = await StatusList2021Credential.create( - ownerKey, - statusListCredId, - ); - await expect( - dock.statusListCredential.createStatusListCredential( - statusListCredId, - statusListCred, - policy, - false, - ), - ).resolves.toBeDefined(); - }, 40000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - it('checks `DockResolver`', async () => { - const resolver = new DockResolver(dock); - - expect(resolver.supports('did:dock:')).toBe(true); - expect(resolver.supports('did:doc:')).toBe(false); - expect(resolver.supports('status-list2021:dock:')).toBe(true); - expect(resolver.supports('status-list2021:*:')).toBe(false); - expect(resolver.supports('status-list2020:doc:')).toBe(false); - expect(await resolver.resolve(String(ownerDID))).toEqual( - await dock.did.getDocument(ownerDID), - ); - expect(await resolver.resolve(statusListCred.id)).toEqual( - statusListCred.toJSON(), - ); - }); - - it('checks `DockStatusList2021Resolver`', async () => { - const resolver = new DockStatusList2021Resolver(dock); - - expect(resolver.supports('did:dock:')).toBe(false); - expect(resolver.supports('did:doc:')).toBe(false); - expect(resolver.supports('status-list2021:dock:')).toBe(true); - expect(resolver.supports('status-list2021:*:')).toBe(false); - expect(resolver.supports('status-list2020:doc:')).toBe(false); - expect(resolver.resolve(String(ownerDID))).rejects.toThrowError( - `Invalid \`StatusList2021Credential\` id: \`${ownerDID}\``, - ); - expect(await resolver.resolve(statusListCred.id)).toEqual( - statusListCred.toJSON(), - ); - }); - - it('checks `DockDidResolver`', async () => { - const resolver = new dockDidResolver(dock); - - expect(resolver.supports('did:dock:')).toBe(true); - expect(resolver.supports('did:doc:')).toBe(false); - expect(resolver.supports('status-list2021:dock:')).toBe(false); - expect(resolver.supports('status-list2021:*:')).toBe(false); - expect(resolver.supports('status-list2020:doc:')).toBe(false); - expect(await resolver.resolve(String(ownerDID))).toEqual( - await dock.did.getDocument(ownerDID), - ); - expect(resolver.resolve(statusListCred.id)).rejects.toThrowError( - `Invalid DID: \`${statusListCred.id}\``, - ); - }); -}); diff --git a/tests/integration/revocation.test.js b/tests/integration/revocation.test.js deleted file mode 100644 index d1de17d0c..000000000 --- a/tests/integration/revocation.test.js +++ /dev/null @@ -1,346 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockAPI } from '../../src/index'; - -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; - -import { OneOfPolicy } from '../../src/utils/revocation'; -import { DidKeypair, DockDid } from '../../src/did'; -import { registerNewDIDUsingPair } from './helpers'; - -describe('Revocation Module', () => { - const dock = new DockAPI(); - let pair; - let pair2; - - // Create a random registry id - const registryId = randomAsHex(32); - // Create a random registry id - const multipleControllerRegistryID = randomAsHex(32); - - // Create a new owner DID, the DID will be registered on the network and own the registry - const ownerDID = DockDid.random(); - const ownerSeed = randomAsHex(32); - - const ownerDID2 = DockDid.random(); - const ownerSeed2 = randomAsHex(32); - - // Create owners - const owners = new Set(); - let policy; - - // Create revoke IDs - const revokeId = randomAsHex(32); - const revokeIds = new Set(); - revokeIds.add(revokeId); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - owners.add(ownerDID); - - // Create a registry policy - policy = new OneOfPolicy(owners); - - // The keyring should be initialized before any test begins as this suite is testing revocation - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // Thees DIDs should be written before any test begins - pair = DidKeypair.fromApi(dock, { - seed: ownerSeed, - keypairType: 'sr25519', - }); - pair2 = DidKeypair.fromApi(dock, { - seed: ownerSeed2, - keypairType: 'sr25519', - }); - - // The controller is same as the DID - await registerNewDIDUsingPair(dock, ownerDID, pair); - // Register secondary DID - await registerNewDIDUsingPair(dock, ownerDID2, pair2); - }, 40000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Can create a registry with a OneOf policy', async () => { - await expect( - dock.revocation.newRegistry(registryId, policy, false, false), - ).resolves.toBeDefined(); - const reg = await dock.revocation.getRevocationRegistry(registryId); - expect(!!reg).toBe(true); - }, 40000); - - test('Can revoke single from a registry', async () => { - const [revoke, sig, nonce] = await dock.revocation.createSignedRevoke( - registryId, - revokeIds, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.revocation.revoke(revoke, [{ nonce, sig }], false); - const revocationStatus = await dock.revocation.getIsRevoked( - registryId, - revokeId, - ); - expect(revocationStatus).toBe(true); - }, 40000); - - test('Can unrevoke single from a registry', async () => { - const [unrevoke, sig, nonce] = await dock.revocation.createSignedUnRevoke( - registryId, - revokeIds, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.revocation.unrevoke(unrevoke, [{ nonce, sig }], false); - - const revocationStatus = await dock.revocation.getIsRevoked( - registryId, - revokeId, - ); - expect(revocationStatus).toBe(false); - }, 40000); - - test('Can revoke and unrevoke multiple from a registry', async () => { - const rIds = new Set(); - const count = 500; - - for (let i = 0; i < count; i++) { - rIds.add(randomAsHex(32)); - } - - const rIdsArr = Array.from(rIds); - - const [revoke, sig, nonce] = await dock.revocation.createSignedRevoke( - registryId, - rIds, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.revocation.revoke(revoke, [{ nonce, sig }], false); - - console.time(`Check ${count} revocation status one by one`); - for (let i = 0; i < rIdsArr.length; i++) { - // eslint-disable-next-line no-await-in-loop - const status = await dock.revocation.getIsRevoked(registryId, rIdsArr[i]); - expect(status).toBe(true); - } - console.timeEnd(`Check ${count} revocation status one by one`); - - console.time(`Check ${count} revocation status in a batch`); - const revocationStatuses = await dock.revocation.areRevoked( - rIdsArr.map((r) => [registryId, r]), - ); - expect(revocationStatuses.length).toBe(rIds.size); - revocationStatuses.forEach((s) => expect(s).toBe(true)); - console.timeEnd(`Check ${count} revocation status in a batch`); - - const [unrevoke, sig1, nonce1] = await dock.revocation.createSignedUnRevoke( - registryId, - rIds, - ownerDID, - pair, - { didModule: dock.did }, - ); - - // Note: Intentionally passing true and waiting for finalization as not doing that makes the multi-query check fail. - // This seems like a bug since the single query check done in next loop work. Even the upgrade to @polkadot/api version 9.14 didn't fix - await dock.revocation.unrevoke( - unrevoke, - [{ nonce: nonce1, sig: sig1 }], - true, - ); - - for (let i = 0; i < rIdsArr.length; i++) { - // eslint-disable-next-line no-await-in-loop - const status = await dock.revocation.getIsRevoked(registryId, rIdsArr[i]); - expect(status).toBe(false); - } - - const revocationStatuses1 = await dock.revocation.areRevoked( - rIdsArr.map((r) => [registryId, r]), - ); - expect(revocationStatuses1.length).toBe(rIds.size); - revocationStatuses1.forEach((s) => expect(s).toBe(false)); - }, 40000); - - test('Can remove a registry', async () => { - const [remove, sig, nonce] = await dock.revocation.createSignedRemove( - registryId, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.revocation.removeRegistry(remove, [{ nonce, sig }], false); - await expect( - dock.revocation.getRevocationRegistry(registryId), - ).rejects.toThrow(/Could not find revocation registry/); - }, 40000); - - test('Can create an add only registry', async () => { - await expect( - dock.revocation.newRegistry(registryId, policy, true, false), - ).resolves.toBeDefined(); - const reg = await dock.revocation.getRevocationRegistry(registryId); - expect(!!reg).toBe(true); - }, 40000); - - test('Can revoke from an add only registry', async () => { - const reg = await dock.revocation.getRevocationRegistry(registryId); - expect(!!reg).toBe(true); - - const [revoke, sig, nonce] = await dock.revocation.createSignedRevoke( - registryId, - revokeIds, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.revocation.revoke(revoke, [{ nonce, sig }], false); - - const revocationStatus = await dock.revocation.getIsRevoked( - registryId, - revokeId, - ); - expect(revocationStatus).toBe(true); - }, 40000); - - test('Can not unrevoke from an add only registry', async () => { - const reg = await dock.revocation.getRevocationRegistry(registryId); - expect(!!reg).toBe(true); - - const [unrevoke, sig, nonce] = await dock.revocation.createSignedUnRevoke( - registryId, - revokeIds, - ownerDID, - pair, - { didModule: dock.did }, - ); - await expect( - dock.revocation.unrevoke(unrevoke, [{ nonce, sig }], false), - ).rejects.toThrow(); - - const revocationStatus = await dock.revocation.getIsRevoked( - registryId, - revokeId, - ); - expect(revocationStatus).toBe(true); - }, 40000); - - test('Can not remove an add only registry', async () => { - const reg = await dock.revocation.getRevocationRegistry(registryId); - expect(!!reg).toBe(true); - - const [remove, sig, nonce] = await dock.revocation.createSignedRemove( - registryId, - ownerDID, - pair, - { didModule: dock.did }, - ); - await expect( - dock.revocation.removeRegistry(remove, [{ nonce, sig }], false), - ).rejects.toThrow(); - - await expect( - dock.revocation.getRevocationRegistry(registryId), - ).resolves.toBeDefined(); - }, 40000); - - test('Can create a registry with multiple owners', async () => { - const controllersNew = new Set(); - controllersNew.add(ownerDID); - controllersNew.add(ownerDID2); - - // Create policy and registry with multiple owners - const policyNew = new OneOfPolicy(controllersNew); - await expect( - dock.revocation.newRegistry( - multipleControllerRegistryID, - policyNew, - false, - false, - ), - ).resolves.toBeDefined(); - const reg = await dock.revocation.getRevocationRegistry( - multipleControllerRegistryID, - ); - expect(reg.policy.isOneOf).toBe(true); - - const controllerSet = reg.policy.asOneOf; - expect(controllerSet.toJSON().length).toBe(2); - - let hasFirstDID = false; - let hasSecondDID = false; - [...controllerSet.entries()] - .flatMap((v) => v) - .map((cnt) => DockDid.from(cnt)) - .forEach((controller) => { - if (controller.toString() === ownerDID.toString()) { - hasFirstDID = true; - } else if (controller.toString() === ownerDID2.toString()) { - hasSecondDID = true; - } - }); - expect(hasFirstDID && hasSecondDID).toBe(true); - }, 40000); - - test('Can revoke, unrevoke and remove registry with multiple owners', async () => { - const revId = randomAsHex(32); - - // Revoke - await dock.revocation.revokeCredentialWithOneOfPolicy( - multipleControllerRegistryID, - revId, - ownerDID, - pair, - { didModule: dock.did }, - false, - ); - const revocationStatus = await dock.revocation.getIsRevoked( - multipleControllerRegistryID, - revId, - ); - expect(revocationStatus).toBe(true); - - // Unrevoke from another DID - await dock.revocation.unrevokeCredentialWithOneOfPolicy( - multipleControllerRegistryID, - revId, - ownerDID2, - pair2, - { didModule: dock.did }, - false, - ); - const revocationStatus1 = await dock.revocation.getIsRevoked( - multipleControllerRegistryID, - revId, - ); - expect(revocationStatus1).toBe(false); - - // Remove - await dock.revocation.removeRegistryWithOneOfPolicy( - multipleControllerRegistryID, - ownerDID, - pair, - { didModule: dock.did }, - false, - ); - await expect( - dock.revocation.getRevocationRegistry(multipleControllerRegistryID), - ).rejects.toThrow(/Could not find revocation registry/); - }, 30000); -}); diff --git a/tests/integration/schema.test.js b/tests/integration/schema.test.js deleted file mode 100644 index 4556e7b5f..000000000 --- a/tests/integration/schema.test.js +++ /dev/null @@ -1,314 +0,0 @@ -import { stringToHex } from '@polkadot/util'; -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockAPI } from '../../src/index'; - -import { DockDid, DidKeypair } from '../../src/did'; -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; -import { verifyCredential, verifyPresentation } from '../../src/utils/vc/index'; -import { - blobHexIdToQualified, - createNewDockBlobId, - DockBlobIdByteSize, -} from '../../src/modules/blob'; -import Schema from '../../src/modules/schema'; -import VerifiableCredential from '../../src/verifiable-credential'; -import exampleSchema from '../example-schema'; -import VerifiablePresentation from '../../src/verifiable-presentation'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import { DockResolver } from '../../src/resolver'; -import { Sr25519VerKeyName } from '../../src/utils/vc/crypto/constants'; -import { registerNewDIDUsingPair } from './helpers'; - -let account; -let pair; -let dockDID; -let blobId; -let keyDoc; -let validCredential; -let invalidCredential; -let invalidFormatBlobId; -let dockResolver; - -const ctx1 = { - '@context': { - emailAddress: 'https://schema.org/email', - alumniOf: 'https://schema.org/alumniOf', - }, -}; - -const ctx2 = { - '@context': { - emailAddress: 'https://schema.org/email', - notAlumniOf: 'https://schema.org/alumniOf', - }, -}; - -describe('Schema Blob Module Integration', () => { - const dockApi = new DockAPI(); - - // Generate first key with this seed. The key type is Sr25519 - const firstKeySeed = randomAsHex(32); - - beforeAll(async () => { - await dockApi.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - account = dockApi.keyring.addFromUri(TestAccountURI); - dockApi.setAccount(account); - pair = DidKeypair.fromApi(dockApi); - dockDID = DockDid.random(); - await registerNewDIDUsingPair(dockApi, dockDID, pair); - blobId = randomAsHex(DockBlobIdByteSize); - - // Write a blob with invalid JSON-schema format - invalidFormatBlobId = randomAsHex(DockBlobIdByteSize); - let blob = { - id: invalidFormatBlobId, - blob: stringToHex('hello world'), - }; - await dockApi.blob.new( - blob, - dockDID, - pair, - { didModule: dockApi.didModule }, - false, - ); - - // Write schema blob - const blobStr = JSON.stringify(exampleSchema); - blob = { - id: blobId, - blob: stringToHex(blobStr), - }; - await dockApi.blob.new( - blob, - dockDID, - pair, - { didModule: dockApi.didModule }, - false, - ); - - // Properly format a keyDoc to use for signing - keyDoc = getKeyDoc( - dockDID, - dockApi.keyring.addFromUri(firstKeySeed, null, 'sr25519'), - Sr25519VerKeyName, - ); - - // Create a resolver for dock DIDs - dockResolver = new DockResolver(dockApi); - - // Create a valid credential with a schema - validCredential = new VerifiableCredential( - 'https://example.com/credentials/123', - ); - validCredential.addContext( - 'https://www.w3.org/2018/credentials/examples/v1', - ); - validCredential.addContext(ctx1); - validCredential.addType('AlumniCredential'); - validCredential.addSubject({ - id: String(dockDID), - alumniOf: 'Example University', - emailAddress: 'john@gmail.com', - }); - validCredential.setSchema( - blobHexIdToQualified(blobId), - 'JsonSchemaValidator2018', - ); - await validCredential.sign(keyDoc); - - // Create a valid credential that doesn't follow the schema - invalidCredential = new VerifiableCredential( - 'https://example.com/credentials/1234', - ); - invalidCredential.addContext( - 'https://www.w3.org/2018/credentials/examples/v1', - ); - invalidCredential.addContext(ctx2); - invalidCredential.addType('AlumniCredential'); - invalidCredential.addSubject({ - id: String(dockDID), - notAlumniOf: 'Example University', - emailAddress: 'john@gmail.com', - }); - invalidCredential.setSchema( - blobHexIdToQualified(blobId), - 'JsonSchemaValidator2018', - ); - await invalidCredential.sign(keyDoc); - }, 90000); - - afterAll(async () => { - await dockApi.disconnect(); - }, 30000); - - test('Set and get schema', async () => { - const schema = new Schema(); - await schema.setJSONSchema(exampleSchema); - await dockApi.blob.new( - schema.toBlob(), - dockDID, - pair, - { didModule: dockApi.didModule }, - false, - ); - const schemaObj = await Schema.get(blobId, dockApi); - expect(schemaObj).toMatchObject({ - ...exampleSchema, - id: blobId, - author: dockDID.toString(), - }); - }, 20000); - - test('Schema.get throws error when schema not in correct format.', async () => { - await expect(Schema.get(invalidFormatBlobId, dockApi)).rejects.toThrow( - /Incorrect schema format/, - ); - }, 30000); - - test('Schema.get throws error when no blob exists at the given id.', async () => { - await expect(Schema.get(createNewDockBlobId(), dockApi)).rejects.toThrow( - /does not exist/, - ); - }, 30000); - - test('Utility method verifyCredential should pass if the subject is compatible with the schema in credentialSchema.', async () => { - await expect( - verifyCredential(validCredential.toJSON(), { - resolver: dockResolver, - compactProof: true, - }), - ).resolves.toBeDefined(); - }, 30000); - - test('The verify method should pass if the subject is compatible with the schema in credentialSchema.', async () => { - await expect( - validCredential.verify({ - resolver: dockResolver, - compactProof: true, - }), - ).resolves.toBeDefined(); - }, 30000); - - test('Utility method verifyCredential should check if schema is incompatible with the credentialSubject.', async () => { - await expect( - verifyCredential(invalidCredential.toJSON(), { - resolver: null, - compactProof: true, - }), - ).rejects.toThrow(/Unsupported protocol blob:/); - - await expect( - verifyCredential(invalidCredential.toJSON(), { - resolver: dockResolver, - compactProof: true, - }), - ).rejects.toThrow(/Schema validation failed/); - }, 30000); - - test('The verify method should detect a subject with incompatible schema in credentialSchema.', async () => { - await expect( - invalidCredential.verify({ - resolver: dockResolver, - compactProof: true, - }), - ).rejects.toThrow(/Schema validation failed/); - }, 30000); - - test('Utility method verifyPresentation should check if schema is incompatible with the credentialSubject.', async () => { - let vpInvalid = new VerifiablePresentation( - 'https://example.com/credentials/12345', - ); - vpInvalid.addCredential(invalidCredential); - vpInvalid.addContext(ctx2); - vpInvalid = await vpInvalid.sign(keyDoc, 'some_challenge', 'some_domain'); - - await expect( - verifyPresentation(vpInvalid.toJSON(), { - challenge: 'some_challenge', - domain: 'some_domain', - resolver: null, - compactProof: true, - }), - ).rejects.toThrow(/Unsupported protocol blob:/); - - await expect( - verifyPresentation(vpInvalid.toJSON(), { - challenge: 'some_challenge', - domain: 'some_domain', - resolver: dockResolver, - compactProof: true, - }), - ).rejects.toThrow(/Schema validation failed/); - }, 90000); - - test('Utility method verifyPresentation should check if schema is compatible with the credentialSubject.', async () => { - let vpValid = new VerifiablePresentation( - 'https://example.com/credentials/12345', - ); - vpValid.addCredential(validCredential); - vpValid.addContext(ctx1); - vpValid = await vpValid.sign(keyDoc, 'some_challenge', 'some_domain'); - - await expect( - verifyPresentation(vpValid.toJSON(), { - challenge: 'some_challenge', - domain: 'some_domain', - resolver: dockResolver, - compactProof: true, - }), - ).resolves.toBeDefined(); - }, 90000); - - test("VerifiablePresentation's verify should check if the schema is incompatible with the credentialSubject.", async () => { - let vpInvalid = new VerifiablePresentation( - 'https://example.com/credentials/12345', - ); - vpInvalid.addCredential(invalidCredential); - vpInvalid.addContext(ctx2); - vpInvalid = await vpInvalid.sign(keyDoc, 'some_challenge', 'some_domain'); - - await expect( - vpInvalid.verify({ - challenge: 'some_challenge', - domain: 'some_domain', - resolver: null, - compactProof: true, - }), - ).rejects.toThrow(/Unsupported protocol blob:/); - - await expect( - vpInvalid.verify({ - challenge: 'some_challenge', - domain: 'some_domain', - resolver: dockResolver, - compactProof: true, - }), - ).rejects.toThrow(/Schema validation failed/); - }, 90000); - - test("VerifiablePresentation's verify should check if the schema is compatible with the credentialSubject.", async () => { - let vpValid = new VerifiablePresentation( - 'https://example.com/credentials/12345', - ); - vpValid.addCredential(validCredential); - vpValid.addContext(ctx1); - vpValid = await vpValid.sign(keyDoc, 'some_challenge', 'some_domain'); - - await expect( - vpValid.verify({ - challenge: 'some_challenge', - domain: 'some_domain', - resolver: dockResolver, - compactProof: true, - }), - ).resolves.toBeDefined(); - }, 90000); -}); diff --git a/tests/integration/status-list-credential-module.test.js b/tests/integration/status-list-credential-module.test.js deleted file mode 100644 index 32e289398..000000000 --- a/tests/integration/status-list-credential-module.test.js +++ /dev/null @@ -1,330 +0,0 @@ -import { randomAsHex } from '@polkadot/util-crypto'; - -import { DockAPI } from '../../src/index'; - -import { - FullNodeEndpoint, - TestKeyringOpts, - TestAccountURI, -} from '../test-constants'; - -import { DockDid, DidKeypair } from '../../src/did'; -import { OneOfPolicy } from '../../src/utils/revocation'; -import { registerNewDIDUsingPair } from './helpers'; -import { getKeyDoc } from '../../src/utils/vc/helpers'; -import StatusList2021Credential from '../../src/status-list-credential/status-list2021-credential'; - -const expectEqualCreds = (cred1, cred2) => { - expect(cred1).toEqual(cred2); - expect(cred1.toJSON()).toEqual(cred2.toJSON()); - expect(StatusList2021Credential.fromJSON(cred1.toJSON())).toEqual( - StatusList2021Credential.fromJSON(cred2.toJSON()), - ); -}; - -describe('StatusListCredential Module', () => { - const dock = new DockAPI(); - let pair; - let pair2; - - // Create a random status list id - const statusListCredId = randomAsHex(32); - // Create a random status list id - const multipleControllerstatusListCredID = randomAsHex(32); - - // Create a new owner DID, the DID will be registered on the network and own the status list - const ownerDID = DockDid.random(); - const ownerSeed = randomAsHex(32); - let ownerKey; - - const ownerDID2 = DockDid.random(); - const ownerSeed2 = randomAsHex(32); - let ownerKey2; - - // Create owners - const owners = new Set(); - let policy; - - // Create revoke IDs - const revokeId = (Math.random() * 10e3) | 0; - const revokeIds = new Set(); - revokeIds.add(revokeId); - - beforeAll(async () => { - await dock.init({ - keyring: TestKeyringOpts, - address: FullNodeEndpoint, - }); - - // Create a status list policy - owners.add(ownerDID); - policy = new OneOfPolicy(owners); - - ownerKey = getKeyDoc( - ownerDID, - dock.keyring.addFromUri(ownerSeed, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - - ownerKey2 = getKeyDoc( - ownerDID2, - dock.keyring.addFromUri(ownerSeed2, null, 'ed25519'), - 'Ed25519VerificationKey2018', - ); - - // The keyring should be initialized before any test begins as this suite is testing statusListCredentialModule - const account = dock.keyring.addFromUri(TestAccountURI); - dock.setAccount(account); - - // Thees DIDs should be written before any test begins - pair = new DidKeypair( - dock.keyring.addFromUri(ownerSeed, null, 'sr25519'), - 1, - ); - pair2 = new DidKeypair( - dock.keyring.addFromUri(ownerSeed2, null, 'sr25519'), - 1, - ); - - // The controller is same as the DID - await registerNewDIDUsingPair(dock, ownerDID, pair); - // Register secondary DID - await registerNewDIDUsingPair(dock, ownerDID2, pair2); - }, 40000); - - afterAll(async () => { - await dock.disconnect(); - }, 10000); - - test('Can create a status list with a OneOf policy', async () => { - const cred = await StatusList2021Credential.create( - ownerKey, - statusListCredId, - {}, - ); - await expect( - dock.statusListCredential.createStatusListCredential( - statusListCredId, - cred, - policy, - false, - ), - ).resolves.toBeDefined(); - const fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ); - expectEqualCreds(cred, fetchedCred); - }, 40000); - - test('Can revoke index from a status list credential', async () => { - const cred = await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ); - await cred.update(ownerKey, { revokeIndices: revokeIds }); - const [revoke, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - cred, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - revoke, - [{ nonce, sig }], - false, - ); - const fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ); - expectEqualCreds(cred, fetchedCred); - expect(await fetchedCred.revoked(revokeId)).toBe(true); - }, 40000); - - test('Cant unsuspend from a status list credential with `statusPurpose` = `revocation`', async () => { - const cred = await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ); - await expect( - cred.update(ownerKey, { unsuspendIndices: revokeIds }), - ).rejects.toEqual( - new Error( - "Can't unsuspend indices for credential with `statusPurpose` = `revocation`, it's only possible with `statusPurpose` = `suspension`", - ), - ); - await expect( - cred.update(ownerKey, { unsuspendIndices: revokeIds }), - ).rejects.toEqual( - new Error( - "Can't unsuspend indices for credential with `statusPurpose` = `revocation`, it's only possible with `statusPurpose` = `suspension`", - ), - ); - expect(await cred.revokedBatch(revokeIds)).toEqual( - Array.from(revokeIds, () => true), - ); - }, 40000); - - test('Can unsuspend from a status list credential', async () => { - const credential = await StatusList2021Credential.create( - ownerKey, - statusListCredId, - { statusPurpose: 'suspension', revokeIndices: revokeIds }, - ); - let [update, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - credential, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - update, - [{ nonce, sig }], - false, - ); - let fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ); - expectEqualCreds(credential, fetchedCred); - await fetchedCred.update(ownerKey, { unsuspendIndices: revokeIds }); - expect(await fetchedCred.revokedBatch(revokeIds)).toEqual( - Array.from(revokeIds, () => false), - ); - [update, sig, nonce] = await dock.statusListCredential.createSignedUpdateStatusListCredential( - statusListCredId, - fetchedCred, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.updateStatusListCredential( - update, - [{ nonce, sig }], - false, - ); - - fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ); - expect(await fetchedCred.revoked(revokeId)).toBe(false); - }, 40000); - - test('Can remove a status list', async () => { - const [remove, sig, nonce] = await dock.statusListCredential.createSignedRemoveStatusListCredential( - statusListCredId, - ownerDID, - pair, - { didModule: dock.did }, - ); - await dock.statusListCredential.removeStatusListCredential( - remove, - [{ nonce, sig }], - false, - ); - expect( - await dock.statusListCredential.fetchStatusList2021Credential( - statusListCredId, - ), - ).toBe(null); - }, 40000); - - test('Can create a status list with multiple owners', async () => { - const controllersNew = new Set(); - controllersNew.add(ownerDID); - controllersNew.add(ownerDID2); - - const cred = await StatusList2021Credential.create( - ownerKey, - multipleControllerstatusListCredID, - { statusPurpose: 'suspension' }, - ); - - // Create policy and status list with multiple owners - const policyNew = new OneOfPolicy(controllersNew); - await expect( - dock.statusListCredential.createStatusListCredential( - multipleControllerstatusListCredID, - cred, - policyNew, - false, - false, - ), - ).resolves.toBeDefined(); - const fetchedCred = ( - await dock.api.query.statusListCredential.statusListCredentials( - multipleControllerstatusListCredID, - ) - ).unwrap(); - expect(fetchedCred.policy.isOneOf).toBe(true); - - const controllerSet = fetchedCred.policy.asOneOf; - expect(controllerSet.toJSON().length).toBe(2); - - let hasFirstDID = false; - let hasSecondDID = false; - [...controllerSet.entries()] - .flatMap((v) => v) - .map((cnt) => DockDid.from(cnt)) - .forEach((controller) => { - if (controller.toString() === DockDid.from(ownerDID).toString()) { - hasFirstDID = true; - } else if ( - controller.toString() === DockDid.from(ownerDID2).toString() - ) { - hasSecondDID = true; - } - }); - expect(hasFirstDID && hasSecondDID).toBe(true); - }, 40000); - - test('Can revoke, unsuspend and remove status list with multiple owners', async () => { - const revId = (Math.random() * 10e3) | 0; - - let fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - multipleControllerstatusListCredID, - ); - await fetchedCred.update(ownerKey, { revokeIndices: [revId] }); - // Revoke - await dock.statusListCredential.updateStatusListCredentialWithOneOfPolicy( - multipleControllerstatusListCredID, - fetchedCred, - ownerDID, - pair, - { didModule: dock.did }, - false, - ); - fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - multipleControllerstatusListCredID, - revId, - ); - expect(await fetchedCred.revoked(revId)).toBe(true); - - await fetchedCred.update(ownerKey2, { unsuspendIndices: [revId] }); - - // Unrevoke from another DID - await dock.statusListCredential.updateStatusListCredentialWithOneOfPolicy( - multipleControllerstatusListCredID, - fetchedCred, - ownerDID2, - pair2, - { didModule: dock.did }, - false, - ); - fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - multipleControllerstatusListCredID, - ); - expect(await fetchedCred.revoked(revId)).toBe(false); - - // Remove - await dock.statusListCredential.removeStatusListCredentialWithOneOfPolicy( - multipleControllerstatusListCredID, - ownerDID, - pair, - { didModule: dock.did }, - false, - ); - fetchedCred = await dock.statusListCredential.fetchStatusList2021Credential( - multipleControllerstatusListCredID, - ); - expect(fetchedCred).toBe(null); - }, 30000); -}); diff --git a/tests/ipfs/crawl.test.js b/tests/ipfs/crawl.test.js deleted file mode 100644 index 24acdff16..000000000 --- a/tests/ipfs/crawl.test.js +++ /dev/null @@ -1,217 +0,0 @@ -import { newEngine } from '@comunica/actor-init-sparql-rdfjs'; -import { crawl, graphResolver } from '../../src/crawl.js'; -import { ANYCLAIM, MAYCLAIM, MAYCLAIM_DEF_1 } from '../../src/rdf-defs.js'; -import { documentLoader, addDocument } from '../cached-document-loader.js'; - -const ipfsDefaultConfig = 'http://127.0.0.1:5001'; - -const ATTESTS = 'https://rdf.dock.io/alpha/2021#attestsDocumentContents'; - -const ipfs_content = { - rootatt: ` - @prefix dockalpha: . - dockalpha:mayClaim dockalpha:ANYCLAIM . - `, - batt: ` - @prefix dockalpha: . - dockalpha:mayClaim dockalpha:ANYCLAIM . - . - `, -}; - -async function ipfsAdd(ipfsClient, content) { - const cid = await ipfsClient.add(content); - return `ipfs://${cid.toV1()}`; -} - -describe('Crawler', () => { - let ipfsClient; - let rootatt_iri; - let batt_iri; - - beforeAll(async () => { - const { createHelia } = await import('helia'); - const { strings } = await import('@helia/strings'); - ipfsClient = strings(await createHelia(ipfsDefaultConfig)); - - rootatt_iri = await ipfsAdd(ipfsClient, ipfs_content.rootatt); - batt_iri = await ipfsAdd(ipfsClient, ipfs_content.batt); - - addDocument('did:root', { - '@id': 'did:root', - [ATTESTS]: { '@id': rootatt_iri }, - }); - addDocument('did:b', { - '@id': 'did:root', - [ATTESTS]: { '@id': batt_iri }, - }); - }); - - test('happy path', async () => { - const RULES = [ - ...MAYCLAIM_DEF_1, - { - if_all: [ - [ - { Unbound: 'a' }, - { Bound: { Iri: ATTESTS } }, - { Unbound: 'doc' }, - { Unbound: 'a' }, - ], - ], - then: [ - [ - { Unbound: 'doc' }, - { Bound: { Iri: MAYCLAIM } }, - { Bound: { Iri: ANYCLAIM } }, - { Unbound: 'a' }, - ], - ], - }, - ]; - const CURIOSITY = ` - prefix dockalpha: - - select ?lookupNext where { - graph { - ?lookupNext dockalpha:mayClaim dockalpha:ANYCLAIM . - } - } - `; - - const failedLookups = []; - const resolveGraph = graphResolver( - ipfsClient, - documentLoader, - (term, _err) => failedLookups.push(term), - ); - const initialFacts = await resolveGraph({ Iri: 'did:root' }); - const allFacts = await crawl(initialFacts, RULES, CURIOSITY, resolveGraph, newEngine()); - expect(failedLookups).toEqual([{ Iri: 'did:c' }]); - expect(allFacts).toEqual( - [ - [ - { Iri: 'did:root' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: rootatt_iri }, - { Iri: 'did:root' }, - ], - [ - { Iri: rootatt_iri }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: rootatt_iri }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:root' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: batt_iri }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:root' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: batt_iri }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:root' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: batt_iri }, - { Iri: rootatt_iri }, - ], - [ - { Iri: batt_iri }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:b' }, - ], - [ - { Iri: batt_iri }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - [ - { Iri: batt_iri }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: rootatt_iri }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: batt_iri }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Iri: 'isbn:978-0-06-245871-1' }, - { Iri: batt_iri }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Iri: 'isbn:978-0-06-245871-1' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Iri: 'isbn:978-0-06-245871-1' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Iri: 'isbn:978-0-06-245871-1' }, - { Iri: rootatt_iri }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: rootatt_iri }, - ], - ], - ); - }); - - test('graphResolver', async () => { - const resolveGraph = graphResolver(ipfsClient, documentLoader); - const initialfacts = await resolveGraph({ Iri: 'did:root' }); - expect(initialfacts).toEqual([ - [ - { Iri: 'did:root' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: 'ipfs://bafkreiddpez3cqhuje7j3b3xwuhyydis5lzsihdavxnigejhtpnod6eiha' }, - { Iri: 'did:root' }, - ], - ]); - }); -}); diff --git a/tests/network-cache.js b/tests/network-cache.js deleted file mode 100644 index 89f93df39..000000000 --- a/tests/network-cache.js +++ /dev/null @@ -1,60 +0,0 @@ -export default { - 'https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw': { - id: 'https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw', - type: 'EcdsaSecp256k1VerificationKey2019', - publicKeyBase58: '222iuczftmixHLkW6wszwyeAfYCZA7bzQMhkEXpeNVJrk', - '@context': 'https://w3id.org/security/v2', - controller: 'https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw', - }, - 'https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw': { - '@context': 'https://w3id.org/security/v2', - id: 'https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw', - assertionMethod: [ - 'https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw', - ], - authentication: [ - 'https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw', - ], - }, - - 'urn:EcdsaSecp256k1VerificationKey2019#keys-1': { - id: 'urn:EcdsaSecp256k1VerificationKey2019#keys-1', - type: 'EcdsaSecp256k1VerificationKey2019', - publicKeyBase58: '222iuczftmixHLkW6wszwyeAfYCZA7bzQMhkEXpeNVJrk', - '@context': 'https://w3id.org/security/v2', - controller: 'urn:EcdsaSecp256k1VerificationKey2019', - }, - 'urn:EcdsaSecp256k1VerificationKey2019': { - '@context': 'https://w3id.org/security/v2', - id: 'urn:EcdsaSecp256k1VerificationKey2019', - assertionMethod: [ - 'urn:EcdsaSecp256k1VerificationKey2019#keys-1', - ], - authentication: [ - 'urn:EcdsaSecp256k1VerificationKey2019#keys-1', - ], - }, - - 'urn:JsonWebKey2020': { - '@context': 'https://w3id.org/security/v2', - id: 'urn:JsonWebKey2020', - assertionMethod: [ - 'urn:JsonWebKey2020#keys-1', - ], - authentication: [ - 'urn:JsonWebKey2020#keys-1', - ], - }, - 'urn:JsonWebKey2020#keys-1': { - '@context': 'https://w3id.org/security/suites/jws-2020/v1', - id: 'urn:JsonWebKey2020#keys-1', - controller: 'urn:JsonWebKey2020', - type: 'JsonWebKey2020', - publicKeyJwk: { - kty: 'EC', - crv: 'P-384', - x: 'dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk', - y: 'viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E' - }, - }, -}; diff --git a/tests/setup-test-env.js b/tests/setup-test-env.js deleted file mode 100644 index 34bd72ce1..000000000 --- a/tests/setup-test-env.js +++ /dev/null @@ -1,2 +0,0 @@ -import 'core-js/stable'; -import 'regenerator-runtime/runtime'; diff --git a/tests/test-keys.js b/tests/test-keys.js deleted file mode 100644 index d372093d6..000000000 --- a/tests/test-keys.js +++ /dev/null @@ -1,36 +0,0 @@ -import { generateEcdsaSecp256k1Keypair, getPublicKeyFromKeyringPair } from '../src/utils/misc'; - -const keypairEcdsaSecp256k1 = generateEcdsaSecp256k1Keypair('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); - -// TODO: add more testing keys (ed25519 etc) -export default [{ - sigType: 'JsonWebSignature2020', - keyDocument: { - '@context': 'https://w3id.org/security/suites/jws-2020/v1', - id: 'urn:JsonWebKey2020#keys-1', - controller: 'urn:JsonWebKey2020', - type: 'JsonWebKey2020', - publicKeyJwk: { - kty: "EC", - crv: "P-384", - x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", - y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E" - }, - privateKeyJwk: { - kty: "EC", - crv: "P-384", - x: "dMtj6RjwQK4G5HP3iwOD94RwbzPhS4wTZHO1luk_0Wz89chqV6uJyb51KaZzK0tk", - y: "viPKF7Zbc4FxKegoupyVRcBr8TZHFxUrKQq4huOAyMuhTYJbFpAwMhIrWppql02E", - d: "Wq5_KgqjvYh_EGvBDYtSs_0ufJJP0y0tkAXl6GqxHMkY0QP8vmD76mniXD-BWhd_" - } - }, -}, { - sigType: 'EcdsaSecp256k1Signature2019', - keyDocument: { - id: 'urn:EcdsaSecp256k1VerificationKey2019#keys-1', - controller: 'urn:EcdsaSecp256k1VerificationKey2019', - type: 'EcdsaSecp256k1VerificationKey2019', - keypair: keypairEcdsaSecp256k1, - publicKey: getPublicKeyFromKeyringPair(keypairEcdsaSecp256k1), - }, -}]; diff --git a/tests/unit/__snapshots__/did.test.js.snap b/tests/unit/__snapshots__/did.test.js.snap deleted file mode 100644 index e3e78c4aa..000000000 --- a/tests/unit/__snapshots__/did.test.js.snap +++ /dev/null @@ -1,5 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`\`DockDidOrDidMethodKey.from\` \`DidMethodKey.from\` work for a raw did:key 1`] = `"Unsupported did string: zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme, expected either \`dock:did:\` or \`dock:key:\`"`; - -exports[`\`DockDidOrDidMethodKey.from\` \`DockDid.from\` work for a raw did 1`] = `"Unsupported did string: 5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk, expected either \`dock:did:\` or \`dock:key:\`"`; diff --git a/tests/unit/canonicalize.test.js b/tests/unit/canonicalize.test.js deleted file mode 100644 index aa8e95690..000000000 --- a/tests/unit/canonicalize.test.js +++ /dev/null @@ -1,31 +0,0 @@ -import deepEqual from 'deep-equal'; -import { canon } from '../../src/utils/canonicalize'; - -describe('Canonicalization.', () => { - test('canon: ∀ A, B ∈ Node: canon(A) = canon(B) <-> A = B', async () => { - const samples = [ - { Iri: 'did:example:ebfeb1f712ebc6f1c276e12ec21' }, - { Iri: 'http://schema.org/alumniOf' }, - { - Literal: { - value: 'Example University', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - { - Literal: { // the keys in this are swapped but the canonical representation shouldn't change - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - value: 'Example University', - }, - }, - { Iri: 'https://example.com/credentials/1872' }, - { Iri: 'https://w3id.org/security#proof' }, - { Blank: '_:b1' }, - ]; - for (const A of samples) { - for (const B of samples) { - expect(deepEqual(A, B)).toEqual(canon(A) === canon(B)); - } - } - }); -}); diff --git a/tests/unit/claim-deduction.test.js b/tests/unit/claim-deduction.test.js deleted file mode 100644 index f431a2bf5..000000000 --- a/tests/unit/claim-deduction.test.js +++ /dev/null @@ -1,590 +0,0 @@ -import b58 from 'bs58'; -import { hexToU8a } from '@polkadot/util'; - -import jsonld from 'jsonld'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { - expandedLogicProperty, - acceptCompositeClaims, - proveh, - validateh, - presentationToEEClaimGraph, - proveCompositeClaims, -} from '../../src/utils/cd'; -import { - issueCredential, - verifyPresentation, - verifyCredential, -} from '../../src/utils/vc/index'; -import { createPresentation } from '../create-presentation'; -import { - documentLoader, addDocument, registered, modifyDocument, -} from '../cached-document-loader'; - -import { generateEcdsaSecp256k1Keypair, getPublicKeyFromKeyringPair } from '../../src/utils/misc'; - -describe('Composite claim soundness checker', () => { - test('control: issue and verify', async () => { - const { did: issuer, suite: kp } = await newDid(); - - const cred = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential'], - issuer, - issuanceDate: '2010-01-01T19:23:24Z', - credentialSubject: { - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }, - }; - const credential = await issueCredential(kp, cred, true, documentLoader); - const vresult = await verifyC(credential); - expect(vresult) - .toHaveProperty('verified', true); - credential.issuanceDate = '9010-01-01T19:23:24Z'; - expect(await verifyC(credential)) - .toHaveProperty('verified', false); - }); - - test('assumption: credential with false issuer will fail', async () => { - const { did: issuera, suite: kpa } = await newDid(); - const { did: issuerb, suite: kpb } = await newDid(); - - // fyi signing a cred does modify the cred by adding a proof - const cred = () => ({ - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential'], - issuer: issuera, - issuanceDate: '2010-01-01T19:23:24Z', - credentialSubject: { - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }, - }); - - expect(await verifyC( - await issueCredential(kpa, cred(), true, documentLoader), - )).toHaveProperty('verified', true); - - let err; - err = await verifyC( - await issueCredential(kpb, cred(), true, documentLoader), - ); - expect(err).toHaveProperty('verified', false); - expect(err.results[0].error.toString()) - .toMatch('Error: Credential issuer must match the verification method controller.'); - - // modify the attackers keydoc to assert it's controller is issuera - await modifyDocument(`${issuerb}#keys-1`, (original) => ({ ...original, controller: issuera })); - expect((await documentLoader(`${issuerb}#keys-1`)).document.controller).toBe(issuera); - - err = await verifyC( - await issueCredential(kpb, cred(), true, documentLoader), - ); - expect(err).toHaveProperty('verified', false); - expect(err.results[0].error.toString()).toMatch(/not authorized by controller/); - }); - - test('behavior on empty input', () => { - const premises = []; - const to_prove = []; - const rules = []; - const proof = proveh(premises, to_prove, rules); - const valid = validateh(rules, proof); - expect(valid).toEqual({ assumed: [], implied: [] }); - }); - - // The user is able to input a set of credentials, along with an associated proof of composite - // claim[s]. - // - // The proof validator(DCK-70) correctly validates the proof. - // - // The verification result is provided to the user. - // - // The program reports all composite claims which were proven. - test('end to end, presentation to result', async () => { - const rules = sampleRules(); - const presentation = await validPresentation(); - const { issuer } = presentation.verifiableCredential[0]; - // here we prove that [a frobs b], a pretty easy proof as the axiom used is unconditional - presentation[expandedLogicProperty] = jsonLiteral([{ - rule_index: 0, - instantiations: [], - }]); - const all = await checkSoundness(presentation, rules); - expect(all).toEqual([ - [ - { Iri: 'did:example:ebfeb1f712ebc6f1c276e12ec21' }, - { Iri: 'http://schema.org/alumniOf' }, - { - Literal: { - value: 'Example University', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - { Iri: issuer }, - ], - [ - { Iri: 'https://example.com/credentials/1872' }, - { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' }, - { Iri: 'https://www.w3.org/2018/credentials#VerifiableCredential' }, - { Iri: issuer }, - ], - [ - { Iri: 'https://example.com/credentials/1872' }, - { Iri: 'https://www.w3.org/2018/credentials#credentialSubject' }, - { Iri: 'did:example:ebfeb1f712ebc6f1c276e12ec21' }, - { Iri: issuer }, - ], - [ - { Iri: 'https://example.com/credentials/1872' }, - { Iri: 'https://www.w3.org/2018/credentials#issuanceDate' }, - { - Literal: { - value: '2010-01-01T19:23:24Z', - datatype: 'http://www.w3.org/2001/XMLSchema#dateTime', - }, - }, - { Iri: issuer }, - ], - [ - { Iri: 'https://example.com/credentials/1872' }, - { Iri: 'https://www.w3.org/2018/credentials#issuer' }, - { Iri: issuer }, - { Iri: issuer }, - ], - [ - { Iri: 'https://example.com/a' }, - { Iri: 'https://example.com/frobs' }, - { Iri: 'https://example.com/b' }, - { DefaultGraph: true }, - ], - ]); - }, 30000); - - // Soundness checking fails if and only if one of the following conditions occurs: - // - Proof assumes claims not attested to by the provided credentials and is therefore not verifiable. - // - Credential claims are not verifiable(credential verification fails) so proof is not verifiable. - - test('Proof including unstated claims should fail.', async () => { - const rules = sampleRules(); - const presentation = await validPresentation(); - presentation[expandedLogicProperty] = jsonLiteral([{ - rule_index: 1, - instantiations: [{ Iri: 'http://example.com/joeThePig' }], - }]); - await expect(checkSoundness(presentation, rules)) - .rejects - .toHaveProperty('unverifiedAssumption', [ - { Iri: 'http://example.com/joeThePig' }, - { Iri: 'https://example.com/Ability' }, - { Iri: 'https://example.com/Flight' }, - { DefaultGraph: true }, - ]); - }); - - test('Proof including inapplicable rule should fail.', async () => { - const rules = sampleRules(); - const presentation = await validPresentation(); - presentation[expandedLogicProperty] = jsonLiteral([{ - rule_index: 0, - instantiations: [{ Iri: 'http://example.com' }], - }]); - await expect(checkSoundness(presentation, rules)) - .rejects - .toEqual({ InvalidProof: 'BadRuleApplication' }); - }); - - test('Unverifiable credential should fail.', async () => { - const rules = sampleRules(); - const presentation = await validPresentation(); - presentation.verifiableCredential[0].issuer = 'did:dock:bobert'; // tamper - presentation[expandedLogicProperty] = jsonLiteral([{ rule_index: 0, instantiations: [] }]); - await expect( - checkSoundness(presentation, rules) - .catch((err) => Promise.reject(JSON.stringify(err))), - ) - .rejects - .toMatch(/Invalid signature/); - }); - - test('bddap is named Gorgadon because joe is a pig that can fly', async () => { - const { did: pigchecker, suite: pigchecker_kp } = await newDid(); - const { did: faa, suite: faa_kp } = await newDid(); - - // if pigs can fly, then bddap is Gorgadon - const gorg = { - if_all: [ - [ - { Unbound: 'pig' }, - { Bound: { Iri: 'https://example.com/Ability' } }, - { Bound: { Iri: 'https://example.com/Flight' } }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Unbound: 'pig' }, - { Bound: rdf('type') }, - { Bound: { Iri: 'https://example.com/Pig' } }, - { Bound: { DefaultGraph: true } }, - ], - ], - then: [ - [ - { Bound: { Iri: 'did:dock:bddap' } }, - { Bound: { Iri: 'http://xmlns.com/foaf/spec/#term_firstName' } }, - { - Bound: { - Literal: { - value: 'Gorgadon', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral', - }, - }, - }, - { Bound: { DefaultGraph: true } }, - ], - ], - }; - const licensing = { - // if a? lp? lo? licenser? - // and licenser? mayLicence li? - // and li? predicate lp? - // and li? object lo? - if_all: [ - [ - { Unbound: 'a' }, - { Unbound: 'lp' }, - { Unbound: 'lo' }, - { Unbound: 'licenser' }, - ], - [ - { Unbound: 'licenser' }, - { Bound: { Iri: 'https://example.com/mayLicense' } }, - { Unbound: 'li' }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Unbound: 'li' }, - { Bound: rdf('predicate') }, - { Unbound: 'lp' }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Unbound: 'li' }, - { Bound: rdf('object') }, - { Unbound: 'lo' }, - { Bound: { DefaultGraph: true } }, - ], - ], - // then [a? lp? lo?], - then: [ - [ - { Unbound: 'a' }, - { Unbound: 'lp' }, - { Unbound: 'lo' }, - { Bound: { DefaultGraph: true } }, - ], - ], - }; - const licenses = { - if_all: [], - then: [ - // the Federal Aviation Administration may grant the ability to fly - [ - { Bound: { Iri: faa } }, - { Bound: { Iri: 'https://example.com/mayLicense' } }, - { Bound: { Iri: 'uuid:5c4cfa6b-d96f-4a53-8786-2cce46cc51c4' } }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Bound: { Iri: 'uuid:5c4cfa6b-d96f-4a53-8786-2cce46cc51c4' } }, - { Bound: rdf('predicate') }, - { Bound: { Iri: 'https://example.com/Ability' } }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Bound: { Iri: 'uuid:5c4cfa6b-d96f-4a53-8786-2cce46cc51c4' } }, - { Bound: rdf('object') }, - { Bound: { Iri: 'https://example.com/Flight' } }, - { Bound: { DefaultGraph: true } }, - ], - // pigchecker is trusted to check whether something is a pig - [ - { Bound: { Iri: pigchecker } }, - { Bound: { Iri: 'https://example.com/mayLicense' } }, - { Bound: { Iri: 'uuid:6f165460-894a-4e51-a2a5-79b537678720' } }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Bound: { Iri: 'uuid:6f165460-894a-4e51-a2a5-79b537678720' } }, - { Bound: rdf('predicate') }, - { Bound: rdf('type') }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Bound: { Iri: 'uuid:6f165460-894a-4e51-a2a5-79b537678720' } }, - { Bound: rdf('object') }, - { Bound: { Iri: 'https://example.com/Pig' } }, - { Bound: { DefaultGraph: true } }, - ], - ], - }; - const rules = [gorg, licensing, licenses]; - - const joe_is_a_pig = await issueCredential(pigchecker_kp, { - '@context': ['https://www.w3.org/2018/credentials/v1'], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential'], - issuer: pigchecker, - issuanceDate: '2010-01-01T19:23:24Z', - credentialSubject: { - '@id': 'did:example:joe', - '@type': 'https://example.com/Pig', - }, - }, true, documentLoader); - - const joe_can_fly = await issueCredential(faa_kp, { - '@context': ['https://www.w3.org/2018/credentials/v1'], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential'], - issuer: faa, - issuanceDate: '2010-01-01T19:23:24Z', - credentialSubject: { - '@id': 'did:example:joe', - 'https://example.com/Ability': { '@id': 'https://example.com/Flight' }, - }, - }, true, documentLoader); - - const presentation = createPresentation( - [ - joe_can_fly, - joe_is_a_pig, - ], - 'uuid:ce0d9145-934a-42b3-aa48-af1d27f33c2a', - 'uuid:078644cf-de19-436c-9691-fbe8a569a1d4', - ); - - // create a proof that bddap is Gorgadon - const presentation_claimgraph = await presentationToEEClaimGraph( - await jsonld.expand(presentation, { documentLoader }), - ); - const claim_to_prove = [ - { Iri: 'did:dock:bddap' }, - { Iri: 'http://xmlns.com/foaf/spec/#term_firstName' }, - { - Literal: { - value: 'Gorgadon', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral', - }, - }, - { DefaultGraph: true }, - ]; - expect(presentation_claimgraph).not.toContainEqual(claim_to_prove); - const proof = proveh( - presentation_claimgraph, - [claim_to_prove], - rules, - ); - presentation[expandedLogicProperty] = jsonLiteral(proof); - - const cg = await checkSoundness(presentation, rules); - expect(cg).toContainEqual(claim_to_prove); - }); - - test('holder: prove composite claim', async () => { - const presentation = await validPresentation(); - const expandedPresentation = await jsonld.expand(presentation, { documentLoader }); - const compositeClaim = [ - { Iri: 'https://example.com/a' }, - { Iri: 'https://example.com/frobs' }, - { Iri: 'https://example.com/b' }, - { DefaultGraph: true }, - ]; - const rules = sampleRules(); - const proof = await proveCompositeClaims(expandedPresentation, [compositeClaim], rules); - expect(await checkSoundness(presentation, rules)).not.toContainEqual(compositeClaim); - presentation[expandedLogicProperty] = proof; - expect(await checkSoundness(presentation, rules)).toContainEqual(compositeClaim); - }, 30000); -}); - -// takes a verifiable presentation and rules, returns all claims which are known to be true under -// the given set of rules -// This function is intentionally not exposed publicly. -async function checkSoundness(presentation, rules) { - const ver = await verifyP(presentation); - if (!ver.verified) { - throw ver; - } - // Pre-expand the presentaion using local cache. Tests run pretty slow otherwise. - presentation = await jsonld.expand(presentation, { documentLoader }); - return acceptCompositeClaims(presentation, rules); -} - -function registerDid(did, keypair) { - if (registered(did)) { throw `${did} already registered`; } - - const publicKeyBase58 = b58.encode(hexToU8a(keypair.publicKey.value)); - const pk = { - id: `${did}#keys-1`, - type: keypair.type, - publicKeyBase58, - controller: did, - publicKey: keypair.publicKey.value, - }; - const doc = { - '@context': 'https://www.w3.org/ns/did/v1', - id: did, - authentication: [pk.id], - assertionMethod: [pk.id], - publicKey: [pk], - }; - addDocument(did, doc); - addDocument(pk.id, { - '@context': 'https://www.w3.org/ns/did/v1', - ...pk, - pkdoc: true, - }); -} - -function randoDID() { - return `did:dock:${randomAsHex(32).substring(2, 2 + 20)}`; -} - -async function verifyC(credential) { - return verifyCredential(credential, { - documentLoader, - }); -} - -async function verifyP(presentation) { - return verifyPresentation(presentation, { - documentLoader, - unsignedPresentation: true, - }); -} - -function getSampleKey(randomDID, keypair) { - return { - id: `${randomDID}#keys-1`, - controller: randomDID, - type: 'EcdsaSecp256k1VerificationKey2019', - keypair, - thisisstring: 'yes', - publicKey: getPublicKeyFromKeyringPair(keypair), - }; -} - -async function newDid() { - const kp = generateEcdsaSecp256k1Keypair(randomAsHex(32)); - const randomDID = randoDID(); - const keypair = getSampleKey(randomDID, kp); - registerDid(randomDID, keypair); - return { - did: randomDID, - suite: keypair, - }; -} - -async function validCredential() { - const { did: issuer, suite: kp } = await newDid(); - const cred = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential'], - issuer, - issuanceDate: '2010-01-01T19:23:24Z', - credentialSubject: { - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }, - }; - const credential = await issueCredential(kp, cred, true, documentLoader); - expect(await verifyC(credential)) - .toHaveProperty('verified', true); - return credential; -} - -/// makes an unsigned presentation -async function validPresentation() { - const creds = [await validCredential()]; - const { did: holder } = await newDid(); - const presentation = createPresentation(creds, `urn:${randomAsHex(16)}`, holder); - expect(await verifyP(presentation)) - .toHaveProperty('verified', true); - return presentation; -} - -// https://w3c.github.io/json-ld-syntax/#json-literals -function jsonLiteral(json) { - return { - '@type': '@json', - '@value': JSON.parse(JSON.stringify(json)), - }; -} - -function sampleRules() { - return [ - { - if_all: [], - then: [ - [ - { Bound: { Iri: 'https://example.com/a' } }, - { Bound: { Iri: 'https://example.com/frobs' } }, - { Bound: { Iri: 'https://example.com/b' } }, - { Bound: { DefaultGraph: true } }, - ], - ], - }, - { - if_all: [ - [ - { Unbound: 'pig' }, - { Bound: { Iri: 'https://example.com/Ability' } }, - { Bound: { Iri: 'https://example.com/Flight' } }, - { Bound: { DefaultGraph: true } }, - ], - [ - { Unbound: 'pig' }, - { Bound: { Iri: 'https://www.w3.org/1999/02/22-rdf-syntax-ns#type' } }, - { Bound: { Iri: 'https://example.com/Pig' } }, - { Bound: { DefaultGraph: true } }, - ], - ], - then: [ - [ - { Bound: { Iri: 'did:dock:bddap' } }, - { Bound: { Iri: 'http://xmlns.com/foaf/spec/#term_firstName' } }, - { - Bound: { - Literal: { - value: 'Gorgadon', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral', - }, - }, - }, - { Bound: { DefaultGraph: true } }, - ], - ], - }, - ]; -} - -// It's common to use shorthand like `rdf:type`. This function let's us do something similar. -// expect(rdf('type')).toEqual({ Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' }); -function rdf(keyword) { - if (!['type', 'subject', 'predicate', 'object'].includes(keyword)) { - throw `are you sure ${keyword} is part of the rdf: context?`; - } - return { Iri: `http://www.w3.org/1999/02/22-rdf-syntax-ns#${keyword}` }; -} diff --git a/tests/unit/claimgraph.test.js b/tests/unit/claimgraph.test.js deleted file mode 100644 index 58b048e59..000000000 --- a/tests/unit/claimgraph.test.js +++ /dev/null @@ -1,227 +0,0 @@ -import jsonld from 'jsonld'; -import { fromJsonldjsCg, merge } from '../../src/utils/claimgraph'; - -describe('Claimgraph operations.', () => { - test('merge', async () => { - const cg1 = [ - [ - { Iri: 'https://example.com/credentials/1872' }, - { - Literal: { - value: 'Example University', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - { Blank: '_:b1' }, - { DefaultGraph: true }, - ], - [ - { Blank: '_:b1' }, - { Blank: '_:b3' }, - { Blank: '_:b5' }, - { Blank: '_:b6' }, - ], - ]; - const cg2 = [ - [ - { Blank: '_:b1' }, - { Blank: '_:b4' }, - { Blank: '_:b5' }, - { Blank: '_:b6' }, - ], - ]; - expect(merge([])).toEqual([]); - expect(merge([cg1])).toEqual([ - [ - { Iri: 'https://example.com/credentials/1872' }, - { - Literal: { - value: 'Example University', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - { Blank: '_:b0' }, - { DefaultGraph: true }, - ], - [ - { Blank: '_:b0' }, - { Blank: '_:b1' }, - { Blank: '_:b2' }, - { Blank: '_:b3' }, - ], - ]); - expect(merge([cg2])).toEqual([ - [ - { Blank: '_:b0' }, - { Blank: '_:b1' }, - { Blank: '_:b2' }, - { Blank: '_:b3' }, - ], - ]); - expect(merge([cg2, cg2])).toEqual([ - [ - { Blank: '_:b0' }, - { Blank: '_:b1' }, - { Blank: '_:b2' }, - { Blank: '_:b3' }, - ], - [ - { Blank: '_:b4' }, - { Blank: '_:b5' }, - { Blank: '_:b6' }, - { Blank: '_:b7' }, - ], - ]); - expect(merge([cg1, cg2])).toEqual([ - [ - { Iri: 'https://example.com/credentials/1872' }, - { - Literal: { - value: 'Example University', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - { Blank: '_:b0' }, - { DefaultGraph: true }, - ], - [ - { Blank: '_:b0' }, - { Blank: '_:b1' }, - { Blank: '_:b2' }, - { Blank: '_:b3' }, - ], - [ - { Blank: '_:b4' }, - { Blank: '_:b5' }, - { Blank: '_:b6' }, - { Blank: '_:b7' }, - ], - ]); - }); - - test('convert claimgraph from jsonld-js represention', async () => { - const jcg = [ - { - subject: { termType: 'NamedNode', value: 'did:example:ebfeb1f712ebc6f1c276e12ec21' }, - predicate: { termType: 'NamedNode', value: 'http://schema.org/alumniOf' }, - object: { - termType: 'Literal', - value: 'Example University', - datatype: { - termType: 'NamedNode', - value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - graph: { termType: 'BlankNode', value: '_:b0' }, - }, - { - subject: { termType: 'NamedNode', value: 'https://example.com/credentials/1872' }, - predicate: { termType: 'NamedNode', value: 'https://w3id.org/security#proof' }, - object: { termType: 'BlankNode', value: '_:b1' }, - graph: { termType: 'BlankNode', value: '_:b0' }, - }, - ]; - expect(fromJsonldjsCg(jcg)).toEqual([ - [ - { Iri: 'did:example:ebfeb1f712ebc6f1c276e12ec21' }, - { Iri: 'http://schema.org/alumniOf' }, - { - Literal: { - value: 'Example University', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML', - }, - }, - { Blank: '_:b0' }, - ], [ - { Iri: 'https://example.com/credentials/1872' }, - { Iri: 'https://w3id.org/security#proof' }, - { Blank: '_:b1' }, - { Blank: '_:b0' }, - ], - ]); - }); - - // The claim graphs of credentials are combined in a safe manner; blank nodes from one credential - // must not be conflated with those from another. Depending on the claim graph representation, - // this may require renaming of blank nodes, or rejection of credential sets where blank node - // names are shared between credentials. - test('no blank_node conflations', () => { - const cg1 = [ - [ - { Iri: 'https://example.com/a' }, - { Iri: 'https://example.com/parent' }, - { Blank: '_:b0' }, - { DefaultGraph: true }, - ], - ]; - const cg2 = [ - [ - { Blank: '_:b0' }, - { Iri: 'https://example.com/parent' }, - { Iri: 'https://example.com/b' }, - { DefaultGraph: true }, - ], - ]; - const merged = merge([cg1, cg2]); - - // It should not be provable that [a grandparent b] because `_:b0` in - // cg1 is not the same as `_:b0` in cg2. Given this result, this property - // is apparent. - expect(merged).toEqual( - [ - [ - { Iri: 'https://example.com/a' }, - { Iri: 'https://example.com/parent' }, - { Blank: '_:b0' }, - { DefaultGraph: true }, - ], - [ - { Blank: '_:b1' }, - { Iri: 'https://example.com/parent' }, - { Iri: 'https://example.com/b' }, - { DefaultGraph: true }, - ], - ], - ); - }); - - test('moron != carrot. https://github.com/docknetwork/sdk/issues/173', async () => { - const jld = { - 'https://example.com/a': [{ - '@value': 'moron', - '@language': 'en', - }, { - '@value': 'moron', - '@language': 'cy', - }], - }; - const cg = fromJsonldjsCg(await jsonld.toRDF(jld)); - expect(cg[0]).not.toEqual(cg[1]); - expect(cg).toEqual([ - [ - { Blank: '_:b0' }, - { Iri: 'https://example.com/a' }, - { - Literal: { - value: 'moron', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString', - language: 'en', - }, - }, - { DefaultGraph: true }, - ], - [ - { Blank: '_:b0' }, - { Iri: 'https://example.com/a' }, - { - Literal: { - value: 'moron', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString', - language: 'cy', - }, - }, - { DefaultGraph: true }, - ], - ]); - }); -}); diff --git a/tests/unit/crawl.test.js b/tests/unit/crawl.test.js deleted file mode 100644 index 5a0f59659..000000000 --- a/tests/unit/crawl.test.js +++ /dev/null @@ -1,208 +0,0 @@ -import { newEngine } from '@comunica/actor-init-sparql-rdfjs'; - -import { crawl } from '../../src/crawl.js'; -import { ANYCLAIM, MAYCLAIM, MAYCLAIM_DEF_1 } from '../../src/rdf-defs.js'; -import { assertValidNode } from '../../src/utils/common.js'; - -const ATTESTS = 'https://rdf.dock.io/alpha/2021#attestsDocumentContents'; -const LIKES = 'http://purl.org/spar/cito/likes'; -const IDENT = 'http://purl.org/dc/terms/identifier'; -const KNOWS = 'http://xmlns.com/foaf/0.1/knows'; - -describe('Crawler unit tests', () => { - test('happy path', async () => { - const RULES = [ - ...MAYCLAIM_DEF_1, - { - if_all: [ - [ - { Unbound: 'a' }, - { Bound: { Iri: ATTESTS } }, - { Unbound: 'doc' }, - { Unbound: 'a' }, - ], - ], - then: [ - [ - { Unbound: 'doc' }, - { Bound: { Iri: MAYCLAIM } }, - { Bound: { Iri: ANYCLAIM } }, - { Unbound: 'a' }, - ], - ], - }, - ]; - const CURIOSITY = ` - prefix dockalpha: - - select ?lookupNext where { - graph { - ?lookupNext dockalpha:mayClaim dockalpha:ANYCLAIM . - } - } - `; - const supergraph = { - 'did:root': [ - [{ Iri: 'did:b' }, { Iri: MAYCLAIM }, { Iri: ANYCLAIM }], - ], - 'did:b': [ - [{ Iri: 'did:b' }, { Iri: ATTESTS }, { Iri: 'b:attestations' }], - // this tests blank node hygiene by using the same blank node name in separate documents - [{ Iri: 'did:b' }, { Iri: KNOWS }, { Blank: '_:b0' }], - ], - 'b:attestations': [ - [{ Iri: 'did:c' }, { Iri: MAYCLAIM }, { Iri: ANYCLAIM }], - [{ Iri: 'did:b' }, { Iri: LIKES }, { Blank: '_:b0' }], - [ - { Blank: '_:b0' }, - { Iri: IDENT }, - { - Literal: { - value: '978-0-06-245871-1', - datatype: 'https://www.w3.org/2001/XMLSchema#string', - }, - }, - ], - ], - // did:c makes no attestations - }; - const resolveGraph = graphResolver(supergraph); - - const initialFacts = await resolveGraph({ Iri: 'did:root' }); - const allFacts = await crawl(initialFacts, RULES, CURIOSITY, resolveGraph, newEngine()); - expect(allFacts).toEqual( - [ - [ - { Iri: 'did:b' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: 'b:attestations' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://xmlns.com/foaf/0.1/knows' }, - { Blank: '_:b0' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'b:attestations' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://xmlns.com/foaf/0.1/knows' }, - { Blank: '_:b0' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'https://rdf.dock.io/alpha/2021#attestsDocumentContents' }, - { Iri: 'b:attestations' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'b:attestations' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'b:attestations' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Blank: '_:b1' }, - { Iri: 'b:attestations' }, - ], - [ - { Blank: '_:b1' }, - { Iri: 'http://purl.org/dc/terms/identifier' }, - { - Literal: { - value: '978-0-06-245871-1', - datatype: 'https://www.w3.org/2001/XMLSchema#string', - }, - }, - { Iri: 'b:attestations' }, - ], - [ - { Blank: '_:b1' }, - { Iri: 'http://purl.org/dc/terms/identifier' }, - { - Literal: { - datatype: 'https://www.w3.org/2001/XMLSchema#string', - value: '978-0-06-245871-1', - }, - }, - { Iri: 'did:b' }, - ], - [ - { Blank: '_:b1' }, - { Iri: 'http://purl.org/dc/terms/identifier' }, - { - Literal: { - datatype: 'https://www.w3.org/2001/XMLSchema#string', - value: '978-0-06-245871-1', - }, - }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Blank: '_:b1' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:b' }, - { Iri: 'http://purl.org/spar/cito/likes' }, - { Blank: '_:b1' }, - { Iri: 'did:root' }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:b' }, - ], - [ - { Iri: 'did:c' }, - { Iri: 'https://rdf.dock.io/alpha/2021#mayClaim' }, - { Iri: 'https://rdf.dock.io/alpha/2021#ANYCLAIM' }, - { Iri: 'did:root' }, - ], - ], - ); - }, 10000); -}); - -function graphResolver(sg) { - async function resolveGraph(term) { - assertValidNode(term); - if (!('Iri' in term)) { - return []; - } - const iri = term.Iri; - if (!(iri in sg)) { - // Some users may wish to customize what happens when a lookup fails - // for example they may want to log an error, that is up to them. - // Here we just return the empty graph. - return []; - } - return sg[iri].map((triple) => [triple[0], triple[1], triple[2], { Iri: iri }]); - } - - return resolveGraph; -} diff --git a/tests/unit/did.test.js b/tests/unit/did.test.js deleted file mode 100644 index 740d97b35..000000000 --- a/tests/unit/did.test.js +++ /dev/null @@ -1,177 +0,0 @@ -import { randomAsHex, encodeAddress } from '@polkadot/util-crypto'; - -import { - validateDockDIDHexIdentifier, - validateDockDIDSS58Identifier, - DockDIDQualifier, - DockDIDByteSize, - DidMethodKeyQualifier, - DockDidOrDidMethodKey, - DockDid, - DidMethodKey, -} from '../../src/did'; -import { getHexIdentifier } from '../../src/utils/codec'; - -const hexDid = (did) => getHexIdentifier( - did, - [DockDIDQualifier, DidMethodKeyQualifier], - DockDIDByteSize, -); - -describe('`DockDidOrDidMethodKey.from`', () => { - test('`DockDid.from` work for a raw did', () => { - const result = DockDid.from( - '5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk', - ); - expect(result.did).toEqual( - '0x338afad72761cffcd0619b8e00fe64a32f79463143e0e812a76b1030c593bb4e', - ); - - expect(() => DockDidOrDidMethodKey.from( - '5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk', - )).toThrowErrorMatchingSnapshot(); - }); - - test('`DidMethodKey.from` work for a raw did:key', () => { - const result = DidMethodKey.from( - 'zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme', - ); - expect(result.didMethodKey.secp256k1).toEqual( - '0x03874c15c7fda20e539c6e5ba573c139884c351188799f5458b4b41f7924f235cd', - ); - expect(result.toString()).toEqual( - 'did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme', - ); - - expect(() => DockDidOrDidMethodKey.from( - 'zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme', - )).toThrowErrorMatchingSnapshot(); - }); - - test('`DockDidOrDidMethodKey.from`/`DockDid.from` work for did:dock', () => { - const classes = [DockDidOrDidMethodKey, DockDid]; - - for (const Did of classes) { - const result = Did.from( - 'did:dock:5DEHasvC9G3eVF3qCsN2VQvEbHYdQtsv74ozZ1ngQQj39Luk', - ); - expect(result.did).toEqual( - '0x338afad72761cffcd0619b8e00fe64a32f79463143e0e812a76b1030c593bb4e', - ); - } - }); - - test('`DockDidOrDidMethodKey.from`/`DidMethodKey.from` works for did:key secp256k1', () => { - const classes = [DockDidOrDidMethodKey, DidMethodKey]; - - for (const Did of classes) { - const result = Did.from( - 'did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme', - ); - expect(result.didMethodKey.secp256k1).toEqual( - '0x03874c15c7fda20e539c6e5ba573c139884c351188799f5458b4b41f7924f235cd', - ); - expect(result.toString()).toEqual( - 'did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme', - ); - } - }); - - test('`DockDidOrDidMethodKey.from`/`DidMethodKey.from` works for did:key ed25519', () => { - const classes = [DockDidOrDidMethodKey, DidMethodKey]; - - for (const Did of classes) { - const result = Did.from( - 'did:key:z6MktvqCyLxTsXUH1tUZncNdVeEZ7hNh7npPRbUU27GTrYb8', - ); - expect(result.didMethodKey.ed25519).toEqual( - '0xd713cb7f8624d8648496e01010f2bd72f0dcbbdecdb7036f38c20475f5f429bf', - ); - expect(result.toString()).toEqual( - 'did:key:z6MktvqCyLxTsXUH1tUZncNdVeEZ7hNh7npPRbUU27GTrYb8', - ); - } - }); -}); - -describe('DID utilities', () => { - test('On input as 40 byte hex, validateDockDIDIdentifier throws error', () => { - expect(() => validateDockDIDHexIdentifier(randomAsHex(40))).toThrow( - /DID identifier must be 32 bytes/, - ); - }); - - test('On input as 30 byte hex, validateDockDIDIdentifier throws error', () => { - expect(() => validateDockDIDHexIdentifier(randomAsHex(30))).toThrow( - /DID identifier must be 32 bytes/, - ); - }); - - test('On input as 32 byte hex, validateDockDIDIdentifier does not throw error', () => { - expect(() => validateDockDIDHexIdentifier(randomAsHex(32))).not.toThrow(); - }); - - test('On input as 33 byte hex, hexDid throws error', () => { - const hex = randomAsHex(33); - expect(() => hexDid(hex)).toThrow(/Invalid hex/); - }); - - test('On input as 32 byte hex, hexDid returns the input', () => { - const hex = randomAsHex(32); - expect(hexDid(hex)).toBe(hex); - }); - - test('On input valid SS58 but without qualifier, hexDid throws error', () => { - const hex = randomAsHex(32); - const id = encodeAddress(hex); - // Without the qualifier, the function tries to parse as hex - expect(() => hexDid(id)).toThrow(/Invalid hex/); - }); - - test('On input invalid SS58 but with qualifier, hexDid throws error', () => { - const did = `${DockDIDQualifier}oO12`; - // Without the qualifier, the function tries to parse as hex - expect(() => hexDid(did)).toThrow(/Invalid SS58/); - }); - - test('On input fully qualified Dock DID, hexDid returns valid hex representation', () => { - // create a valid DID - const hex = randomAsHex(32); - const did = `${DockDIDQualifier}${encodeAddress(hex)}`; - expect(hexDid(did)).toBe(hex); - }); - - test('On input valid SS58 and with qualifier but smaller than 32 bytes, hexDid throws error', () => { - const hex = randomAsHex(8); - const did = `${DockDIDQualifier}${encodeAddress(hex)}`; - // Without the qualifier, the function tries to parse as hex - expect(() => hexDid(did)).toThrow(/Invalid SS58/); - }); - - test('On input valid SS58 and with qualifier but larger than 32 bytes, hexDid throws error', () => { - const ss58 = encodeAddress(randomAsHex(32)); - const did = `${DockDIDQualifier}${ss58}${ss58}`; - // Without the qualifier, the function tries to parse as hex - expect(() => hexDid(did)).toThrow(/Invalid SS58/); - }); - - test('On input valid SS58 identifier but smaller than 32 bytes, validateDockDIDSS58Identifier throws error', () => { - const ss58 = encodeAddress(randomAsHex(8)); - expect(() => validateDockDIDSS58Identifier(ss58)).toThrow( - /The identifier must be 32 bytes and valid SS58 string/, - ); - }); - - test('On input valid SS58 identifier but larger than 32 bytes, validateDockDIDSS58Identifier throws error', () => { - const ss58 = encodeAddress(randomAsHex(32)); - const did = `${ss58}${ss58}`; - expect(() => validateDockDIDSS58Identifier(did)).toThrow( - /The identifier must be 32 bytes and valid SS58 string/, - ); - }); - - test('On input valid SS58 identifier, validateDockDIDSS58Identifier does not throw error', () => { - const ss58 = encodeAddress(randomAsHex(32)); - expect(() => validateDockDIDSS58Identifier(ss58)).not.toThrow(); - }); -}); diff --git a/tests/unit/issuing.test.js b/tests/unit/issuing.test.js deleted file mode 100644 index 1d4e93a62..000000000 --- a/tests/unit/issuing.test.js +++ /dev/null @@ -1,469 +0,0 @@ -// Mock fetch -import mockFetch from '../mocks/fetch'; - -import { - issueCredential, - verifyCredential, - verifyPresentation, - signPresentation, -} from '../../src/utils/vc/index'; -import VerifiableCredential from '../../src/verifiable-credential'; -import VerifiablePresentation from '../../src/verifiable-presentation'; -import testingKeys from '../test-keys'; - -mockFetch(); - -// Test constants -const issuanceDate = '2020-04-15T09:05:35Z'; - -const vpId = 'https://example.com/credentials/12345'; -const vpHolder = 'https://example.com/credentials/1234567890'; -const sampleId = 'http://example.edu/credentials/2803'; -const fakeContext = { - '@context': { - '@protected': true, - id: '@id', - type: '@type', - }, -}; - -function getSampleCredential() { - return { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential', 'AlumniCredential'], - issuanceDate, - credentialSubject: { - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }, - }; -} - -function getSamplePres(presentationCredentials) { - return { - '@context': ['https://www.w3.org/2018/credentials/v1'], - type: ['VerifiablePresentation'], - verifiableCredential: presentationCredentials, - id: vpId, - holder: vpHolder, - }; -} - -testingKeys.forEach((testKey) => { - const { sigType, keyDocument } = testKey; - const keyUrl = keyDocument.id; - const controllerUrl = keyDocument.controller; - - describe(`Verifiable Credential Issuing [${keyDocument.type}]`, () => { - test('Issuing should return an object with a proof, and it must pass validation.', async () => { - const credential = await issueCredential(testKey.keyDocument, getSampleCredential()); - expect(credential.id).toBe('https://example.com/credentials/1872'); - expect(credential.type).toContain('VerifiableCredential'); - expect(credential.type).toContain('AlumniCredential'); - expect(credential.issuanceDate).toBe(issuanceDate); - expect(credential.credentialSubject.id).toBe('did:example:ebfeb1f712ebc6f1c276e12ec21'); - expect(credential.credentialSubject.alumniOf).toBe('Example University'); - expect(credential.issuer).toBe(controllerUrl); - expect(credential.proof.type).toBe(sigType); - expect(credential.proof.created).toBeDefined(); - expect(credential.proof.proofPurpose).toBe('assertionMethod'); - expect(credential.proof.verificationMethod).toBe(keyUrl); - - const result = await verifyCredential(credential); - expect(result.verified).toBe(true); - expect(result.results[0].proof).toBeDefined(); - expect(result.results[0].proof.proofPurpose).toBe('assertionMethod'); - expect(result.results[0].proof.type).toBe(sigType); - expect(result.results[0].proof.verificationMethod).toBe(keyUrl); - expect(result.results[0].verified).toBe(true); - }, 30000); - - // JsonWebKey signatures cant use proofValue - if (keyDocument.type !== 'JsonWebKey2020') { - test('Issuing should return an object with a proof, and it must pass validation (using proofValue).', async () => { - const credential = await issueCredential(testKey.keyDocument, getSampleCredential(), true, null, null, null, null, false, 'proofValue'); - expect(credential.proof.proofValue).toBeDefined(); - const result = await verifyCredential(credential); - expect(result.verified).toBe(true); - }, 30000); - } - - test('Issuing should return a valid JWT, and it must pass validation', async () => { - const credential = await issueCredential(testKey.keyDocument, getSampleCredential(), true, null, null, null, null, false, 'jwt'); - expect(typeof credential).toEqual('string'); - const result = await verifyCredential(credential); - expect(result.verified).toBe(true); - }, 30000); - - test('Tampered Credential should not pass validation.', async () => { - const credential = await issueCredential(testKey.keyDocument, getSampleCredential()); - credential.issuanceDate = '9020-04-15T09:05:35Z'; - const result = await verifyCredential(credential); - expect(result.verified).toBe(false); - }, 30000); - - test('Expired Credential should not pass validation with verifyDates as true', async () => { - const credential = await issueCredential(testKey.keyDocument, { - ...getSampleCredential(), - expirationDate: new Date('2000-01-01T09:05:35Z').toISOString(), - }); - const result = await verifyCredential(credential); - expect(result.verified).toBe(false); - expect(result.error.message).toEqual('Credential has expired'); - }, 30000); - - test('Expired Credential should pass validation with verifyDates as false', async () => { - const credential = await issueCredential(testKey.keyDocument, { - ...getSampleCredential(), - expirationDate: new Date('2000-01-01T09:05:35Z').toISOString(), - }); - const result = await verifyCredential(credential, { verifyDates: false }); - expect(result.verified).toBe(true); - }, 30000); - - test('Credential With incorrect issuer should not pass validation.', async () => { - const keydoc = { ...testKey.keyDocument }; - keydoc.controller = 'did:rando:id'; - const credential = await issueCredential(keydoc, getSampleCredential()); - const result = await verifyCredential(credential); - expect(result.verified).toBe(false); - }, 30000); - }); - - describe(`Verifiable Presentation creation [${keyDocument.type}]`, () => { - let presentationCredentials; - beforeAll(async () => { - const sampleIssuedCredential = await issueCredential(testKey.keyDocument, getSampleCredential()); - presentationCredentials = [sampleIssuedCredential, sampleIssuedCredential]; - }); - - test('A verifiable presentation should contain a proof once signed, and it should pass verification.', async () => { - const signedVp = await signPresentation( - getSamplePres(presentationCredentials), - testKey.keyDocument, - 'some_challenge', - 'some_domain', - ); - - const results = await verifyPresentation( - signedVp, - { - challenge: 'some_challenge', - domain: 'some_domain', - }, - ); - - expect(results.verified).toBe(true); - expect(results.error).toBe(undefined); - expect(results.presentationResult.verified).toBe(true); - // expect(results.presentationResult.results[0].proof['@context']).toBe('https://w3id.org/security/v2'); - expect(results.presentationResult.results[0].proof.type).toBe(sigType); - expect(results.presentationResult.results[0].proof.challenge).toBe('some_challenge'); - expect(results.presentationResult.results[0].proof.domain).toBe('some_domain'); - expect(results.presentationResult.results[0].proof.proofPurpose).toBe('authentication'); - expect(results.presentationResult.results[0].proof.verificationMethod).toBe(keyUrl); - expect(results.presentationResult.results[0].verified).toBe(true); - expect(results.credentialResults[0].verified).toBe(true); - expect(results.credentialResults[0].results).toBeDefined(); - expect(results.credentialResults[1].verified).toBe(true); - expect(results.credentialResults[1].results).toBeDefined(); - }, 30000); - }); - - describe(`Verifiable Credential incremental creation [${keyDocument.type}]`, () => { - test('VC creation with only id should be possible, yet bring default values', async () => { - const credential = new VerifiableCredential(sampleId); - expect(credential.id).toBe(sampleId); - expect(credential.context).toEqual(['https://www.w3.org/2018/credentials/v1']); - expect(credential.type).toEqual(['VerifiableCredential']); - expect(credential.issuanceDate).toEqual(expect.anything()); - }); - - test('VC creation with an object context should be possible', async () => { - const credential = new VerifiableCredential(sampleId); - credential.addContext(fakeContext); - expect(credential.context).toEqual(['https://www.w3.org/2018/credentials/v1', fakeContext]); - }); - - test('JSON representation of a VC should bring the proper keys', async () => { - const credential = new VerifiableCredential(sampleId); - const credentialJSON = credential.toJSON(); - expect(credentialJSON['@context']).toContain('https://www.w3.org/2018/credentials/v1'); - expect(credentialJSON.id).toBe(sampleId); - expect(credentialJSON.credentialSubject).toEqual([]); - expect(credentialJSON.type).toEqual(['VerifiableCredential']); - expect(credentialJSON.issuanceDate).toBeDefined(); - }); - - test('Incremental VC creation should be possible', async () => { - const credential = new VerifiableCredential(sampleId); - expect(credential.id).toBe(sampleId); - - credential.addContext('https://www.w3.org/2018/credentials/examples/v1'); - expect(credential.context).toEqual([ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ]); - credential.addType('some_type'); - expect(credential.type).toEqual([ - 'VerifiableCredential', - 'some_type', - ]); - credential.addSubject({ id: 'some_subject_id' }); - expect(credential.credentialSubject).toEqual([{ id: 'some_subject_id' }]); - credential.setStatus({ id: 'some_status_id', type: 'CredentialStatusList2017' }); - expect(credential.status).toEqual({ id: 'some_status_id', type: 'CredentialStatusList2017' }); - credential.setIssuanceDate('2020-03-18T19:23:24Z'); - expect(credential.issuanceDate).toEqual('2020-03-18T19:23:24Z'); - credential.setExpirationDate('2021-03-18T19:23:24Z'); - expect(credential.expirationDate).toEqual('2021-03-18T19:23:24Z'); - }); - - test('Duplicates in context, types and subjects are omitted.', async () => { - const credential = new VerifiableCredential(sampleId); - - credential.addContext('https://www.w3.org/2018/credentials/examples/v1'); - expect(credential.context).toEqual([ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ]); - credential.addContext('https://www.w3.org/2018/credentials/examples/v1'); - expect(credential.context).toEqual([ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ]); - credential.addContext({ '@context': 'https://www.google.com' }); - expect(credential.context).toEqual([ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - { '@context': 'https://www.google.com' }, - ]); - credential.addContext({ '@context': 'https://www.google.com' }); - expect(credential.context).toEqual([ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - { '@context': 'https://www.google.com' }, - ]); - - credential.addType('some_type'); - expect(credential.type).toEqual([ - 'VerifiableCredential', - 'some_type', - ]); - credential.addType('some_type'); - expect(credential.type).toEqual([ - 'VerifiableCredential', - 'some_type', - ]); - - credential.addSubject({ - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }); - expect(credential.credentialSubject).toEqual([{ - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }]); - credential.addSubject({ - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }); - expect(credential.credentialSubject).toEqual([{ - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }]); - }); - - test('Incremental VC creations runs basic validation', async () => { - const credential = new VerifiableCredential(sampleId); - expect(() => { - credential.addContext(123); - }).toThrowError('needs to be a string.'); - - expect(() => { - credential.setStatus({ some: 'value', type: 'something' }); - }).toThrowError('"credentialStatus" must include the \'id\' property.'); - expect(() => { - credential.setStatus({ id: 'value', some: 'value' }); - }).toThrowError('"credentialStatus" must include a type.'); - - expect(() => { - credential.setIssuanceDate('2020'); - }).toThrowError('needs to be a valid datetime.'); - - expect(() => { - credential.setExpirationDate('2020'); - }).toThrowError('needs to be a valid datetime.'); - - await expect(credential.verify()).rejects.toThrowError('The current Verifiable Credential has no proof.'); - }); - - test('Issuing an incrementally-created VC should return an object with a proof, and it must pass validation.', async () => { - const unsignedCredential = new VerifiableCredential('https://example.com/credentials/1872'); - unsignedCredential.addContext('https://www.w3.org/2018/credentials/examples/v1'); - const signedCredential = await unsignedCredential.sign(testKey.keyDocument); - expect(signedCredential.proof).toBeDefined(); - const result = await signedCredential.verify(); - expect(result.verified).toBe(true); - expect(result.results[0].proof).toBeDefined(); - expect(result.results[0].verified).toBe(true); - }, 30000); - }); - - describe(`Verifiable Presentation incremental creation [${keyDocument.type}]`, () => { - let presentationCredentials; - beforeAll(async () => { - const sampleIssuedCredential = await issueCredential(testKey.keyDocument, getSampleCredential()); - presentationCredentials = [sampleIssuedCredential, sampleIssuedCredential]; - }); - - test('VP creation with only id should be possible, yet bring default values', async () => { - const vp = new VerifiablePresentation(sampleId); - expect(vp.id).toBe(sampleId); - expect(vp.context).toEqual(['https://www.w3.org/2018/credentials/v1']); - expect(vp.type).toEqual(['VerifiablePresentation']); - expect(vp.credentials).toEqual([]); - }); - - test('VP creation with an object context should be possible', async () => { - const vp = new VerifiablePresentation(sampleId); - vp.addContext(fakeContext); - expect(vp.context).toEqual(['https://www.w3.org/2018/credentials/v1', fakeContext]); - }); - - test('The JSON representation of a VP should bring the proper keys', async () => { - const vp = new VerifiablePresentation(sampleId); - const vpJSON = vp.toJSON(); - expect(vpJSON['@context']).toContain('https://www.w3.org/2018/credentials/v1'); - expect(vpJSON.id).toBe(sampleId); - expect(vpJSON.type).toEqual(['VerifiablePresentation']); - expect(vpJSON.verifiableCredential).toEqual([]); - }); - - test('Incremental VP creation should be possible', async () => { - const vp = new VerifiablePresentation(sampleId); - expect(vp.id).toBe(sampleId); - - vp.addContext('https://www.w3.org/2018/credentials/examples/v1'); - expect(vp.context).toEqual([ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ]); - vp.addType('some_type'); - expect(vp.type).toEqual([ - 'VerifiablePresentation', - 'some_type', - ]); - vp.addCredential({ id: 'some_credential_id' }); - expect(vp.credentials).toEqual([{ id: 'some_credential_id' }]); - }); - - test('Incremental VP creations runs basic validation', async () => { - const vp = new VerifiablePresentation(sampleId); - expect(() => { - vp.addContext(123); - }).toThrowError('needs to be a string.'); - expect(() => { - vp.addContext('123'); - }).toThrowError('needs to be a valid URI.'); - - expect(() => { - vp.addCredential({ some: 'value' }); - }).toThrowError('"credential" must include the \'id\' property.'); - - await expect(vp.verify({ - challenge: 'some_challenge', - domain: 'some_domain', - })).rejects.toThrowError('The current VerifiablePresentation has no proof.'); - }); - - test('Incremental VP creation from external VCs should be possible', async () => { - const vp = new VerifiablePresentation(vpId); - vp.addCredential(presentationCredentials[0]); - expect(vp.credentials).toEqual([presentationCredentials[0]]); - await vp.sign( - testKey.keyDocument, - 'some_challenge', - 'some_domain', - ); - expect(vp.proof).toMatchObject({ type: sigType }); - expect(vp.proof).toMatchObject({ created: expect.anything() }); - expect(vp.proof).toMatchObject({ challenge: 'some_challenge' }); - expect(vp.proof).toMatchObject({ domain: 'some_domain' }); - expect(vp.proof).toMatchObject({ jws: expect.anything() }); - expect(vp.proof).toMatchObject({ proofPurpose: 'authentication' }); - expect(vp.proof).toMatchObject({ verificationMethod: expect.anything() }); - - const results = await vp.verify({ - challenge: 'some_challenge', - domain: 'some_domain', - }); - - expect(results.presentationResult).toMatchObject({ verified: true }); - expect(results.presentationResult.results[0]).toMatchObject({ verified: true }); - expect(results.presentationResult.results[0]).toMatchObject({ proof: expect.anything() }); - expect(results.credentialResults[0]).toMatchObject({ verified: true }); - expect(results.credentialResults[0]).toMatchObject({ results: expect.anything() }); - }, 20000); - - test('Issuing an incrementally-created VP from an incrementally created VC should return an object with a proof, and it must pass validation.', async () => { - const vc = new VerifiableCredential('https://example.com/credentials/1872'); - vc.addContext('https://www.w3.org/2018/credentials/examples/v1'); - vc.addType('AlumniCredential'); - vc.addSubject({ - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }); - await vc.sign(testKey.keyDocument); - const vcVerificationResult = await vc.verify(); - expect(vcVerificationResult).toMatchObject({ verified: true }); - - const vp = new VerifiablePresentation(vpId); - vp.setHolder(vpHolder); - vp.addCredential(vc); - await vp.sign( - testKey.keyDocument, - 'some_challenge', - 'some_domain', - ); - expect(vp.proof).toMatchObject({ type: sigType }); - expect(vp.proof).toMatchObject({ created: expect.anything() }); - expect(vp.proof).toMatchObject({ challenge: 'some_challenge' }); - expect(vp.proof).toMatchObject({ domain: 'some_domain' }); - expect(vp.proof).toMatchObject({ jws: expect.anything() }); - expect(vp.proof).toMatchObject({ proofPurpose: 'authentication' }); - expect(vp.proof).toMatchObject({ verificationMethod: expect.anything() }); - - const results = await vp.verify({ - challenge: 'some_challenge', - domain: 'some_domain', - }); - expect(results.presentationResult).toMatchObject({ verified: true }); - expect(results.presentationResult.results[0]).toMatchObject({ verified: true }); - expect(results.presentationResult.results[0]).toMatchObject({ proof: expect.anything() }); - expect(results.credentialResults[0]).toMatchObject({ verified: true }); - expect(results.credentialResults[0]).toMatchObject({ results: expect.anything() }); - }, 30000); - - test('Support contexts without @context key', () => { - const credential = new VerifiableCredential(sampleId); - const context = { - name: 'http://schema.org/name', - image: { - '@id': 'http://schema.org/image', - '@type': '@id', - }, - homepage: { - '@id': 'http://schema.org/url', - '@type': '@id', - }, - }; - credential.setContext(context); - expect(credential.context).toEqual(context); - }); - }); -}); diff --git a/tests/unit/jwt-vc.test.js b/tests/unit/jwt-vc.test.js deleted file mode 100644 index 336139dfe..000000000 --- a/tests/unit/jwt-vc.test.js +++ /dev/null @@ -1,45 +0,0 @@ -// Mock fetch -import mockFetch from '../mocks/fetch'; - -import { - verifyCredential, - verifyPresentation, -} from '../../src/utils/vc/index'; -import DIDJWKResolver from '../../src/resolver/did/did-jwk-resolver'; - -mockFetch(); - -const SPHEREON_ID_JWT_CREDENTIAL = 'eyJraWQiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlV6STFOaUlzSW5WelpTSTZJbk5wWnlJc0ltdDBlU0k2SWtWRElpd2lZM0oySWpvaVVDMHlOVFlpTENKNElqb2lSRlZqTUVwMVNuRjFNbFV5U1dGNVN6TXlOMFJzVjE5b05VcHJPRzlqUmxSbVVsQktRVGxNTUVwQlVTSXNJbmtpT2lJd01qSlBWMk5IYmtvNFJFUmZkbmhGTFY5UldUSmhURUZQZUZSdVlUVjFabmRpWWpkMVNFRnhSM0YzSW4wIzAiLCJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc3BoZXJlb24tb3BlbnNvdXJjZS5naXRodWIuaW8vc3NpLW1vYmlsZS13YWxsZXQvY29udGV4dC9zcGhlcmVvbi13YWxsZXQtaWRlbnRpdHktdjEuanNvbmxkIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJTcGhlcmVvbldhbGxldElkZW50aXR5Q3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJmaXJzdE5hbWUiOiJUZXN0IiwibGFzdE5hbWUiOiJUZXN0IiwiZW1haWxBZGRyZXNzIjoidGVzdEB0ZXN0LmNvbSJ9fSwic3ViIjoiZGlkOmp3azpleUpoYkdjaU9pSkZVekkxTmlJc0luVnpaU0k2SW5OcFp5SXNJbXQwZVNJNklrVkRJaXdpWTNKMklqb2lVQzB5TlRZaUxDSjRJam9pUkZWak1FcDFTbkYxTWxVeVNXRjVTek15TjBSc1YxOW9OVXByT0c5alJsUm1VbEJLUVRsTU1FcEJVU0lzSW5raU9pSXdNakpQVjJOSGJrbzRSRVJmZG5oRkxWOVJXVEpoVEVGUGVGUnVZVFYxWm5kaVlqZDFTRUZ4UjNGM0luMCIsImp0aSI6InVybjp1dWlkOmNiOWUzYzZhLTZjOTYtNGFiYS1iNWY0LWFiM2RmMDM4Y2MyMiIsIm5iZiI6MTcyMjk3NDM5OSwiaXNzIjoiZGlkOmp3azpleUpoYkdjaU9pSkZVekkxTmlJc0luVnpaU0k2SW5OcFp5SXNJbXQwZVNJNklrVkRJaXdpWTNKMklqb2lVQzB5TlRZaUxDSjRJam9pUkZWak1FcDFTbkYxTWxVeVNXRjVTek15TjBSc1YxOW9OVXByT0c5alJsUm1VbEJLUVRsTU1FcEJVU0lzSW5raU9pSXdNakpQVjJOSGJrbzRSRVJmZG5oRkxWOVJXVEpoVEVGUGVGUnVZVFYxWm5kaVlqZDFTRUZ4UjNGM0luMCJ9.Y9CBYHA_sgfA_V40i69SYrqsAK1OZ6rUW8NlrZwavbPxcVS_LX3tFvRRU0jkslUbuf7rColxf2f8zo-YMan-_w'; - -// Test constants -const vpId = 'https://example.com/credentials/12345'; -const vpHolder = 'https://example.com/credentials/1234567890'; - -function getSamplePres(presentationCredentials) { - return { - '@context': ['https://www.w3.org/2018/credentials/v1'], - type: ['VerifiablePresentation'], - verifiableCredential: presentationCredentials, - id: vpId, - holder: vpHolder, - }; -} - -describe('Static JWT-VC verification', () => { - const resolver = new DIDJWKResolver(); - - test('Sphereon ID credential', async () => { - const result = await verifyCredential(SPHEREON_ID_JWT_CREDENTIAL, { - resolver, - }); - expect(result.verified).toBe(true); - }); - - test('Sphereon ID credential in presentation', async () => { - const result = await verifyPresentation(getSamplePres([SPHEREON_ID_JWT_CREDENTIAL]), { - resolver, - unsignedPresentation: true, - }); - expect(result.verified).toBe(true); - }); -}); diff --git a/tests/unit/logic.test.js b/tests/unit/logic.test.js deleted file mode 100644 index 6a338c67d..000000000 --- a/tests/unit/logic.test.js +++ /dev/null @@ -1,129 +0,0 @@ -import jsonld from 'jsonld'; -import { randomAsHex } from '@polkadot/util-crypto'; -import { presentationToEEClaimGraph, proveh } from '../../src/utils/cd'; -import { documentLoader } from '../cached-document-loader.js'; -import { - ANYCLAIM, MAYCLAIM, MAYCLAIM_DEF_1, MAYCLAIM_DEF_2, -} from '../../src/rdf-defs'; - -const COOLNESS = 'https://example.com/coolnessLevel'; - -describe('logic', () => { - test('delegation chain', async () => { - const cred = { - '@context': 'https://www.w3.org/2018/credentials/v1', - type: 'VerifiableCredential', - issuer: 'did:example:c', - credentialSubject: { - id: 'did:example:d', - [COOLNESS]: 1, - }, - }; - - const del1 = { - '@context': 'https://www.w3.org/2018/credentials/v1', - type: 'VerifiableCredential', - issuer: 'did:example:a', - credentialSubject: { - id: 'did:example:b', - [MAYCLAIM]: { '@id': ANYCLAIM }, - }, - }; - - const del2 = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ], - type: 'VerifiableCredential', - issuer: 'did:example:b', - credentialSubject: { - id: 'did:example:c', - [MAYCLAIM]: { '@id': ANYCLAIM }, - }, - }; - - const to_prove = [[ - { Iri: 'did:example:d' }, - { Iri: COOLNESS }, - { Literal: { datatype: 'http://www.w3.org/2001/XMLSchema#integer', value: '1' } }, - { DefaultGraph: true }, - ]]; - - // Manually grant 'did:example:a' authority to make claims. This makes 'did:example:a' a root authority. - const assumed = [[ - { Iri: 'did:example:a' }, - { Iri: MAYCLAIM }, - { Iri: ANYCLAIM }, - { DefaultGraph: true }, - ]]; - - let cg; - - // happy path - cg = cat(await asCg([cred, del1, del2]), assumed); - proveh(cg, to_prove, MAYCLAIM_DEF_1); - proveh(cg, to_prove, MAYCLAIM_DEF_2); - - // the assumption assigning a root authority is not included in the claimgraph - cg = await asCg([cred, del1, del2]); - assert_error( - () => proveh(cg, to_prove, MAYCLAIM_DEF_1), - { CantProve: 'NovelName' }, - ); - assert_error( - () => proveh(cg, to_prove, MAYCLAIM_DEF_2), - { CantProve: 'ExhaustedSearchSpace' }, - ); - - // a link in the delegation chain is broken - cg = cat(await asCg([cred, del1]), assumed); - assert_error( - () => proveh(cg, to_prove, MAYCLAIM_DEF_1), - { CantProve: 'ExhaustedSearchSpace' }, - ); - assert_error( - () => proveh(cg, to_prove, MAYCLAIM_DEF_2), - { CantProve: 'ExhaustedSearchSpace' }, - ); - }); -}); - -// bundle a list of creds into a presentation -// return the bundle as a claimgraph as if the presentation were verified -async function asCg(creds) { - const exp = await expand(present(creds)); - return presentationToEEClaimGraph(exp); -} - -async function expand(jld) { - return jsonld.expand(jld, { documentLoader }); -} - -function assert_error(cb, expected_error) { - try { - cb(); - } catch (err) { - expect(err).toEqual(expected_error); - } -} - -function present(creds) { - return { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - ], - '@type': ['VerifiablePresentation'], - id: `urn:${randomAsHex(16)}`, - holder: `urn:${randomAsHex(16)}`, - verifiableCredential: creds, - }; -} - -function cat(...arrays) { - let ret = []; - for (const array of arrays) { - ret = ret.concat(array); - } - return ret; -} diff --git a/tests/unit/presigned-validation.test.js b/tests/unit/presigned-validation.test.js deleted file mode 100644 index b78c31818..000000000 --- a/tests/unit/presigned-validation.test.js +++ /dev/null @@ -1,42 +0,0 @@ -// Mock fetch -import mockFetch from '../mocks/fetch'; - -import { - verifyCredential, -} from '../../src/utils/vc/index'; - -mockFetch(); - -const controllerUrl = 'https://gist.githubusercontent.com/lovesh/312d407e3a16be0e7d5e43169e824958/raw'; -const keyUrl = 'https://gist.githubusercontent.com/lovesh/67bdfd354cfaf4fb853df4d6713f4610/raw'; - -function getSamplePresignedCredential() { - return { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://www.w3.org/2018/credentials/examples/v1', - ], - id: 'https://example.com/credentials/1872', - type: ['VerifiableCredential', 'AlumniCredential'], - issuanceDate: '2020-04-15T09:05:35Z', - credentialSubject: { - id: 'did:example:ebfeb1f712ebc6f1c276e12ec21', - alumniOf: 'Example University', - }, - issuer: controllerUrl, - proof: { - type: 'EcdsaSecp256k1Signature2019', - created: '2021-11-24T21:47:28Z', - proofValue: 'zAN1rKvtBajWcQS61LU4wX8hB4tUNFze44pHKwkVYoZaGMRxXquAaKcnUiwarZyWmMQzB4ttFLCEFXQq6F9dnq5pWJSC1WZgga', - proofPurpose: 'assertionMethod', - verificationMethod: keyUrl, - }, - }; -} - -describe('Static pre-signed credential validation', () => { - test('Presigned credential should verify', async () => { - const results = await verifyCredential(getSamplePresignedCredential()); - expect(results.verified).toBe(true); - }); -}); diff --git a/tests/unit/resolvers.test.js b/tests/unit/resolvers.test.js deleted file mode 100644 index eda982dd7..000000000 --- a/tests/unit/resolvers.test.js +++ /dev/null @@ -1,209 +0,0 @@ -import { MultiResolver, WILDCARD, createResolver } from '../../src/resolver'; - -class APrefixBMethodFull extends MultiResolver { - static PREFIX = 'a'; - static METHOD = 'b'; - - async resolve(id) { - return this.supports(id) ? `ab-full-${id}` : null; - } -} - -class CPrefixDMethodFull extends MultiResolver { - static PREFIX = 'c'; - static METHOD = 'd'; - - async resolve(id) { - return this.supports(id) ? `cd-full-${id}` : null; - } -} - -class BMethod extends MultiResolver { - static METHOD = 'b'; -} - -class APrefix extends MultiResolver { - static PREFIX = 'a'; -} - -class APrefixBMethod extends APrefix { - static METHOD = 'b'; -} - -class APrefixBMethodFullExtended extends APrefixBMethod { - async resolve(id) { - return this.supports(id) ? `ab-extended-${id}` : null; - } -} - -class APrefixCDMethod extends MultiResolver { - static PREFIX = 'a'; - static METHOD = ['c', 'd']; - - async resolve(id) { - return this.supports(id) ? `a-cd-${id}` : null; - } -} - -class APrefixWildcardMethodFull extends MultiResolver { - static PREFIX = 'a'; - static METHOD = WILDCARD; - - async resolve(id) { - return this.supports(id) ? `a-wildcard-${id}` : null; - } -} - -class WildcardPrefixBMethodFull extends MultiResolver { - static PREFIX = WILDCARD; - static METHOD = 'b'; - - async resolve(id) { - return this.supports(id) ? `wildcard-b-${id}` : null; - } -} - -class WildcardPrefixAndMethod extends MultiResolver { - static PREFIX = WILDCARD; - static METHOD = WILDCARD; -} - -class WildcardPrefixAndMethodFull extends WildcardPrefixAndMethod { - async resolve(id) { - return this.supports(id) ? `wildcard-wildcard-${id}` : null; - } -} - -describe('Resolvers', () => { - it('checks `MultiResolver`', async () => { - expect(() => new MultiResolver()).toThrowError( - "Static property `PREFIX` of `MultiResolver` isn't extended properly", - ); - expect(() => new BMethod()).toThrowError( - "Static property `PREFIX` of `BMethod` isn't extended properly", - ); - expect(() => new APrefixBMethod()).toThrowError( - 'No resolvers were provided. You need to either implement `resolve` or provide a list of resolvers', - ); - expect(() => new APrefix()).toThrowError( - "Static property `METHOD` of `APrefix` isn't extended properly", - ); - expect(() => new MultiResolver([new APrefixBMethodFull()])).toThrowError( - "Static property `PREFIX` of `MultiResolver` isn't extended properly", - ); - expect( - () => new APrefixBMethod([new APrefixBMethodFull(), new APrefixBMethodFull()]), - ).toThrowError( - 'Two resolvers for the same prefix and method - `a:b:`: `APrefixBMethodFull` and `APrefixBMethodFull`', - ); - expect(await new APrefixBMethodFull().resolve('a:b:123')).toBe( - 'ab-full-a:b:123', - ); - expect(new APrefixBMethodFull().supports('a:b:123')).toBe(true); - expect(new APrefixBMethodFull().supports('a:c:123')).toBe(false); - expect(new APrefixBMethodFull().supports('c:b:123')).toBe(false); - expect(new APrefixBMethodFull().supports('a:b:123')).toBe(true); - expect(new APrefixBMethodFull().supports('a:c:123')).toBe(false); - expect(new APrefixBMethodFull().supports('c:b:123')).toBe(false); - - expect(await new APrefixBMethodFullExtended().resolve('a:b:456')).toBe( - 'ab-extended-a:b:456', - ); - expect( - await new APrefixBMethod([new APrefixBMethodFull()]).resolve('a:b:456'), - ).toBe('ab-full-a:b:456'); - expect( - await new APrefixBMethod([new APrefixBMethodFullExtended()]).resolve( - 'a:b:456', - ), - ).toBe('ab-extended-a:b:456'); - - const wildcard = new WildcardPrefixAndMethod([ - new APrefixBMethodFull(), - new CPrefixDMethodFull(), - new APrefixWildcardMethodFull(), - new WildcardPrefixBMethodFull(), - new WildcardPrefixAndMethodFull(), - ]); - - expect(await wildcard.resolve('a:b:')).toBe('ab-full-a:b:'); - expect(await wildcard.resolve('a:asdasdas:')).toBe( - 'a-wildcard-a:asdasdas:', - ); - expect(await wildcard.resolve('asdasdasd:b:')).toBe( - 'wildcard-b-asdasdasd:b:', - ); - expect(await wildcard.resolve('c:d:')).toBe('cd-full-c:d:'); - expect(await wildcard.resolve('asdasdasd:asdasdasd:')).toBe( - 'wildcard-wildcard-asdasdasd:asdasdasd:', - ); - - const nestedWildcard = new WildcardPrefixAndMethod([ - new APrefixBMethodFullExtended(), - new WildcardPrefixAndMethod([wildcard]), - ]); - expect(await nestedWildcard.resolve('a:b:')).toBe('ab-extended-a:b:'); - expect(await nestedWildcard.resolve('c:d:')).toBe('cd-full-c:d:'); - expect(await wildcard.resolve('a:asdasdas:')).toBe( - 'a-wildcard-a:asdasdas:', - ); - expect(await nestedWildcard.resolve('asdasdasd:asdasdasd:')).toBe( - 'wildcard-wildcard-asdasdasd:asdasdasd:', - ); - - const abTop = new APrefixBMethodFullExtended(); - const ab = new APrefixBMethodFull(); - const cd = new CPrefixDMethodFull(); - const acdTop = new APrefixCDMethod(); - const awildcard = new APrefixWildcardMethodFull(); - const widlcardb = new WildcardPrefixBMethodFull(); - - const discreteWrappedInWildcard = new WildcardPrefixAndMethod([ - new WildcardPrefixAndMethod([ab, cd, awildcard, widlcardb]), - acdTop, - abTop, - ]); - - expect(discreteWrappedInWildcard.matchingResolver('a:b:')).toBe(abTop); - expect(discreteWrappedInWildcard.matchingResolver('c:d:').matchingResolver('c:d:')).toBe(cd); - expect(discreteWrappedInWildcard.matchingResolver('a:c:')).toBe(acdTop); - expect(discreteWrappedInWildcard.matchingResolver('a:d:')).toBe(acdTop); - expect(discreteWrappedInWildcard.matchingResolver('a:e:').matchingResolver('a:e:')).toBe(awildcard); - expect(discreteWrappedInWildcard.matchingResolver('c:f:')).toBe(null); - expect(discreteWrappedInWildcard.matchingResolver('x:b:').matchingResolver('x:b:')).toBe(widlcardb); - expect(discreteWrappedInWildcard.matchingResolver('e:a:')).toBe(null); - }); - - it('checks `createResolver`', async () => { - const resolve = async () => 1; - - expect(() => createResolver(new APrefixBMethodFull(), { prefix: 'c' })).toThrowError('Item not found in `[c]`: `a`'); - - expect(() => createResolver(new APrefixBMethodFull(), { method: 'c' })).toThrowError('Item not found in `[c]`: `b`'); - - const singleResolver = createResolver(resolve, { - prefix: 'abc', - method: 'cde', - }); - - expect(await singleResolver.resolve('abc:cde:1')).toBe(1); - expect(singleResolver.supports('abc:cde:1')).toBe(true); - expect(singleResolver.supports('abc:de:1')).toBe(false); - - const wildcardResolver = createResolver( - createResolver(resolve, { prefix: 'abc', method: 'cde' }), - ); - - expect(await wildcardResolver.resolve('abc:cde:1')).toBe(1); - expect(wildcardResolver.supports('abc:cde:1')).toBe(true); - expect(wildcardResolver.supports('abc:de:1')).toBe(true); - - const multiResolver = createResolver(resolve, { - prefix: ['abc'], - method: ['cde'], - }); - expect(await multiResolver.resolve('abc:cde:1')).toBe(1); - expect(multiResolver.supports('abc:cde:1')).toBe(true); - expect(multiResolver.supports('abc:de:1')).toBe(false); - }); -}); diff --git a/tests/unit/schema.test.js b/tests/unit/schema.test.js deleted file mode 100644 index 7ddf9bb07..000000000 --- a/tests/unit/schema.test.js +++ /dev/null @@ -1,158 +0,0 @@ -// Mock fetch -import { cryptoWaitReady } from '@polkadot/util-crypto'; - -import VerifiableCredential from '../../src/verifiable-credential'; -import Schema from '../../src/modules/schema'; -import { DockBlobQualifier } from '../../src/modules/blob'; - -import { - validateCredentialSchema, -} from '../../src/utils/vc/schema'; - -import exampleCredential from '../example-credential'; -import exampleSchema from '../example-schema'; - -describe('VerifiableCredential Tests', () => { - const vc = new VerifiableCredential(exampleCredential.id); - vc.addSubject(exampleCredential.credentialSubject); - vc.setContext(exampleCredential['@context']); - - test('VerifiableCredential\'s setSchema should appropriately set credentialSchema.', () => { - vc.setSchema(exampleCredential.credentialSchema.id, exampleCredential.credentialSchema.type); - expect(vc.credentialSchema).toMatchObject( - expect.objectContaining({ - id: expect.anything(), - type: expect.anything(), - }), - ); - }); - - test('VerifiableCredential\'s validateSchema should validate the credentialSubject with given JSON schema.', async () => { - const result = await vc.validateSchema(exampleSchema); - expect(result).toBe(true); - }, 20000); -}); - -describe('Basic Schema Tests', () => { - let schema; - beforeAll(async () => { - await cryptoWaitReady(); - schema = new Schema(); - }, 10000); - - test('accepts the id optionally and generates id of correct size when id is not given', () => { - const schemaNoID = new Schema(); - const encodedIDByteSize = 48; - expect(schemaNoID.id && schemaNoID.id.length).toBe(encodedIDByteSize + DockBlobQualifier.length); - }); - - test('setJSONSchema will only accept valid JSON schema and set the schema key of the object.', async () => { - await expect(schema.setJSONSchema({ - invalidSchema: true, - })).rejects.toThrow(); - - await schema.setJSONSchema(exampleSchema); - expect(schema.schema).toBe(exampleSchema); - }); - - test('validateSchema will check that the given schema is a valid JSON-schema.', async () => { - await expect(Schema.validateSchema(exampleSchema)).resolves.toBeDefined(); - }); - - test('toJSON will generate a JSON that can be sent to chain.', () => { - const result = schema.toJSON(); - expect(result).toMatchObject( - expect.objectContaining({ - id: expect.anything(), - schema: expect.anything(), - }), - ); - }); - - test('toBlob will generate a JSON that can be sent to written with blob module', () => { - const result = schema.toBlob(); - expect(result).toMatchObject( - expect.objectContaining({ - id: expect.anything(), - blob: expect.anything(), - }), - ); - }); -}); - -describe('Validate Credential Schema utility', () => { - const schema = new Schema(); - schema.setJSONSchema(exampleSchema); - - test('credentialSubject has same fields and fields have same types as JSON-schema', () => { - expect(validateCredentialSchema(exampleCredential, schema, exampleCredential['@context'])).toBe(true); - }); - - test('credentialSubject has same fields but fields have different type than JSON-schema', async () => { - expect(() => validateCredentialSchema({ - credentialSubject: { - emailAddress: true, - }, - }, schema, exampleCredential['@context'])).toThrow(); - }, 100000); - - test('credentialSubject is missing required fields from the JSON-schema and it should fail to validate.', async () => { - const credentialSubject = { ...exampleCredential.credentialSubject }; - delete credentialSubject.alumniOf; - expect(() => validateCredentialSchema({ - credentialSubject, - }, schema, exampleCredential['@context'])).toThrow(); - }, 100000); - - test('The schema\'s properties is missing the required key and credentialSubject can omit some of the properties.', async () => { - const nonRequiredSchema = { ...exampleSchema }; - delete nonRequiredSchema.required; - await schema.setJSONSchema(nonRequiredSchema); - - const credentialSubject = { ...exampleCredential.credentialSubject }; - delete credentialSubject.alumniOf; - - expect(validateCredentialSchema({ - credentialSubject, - }, schema, exampleCredential['@context'])).toBe(true); - }); - - test('credentialSubject has extra fields than given schema specifies and additionalProperties has certain type.', async () => { - const credentialSubject = { ...exampleCredential.credentialSubject, additionalString: 'mystring' }; - await schema.setJSONSchema({ - ...exampleSchema, - additionalProperties: { type: 'string' }, - }); - - expect(validateCredentialSchema({ - credentialSubject, - }, schema, exampleCredential['@context'])).toBe(true); - }); - - test('credentialSubject has nested fields and given schema specifies the nested structure.', async () => { - const credentialSubject = { - ...exampleCredential.credentialSubject, - nestedFields: { - test: true, - }, - }; - - await schema.setJSONSchema({ - ...exampleSchema, - properties: { - ...exampleSchema.properties, - nestedFields: { - properties: { - test: { - type: 'boolean', - }, - }, - }, - }, - }); - - expect(validateCredentialSchema({ - credentialSubject, - }, schema, exampleCredential['@context'])).toBe(true); - }); -}); diff --git a/tests/unit/serialize.test.js b/tests/unit/serialize.test.js deleted file mode 100644 index 640e581e8..000000000 --- a/tests/unit/serialize.test.js +++ /dev/null @@ -1,82 +0,0 @@ -import VerifiableCredential from '../../src/verifiable-credential'; -import VerifiablePresentation from '../../src/verifiable-presentation'; -import Schema from '../../src/modules/schema'; - -import exampleCredential from '../example-credential'; - -describe('Serialization', () => { - test('VerifiableCredential fromJSON should fail if no type is provided', () => { - expect(() => VerifiableCredential.fromJSON({ - ...exampleCredential, - type: undefined, - })).toThrow(); - }); - - test('VerifiableCredential fromJSON should fail if no context is provided', () => { - expect(() => VerifiableCredential.fromJSON({ - ...exampleCredential, - '@context': undefined, - })).toThrow(); - }); - - test('VerifiablePresentation fromJSON should fail if no type is provided', () => { - expect(() => VerifiablePresentation.fromJSON({ - '@context': 'https://www.w3.org/2018/credentials/v1', - type: undefined, - })).toThrow(); - }); - - test('VerifiablePresentation fromJSON should fail if no context is provided', () => { - expect(() => VerifiablePresentation.fromJSON({ - '@context': undefined, - })).toThrow(); - }); - - test('VerifiableCredential from/to JSON serialization', () => { - const vc = VerifiableCredential.fromJSON(exampleCredential); - const vcJson = vc.toJSON(); - expect(vcJson).toMatchObject(exampleCredential); - }); - - test('VerifiablePresentation from/to JSON serialization', () => { - const presentationId = 'http://example.edu/credentials/2803'; - const vp = new VerifiablePresentation(presentationId); - vp.addContext('https://www.w3.org/2018/credentials/examples/v1'); - vp.addType('some_type'); - - const vc = VerifiableCredential.fromJSON(exampleCredential); - vp.addCredential(vc); - - const vpJson = vp.toJSON(); - - const constructedVP = VerifiablePresentation.fromJSON(vpJson); - expect(vpJson).toMatchObject(constructedVP.toJSON()); - }); - - test('Schema from/to JSON serialization', async () => { - const schema = new Schema(); - await schema.setJSONSchema({ - $schema: 'http://json-schema.org/draft-07/schema#', - description: 'Dock Schema Example', - type: 'object', - properties: { - id: { - type: 'string', - }, - emailAddress: { - type: 'string', - format: 'email', - }, - alumniOf: { - type: 'string', - }, - }, - required: ['emailAddress', 'alumniOf'], - additionalProperties: false, - }); - - const shemaJSON = schema.toJSON(); - const constructedSchema = Schema.fromJSON(shemaJSON); - expect(shemaJSON).toMatchObject(constructedSchema.toJSON()); - }); -}); diff --git a/tests/unit/utils.test.js b/tests/unit/utils.test.js deleted file mode 100644 index 0ff064858..000000000 --- a/tests/unit/utils.test.js +++ /dev/null @@ -1,343 +0,0 @@ -import { cryptoWaitReady, randomAsHex } from '@polkadot/util-crypto'; -import { Keyring } from '@polkadot/api'; -import { initializeWasm } from '@docknetwork/crypto-wasm-ts'; - -import { - generateEcdsaSecp256k1Keypair, - getPublicKeyFromKeyringPair, - getSignatureFromKeyringPair, - verifyEcdsaSecp256k1Sig, -} from '../../src/utils/misc'; -import { ReusablePromiseMap, retry, timeout } from '../../src/utils/async'; -import { - PublicKeyEd25519, - PublicKeySr25519, - PublicKeySecp256k1, -} from '../../src/public-keys'; -import { - SignatureEd25519, - SignatureSr25519, - SignatureSecp256k1, -} from '../../src/signatures'; -import { isHexWithGivenByteSize } from '../../src/utils/codec'; -import { expandJSONLD } from '../../src/utils/vc'; -import { - getCredentialStatus, - isAccumulatorRevocationStatus, -} from '../../src/utils/revocation'; - -describe('Testing isHexWithGivenByteSize', () => { - test('isHexWithGivenByteSize rejects strings not starting with 0x', () => { - expect(isHexWithGivenByteSize('12')).toBe(false); - }); - - test('isHexWithGivenByteSize rejects strings with invalid hex', () => { - expect(isHexWithGivenByteSize('0x1h')).toBe(false); - }); - - test('isHexWithGivenByteSize rejects strings with non-full byte', () => { - expect(isHexWithGivenByteSize('0x123')).toBe(false); - }); - - test('isHexWithGivenByteSize rejects strings with byte size 0', () => { - expect(isHexWithGivenByteSize('0x')).toBe(false); - }); - - test('isHexWithGivenByteSize rejects strings not matching expected byte size', () => { - expect(isHexWithGivenByteSize('0x12', 2)).toBe(false); - expect(isHexWithGivenByteSize('0x1234', 1)).toBe(false); - expect(isHexWithGivenByteSize('0x1234', 0)).toBe(false); - }); - - test('isHexWithGivenByteSize accepts correct hex string with full bytes', () => { - expect(isHexWithGivenByteSize('0x12')).toBe(true); - expect(isHexWithGivenByteSize('0x1234')).toBe(true); - expect(isHexWithGivenByteSize('0x1234ef')).toBe(true); - }); - - test('isHexWithGivenByteSize accepts correct hex string matching expected byte size', () => { - expect(isHexWithGivenByteSize('0x12', 1)).toBe(true); - expect(isHexWithGivenByteSize('0x1234', 2)).toBe(true); - expect(isHexWithGivenByteSize('0x1234ef', 3)).toBe(true); - }); - - const crateElapsedTimeSec = () => { - const start = +new Date(); - - return (expected) => expect(Math.round((+new Date() - start) / 1e2) / 10).toBe(expected); - }; - - test('`timeout` works properly', async () => { - const expectElapsedTimeSec = crateElapsedTimeSec(); - - await Promise.all( - [ - async () => { - expect(await timeout(1e2)).toBe(void 0); - expectElapsedTimeSec(0.1); - }, - async () => { - expect(await timeout(3e2, () => 'a')).toBe('a'); - expectElapsedTimeSec(0.3); - }, - async () => { - await expect(() => timeout(2e2, () => { - throw new Error('Rejected timeout'); - })).rejects.toThrowErrorMatchingSnapshot(); - expectElapsedTimeSec(0.2); - }, - ].map((f) => f()), - ); - }); - - test('`ReusablePromiseMap` works properly', async () => { - const map = new ReusablePromiseMap(); - - const results = await Promise.all([ - map.callByKey(1, () => timeout(5e2, () => 10)), - timeout(2e2, () => map.callByKey(1, () => Promise.resolve(2))), - timeout(7e2, () => map.callByKey(1, () => Promise.resolve(1))), - ]); - - expect(results).toEqual([10, 10, 1]); - - await expect(() => map.callByKey(10, () => Promise.reject(1))).rejects; - expect(map.map.size).toBe(0); - }); - - test('`ReusablePromiseMap` capacity', async () => { - const map = new ReusablePromiseMap({ capacity: 2 }); - - const expectElapsedTimeSec = crateElapsedTimeSec(); - - let results = await Promise.all( - Array.from({ length: 10 }, (_, i) => map.callByKey(i, () => timeout(5e2, () => i))), - ); - - expect(results).toEqual(Array.from({ length: 10 }, (_, i) => i)); - expect(map.map.size).toBe(0); - expect(map.queue.length).toBe(0); - - expectElapsedTimeSec(2.5); - - const mapWithBoundQueue = new ReusablePromiseMap({ - capacity: 1, - queueCapacity: 3, - }); - - results = await Promise.all( - [ - () => mapWithBoundQueue.callByKey(1, () => timeout(5e2, () => 1)), - () => mapWithBoundQueue.callByKey(2, () => timeout(5e2, () => 2)), - () => mapWithBoundQueue.callByKey(3, () => timeout(5e2, () => 3)), - () => mapWithBoundQueue.callByKey(3, () => timeout(5e2, () => 4)), - () => expect(() => mapWithBoundQueue.callByKey(4, () => timeout(5e2, () => 5))).rejects.toThrowErrorMatchingSnapshot(), - ].map((f) => f()), - ); - - expect(results).toEqual([1, 2, 3, 4, undefined]); - }); - - test('`retry` works properly', async () => { - const makeCtrFn = (ctr, placeholder = new Promise((_) => {})) => async () => { - if (!ctr--) { - return 0; - } else { - return placeholder; - } - }; - const expectElapsedTimeSec = crateElapsedTimeSec(); - - await Promise.all( - [ - async () => { - const onTimeoutExceeded = jest.fn((retrySym) => retrySym); - - expect( - await retry(makeCtrFn(5), 3e2, { delay: 2e2, onTimeoutExceeded }), - ).toBe(0); - expectElapsedTimeSec(2.5); - - expect(onTimeoutExceeded).toBeCalledTimes(5); - }, - async () => { - expect(await retry(makeCtrFn(5), 3e2)).toBe(0); - expectElapsedTimeSec(1.5); - }, - async () => { - expect(await retry(makeCtrFn(0), 3e2)).toBe(0); - expectElapsedTimeSec(0); - }, - async () => { - await expect(() => retry(makeCtrFn(5), 3e2, { maxAttempts: 3 })).rejects.toThrowErrorMatchingSnapshot(); - expectElapsedTimeSec(1.2); - }, - async () => { - expect( - await retry(makeCtrFn(5), 3e2, { maxAttempts: 5, delay: 2e2 }), - ).toBe(0); - expectElapsedTimeSec(2.5); - }, - async () => { - await expect(() => retry(makeCtrFn(100), 1, { maxAttempts: 99 })).rejects.toThrowErrorMatchingSnapshot(); - expectElapsedTimeSec(0.1); - }, - async () => { - expect( - await retry(makeCtrFn(4, Promise.reject(1)), 3e2, { - onError: (_, next) => next, - }), - ).toBe(0); - expectElapsedTimeSec(0); - }, - async () => { - expect( - await retry(makeCtrFn(4, Promise.reject(1)), 3e2, { - onError: (error) => error, - }), - ).toBe(1); - expectElapsedTimeSec(0); - }, - async () => { - await expect(() => retry(makeCtrFn(4, Promise.reject(1)), 3e2, { - onError: () => { - throw new Error('From `onError` callback'); - }, - })).rejects.toThrowErrorMatchingSnapshot(); - expectElapsedTimeSec(0); - }, - ].map((f) => f()), - ); - }); -}); - -describe('Testing public key and signature instantiation from keyring', () => { - beforeAll(async () => { - await initializeWasm(); - await cryptoWaitReady(); - }); - - test('getCorrectPublicKeyFromKeyringPair returns correct public key from ed25519 pair', () => { - const keyring = new Keyring(); - const pair = keyring.addFromUri(randomAsHex(32), null, 'ed25519'); - const pk = getPublicKeyFromKeyringPair(pair); - expect(pk instanceof PublicKeyEd25519).toBe(true); - }); - - test('getCorrectPublicKeyFromKeyringPair returns correct public key from sr25519 pair', () => { - const keyring = new Keyring(); - const pair = keyring.addFromUri(randomAsHex(32), null, 'sr25519'); - const pk = getPublicKeyFromKeyringPair(pair); - expect(pk instanceof PublicKeySr25519).toBe(true); - }); - - test('getCorrectPublicKeyFromKeyringPair returns correct public key from secp256k1 pair', () => { - const pair = generateEcdsaSecp256k1Keypair(randomAsHex(32)); - const pk = getPublicKeyFromKeyringPair(pair); - expect(pk instanceof PublicKeySecp256k1).toBe(true); - }); - - test('getCorrectSignatureFromKeyringPair returns correct signature from ed25519 pair', () => { - const keyring = new Keyring(); - const pair = keyring.addFromUri(randomAsHex(32), null, 'ed25519'); - const sig = getSignatureFromKeyringPair(pair, [1, 2]); - expect(sig instanceof SignatureEd25519).toBe(true); - }); - - test('getCorrectSignatureFromKeyringPair returns correct signature from sr25519 pair', () => { - const keyring = new Keyring(); - const pair = keyring.addFromUri(randomAsHex(32), null, 'sr25519'); - const sig = getSignatureFromKeyringPair(pair, [1, 2]); - expect(sig instanceof SignatureSr25519).toBe(true); - }); - - test('getCorrectSignatureFromKeyringPair returns correct signature from secp256k1 pair', () => { - const pair = generateEcdsaSecp256k1Keypair(randomAsHex(32)); - const sig = getSignatureFromKeyringPair(pair, [1, 2]); - expect(sig instanceof SignatureSecp256k1).toBe(true); - }); -}); - -describe('Testing Ecdsa with secp256k1', () => { - test('Signing and verification works', () => { - const msg = [ - 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, - 2, 3, 4, 5, 6, 7, 8, - ]; - const entropy = '0x4c94485e0c21ae6c41ce1dfe7b6bfaceea5ab68e40a2476f50208e526f506080'; - const pair = generateEcdsaSecp256k1Keypair(entropy); - const pk = PublicKeySecp256k1.fromKeyringPair(pair); - const sig = SignatureSecp256k1.signWithKeyringPair(msg, pair); - expect(verifyEcdsaSecp256k1Sig(msg, sig, pk)).toBe(true); - - const msg1 = [ - 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, - 2, 3, 4, 5, 6, 7, 8, 9, - ]; - const sig1 = SignatureSecp256k1.signWithKeyringPair(msg1, pair); - expect(verifyEcdsaSecp256k1Sig(msg1, sig1, pk)).toBe(true); - expect(msg !== msg1).toBe(true); - expect(sig !== sig1).toBe(true); - - const msg2 = [ - 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, - 2, 3, 4, 5, 6, 7, - ]; - const sig2 = SignatureSecp256k1.signWithKeyringPair(msg2, pair); - expect(verifyEcdsaSecp256k1Sig(msg2, sig2, pk)).toBe(true); - expect(msg2 !== msg1).toBe(true); - expect(sig2 !== sig1).toBe(true); - }); -}); - -describe('Detecting accumulator status', () => { - test('works', async () => { - const credential = { - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - { - dk: 'https://ld.dock.io/credentials#', - PermanentResidentCard: 'dk:PermanentResidentCard', - PermanentResident: 'dk:PermanentResident', - Person: 'dk:Person', - givenName: 'dk:givenName', - familyName: 'dk:familyName', - lprNumber: 'dk:lprNumber', - name: 'http://schema.org/name', - description: 'http://schema.org/description', - }, - ], - credentialStatus: { - id: 'dock:accumulator:0x4e8ae3b33f1601844f31dd9d121adb0157bd609b04d3449d0fabe45bd057c93f', - type: 'DockVBAccumulator2022', - revocationCheck: 'membership', - revocationId: '4', - }, - id: 'http://localhost:3001/8c818a2fbf84bb14720ceea764af21a7023141b231b319e45f0753d57955ecf8', - type: ['VerifiableCredential', 'PermanentResidentCard'], - credentialSubject: { - id: 'did:dock:5GLu8vCdG2CUTpuq3f7TehjYbM3izoo64vovKgwbAdrv6Dq2', - type: ['PermanentResident', 'Person'], - givenName: 'JOHN', - familyName: 'SMITH', - lprNumber: 1234, - }, - issuer: 'did:dock:5GLu8vCdG2CUTpuq3f7TehjYbM3izoo64vovKgwbAdrv6Dq2', - name: 'Permanent Resident Card', - description: 'Government of Example Permanent Resident Card.', - }; - - let expandedCredential = await expandJSONLD(credential); - let status = getCredentialStatus(expandedCredential); - expect(isAccumulatorRevocationStatus(status)).toEqual(true); - - credential.credentialStatus = { - id: 'rev-reg:dock:0x0194', - type: 'CredentialStatusList2017', - }; - - expandedCredential = await expandJSONLD(credential); - status = getCredentialStatus(expandedCredential); - expect(isAccumulatorRevocationStatus(status)).toEqual(false); - }); -}); diff --git a/tests/unit/utils/type-helpers.test.js b/tests/unit/utils/type-helpers.test.js deleted file mode 100644 index 42431dbb2..000000000 --- a/tests/unit/utils/type-helpers.test.js +++ /dev/null @@ -1,15 +0,0 @@ -import { ensureValidDatetime } from '../../../src/utils/type-helpers'; - -describe('ensureValidDatetime.', () => { - test('happy path', () => { - expect(ensureValidDatetime('2023-10-09T20:05:44.039Z')).toBe(true); - expect(ensureValidDatetime('2020-01-01T20:12:08.613Z')).toBe(true); - expect(ensureValidDatetime('1970-01-01T20:12:08.613Z')).toBe(true); - }); - - test('unhappy path', () => { - expect(() => ensureValidDatetime('2023-13-09T15:12:08.613Z')).toThrow(); - expect(() => ensureValidDatetime('2020-01-01')).toThrow(); - expect(() => ensureValidDatetime('not a date')).toThrow(); - }); -}); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 0abca4b15..000000000 --- a/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "types": ["node", "jest"], - "skipLibCheck": true, - "module": "Node16", // or "NodeNext" - "target": "ESNext", - "moduleResolution": "Node16", // or "NodeNext" - "esModuleInterop": true - }, - "include": [ - "src/**/*.js", - "example/**/*.js" - ], - "exclude": [ - "node_modules" - ] -} diff --git a/turbo.json b/turbo.json new file mode 100644 index 000000000..837ebdee9 --- /dev/null +++ b/turbo.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://turbo.build/schema.json", + "tasks": { + "build": { + "cache": true, + "dependsOn": ["^build"], + "outputs": ["packages/**/dist/**"] + }, + "docs": { + "cache": true, + "dependsOn": ["^build"], + "outputs": ["out/**"] + }, + "lint": { + "cache": false, + "outputs": [] + }, + "publish": { + "outputs": [] + }, + "test": { + "dependsOn": ["^build"], + "outputs": [] + }, + "examples": { + "dependsOn": ["^build"], + "outputs": [] + }, + "test-with-node": { + "dependsOn": ["^build"], + "outputs": [], + "env": ["CHEQD_MNEMONIC"] + }, + "examples-with-node": { + "dependsOn": ["^build"], + "outputs": [] + }, + "publish-packages": { + "dependsOn": ["^build"], + "outputs": [] + } + } +} diff --git a/tutorials/book.toml b/tutorials/book.toml index 85a7d1094..9d8d06bfc 100644 --- a/tutorials/book.toml +++ b/tutorials/book.toml @@ -1,5 +1,11 @@ [book] -authors = ["Andrew Dirksen", "Fausto Woelflin", "Sam Hellawell", "Lovesh Harchandani"] +authors = [ + "Andrew Dirksen", + "Fausto Woelflin", + "Sam Hellawell", + "Lovesh Harchandani", + "Oleg Nosov", +] language = "en" multilingual = false src = "src" diff --git a/tutorials/src/concepts.md b/tutorials/src/concepts.md index d78c9c89b..c44e993cb 100644 --- a/tutorials/src/concepts.md +++ b/tutorials/src/concepts.md @@ -1,4 +1,5 @@ # Concepts + 1. [DID](./concepts_did.md) 1. [Verifiable credentials](./concepts_vcdm.md) 1. [Blobs and Schemas](./concepts_blobs_schemas.md) diff --git a/tutorials/src/concepts_blobs_schemas.md b/tutorials/src/concepts_blobs_schemas.md index fe0fe1ce3..607eaade9 100644 --- a/tutorials/src/concepts_blobs_schemas.md +++ b/tutorials/src/concepts_blobs_schemas.md @@ -1,12 +1,14 @@ # Schemas ## Table of Contents + 1. [Intro](#intro-to-schemas) 1. [Blobs](#blobs) 1. [JSON Schemas](#json-schemas) 1. [Schemas in Verifiable Credentials](#schemas-in-verifiable-credentials) ## Intro to Schemas + Data Schemas are useful when enforcing a specific structure on a collection of data like a Verifiable Credential. Data Verification schemas, for example, are used to verify that the structure and contents of a Verifiable Credential conform to a published schema. Data Encoding schemas, on the other hand, are used to map the contents of a Verifiable @@ -16,6 +18,7 @@ neither enforces data structure or data syntax, nor enables the definition of ar representation formats. ## Blobs + Before diving further into Schemas in it is important to understand the way these are stored in the Dock chain. Schemas are stored on chain as a `Blob` in the Blob Storage module. They are identified and retrieved by their unique blob id, a 32 byte long hex string. They are authored by a DID and have a max size of 8192 bytes. @@ -23,6 +26,7 @@ The chain is agnostic to the contents of blobs and thus to schemas. Blobs may be schemas. ## JSON Schemas + JSON Schema can be used to require that a given JSON document (an instance) satisfies a certain number of criteria. JSON Schema validation asserts constraints on the structure of instance data. An instance location that satisfies all asserted constraints is then annotated with any keywords that contain non-assertion information, such as descriptive @@ -35,6 +39,7 @@ More about JSON schemas can be found [here](http://json-schema.org/draft/2019-09 [here](https://json-schema.org/understanding-json-schema/index.html). Let's see an example JSON schema definition: + ```json { "$schema": "http://json-schema.org/draft-07/schema#", @@ -55,35 +60,37 @@ Let's see an example JSON schema definition: ``` In our context, these schemas are stored on-chain as a blob, which means they have a Blob Id as id and a DID as author: + ```json { - "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", - "author": "did:dock:5CEdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", - "schema": { - "$schema": "http://json-schema.org/draft-07/schema#", - "description": "Alumni", - "type": "object", - "properties": { - "emailAddress": { - "type": "string", - "format": "email" - }, - "alumniOf": { - "type": "string" - } + "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", + "author": "did:dock:5CEdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "Alumni", + "type": "object", + "properties": { + "emailAddress": { + "type": "string", + "format": "email" }, - "required": ["emailAddress", "alumniOf"], - "additionalProperties": false - } + "alumniOf": { + "type": "string" + } + }, + "required": ["emailAddress", "alumniOf"], + "additionalProperties": false + } } ``` + Had we referenced this JSON schema from within a Verifiable Credential, validation would fail if the `credentialSubject` doesn't contain an `emailAddress` field, or it isn't a string formatted as an email; or if it doesn't contain a property `alumniOf` with type string. It'd also fail if a subject contains other properties not listed here (except for the `id` property which is popped out before validation). - ## Schemas in Verifiable Credentials + In pursuit of [extensibility](https://w3c.github.io/vc-data-model/#extensibility), VCDM makes an Open World Assumption; a credential can state anything. Schemas allow issuers to "opt-out" of some of the freedom VCDM allows. Issuers can concretely limit what a given credential will claim. In a closed world, a verifier can rely on the structure of a @@ -99,81 +106,80 @@ and the protocols for evolving the schema. Following our example above, we could use the current SDK to store the Email schema above as a Blob in the Dock chain. Assuming we did that and our schema was stored as `blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW`, we can use it in a Verifiable Credential as follows: + ```json "credentialSchema": { "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", "type": "JsonSchemaValidator2018" } ``` + The following is an example of a valid Verifiable Credential using the above schema: + ```json { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "id": "uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc", - "type": [ - "VerifiableCredential", - "AlumniCredential" - ], - "issuanceDate": "2020-03-18T19:23:24Z", - "credentialSchema": { - "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", - "type": "JsonSchemaValidator2018" - }, - "credentialSubject": { - "id": "did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", - "emailAddress": "john.smith@example.com", - "alumniOf": "Example University" - }, - "issuer": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr", - "proof": { - "type": "Ed25519Signature2018", - "created": "2020-04-22T07:50:13Z", - "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1" - } + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc", + "type": ["VerifiableCredential", "AlumniCredential"], + "issuanceDate": "2020-03-18T19:23:24Z", + "credentialSchema": { + "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", + "type": "JsonSchemaValidator2018" + }, + "credentialSubject": { + "id": "did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", + "emailAddress": "john.smith@example.com", + "alumniOf": "Example University" + }, + "issuer": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr", + "proof": { + "type": "Ed25519Signature2018", + "created": "2020-04-22T07:50:13Z", + "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg", + "proofPurpose": "assertionMethod", + "verificationMethod": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1" + } } ``` + In contrast, the following is an example of an invalid Verifiable Credential: + ```json { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "id": "uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc", - "type": [ - "VerifiableCredential", - "AlumniCredential" - ], - "issuanceDate": "2020-03-18T19:23:24Z", - "credentialSchema": { - "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", - "type": "JsonSchemaValidator2018" - }, - "credentialSubject": [ - { - "id": "did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", - "emailAddress": "john.smith@example.com", - "alumniOf": "Example University" - }, - { - "id": "did:dock:6DF3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", - } - - ], - "issuer": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr", - "proof": { - "type": "Ed25519Signature2018", - "created": "2020-04-22T07:50:13Z", - "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1" - } + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "uuid:0x9b561796d3450eb2673fed26dd9c07192390177ad93e0835bc7a5fbb705d52bc", + "type": ["VerifiableCredential", "AlumniCredential"], + "issuanceDate": "2020-03-18T19:23:24Z", + "credentialSchema": { + "id": "blob:dock:1DFdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW", + "type": "JsonSchemaValidator2018" + }, + "credentialSubject": [ + { + "id": "did:dock:5GL3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi", + "emailAddress": "john.smith@example.com", + "alumniOf": "Example University" + }, + { + "id": "did:dock:6DF3xbkr3vfs4qJ94YUHwpVVsPSSAyvJcafHz1wNb5zrSPGi" + } + ], + "issuer": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr", + "proof": { + "type": "Ed25519Signature2018", + "created": "2020-04-22T07:50:13Z", + "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GBqyaiTMhVt4R5P2bMGcLNJPWEUq7WmGHG7Wc6mKBo9k3vSo7v7sRKwqS8-m0og_ANKcb5m-_YdXC2KMnZwLBg", + "proofPurpose": "assertionMethod", + "verificationMethod": "did:dock:5GUBvwnV6UyRWZ7wjsBptSquiSHGr9dXAy8dZYUR9WdjmLUr#keys-1" + } } ``` + the reason this last Credential is invalid is that only one of the subjects properly follow the Schema, the second subject does not specify the fields `emailAddress` and `alumniOf` which were specified as required. diff --git a/tutorials/src/concepts_claim_deduction.md b/tutorials/src/concepts_claim_deduction.md index 0c63f2367..b3a56fe6a 100644 --- a/tutorials/src/concepts_claim_deduction.md +++ b/tutorials/src/concepts_claim_deduction.md @@ -1,12 +1,12 @@ # Claim Deduction -The [verifiable credentials data model](https://www.w3.org/TR/vc-data-model/) is based on a machine comprehensible language called [RDF](https://www.w3.org/TR/rdf-primer/). RDF represents arbitrary semantic knowledge as [graph](https://en.wikipedia.org/wiki/Graph_(discrete_mathematics))s. Computers can perform automatic deductive reasoning over RDF; given assumptions (represented as an RDF graph) and axioms (represented as logical rules), a computer can infer new conclusions and even prove them to other computers using deductive derivations (proofs). +The [verifiable credentials data model](https://www.w3.org/TR/vc-data-model/) is based on a machine comprehensible language called [RDF](https://www.w3.org/TR/rdf-primer/). RDF represents arbitrary semantic knowledge as [graph]()s. Computers can perform automatic deductive reasoning over RDF; given assumptions (represented as an RDF graph) and axioms (represented as logical rules), a computer can infer new conclusions and even prove them to other computers using deductive derivations (proofs). Every VCDM credential is representable as an RDF graph. So computers can reason about them, deriving new conclusions that weren't explicitly stated by the issuer. The Dock SDK exposes utilities for primitive deductive reasoning over verified credentials. The Verifier has a choice to perform deduction themself (expensive), or offload that responsibility to the Presenter of the credential[s] by accepting deductive proofs of composite claims. -In RDF, if graph A is true and graph B is true, then the [union](https://en.wikipedia.org/wiki/Union_(set_theory)) of those graphs, is also true `A∧B->A∪B` [^1]. Using this property we can combine multiple credentials and reason over their union. +In RDF, if graph A is true and graph B is true, then the [union]() of those graphs, is also true `A∧B->A∪B` [^1]. Using this property we can combine multiple credentials and reason over their union. ## Explicit Ethos @@ -39,9 +39,9 @@ Proven: . ``` -The fourth and final element of the proven *quad* is used here to indicate the source of the information, Alice. The final element of a quad is its [graph name](https://www.w3.org/TR/rdf11-concepts/#dfn-graph-name). +The fourth and final element of the proven _quad_ is used here to indicate the source of the information, Alice. The final element of a quad is its [graph name](https://www.w3.org/TR/rdf11-concepts/#dfn-graph-name). -A signed credentials are [ethos](https://en.wikipedia.org/wiki/Modes_of_persuasion#Ethos) arguments and a credential may be converted to a list of quads (a claimgraph). We call this representation "Explicit Ethos" form. If a credential is *verified*, then its explicit ethos form is *true*. +A signed credentials are [ethos](https://en.wikipedia.org/wiki/Modes_of_persuasion#Ethos) arguments and a credential may be converted to a list of quads (a claimgraph). We call this representation "Explicit Ethos" form. If a credential is _verified_, then its explicit ethos form is _true_. ## Rule Format @@ -112,15 +112,15 @@ enum RdfNode { The SDK represents RDF nodes like so: ```js -const alice = { Iri: 'did:sample:alice' }; +const alice = { Iri: "did:sample:alice" }; const literal = { Literal: { - value: '{}', - datatype: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON', - } + value: "{}", + datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON", + }, }; // blank nodes are generally not useful in rule definitions -const blank = { Blank: '_:b0' }; +const blank = { Blank: "_:b0" }; const defaultGraph = { DefaultGraph: true }; ``` @@ -173,7 +173,7 @@ The rule language is expected to be expressive enough to implement [OWL 2 EL](ht - [RDF](https://en.wikipedia.org/wiki/Resource_Description_Framework): A model for representing general knowledge in a machine friendly way. - RDF triple: A single sentence consisting of subject, predicate and object. Each element of the triple is an RDF node. - RDF quad: A single sentence consisting of subject, predicate, object, graph. Each element of the quad is an RDF term. -- [RDF graph](https://www.w3.org/TR/rdf-primer/#rdfmodel): A directed, labeled [graph](https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)) with RDF triples as edges. +- [RDF graph](https://www.w3.org/TR/rdf-primer/#rdfmodel): A directed, labeled [graph]() with RDF triples as edges. - [RDF node](https://www.w3.org/TR/rdf-primer/#rdfmodel) - Composite Claim: An rdf triple which was infered, rather than stated explicitly in a credential. - Explicit [Ethos](https://en.wikipedia.org/wiki/Modes_of_persuasion#Ethos) statement: A statement of the form "A claims X." where X is also a statement. Explicit Ethos is encodable in natural human languages as well as in RDF. diff --git a/tutorials/src/concepts_did.md b/tutorials/src/concepts_did.md index d837a63a6..8104d2f22 100644 --- a/tutorials/src/concepts_did.md +++ b/tutorials/src/concepts_did.md @@ -35,9 +35,11 @@ add/remove service endpoints and remove the DID. Also a DID can have 1 or more c update its DID document. A DID with a key with `capabilityInvocation` verification relationship is its own controller. An example on-chain Dock DID. + ``` did:dock:5CEdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW ``` + Above DID has method `dock` and the DID identifier is `5CEdyZkZnALDdCAp7crTRiaCq6KViprTM6kHUQCD8X6VqGPW`. Dock DID identifiers are 32 bytes in size. @@ -45,14 +47,10 @@ An example DID Document ```json { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], + "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", - "controller": [ - "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn" - ], - "publicKey": [ + "controller": ["did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn"], + "verificationMethod": [ { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#keys-1", "type": "Sr25519VerificationKey2020", @@ -81,22 +79,20 @@ An example DID Document Dock DIDs support multiple keys. The keys are present in the `publicKey` section. As per the above DID document, the DID `did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn` has 2 public keys and 1 controller which is itself. -Note how that public key is referred to using its `id` in `authentication`, `assertionMethod` and `capabilityInvocation` sections. +Note how that public key is referred to using its `id` in `authentication`, `assertionMethod` and `capabilityInvocation` sections. The above document states that the DID `did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn` can authenticate with 2 public keys whose id is specified under `authentication`. When it attests to some fact (becomes issuer), it can only use 1 key, which is under `assertionMethod`. The keys specified under `capabilityInvocation` can be used to update the DID document, i.e. add/remove keys, etc. ```json { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], + "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", "controller": [ "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", "did:dock:5Hc3RZyfJd98QbFENrDP57Lga8mSofDFwKQpodN2g2ZcYscz" ], - "publicKey": [ + "verificationMethod": [ { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#keys-1", "type": "Sr25519VerificationKey2020", @@ -129,15 +125,13 @@ can also modify above DID document, i.e. add/remove keys, add/remove controller, ```json { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], + "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", "controller": [ "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", "did:dock:5Hc3RZyfJd98QbFENrDP57Lga8mSofDFwKQpodN2g2ZcYscz" ], - "publicKey": [ + "verificationMethod": [ { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#keys-1", "type": "Sr25519VerificationKey2020", @@ -165,9 +159,7 @@ can also modify above DID document, i.e. add/remove keys, add/remove controller, { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#linked-domain-1", "type": "LinkedDomains", - "serviceEndpoint": [ - "https://foo.example.com" - ] + "serviceEndpoint": ["https://foo.example.com"] } ] } @@ -180,14 +172,10 @@ another DID(s) and the other DID could add/remove keys, controllers or remove th ```json { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], + "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", - "controller": [ - "did:dock:5Hc3RZyfJd98QbFENrDP57Lga8mSofDFwKQpodN2g2ZcYscz" - ], - "publicKey": [], + "controller": ["did:dock:5Hc3RZyfJd98QbFENrDP57Lga8mSofDFwKQpodN2g2ZcYscz"], + "verificationMethod": [], "authentication": [], "assertionMethod": [], "capabilityInvocation": [], @@ -195,9 +183,7 @@ another DID(s) and the other DID could add/remove keys, controllers or remove th { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#linked-domain-1", "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] + "serviceEndpoint": ["https://bar.example.com"] } ] } @@ -209,14 +195,10 @@ DID Doc will look like below ```json { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], + "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn", - "controller": [ - "did:dock:5Hc3RZyfJd98QbFENrDP57Lga8mSofDFwKQpodN2g2ZcYscz" - ], - "publicKey": [ + "controller": ["did:dock:5Hc3RZyfJd98QbFENrDP57Lga8mSofDFwKQpodN2g2ZcYscz"], + "verificationMethod": [ { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#keys-1", "type": "Ed25519VerificationKey2018", @@ -225,7 +207,7 @@ DID Doc will look like below } ], "authentication": [ - "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#keys-1", + "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#keys-1" ], "assertionMethod": [], "capabilityInvocation": [], @@ -233,9 +215,7 @@ DID Doc will look like below { "id": "did:dock:5Hhnorjqd7vXPKdT7Y1ZpHksMBHsVRNewntZjMF2NHm3PoFn#linked-domain-1", "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] + "serviceEndpoint": ["https://bar.example.com"] } ] } diff --git a/tutorials/src/concepts_public_attestation.md b/tutorials/src/concepts_public_attestation.md index 6c631e7fc..508a39e88 100644 --- a/tutorials/src/concepts_public_attestation.md +++ b/tutorials/src/concepts_public_attestation.md @@ -1,10 +1,10 @@ # Public Attestation -This feature should be considered *Alpha*. +This feature should be considered _Alpha_. [RFC](https://github.com/docknetwork/planning/blob/master/rfc/0014-public-attestation.md) -VCDM Verifiable credentials are a way to prove an *attestation*. Valid credentials prove statements of the form `Issuer claims X`, where `X` is itself a statement. One property of verifiable credentials is that the holder may keep them private simply by not sharing them with other parties. That property will be sometimes useful, sometimes not. VCDM crededentials are private and therefore not automatically discoverable but Public Attestations give a decentralized identity the ability to post claims that *are* discoverable by any party. For Dock DIDs, attestations are linked on-chain but Public Attestations are not specicfic to Dock. Other DID methods can implement public attestations by including them in DID documents. +VCDM Verifiable credentials are a way to prove an _attestation_. Valid credentials prove statements of the form `Issuer claims X`, where `X` is itself a statement. One property of verifiable credentials is that the holder may keep them private simply by not sharing them with other parties. That property will be sometimes useful, sometimes not. VCDM crededentials are private and therefore not automatically discoverable but Public Attestations give a decentralized identity the ability to post claims that _are_ discoverable by any party. For Dock DIDs, attestations are linked on-chain but Public Attestations are not specicfic to Dock. Other DID methods can implement public attestations by including them in DID documents. Public Attestations are posted as RDF documents. Since RDF can represent, or link to, arbitrary types of data, Public Attestations can be used to publish arbitrary content. @@ -90,8 +90,8 @@ While it is valid DIDs to include multiple attested IRIs in a single DID documen Two properties of RDF have the potential to supercharge Public Attestations. -1) It's a semantic knowlege representation, it can be [reasoned over](https://github.com/docknetwork/rify). -2) It's [queryable](https://en.wikipedia.org/wiki/SPARQL) in it's native form. +1. It's a semantic knowlege representation, it can be [reasoned over](https://github.com/docknetwork/rify). +2. It's [queryable](https://en.wikipedia.org/wiki/SPARQL) in it's native form. Via these properties the sdk implements a "Curious Agent". The Curious Agent seeks out information. It starts with an initial kernel of knowlege (an RDF dataset) and it follows a sense of curiosity, gradually building it's knowlege graph by dereferencing IRIs, stopping when it finds nothing new to be curious about. As it crawls, it reasons over the information it's found, deducing new facts, which may in turn spark new curiosity. The Curious Agent accepts it's curiosity as Sparql queries. The logical rules it uses to reason are also configurable, axioms are provided to the Agent as conjunctive if-then statements (like in [Claim Deduction](./concepts_claim_deduction.md)). Within the sdk, the Curious Agent is simply called `crawl()`. diff --git a/tutorials/src/concepts_public_delegation.md b/tutorials/src/concepts_public_delegation.md index f39b2fb34..67064405e 100644 --- a/tutorials/src/concepts_public_delegation.md +++ b/tutorials/src/concepts_public_delegation.md @@ -1,6 +1,6 @@ # Public Delegation -This feature should be considered *Alpha*. +This feature should be considered _Alpha_. [RFC](https://github.com/docknetwork/planning/blob/master/rfc/0013-public-delegation.md) diff --git a/tutorials/src/concepts_vcdm.md b/tutorials/src/concepts_vcdm.md index c9a57607c..cd5eddbc1 100644 --- a/tutorials/src/concepts_vcdm.md +++ b/tutorials/src/concepts_vcdm.md @@ -22,26 +22,29 @@ way that is cryptographically secure, privacy respecting, and machine-verifiable. ## Participants and workflow + - Credentials are issued by an entity called the **issuer**. - **Issuer** issues the credential about a **subject** by signing the credential with his key. If the credential is revocable, -the issuer must specify how and from where revocation status must be checked. It is not necessary that revocation is managed by -the issuer, the issuer might designate a different authority for revocation. + the issuer must specify how and from where revocation status must be checked. It is not necessary that revocation is managed by + the issuer, the issuer might designate a different authority for revocation. - **Issuer** gives the credential to the **holder**. The **holder** might be the same as the **subject**. - A service provider or anyone willing to check if the **holder** possesses certain credentials requests a **presentation** about those -credentials. This entity requesting the **presentation** is called the **verifier**. To protect against replay attacks, (a -verifier receiving the presentation and replaying the same presentation at some other verifier), a verifier must supply a -challenge that must be embedded in the presentation. + credentials. This entity requesting the **presentation** is called the **verifier**. To protect against replay attacks, (a + verifier receiving the presentation and replaying the same presentation at some other verifier), a verifier must supply a + challenge that must be embedded in the presentation. - **Holder** creates a **presentation** for the required credentials. The **presentation** must indicate which -credentials it is about and must be signed by the **holder** of the credentials. + credentials it is about and must be signed by the **holder** of the credentials. - **Verifier** on receiving the presentation verifies the validity of each credential in the **presentation**. This includes -checking correctness of the data model of the credential, the authenticity by verifying the issuer's signature and revocation -status if the credential is revocable. It then checks whether the presentation contains the signature from the -**holder** on the presentation which also includes his given challenge. + checking correctness of the data model of the credential, the authenticity by verifying the issuer's signature and revocation + status if the credential is revocable. It then checks whether the presentation contains the signature from the + **holder** on the presentation which also includes his given challenge. ## Issuing + To issue a verifiable credential, the issuer needs to have a public key that is accessible by the holder and verifier to verify the signature (in `proof`) in the credential. Though the VCDM spec does not mandate it, an issuer in Dock must have a DID on chain. This DID is present in the credential in the `issuer` field. An example credential where both the issuer and holder have Dock DIDs + ```js { '@context': [ @@ -67,10 +70,12 @@ This DID is present in the credential in the `issuer` field. An example credenti ``` ## Presentation + The holder while creating the presentation signs it with his private key. For the verifier to verify the presentation, in addition to verifying the issuer's signature, he needs to verify this signature as well, and for that he must know the holder's public key. One way to achieve this is to make the holder have a DID too so that the verifier can look up the DID on chain and learn the public key. An example presentation signed by the holder + ```js { '@context': [ 'https://www.w3.org/2018/credentials/v1' ], @@ -116,11 +121,13 @@ on chain and learn the public key. An example presentation signed by the holder ``` ## Revocation + If the credential is revocable, the issuer must specify how the revocation check must be done in the `credentialStatus` field. On Dock, credential revocation is managed with a revocation registry. There can be multiple registries on chain and each registry has a unique id. It is recommended that the revocation authority creates a new registry for each credential type. While issuing the credential, issuer embeds the revocation registry's id in the credential in the `credentialStatus` field. An example credential with Dock revocation registry + ```js { '@context': [ diff --git a/tutorials/src/introduction.md b/tutorials/src/introduction.md index abd609bec..943649ace 100644 --- a/tutorials/src/introduction.md +++ b/tutorials/src/introduction.md @@ -1,50 +1,60 @@ # Intro + [Dock](https://dock.io) is a blockchain built using [Substrate](https://www.parity.io/substrate/) to facilitate the use of [Verifiable Credentials Data Model 1.0](https://www.w3.org/TR/vc-data-model/) compliant documents, creating/managing [W3C spec](https://www.w3.org/TR/did-core) compliant DIDs and more. The client SDK contains a library and tooling to interact with the Dock chain and also other things such as verifying and issuing credentials. View the video verison of this tutorial here: [https://www.youtube.com/watch?v=jvgn9oSXBDQ](https://www.youtube.com/watch?v=jvgn9oSXBDQ) # Pre-requisites for these tutorials + For these tutorials we will be a running our own local development node. Instructions to do this can be found at the [dock substrate repository](https://github.com/docknetwork/dock-substrate). Once you have followed the instructions and have your local node running, you can continue. Please note that you don't always need a node to use the Dock SDK, but certain features rely on it. # Installation + Installation of the SDK is pretty simple, we use NPM and our source is also available at GitHub (links below). To install via NPM or Yarn, run either `npm install @docknetwork/sdk` or `yarn add @docknetwork/sdk` respectively. Once the package and dependencies are installed, you can import it like any ES6/CJS module. You can find the complete source for the SDK at https://github.com/docknetwork/sdk and the tutorials at https://github.com/docknetwork/dock-tutorials. # Importing + In this tutorial series we will be using NodeJS with babel for ES6 support, however the same code should work in browsers too once it is transpiled. To begin with, we should import the Dock SDK. Importing the default reference will give us a DockAPI instance. With this we will communicate with the blockchain. You can also import the DockAPI class instanciate your own objects if you prefer. Simply do: + ```javascript // Import the dock SDK -import dock from '@docknetwork/sdk'; +import dock from "@docknetwork/sdk"; ``` We will add one more import here for some shared constants across each tutorial, just the node address and account secret: + ```javascript // Import some shared variables -import { address, secretUri } from './shared-constants'; +import { address, secretUri } from "./shared-constants"; ``` Lets also create this file, creating `shared-constants.js` with the contents: + ```javascript -export const address = 'ws://localhost:9944'; // Websocket address of your Dock node -export const secretUri = '//Alice'; // Account secret in uri format, we will use Alice for local testing +export const address = "ws://localhost:9944"; // Websocket address of your Dock node +export const secretUri = "//Alice"; // Account secret in uri format, we will use Alice for local testing ``` # Connecting to a node + With the required packages and variables imported, we can go ahead and connect to our node. If you don't have a local testnet running alraedy, go to https://github.com/docknetwork/dock-substrate and follow the steps in the readme to start one. You could use the Dock testnet given a proper account with enough funds. First, create a method named `connectToNode` with an empty body for now: -```javascript -export async function connectToNode() { -} +```javascript +export async function connectToNode() {} ``` Before working with the SDK, we need to initialize it. Upon initialization the SDK will connect to the node with the supplied address and create a keyring to manage accounts. Simply call `dock.init` and wait for the promise to resolve to connect to your node: + ```javascript // Initialize the SDK and connect to the node await dock.init({ address }); -console.log('Connected to the node and ready to go!'); +console.log("Connected to the node and ready to go!"); ``` # Creating an account + In order to write to the chain we will need to set an account. We can perform read operations with no account set, but for our purposes we will need one. Accounts can be generated using the `dock.keyring` object through multiple methods such as URI, memonic phrase and raw seeds. See the polkadot keyring documentation (https://polkadot.js.org/api/start/keyring.html) for more information. We will use our URI secret of `//Alice` which was imported from `shared-constants.js` to work with our local testnet. Add this code after `dock.init`: + ```javascript // Create an Alice account for our local node // using the dock keyring. You don't -need this @@ -53,30 +63,35 @@ const account = dock.keyring.addFromUri(secretUri); dock.setAccount(account); // We are now ready to transact! -console.log('Connected to the node and ready to go!'); +console.log("Connected to the node and ready to go!"); ``` If all has gone well, you should be able to run this script and see that you are connected to the node. If any errors occur, the promise will fail and they will be outputted to the console. # Basic usage + To construct your own API object, once the SDK has been installed, import the Dock API object as + ```js -import { DockAPI } from '@docknetwork/sdk/api'; +import { DockAPI } from "@docknetwork/sdk/api"; const dock = new DockAPI(); ``` To make the API object connect to the node call `init` method. This method accepts the Websocket RPC endpoint of the node is needed. Say you have it in `address`. It also accepts a Polkadot-js keyring as well. + ```js await dock.init({ address, keyring }); ``` To disconnect from the node + ```js await dock.disconnect(); ``` To set the account used in sending the transaction and pay fees, call `setAccount` with the polkadot-js `account` + ```js // the `account` object might have been generated as const account = dock.keyring.addFromUri(secretURI); @@ -85,21 +100,25 @@ dock.setAccount(account); ``` To get the account, call `getAccount` + ```js dock.getAccount(); ``` To send a transaction, use the `signAndSend` on the `DockAPI` object + ```js const res = await dock.signAndSend(transaction); ``` For interacting with the DID module, i.e. creating, updating and removing them, get the `didModule` with `did` getter + ```js const didModule = dock.did; ``` Similarly, for the revocation module, get the `revocationModule` with `revocation` getter + ```js const revocationModule = dock.revocation; ``` diff --git a/tutorials/src/tutorial_anoncreds.md b/tutorials/src/tutorial_anoncreds.md index d344756d5..66ca6ec07 100644 --- a/tutorials/src/tutorial_anoncreds.md +++ b/tutorials/src/tutorial_anoncreds.md @@ -15,6 +15,7 @@ accumulator public keys and some accumulator details like current accumulated va to the cryptographic details and treat the values as bytes with some size bounds. - **BBS+ module** + - At path `src/modules/bbs-plus.js` in the repo. - Used to create and remove signature parameters and public keys. - The public keys can either refer the signature params or not pass the reference while creating. @@ -22,6 +23,7 @@ to the cryptographic details and treat the values as bytes with some size bounds - See the tests at `tests/integration/anoncreds/bbs-plus.test.js` on how to create, query and remove these. - **Accumulator module** + - At path `src/modules/accumulator.js` in the repo. - The parameters and public keys are managed in the same way as BBS+ signatures. - Accumulators are owned by a DID and can be only removed by that DID. @@ -36,6 +38,7 @@ to the cryptographic details and treat the values as bytes with some size bounds the accumulator. - Composite proofs + - Proofs that use BBS+ signatures and accumulator - The SDK itself doesn't include the Typescript package containing the crypto as a dependency. But it can be used with the SDK to issue, prove, verify and revoke credentials as shown in tests mentioned below. @@ -44,6 +47,7 @@ to the cryptographic details and treat the values as bytes with some size bounds means the credential is valid and absence means invalid. - Verifiable encryption + - Encrypt messages from BBS+ signatures for a 3rd party and prove that the encryption was done correctly. - See the test `tests/integration/anoncreds/saver-and-bound-check.test.js` diff --git a/tutorials/src/tutorial_blobs_schemas.md b/tutorials/src/tutorial_blobs_schemas.md index 3dbc89fc6..f6e7b2905 100644 --- a/tutorials/src/tutorial_blobs_schemas.md +++ b/tutorials/src/tutorial_blobs_schemas.md @@ -1,80 +1,100 @@ # Schemas + ## Table of contents + 1. [Intro](#intro) 1. [Blobs](#blobs) - 1. [Writing a Blob](#writing-a-blob) - 1. [Reading a Blob](#reading-a-blob) + 1. [Writing a Blob](#writing-a-blob) + 1. [Reading a Blob](#reading-a-blob) 1. [Schemas](#blobs) - 1. [Creating a Schema](#creating-a-schema) - 1. [Writing a Schema](#writing-a-schema-to-the-dock-chain) - 1. [Reading a Schema](#reading-a-schema-from-the-dock-chain) - 1. [Schemas in Verifiable Credentials](#schemas-in-verifiable-credentials) - 1. [Schemas in Verifiable Presentations](#schemas-in-verifiable-presentations) + 1. [Creating a Schema](#creating-a-schema) + 1. [Writing a Schema](#writing-a-schema-to-the-dock-chain) + 1. [Reading a Schema](#reading-a-schema-from-the-dock-chain) + 1. [Schemas in Verifiable Credentials](#schemas-in-verifiable-credentials) + 1. [Schemas in Verifiable Presentations](#schemas-in-verifiable-presentations) ## Intro + Data Schemas are useful way of enforcing a specific structure on a collection of data like a Verifiable Credential. Data schemas serve a different purpose than that of the `@context` property in a Verifiable Credential, the latter neither enforces data structure or data syntax, nor enables the definition of arbitrary encodings to alternate representation formats. ## Blobs + Schemas are stored on chain as a `Blob` in the Blob Storage module of the Dock chain, so understanding blobs is important before diving into Schemas. ### Writing a Blob + A new Blob can be registered on the Dock Chain by using the method `writeToChain` in the BlobModule class. It accepts a `blob` object with the struct to store on chain (it can either be a hex string or a byte array), and one of `keyPair` (a keyPair to sign the payload with). You'll get a signed extrinsic that you can send to the Dock chain: + ```javascript const blobId = randomAsHex(DockBlobIdByteSize); // 32-bytes long hex string to use as the blob's id const blobStruct = { id: blobId, - blob: blobHexOrArray, // Contents of your blob as a hex string or byte array -} -const result = await dock.blob.new(blobStruct, signerDid, keypair, { didModule: dock.didModule }); + blob: blobHexOrArray, // Contents of your blob as a hex string or byte array +}; +const result = await dock.blob.new(blobStruct, signerDid, keypair, { + didModule: dock.didModule, +}); ``` + If everything worked properly `result` will indicate a successful transaction. We'll see how to retrieve the blob next. - ### Reading a Blob + A Blob can be retrieved by using the method `get` in the BlobModule class. It accepts a `blobId` string param which can either be a fully-qualified blob id like `blob:dock:0x...` or just its hex identifier. In response you will receive a two-element array: + ```javascript const chainBlob = await dock.blob.get(blobId); ``` + `chainBlob`'s first element will be the blob's author (a DID). It's second element will be the contents of your blob (`blobHexOrArray` in our previous example). - ## Schemas + Since Schemas are stored on chain as a `Blob` in the Blob Storage module, the `Schema` class uses the `BlobModule` class internally. Schemas are identified and retrieved by their unique `blobId`, a 32 byte long hex string. As mentioned, the chain is agnostic to the contents of blobs and thus to schemas. ### Creating a Schema + The first step to creating a Schema is to initialize it, we can do that using the `Schema` class constructor which accepts an (optional) `id` string as sole argument: + ```javascript const myNewSchema = new Schema(); ``` + When an `id` isn't passed, a random `blobId` will be assigned as the schema's id. + ```javascript > myNewSchema.id <- "blob:dock:5Ek98pDX61Dwo4EDmsogUkYMBqfFHtiS5hVS7xHuVvMByh3N" ``` + Also worth noticing is the JSON representation of the schema as is right now, which can be achieved by calling the `toJSON` method on your new schema: + ```javascript > myNewSchema.toJSON() <- {"id":"0x768c21de02890dad5dbf6f108b6822b865e4ea495bb7f43f8947714e90fcc060"} ``` + where you can see that the schema's `id` gets modified with `getHexIdentifierFromBlobID`. #### Setting a JSON Schema + A JSON schema can be added with the `setJSONSchema` method. It accepts a single argument `json` (an object that is checked to be a valid JSON schema before being added): + ```javascript > const someNewJSONSchema = { $schema: 'http://json-schema.org/draft-07/schema#', @@ -100,10 +120,11 @@ checked to be a valid JSON schema before being added): <- true ``` - #### Formatting for storage + Your new schema is now ready to be written to the Dock chain, the last step is to format it properly for the BlobModule to be able to use it. That's where the `toBlob` method comes in handy: + ```javascript > myNewSchema.toBlob() <- { @@ -112,28 +133,33 @@ to be able to use it. That's where the `toBlob` method comes in handy: } ``` - ### Writing a Schema to the Dock chain + Writing a Schema to the Dock chain is similar to writing any other Blob. `1` is the key id for the on-chain public key corresponding to `keyPair` + ```javascript > const formattedBlob = myNewSchema.toBlob(dockDID); > await myNewSchema.writeToChain(dock, dockDID, keypair); ``` ### Reading a Schema from the Dock chain + Reading a Schema from the Dock chain can easily be achieved by using the `get` method from the `Schema` class. It accepts a string `id` param (a fully-qualified blob id like "blob:dock:0x..." or just its hex identifier) and a `dockAPI` instance: + ```javascript > const result = await Schema.get(blob.id, dock); ``` -`result[0]` will be the author of the Schema, and `result[1]` will be the contents of the schema itself. +`result[0]` will be the author of the Schema, and `result[1]` will be the contents of the schema itself. ### Schemas in Verifiable Credentials + The [VCDM spec](https://www.w3.org/TR/vc-data-model/#data-schemas) specify how the `credentialSchema` property should be used when present. Basically, once you've created and stored your Schema on chain, you can reference to it by its `blobId` when issuing a Verifiable Credential. Let's see an example: + ```javascript > const dockApi = new DockAPI(); > const dockResolver = new DockResolver(dockApi); @@ -158,11 +184,12 @@ used when present. Basically, once you've created and stored your Schema on chai compactProof: true, }); ``` + Assuming that the `blobId` points to a schema taken from the previous examples, the verification above would fail if I the `credentialSubject` in the Verifiable Credential didn't have one of the `alumniOf` or `emailAddress` properties. - ### Schemas in Verifiable Presentations + The current implementation does not specify a way to specify a schema for a Verifiable Presentation itself. However, a Verifiable Presentation may contain any number of Verifiable Credentials, each of which may or may not use a Schema themselves. The `verify` method for Verifiable Presentations will enforce a schema validation in each of the diff --git a/tutorials/src/tutorial_claim_deduction.md b/tutorials/src/tutorial_claim_deduction.md index 3863efe74..ee228d47c 100644 --- a/tutorials/src/tutorial_claim_deduction.md +++ b/tutorials/src/tutorial_claim_deduction.md @@ -15,21 +15,21 @@ const rules = [ { if_all: [ [ - { Unbound: 'subject' }, - { Unbound: 'predicate' }, - { Unbound: 'object' }, - { Bound: { Iri: 'did:example:issuer' } }, + { Unbound: "subject" }, + { Unbound: "predicate" }, + { Unbound: "object" }, + { Bound: { Iri: "did:example:issuer" } }, ], ], then: [ [ - { Unbound: 'subject' }, - { Unbound: 'predicate' }, - { Unbound: 'object' }, + { Unbound: "subject" }, + { Unbound: "predicate" }, + { Unbound: "object" }, { Bound: { DefaultGraph: true } }, ], ], - } + }, ]; ``` @@ -38,26 +38,40 @@ That single rule is enough for some use-cases but it's not scalable. What if we ### Unwrapping Explicit Ethos by Defining Trustworthiness ```js -const trustworthy = { Bound: { Iri: 'https://www.dock.io/rdf2020#Trustworthy' } }; -const type = { Bound: { Iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' } }; +const trustworthy = { + Bound: { Iri: "https://www.dock.io/rdf2020#Trustworthy" }, +}; +const type = { + Bound: { Iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }, +}; const defaultGraph = { Bound: { DefaultGraph: true } }; const rules = [ { if_all: [ - [{ Unbound: 'issuer' }, type, trustworthy, defaultGraph], - [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'issuer' }], + [{ Unbound: "issuer" }, type, trustworthy, defaultGraph], + [ + { Unbound: "s" }, + { Unbound: "p" }, + { Unbound: "o" }, + { Unbound: "issuer" }, + ], ], then: [ - [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, defaultGraph], + [{ Unbound: "s" }, { Unbound: "p" }, { Unbound: "o" }, defaultGraph], ], }, { if_all: [], then: [ - [{ Bound: { Iri: 'did:example:issuer' } }, type, trustworthy, defaultGraph] + [ + { Bound: { Iri: "did:example:issuer" } }, + type, + trustworthy, + defaultGraph, + ], ], - } + }, ]; ``` @@ -67,7 +81,7 @@ By the primitive definition of "trustworthiness" written above, any claim made b ## Proving Composite Claims -As a Holder of verifiable credentials, you'll want to prove specific claims to a Verifier. If those claims are composite, you'll sometimes need to bundle a deductive proof in your verifiable credentials presentation. This should be done after the presentation has been assembled. If the presentation is going to be signed, sign it *after* including the deductive proof. +As a Holder of verifiable credentials, you'll want to prove specific claims to a Verifier. If those claims are composite, you'll sometimes need to bundle a deductive proof in your verifiable credentials presentation. This should be done after the presentation has been assembled. If the presentation is going to be signed, sign it _after_ including the deductive proof. ```js import { proveCompositeClaims } from '@docknetwork/sdk/utils/cd'; diff --git a/tutorials/src/tutorial_did.md b/tutorials/src/tutorial_did.md index 099f6f95b..f3d12130c 100644 --- a/tutorials/src/tutorial_did.md +++ b/tutorials/src/tutorial_did.md @@ -3,6 +3,7 @@ If you are not familiar with DIDs, you can get a conceptual overview [here](./concepts_did.md). ## Overview + DIDs in Dock are created by choosing a 32 byte unique (on Dock chain) identifier along with 1 ore more public keys or controllers. The public key can be added or removed by the DID's controller (which the DID maybe itself) signature with a key having `capabilityInvocation` verification relationship. @@ -16,61 +17,40 @@ for itself or any DID it controls, adding a blob, etc should supply a nonce 1 hi This is done for replay protection but this detail however is hidden in the API so the caller should not have to worry about this. ## DID creation + Create a new random DID. + ```js -import {DockDid} from '@docknetwork/sdk/did'; +import { DockDid } from "@docknetwork/credential-sdk/types"; const did = DockDid.random(); ``` The DID is not yet registered on the chain. Before the DID can be registered, a public key needs to created as well. -## Public key creation -Dock supports 3 kinds of public keys, Sr25519, Ed25519 and EcdsaSecp256k1. These public keys are supported -through 3 classes, `PublicKeySr25519`, `PublicKeyEd25519` and `PublicKeySecp256k1` respectively. +## Keypair creation -These 3 classes extend from the same class called `PublicKey`. These can be instantiated directly by passing them as hex -encoded bytes. +We can create a random `ed25519` keypair using `Ed25519Keypair` class. ```js -import {PublicKeySr25519, PublicKeyEd25519, PublicKeySecp256k1} from '@docknetwork/sdk/api'; +import { Ed25519Keypair } from "@docknetwork/credential-sdk/keypairs"; -const pk1 = new PublicKeySr25519(bytesAsHex); -const pk2 = new PublicKeyEd25519(bytesAsHex); -const pk3 = new PublicKeySecp256k1(bytesAsHex); +const kp = Ed25519Keypair.random(); ``` -Or they can be created by first creating a keyring -```js -import {PublicKeySr25519, PublicKeyEd25519} from '@docknetwork/sdk/api'; - -// Assuming you had a keyring, you can create keypairs or used already created keypairs -const pair1 = keyring.addFromUri(secretUri, someMetadata, 'ed25519'); -const pk1 = PublicKeyEd25519.fromKeyringPair(pair1); +The result pair can be used as following: -const pair2 = keyring.addFromUri(secretUri2, someMetadata, 'sr25519'); -const pk2 = PublicKeySr25519.fromKeyringPair(pair2); +```javascript +const publicKey = kp.publicKey(); +const privateKey = kp.privateKey(); -``` - -Polkadot-js keyring does not support ECDSA with secp256k1 so there is a function `generateEcdsaSecp256k1Keypair` that -takes some entropy and generate a keypair. -```js -import { generateEcdsaSecp256k1Keypair } from '@docknetwork/sdk/utils/misc'; -import {PublicKeySecp256k1} from '@docknetwork/sdk/api'; -// The pers and entropy are optional but must be used when keys need to be deterministic -const pair3 = generateEcdsaSecp256k1Keypair(pers, entropy); -const pk3 = PublicKeySecp256k1.fromKeyringPair(pair3); -``` - -Or you can directly pass any of the above keypairs in the function `getPublicKeyFromKeyringPair` and it will return an -object of the proper child class of `PublicKey` -```js -import { getPublicKeyFromKeyringPair } from '@docknetwork/sdk/utils/misc'; -const publicKey = getPublicKeyFromKeyringPair(pair); +const message = Uint8Array.from([1, 2, 3]); +const signature = kp.sign(message); +assert(Ed25519Keypair.verify(message, signature, publicKey)); ``` ## Registering a new DID on chain + Now that you have a DID and a public key, the DID can be registered on the Dock chain. Note that this public key associated with DID is independent of the key used for sending the transaction and paying the fees. @@ -78,73 +58,76 @@ with DID is independent of the key used for sending the transaction and paying t In most cases, a DID will have its own keys and will control itself, i.e. a self-controlled DID. Following is an example of DID creation in this scenario. -1. First create a `DidKey` object. The first argument of this function is a `PublicKey` and the second argument is -the verification relationship. A verification relationship can be 1 or more of these `authentication`, `assertion`, `capabilityInvocation` or `keyAgreement` +1. First, create a `DidKeypair` object. The first argument is a DID reference and the second is the underlying keypair. ```js - import { DidKey, VerificationRelationship } from '@docknetwork/sdk/public-keys'; - const didKey = new DidKey(publicKey, new VerificationRelationship()); + import { DidKeypair } from "@docknetwork/credential-sdk/keypair"; + + const didKeypair = new DidKeypair([did, 1], kp); ``` -2. Now submit the transaction using a `DockAPI` object and the newly created DID `did` and `didKey`. +2. Second, let's get a did key with verication relationship from the did's keypair. The only argument is + the verification relationship. A verification relationship can be 1 or more of these `authentication`, `assertion`, `capabilityInvocation` or `keyAgreement` + + ```js + const didKey = didKeypair.didKey(); + ``` + +3. Now submit the transaction using a `DockAPI` object and the newly created DID `did` and `didKey`. ```js - await dock.did.new(did, [didKey], []); + const document = DIDDocument.create(did, [didKey]); + await dock.did.createDocument(document, didKeypair); ``` ### Keyless DIDs -A DID might not have any keys and thus be controlled by other DIDs. Assuming a DID `did1` already exists, it can register a +A DID might not have any keys and thus be controlled by other DIDs. Assuming a DID `did` already exists, it can register a keyless DID `did2` as - ```js - await dock.did.new(did2, [], [did1]); - ``` + +```js +const document = DIDDocument.create(did2); +await dock.did.createDocument(document, didKeypair); +``` Moreover, a DID can have keys for certain functions like authentication but still be controlled by other DID(s). ## Fetching a DID from chain + To get a DID document, use `getDocument` - ```js - const result = await dock.did.getDocument(did); - ``` + +```js +const result = await dock.did.getDocument(did); +``` ## Adding a key to an existing DID + A DID's controller can add a public key to an on-chain DID by preparing a signed payload. Each new key is given a number key index which 1 is greater than the last used index. Key indices start from 1. + 1. Create a new public key and use the current keypair to sign the message - ```js - // the current pair, its a sr25519 in this example - const currentPair = dock.keyring.addFromUri(secretUri, null, 'sr25519'); - const newPk = // Using any of the above methods - ``` -1. The caller might directly create a signed key update - ```js - const vr = new VerificationRelationship(); - // This new key can only be used for issuance. - vr.setAssertion(); - const newDidKey = new DidKey(newPk, vr); - ``` -1. Now send the signed payload in a transaction to the chain in a transaction. - In the arguments, the first `did` specifies that a key must be added to DID `did` and the second `did` specifies that DID `did` is signing the payload - The `1` below is for the key index. - ```js - dock.did.addKeys([newDidKey], did, did, currentpair, undefined, false); - ``` + ```js + // the current pair, its a sr25519 in this example + const newKp = Ed25519Keypair.random(); + ``` +2. Now send the signed payload in a transaction to the chain in a transaction. + In the arguments, the first `did` specifies that a key must be added to DID `did` and the second `did` specifies that DID `did` is signing the payload. + ```js + const document = await dock.did.getDocument(did); + document.addKey([did, 2], newKp.didKey()); + await dock.did.updateDocument(document, didKeypair); + ``` ## Removing an existing DID from chain + A DID can be removed from the chain by sending the corresponding message signed with an appropriate key. -1. Fetch the current keypair to sign the DID removal message - ```js - // the current pair, its a sr25519 in this example - const currentPair = dock.keyring.addFromUri(secretUri, null, 'sr25519'); - ``` + 1. Now send the message with the signature to the chain in a transaction ```js - dock.did.remove(did, did, pair) + dock.did.removeDocument(did, didKeypair); ``` For more details see example in `examples/dock-did.js` or the integration tests. - Note that they accounts used to send the transactions are independent of the keys associated with the DID. So the DID could have been created with one account, updated with another account and removed with another account. diff --git a/tutorials/src/tutorial_evm.md b/tutorials/src/tutorial_evm.md deleted file mode 100644 index 7c6a71ca4..000000000 --- a/tutorials/src/tutorial_evm.md +++ /dev/null @@ -1,222 +0,0 @@ -# Ethereum integration - -## Table of contents - -1. [Intro](#intro) -1. [Dock and EVM accounts](#dock-and-evm-accounts) -1. [Deploying a DAO](#dao) -1. [Chainlink integration](#chainlink) - - -**This document assumes hands-on experience with Ethereum and interaction with smart contracts using libraries like [web3](https://github.com/ChainSafe/web3.js) or [ethers-js](https://github.com/ethers-io/ethers.js).** - -## Intro - - The chain allows you to deploy and interact with existing EVM smart contracts by using popular Ethereum client libraries like [web3](https://github.com/ChainSafe/web3.js) or [ethers-js](https://github.com/ethers-io/ethers.js). - You can directly send contract's bytecode as well if you don't want to use these libraries. This is possible because the chain integrates 2 modules [pallet-evm](https://github.com/paritytech/frontier/tree/master/frame/evm) and [pallet-ethereum](https://github.com/paritytech/frontier/tree/master/frame/ethereum) from [Parity's frontier](https://github.com/paritytech/frontier) project. - `pallet-evm` allows the chain to execute EVM bytecode and persist state like contract storage but does not understand how Ethereum transactions, blocks, etc are created and have to be parsed. Handling that is the job of `pallet-ethereum` which uses `pallet-evm` for executing the bytecode. More detailed docs of these pallets are available [here](https://github.com/paritytech/frontier/tree/master/docs/frame). - -The motivation for this integration was to support [Chainlink](https://chain.link/) for providing [price feed](https://docs.chain.link/docs/using-chainlink-reference-contracts) of the DOCK/USD pair which can then be used by the chain to charge transactions at a USD price. - -The document will however show how to deploy and use a different set of contracts. A [DAO](https://academy.binance.com/en/glossary/decentralized-autonomous-organization), which replicates [Aragon's voting app](https://github.com/aragon/aragon-apps/tree/master/apps/voting). The app lets token holders vote in proportion to the tokens they hold and the winning vote executes an action by calling a method on another contract. - -Most of the examples use web-3 but there is [a test](../../tests/integration/eth/using-ethers.test.js) using ethers-js as well. - -## Dock and EVM accounts - -Accounts in Dock are 32 bytes (excluding network identifier and checksum) but EVM accounts are 20 bytes (last 20 bytes of the public key). As there is no direct conversion possible between these two and we don't support -binding these two together in an onchain mapping, a separate Ethereum address has to be created and funded with tokens to send Ethereum style transactions. `pallet-evm` derives a Dock address from this Ethereum address -and expects that Dock address to have tokens. The test [native-balance-to-eth.test](../../tests/integration/eth/native-balance-to-eth.test.js) shows an Ethereum account `carol` created using web3 being given some tokens using function `endowEVMAddress`. - -```js - // An API object which will connect to node and send non-EVM transactions like balance transfer - const dock = new DockAPI(); - await dock.init({ - address: FullNodeEndpoint, - }); - - // Jacob has Dock tokens and will send tokens to Carol. - const jacob = dock.keyring.addFromUri(EndowedSecretURI); - dock.setAccount(jacob); - - // ... - // .... - - const carol = ""; - await endowEVMAddress(dock, carol.address); -``` - -The substrate address can also be generated by function `evmAddrToSubstrateAddr`. Its balance can be queried either using `web3` or `polkadot-js`. - -```js - // Every EVM address has a mapping to Substrate address whose balance is deducted for fee when the EVM address does a transaction. - const carolSubsAddr = evmAddrToSubstrateAddr(carol.address); - console.log(`Querying balance of Carol's address using web3 ${(await web3.eth.getBalance(carol.address))}`); - console.log(`Querying balance of Carol's address using polkadot-js ${(await getBalance(dock.api, carolSubsAddr, false))}`); -``` - -`endowEVMAddress` uses `evmAddrToSubstrateAddr` to covert the passed EVM address to the Substrate address and do a `transfer` as shown below - -```js -// Give `amount` of Dock tokens to EVM address. `amount` defaults to the number of tokens required to pay of maximum gas -export function endowEVMAddress(dock, evmAddr, amount) { - // Convert EVM address to a Substrate address - const substrateAddr = evmAddrToSubstrateAddr(evmAddr); - - // Selecting the amount such that it can pay fees for the upto the maximum gas allowed and some extra - const amt = amount !== undefined ? amount : bnToBn(MinGasPrice).mul(bnToBn(MaxGas)).muln(2); - - // Transfer to the Substrate address created above - const transfer = dock.api.tx.balances.transfer(substrateAddr, amt); - return dock.signAndSend(transfer, false); -} -``` - -To send arbitrary EVM transactions and deploy contracts using web3, look at the functions `sendEVMTxn` and `deployContract` respectively in `scripts/eth/helpers.js`. - -Withdrawing tokens back from an EVM address to a Substrate address is a 3-step process. - -1. Derive an intermediate EVM address from the receiving Substrate address. -2. Send tokens using web3 to this intermediate EVM address. -3. Send tokens using polkadot-js from intermediate address to target address. - -```js - // Withdraw some tokens from EVM address, i.e. Carol to Jacob. - - // Jacob's account is set as signer in the API object `dock` - - // Step-1 - // Create an intermediate EVM address - const intermediateAddress = substrateAddrToEVMAddr(jacob.address); - - // Step-2 - // Carol sends 100 tokens to the intermediate EVM address. `sendTokensToEVMAddress` uses web3 to send an Ethereum style - // transfer transaction, i.e. `data` field is set to 0 and `value` field specifies the transfer amount. - await sendTokensToEVMAddress(web3, carol, intermediateAddress, 1000); - - // Step-3 - // Withdraw from the intermediate address to the Substrate address sending this transaction, i.e. Jacob - const withdraw = dock.api.tx.evm.withdraw(intermediateAddress, 1000); - await dock.signAndSend(withdraw, false); -``` - -The second step above of sending tokens in EVM requires to specify minimum gas price and maximum allowed gas. The function `sendTokensToEVMAddress` needs to -know these values and accepts them as arguments. If not provided it will check for environment variables `MinGasPrice` and `MaxGas`. This behavior is -common to all script helpers. - -## DAO - -This section shows how to deploy a voting DAO where tokens holder can vote to execute certain actions. This replicates [Aragon's voting app](https://github.com/aragon/aragon-apps/tree/master/apps/voting). -The complete script is [here](../../scripts/eth/dao/voting-dao-test.js) and below is an explainer of the script - -1. Create some accounts that will send Ethereum style transactions and fund them with Dock tokens. The accounts generated in the code are only for testing - so create your own accounts for real world apps. - - ```js - const web3 = getWeb3(); - - // Create some test accounts. Alice will be the manager of the DAO while Bob, Carol and Dave will be voters. - const [alice, bob, carol, dave] = getTestEVMAccountsFromWeb3(web3); - - // Endow accounts with tokens so they can pay fees for transactions - await endowEVMAddressWithDefault(alice.address); - await endowEVMAddressWithDefault(bob.address); - await endowEVMAddressWithDefault(carol.address); - await endowEVMAddressWithDefault(dave.address); - ``` - - `getTestEVMAccountsFromWeb3` uses web3 to create EVM accounts using some test private keys. - - ```js - // Returns some test EVM accounts - export function getTestEVMAccountsFromWeb3(web3) { - return getTestPrivKeysForEVMAccounts().map((k) => web3.eth.accounts.privateKeyToAccount(k)); - } - ``` - -1. Create a DAO factory contract which will then be used to initialize a new DAO instance. Also setup the access control list for the DAO and set the DAO manager (an admin role) - - ```js - // Create a contract factory to create new DAO instance. - const [, , , daoFactContractAddr] = await createDaoFactory(web3, alice); - - // Create a new DAO instance - const daoAddr = await createNewDao(web3, alice, alice.address, daoFactContractAddr); - - // Set access control and set Alice as DAO's manager - const aclAddr = await setupAcl(web3, alice, alice.address, daoAddr); - ``` - -1. A DAO can install several apps but here we will have only one app; for voting. Choose a unique app id. - - ```js - // Some unique app id - const appId = '0x0000000000000000000000000000000000000000000000000000000000000100'; - ``` - -1. Create a voting app (contract) with the above app id. Install the app in the DAO and allow any token holder to vote using the DAO's access control list (ACL). - - ```js - // Create a voting contract, install it as an app in the DAO and allow any token holder to vote - const votingAppAddress = await setupVotingApp(web3, alice, alice.address, appId, daoAddr, aclAddr); - const votingApp = new web3.eth.Contract(VotingDAOABI, votingAppAddress); - ``` - -1. Voting in this DAO requires voters to have tokens and their vote will carry weight proportional to their token balance. Deploy a token contract. This token contract is - [Aragon's MiniMeToken](https://github.com/aragon/minime/blob/master/contracts/MiniMeToken.sol) that extends ERC-20 interface. After deploying token, accounts `bob`, `carol` - and `dave` are given 51, 29 and 20 tokens respectively. This makes the total supply of the `MiniMeToken` as 100 where `bob`, `carol` and `dave` hold 51%, 29% and 20% supply - respectively. - - ```js - // Deploy a token contract where Bob, Carol and Dave will have 51%, 29% and 20% tokens as thus proportional voting power. - const tokenContractAddr = await deployToken(web3, alice, [[bob.address, 51], [carol.address, 29], [dave.address, 20]]); - ``` - -1. Now initialize the voting app by setting the token contract address and thresholds for voting. The example scripts set the winning percentage to 51%. - As `bob`, `carol` and `dave` hold 51%, 29% and 20% token supply, they will have 51%, 29% and 20% voting power respectively. - - ```js - // Initialize the voting by supplying the token contract and thresholds for voting. - await initializeVotingApp(web3, alice, votingAppAddress, tokenContractAddr); - ``` - -1. For this example, we want successful voting to increment a counter in a contract. However, this contract is for demo purpose only. `counterAddr` is the - address of the demo contract and `incrementScript` is the encoded call to a function to increment the counter. - - ```js - // A Counter contract as an example executor. In practice, the executor methods will only allow calls by the voting contract. - const [counterAddr, incrementScript] = await setupVotingExecutor(web3, alice); - ``` - -1. As `bob` has 51% of the voting power, it can create a new vote by calling contract method `newVote` - - ```js - // Bob alone can increment the Counter as he has 51% tokens - console.log(`Counter before increment from Bob ${(await getCounter(web3, counterAddr))}`); - await sendEVMTxn(web3, bob, votingAppAddress, votingApp.methods.newVote(incrementScript, '').encodeABI()); - console.log(`Counter after increment from Bob ${(await getCounter(web3, counterAddr))}`); - ``` - -1. As `carol` and `dave` together hold less than 51%, they cannot increment the counter by voting. Here `carol` creates a new vote by calling contract - method `newVote` which returns the vote id and dave uses votes in approval of `carol` by calling contract method `vote` and passing the vote id and `true`. - The other `true` indicates the vote should trigger the execution if successful. - - ```js - // Carol creates a new vote - const voteId = await createNewVote(web3, carol, votingAppAddress, incrementScript); - // Dave seconds Carol's vote - await sendEVMTxn(web3, dave, votingAppAddress, votingApp.methods.vote(voteId, true, true).encodeABI()); - console.log("Counter after attempted increment from Carol and Dave. Counter will not change as Bob and Carol don't have enough voting power"); - ``` - -## Chainlink - -The chain will have Chainlink contracts for price feed in addition to Link token and others. The contracts and scripts to interact -with Chainlink contracts are at `scripts/eth/chainlink` in the repo. The scripts have some comments to explain the working. - -- To deploy the Link token, check the script `link-token.js` at path `scripts/eth/chainlink/link-token.js` in the repo. -- To deploy the [FluxAggregator](https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/FluxAggregator.sol) contract that is used by oracles to submit prices, check script `flux-aggegator.js` at path `scripts/eth/chainlink/flux-aggegator.js` in the repo. -- To deploy aggregator with access control on reads and with proxy, [AccessControlledAggregator](https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/AccessControlledAggregator.sol) and [EACAggregatorProxy](https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/EACAggregatorProxy.sol) are deployed. - Check script `access-controlled-aggregator-proxy.js` at path `scripts/eth/chainlink/access-controlled-aggregator-proxy.js` in the repo. To deploy with [DeviationFlaggingValidator](https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/DeviationFlaggingValidator.sol) that raises flag on price off by a threshold in either direction, - use script `deviation-flag-validator.js` at path `scripts/eth/chainlink/deviation-flag-validator.js`. The set the validator address while deploying `AccessControlledAggregator`. -- To setup a contract for an Oracle (not needed for price feed though), check script `oracle.js` in `scripts/eth/chainlink/oracle.js`. diff --git a/tutorials/src/tutorial_ipv.md b/tutorials/src/tutorial_ipv.md index 1cbf120b7..dc6ef24e9 100644 --- a/tutorials/src/tutorial_ipv.md +++ b/tutorials/src/tutorial_ipv.md @@ -1,40 +1,46 @@ # Verifiable Credentials and Verifiable Presentations: issuing, signing and verification ## Table of contents + - [Incremental creation and verification of VC](#incremental-creation-and-verification-of-verifiable-credentials) - - [Building a Verifiable Credential](#building-a-verifiable-credential) - - [Adding a Context](#adding-a-context) - - [Adding a Type](#adding-a-type) - - [Adding a Subject](#adding-a-subject) - - [Setting a Status](#setting-a-status) - - [Setting the Issuance Date](#setting-the-issuance-date) - - [Setting an Expiration Date](#setting-an-expiration-date) - - [Signing a Verifiable Credential](#signing-a-verifiable-credential) - - [Verifying a Verifiable Credential](#verifying-a-verifiable-credential) + - [Building a Verifiable Credential](#building-a-verifiable-credential) + - [Adding a Context](#adding-a-context) + - [Adding a Type](#adding-a-type) + - [Adding a Subject](#adding-a-subject) + - [Setting a Status](#setting-a-status) + - [Setting the Issuance Date](#setting-the-issuance-date) + - [Setting an Expiration Date](#setting-an-expiration-date) + - [Signing a Verifiable Credential](#signing-a-verifiable-credential) + - [Verifying a Verifiable Credential](#verifying-a-verifiable-credential) - [Incremental creation and verification of VP](#incremental-creation-and-verification-of-verifiable-presentations) - - [Building a Verifiable Presentation](#building-a-verifiable-presentation) - - [Adding a Context](#adding-a-context) - - [Adding a Type](#adding-a-type) - - [Setting a Holder](#setting-a-holder) - - [Adding a Verifiable Credential](#adding-a-verifiable-credential) - - [Signing a Verifiable Presentation](#signing-a-verifiable-presentation) - - [Verifying a Verifiable Presentation](#verifying-a-verifiable-presentation) + - [Building a Verifiable Presentation](#building-a-verifiable-presentation) + - [Adding a Context](#adding-a-context) + - [Adding a Type](#adding-a-type) + - [Setting a Holder](#setting-a-holder) + - [Adding a Verifiable Credential](#adding-a-verifiable-credential) + - [Signing a Verifiable Presentation](#signing-a-verifiable-presentation) + - [Verifying a Verifiable Presentation](#verifying-a-verifiable-presentation) - [Using DIDs](#using-dids) - [Creating a keyDoc](#creating-a-keydoc) --------- +--- ## Incremental creation and verification of Verifiable Credentials + The `client-sdk` exposes a `VerifiableCredential` class that is useful to incrementally create valid Verifiable Credentials of any type, sign them and verify them. Once the credential is initialized, you can sequentially call the different methods provided by the class to add contexts, types, issuance dates and everything else. ### Building a Verifiable Credential + The first step to build a Verifiable Credential is to initialize it, we can do that using the `VerifiableCredential` class constructor which takes a `credentialId` as sole argument: + ```javascript -let vc = new VerifiableCredential('http://example.edu/credentials/2803'); +let vc = new VerifiableCredential("http://example.edu/credentials/2803"); ``` + You now have an unsigned Verifiable Credential in the `vc` variable! This Credential isn't signed since we only just initialized it. It brings however some useful defaults to make your life easier. + ```javascript > vc.context <- ["https://www.w3.org/2018/credentials/v1"] @@ -45,6 +51,7 @@ This Credential isn't signed since we only just initialized it. It brings howeve > vc.credentialSubject <- [] ``` + The default `context` is an array with `"https://www.w3.org/2018/credentials/v1"` as first element. This is required by the VCDMv1 specs so having it as default helps ensure your Verifiable @@ -62,6 +69,7 @@ We could also have checked those defaults more easily by checking the Verifiable Credential's JSON representation. This can be achieved by calling the `toJSON()` method on it: + ```javascript > vc.toJSON() <- { @@ -74,6 +82,7 @@ This can be achieved by calling the `toJSON()` method on it: "issuanceDate": "2020-04-14T14:48:48.486Z" } ``` + An interesting thing to note here is the transformation happening to some of the root level keys in the JSON representation of a `VerifiableCredential` object. @@ -90,7 +99,9 @@ the rest of the building functions to define it completely before finally signing it. #### Adding a Context + A context can be added with the `addContext` method. It accepts a single argument `context` which can either be a string (in which case it needs to be a valid URI), or an object: + ```javascript > vc.addContext('https://www.w3.org/2018/credentials/examples/v1') > vc.context @@ -101,7 +112,9 @@ A context can be added with the `addContext` method. It accepts a single argumen ``` #### Adding a Type + A type can be added with the `addType` function. It accepts a single argument `type` that needs to be a string: + ```javascript > vc.addType('AlumniCredential') > vc.type @@ -112,7 +125,9 @@ A type can be added with the `addType` function. It accepts a single argument `t ``` #### Adding a Subject + A subject can be added with the `addSubject` function. It accepts a single argument `subject` that needs to be an object with an `id` property: + ```javascript > vc.addSubject({ id: 'did:dock:123qwe123qwe123qwe', alumniOf: 'Example University' }) > vc.credentialSubject @@ -120,7 +135,9 @@ A subject can be added with the `addSubject` function. It accepts a single argum ``` #### Setting a Status + A status can be set with the `setStatus` function. It accepts a single argument `status` that needs to be an object with an `id` property: + ```javascript > vc.setStatus({ id: "https://example.edu/status/24", type: "CredentialStatusList2017" }) > vc.status @@ -131,6 +148,7 @@ A status can be set with the `setStatus` function. It accepts a single argument ``` #### Setting the Issuance Date + The issuance date is set by default to the datetime you first initialize your `VerifiableCredential` object. @@ -141,6 +159,7 @@ to have an issuanceDate property). However, if you need to change this date you can use the `setIssuanceDate` method. It takes a single argument `issuanceDate` that needs to be a string with a valid ISO formatted datetime: + ```javascript > vc.issuanceDate <- "2020-04-14T14:48:48.486Z" @@ -150,11 +169,13 @@ with a valid ISO formatted datetime: ``` #### Setting an Expiration Date + An expiration date is not set by default as it isn't required by the specs. If you wish to set one, you can use the `setExpirationDate` method. It takes a single argument `expirationDate` that needs to be a string with a valid ISO formatted datetime: + ```javascript > vc.setExpirationDate("2029-01-01T14:48:48.486Z") > vc.expirationDate @@ -162,17 +183,21 @@ valid ISO formatted datetime: ``` ### Signing a Verifiable Credential + Once you've crafted your Verifiable Credential it is time to sign it. This can be achieved with the `sign` method. It requires a `keyDoc` parameter (an object with the params and keys you'll use for signing) and it also accepts a boolean `compactProof` that determines whether you want to compact the JSON-LD or not: + ```javascript > await vc.sign(keyDoc) ``` + Please note that signing is an async process. Once done, your `vc` object will have a new `proof` field: + ```javascript > vc.proof <- { @@ -185,6 +210,7 @@ Once done, your `vc` object will have a new `proof` field: ``` ### Verifying a Verifiable Credential + Once your Verifiable Credential has been signed you can proceed to verify it with the `verify` method. The `verify` method takes an object of arguments, and is optional. @@ -194,6 +220,7 @@ You can also use the booleans `compactProof` (to compact the JSON-LD). If your credential has uses the `credentialStatus` field, the credential will be checked not to be revoked unless you pass `skipRevocationCheck` flag. + ```javascript > const result = await vc.verify({ ... }) > result @@ -216,13 +243,15 @@ not to be revoked unless you pass `skipRevocationCheck` flag. ] } ``` + Please note that the verification is an async process that returns an object when the promise resolves. A boolean value for the entire verification process can be checked at the root level `verified` property. -------------- +--- ## Incremental creation and verification of Verifiable Presentations + The `client-sdk` exposes a `VerifiablePresentation` class that is useful to incrementally create valid Verifiable Presentations of any type, sign them and verify them. @@ -232,17 +261,20 @@ methods provided by the class to add `contexts`, `types`, `holders` and `credentials`. ### Building a Verifiable Presentation + The first step to build a Verifiable Presentation is to initialize it, we can do that using the `VerifiablePresentation` class constructor which takes an `id` as sole argument: + ```javascript -let vp = new VerifiablePresentation('http://example.edu/credentials/1986'); +let vp = new VerifiablePresentation("http://example.edu/credentials/1986"); ``` You now have an unsigned Verifiable Presentation in the `vp` variable! This Presentation isn't signed since we only just initialized it. It brings however some useful defaults to make your life easier. + ```javascript > vp.context <- ["https://www.w3.org/2018/credentials/v1"] @@ -251,6 +283,7 @@ however some useful defaults to make your life easier. > vp.credentials <- [] ``` + The default `context` is an array with `"https://www.w3.org/2018/credentials/v1"` as first element. This is required by the VCDMv1 specs so having it as default helps ensure your Verifiable @@ -267,6 +300,7 @@ We could also have checked those defaults more easily by checking the Verifiable Presentation's JSON representation. This can be achieved by calling the `toJSON()` method on it: + ```javascript > vp.toJSON() <- { @@ -278,6 +312,7 @@ This can be achieved by calling the `toJSON()` method on it: "verifiableCredential": [], } ``` + An interesting thing to note here is the transformation happening to some of the root level keys in the JSON representation of a `VerifiablePresentation` object. @@ -292,9 +327,11 @@ use the rest of the building functions to define it completely before finally signing it. #### Adding a Context + A context can be added with the `addContext` method. It accepts a single argument `context` which can either be a string (in which case it needs to be a valid URI), or an object + ```javascript > vp.addContext('https://www.w3.org/2018/credentials/examples/v1') > vp.context @@ -305,7 +342,9 @@ a valid URI), or an object ``` #### Adding a Type + A type can be added with the `addType` function. It accepts a single argument `type` that needs to be a string: + ```javascript > vp.addType('CredentialManagerPresentation') > vp.type @@ -316,9 +355,11 @@ A type can be added with the `addType` function. It accepts a single argument `t ``` #### Setting a Holder + Setting a Holder is optional and it can be achieved using the `setHolder` method. It accepts a single argument `type` that needs to be a string (a URI for the entity that is generating the presentation): + ```javascript > vp.setHolder('https://example.com/credentials/1234567890'); > vp.holder @@ -326,11 +367,13 @@ for the entity that is generating the presentation): ``` #### Adding a Verifiable Credential + Your Verifiable Presentations can contain one or more Verifiable Credentials inside. Adding a Verifiable Credential can be achieved using the `addCredential` method. It accepts a single argument `credential` that needs to be an object (a valid, signed Verifiable Credential): + ```javascript > vp.addCredential(vc); > vp.credentials @@ -338,10 +381,11 @@ method. It accepts a single argument `credential` that needs to be an object {...} ] ``` -Please note that the example was truncated to enhance readability. +Please note that the example was truncated to enhance readability. ### Signing a Verifiable Presentation + Once you've crafted your Verifiable Presentation and added your Verifiable Credentials to it, it is time to sign it. @@ -352,6 +396,7 @@ This can be achieved with the `sign` method. It requires a `keyDoc` parameter It also accepts a `domain` string for the proof, a `resolver` in case you're using DIDs and a boolean `compactProof` that determines whether you want to compact the JSON-LD or not: + ```javascript > await vp.sign( keyDoc, @@ -359,8 +404,10 @@ compact the JSON-LD or not: 'some_domain', ); ``` + Please note that signing is an async process. Once done, your `vp` object will have a new `proof` field: + ```javascript > vp.proof <- { @@ -375,6 +422,7 @@ Once done, your `vp` object will have a new `proof` field: ``` ### Verifying a Verifiable Presentation + Once your Verifiable Presentation has been signed you can proceed to verify it with the `verify` method. @@ -384,6 +432,7 @@ the booleans `compactProof` (to compact the JSON-LD). If your credential uses the `credentialStatus` field, the credential will be checked to be not revoked unless you pass `skipRevocationCheck`. For the simplest cases you only need a `challenge` string and possibly a `domain` string: + ```javascript > const results = await vp.verify({ challenge: 'some_challenge', domain: 'some_domain' }); > results @@ -427,6 +476,7 @@ For the simplest cases you only need a `challenge` string and possibly a ] } ``` + Please note that the verification is an async process that returns an object when the promise resolves. @@ -437,6 +487,7 @@ A boolean value for the entire verification process can be checked at the root level `verified` property. ## Using DIDs + The examples shown above use different kinds of URIs as `id` property of different sections. It is worth mentioning that the use of DIDs is not only supported but also encouraged. @@ -450,14 +501,23 @@ If you don't know how to create a DID there's a specific [tutorial on DIDs](tuto Bear in mind that you will need to provide a `resolver` method if you decide to use DIDs in your Verifiable Credentials or Verifiable Presentations. More on resolvers can be found in the [tutorial on Resolvers](tutorial_resolver.md). Here's an example of issuing a Verifiable Credential using DIDs, provided that you've created and a DID that you store in `issuerDID`: + ```javascript -const issuerKey = getKeyDoc(issuerDID, dock.keyring.addFromUri(issuerSeed, null, 'ed25519'), 'Ed25519VerificationKey2018'); +const issuerKey = getKeyDoc( + issuerDID, + dock.keyring.addFromUri(issuerSeed, null, "ed25519"), + "Ed25519VerificationKey2018" +); await vc.sign(issuerKey); -const verificationResult = await signedCredential.verify({ resolver, compactProof: true }); +const verificationResult = await signedCredential.verify({ + resolver, + compactProof: true, +}); console.log(verificationResult.verified); // Should print `true` ``` ## Creating a keyDoc + It can be seen from the above examples that signing of credentials and presentations require keypairs to be formatted into a `keyDoc` object. @@ -471,7 +531,9 @@ keyring for Sr25519 and Ed25519 or keypair generated with and a `type` string containing the type of the provided key (one of the supported 'Sr25519VerificationKey2020', 'Ed25519VerificationKey2018' or 'EcdsaSecp256k1VerificationKey2019'): + ```javascript - const keyDoc = getKeyDoc(did, keypair, type) +const keyDoc = getKeyDoc(did, keypair, type); ``` + Please check the example on the [previous section](#using-dids) or refer to the [presenting integration tests](../../tests/integration/presenting.test.js) for a live example. diff --git a/tutorials/src/tutorial_private_delegation.md b/tutorials/src/tutorial_private_delegation.md index a2ce6c32c..afd27a20a 100644 --- a/tutorials/src/tutorial_private_delegation.md +++ b/tutorials/src/tutorial_private_delegation.md @@ -29,14 +29,14 @@ async function verifyPresentation(presentation) { ... } ```js const delegation = { - '@context': [ 'https://www.w3.org/2018/credentials/v1' ], + "@context": ["https://www.w3.org/2018/credentials/v1"], id: uuid(), - type: [ 'VerifiableCredential' ], - issuer: 'did:ex:a', + type: ["VerifiableCredential"], + issuer: "did:ex:a", credentialSubject: { - id: 'did:ex:b', - 'https://rdf.dock.io/alpha/2021#mayClaim': - 'https://rdf.dock.io/alpha/2021#ANYCLAIM' + id: "did:ex:b", + "https://rdf.dock.io/alpha/2021#mayClaim": + "https://rdf.dock.io/alpha/2021#ANYCLAIM", }, issuanceDate: new Date().toISOString(), }; @@ -51,13 +51,13 @@ Next `did:ex:a` sends the signed credential to `did:ex:b`. ```js const newcred = { - '@context': [ 'https://www.w3.org/2018/credentials/v1' ], + "@context": ["https://www.w3.org/2018/credentials/v1"], id: uuid(), - type: [ 'VerifiableCredential' ], - issuer: 'did:ex:b', + type: ["VerifiableCredential"], + issuer: "did:ex:b", credentialSubject: { - id: 'did:ex:c', - 'https://example.com/score': 100, + id: "did:ex:c", + "https://example.com/score": 100, }, issuanceDate: new Date().toISOString(), }; @@ -66,19 +66,19 @@ const signed_newcred = signCredential(newcred, didb_secret); So far we have two credentials, `signed_delegation` and `signed_newcred`. `signed_delegation` proves that any claim made by `did:ex:b` is effectively a claim made by `did:ex:a`. `signed_newcred` proves tha `did:ex:b` claims that `did:ex:c` has a score of 100. By applying one of the logical rules provided by the sdk, we can infer that `did:ex:a` claims `did:ex:c` has a score of 100. The logical rule named `MAYCLAIM_DEF_1` will work for this use-case. `MAYCLAIM_DEF_1` will be used by the verifier. -Now `did:ex:b` has both signed credentials. `did:ex:b` may now pass both credentials to the *holder*. In this case the holder is `did:ex:c`. `did:ex:c` also happens to be the *subject* of one of the credentials. +Now `did:ex:b` has both signed credentials. `did:ex:b` may now pass both credentials to the _holder_. In this case the holder is `did:ex:c`. `did:ex:c` also happens to be the _subject_ of one of the credentials. ## Present a Delegated Credential -`did:ex:c` now holds two credentials, `signed_delegation` and `signed_newcred`. Together they prove that `did:ex:a` indirectly claims `did:ex:c` to have a score of 100. `did:ex:c` wants to prove this statement to another party, a *verifier*. `did:ex:c` must bundle the two credentials into a VCDM *presentation*. +`did:ex:c` now holds two credentials, `signed_delegation` and `signed_newcred`. Together they prove that `did:ex:a` indirectly claims `did:ex:c` to have a score of 100. `did:ex:c` wants to prove this statement to another party, a _verifier_. `did:ex:c` must bundle the two credentials into a VCDM _presentation_. ```js let presentation = { - '@context': [ 'https://www.w3.org/2018/credentials/v1' ], - type: [ 'VerifiablePresentation' ], + "@context": ["https://www.w3.org/2018/credentials/v1"], + type: ["VerifiablePresentation"], id: uuid(), holder: `did:ex:c`, - verifiableCredential: [ signed_delegation, signed_newcred ], + verifiableCredential: [signed_delegation, signed_newcred], }; ``` @@ -86,7 +86,7 @@ let presentation = { ## Accept a Delegated Credential -The verifier receives `presentation`, *verifies the enclosed credentials*, then reasons over the union of all the credentials in the bundle using the rule `MAYCLAIM_DEF_1`. The process is the one outlined in [Verifier-Side Reasoning](./tutorial_claim_deduction.md#verifier-side-reasoning) but using a different composite claim and a different rule list. +The verifier receives `presentation`, _verifies the enclosed credentials_, then reasons over the union of all the credentials in the bundle using the rule `MAYCLAIM_DEF_1`. The process is the one outlined in [Verifier-Side Reasoning](./tutorial_claim_deduction.md#verifier-side-reasoning) but using a different composite claim and a different rule list. ```js import { MAYCLAIM_DEF_1 } from '@docknetwork/sdk/rdf-defs'; diff --git a/tutorials/src/tutorial_public_delegation.md b/tutorials/src/tutorial_public_delegation.md index 2e672989f..050da4c9b 100644 --- a/tutorials/src/tutorial_public_delegation.md +++ b/tutorials/src/tutorial_public_delegation.md @@ -1,6 +1,6 @@ # Public Delegation -This feature should be considered *Alpha*. +This feature should be considered _Alpha_. Public Delegations use the same data model as Private Delegations. A delegator attests to some delegation. The verifier somehow gets and verifies that attestation then reasons over it in conjuction with a some credential. The difference is that while Private Delegations are passed around as credentials, Public Delegations are linked from the DID document of the delegator. @@ -61,7 +61,7 @@ A link to this ipfs document is then added to the delegators DID document. For a await setAttestation( delegatorDid, delegatorSk, - 'ipfs://Qmeg1Hqu2Dxf35TxDg19b7StQTMwjCqhWigm8ANgm8wA3p' + "ipfs://Qmeg1Hqu2Dxf35TxDg19b7StQTMwjCqhWigm8ANgm8wA3p" ); ``` @@ -82,15 +82,15 @@ As with any Public Attestations, delegation information is revocable by removing The following example shows how a verifier might ```js -import { ANYCLAIM, MAYCLAIM, MAYCLAIM_DEF_1 } from '@docknetwork/sdk/rdf-defs'; -import { crawl } from '@docknetwork/sdk/crawl.js'; +import { ANYCLAIM, MAYCLAIM, MAYCLAIM_DEF_1 } from "@docknetwork/sdk/rdf-defs"; +import { crawl } from "@docknetwork/sdk/crawl.js"; import { proveCompositeClaims, presentationToEEClaimGraph, inferh, -} from '@docknetwork/sdk/utils/cd'; -import { merge } from '@docknetwork/sdk/utils/claimgraph'; -import jsonld from 'jsonld'; +} from "@docknetwork/sdk/utils/cd"; +import { merge } from "@docknetwork/sdk/utils/claimgraph"; +import jsonld from "jsonld"; // These logical rules will be used for reasoning during both crawing and verifiying // credentials. @@ -102,18 +102,18 @@ const RULES = [ { if_all: [ [ - { Unbound: 'a' }, + { Unbound: "a" }, { Bound: { Iri: ATTESTS } }, - { Unbound: 'doc' }, - { Unbound: 'a' }, + { Unbound: "doc" }, + { Unbound: "a" }, ], ], then: [ [ - { Unbound: 'doc' }, + { Unbound: "doc" }, { Bound: { Iri: MAYCLAIM } }, { Bound: { Iri: ANYCLAIM } }, - { Unbound: 'a' }, + { Unbound: "a" }, ], ], }, @@ -134,7 +134,7 @@ const CURIOSITY = ` `; // To spark the crawlers interest we'll feed it some initial knowlege about did:ex:a . -const initialFacts = await resolveGraph({ Iri: 'did:ex:a' }); +const initialFacts = await resolveGraph({ Iri: "did:ex:a" }); // `allFact` contains our delegation information, it will be merged with verified // credentials in order to reason over delegations diff --git a/tutorials/src/tutorial_resolver.md b/tutorials/src/tutorial_resolver.md index 473cdb962..35edd169c 100644 --- a/tutorials/src/tutorial_resolver.md +++ b/tutorials/src/tutorial_resolver.md @@ -110,7 +110,11 @@ has resolvers for DID methods `dock` and `ethr`. For resolving DID of any other method, `UniversalResolver` object will be used. ```js -import { DockDIDResolver, DIDResolver, WILDCARD } from "@docknetwork/sdk/resolver"; +import { + DockDIDResolver, + DIDResolver, + WILDCARD, +} from "@docknetwork/sdk/resolver"; class MultiDIDResolver extends DIDResolver { static METHOD = WILDCARD; @@ -119,7 +123,7 @@ class MultiDIDResolver extends DIDResolver { super([ new DockDIDResolver(dock), new EtherResolver(ethereumProviderConfig), - new UniversalResolver(universalResolverUrl) + new UniversalResolver(universalResolverUrl), ]); } } diff --git a/tutorials/src/tutorial_revocation.md b/tutorials/src/tutorial_revocation.md deleted file mode 100644 index c76ed4cb6..000000000 --- a/tutorials/src/tutorial_revocation.md +++ /dev/null @@ -1,76 +0,0 @@ -# Revocation - -## Overview -Credential revocation is managed with on-chain revocation registries. To revoke a credential, its id (or hash of its id) must be -added to the credential. It is advised to have one revocation registry per credential type. Each registry has a unique id and -an associated policy. The policy determines who can update the revocation registry. The registry also has an "add-only" flag specifying -whether an id once added to the registry can be removed (leading to undoing the revocation) or not. -Similar to the replay protection mechanism for DIDs, for each registry, the last modified block number is kept which is updated -each time a credential is revoked or unrevoked. -For now, only one policy is supported which is that each registry is owned by a single DID. Also, neither the policy -nor the "add-only" flag can be updated post the creation of the registry for now. - -## Registry creation -To create a registry, first a `Policy` object needs to be created for which a DID is needed. It is advised that the DID -is registered on chain first (else someone can look at the registry a register the DID, thus controlling the registry). -```js -import {OneOfPolicy} from '@docknetwork/sdk/utils/revocation'; -const policy = new OneOfPolicy(); -policy.addOwner(ownerDID); - -// Or in a single step -const policy = new OneOfPolicy([ownerDID]); -``` - -Now create a random registry id. The registry id supposed to be unique among all registries on chain. -```js -import {createRandomRegistryId} from '@docknetwork/sdk/utils/revocation'; -const registryId = createRandomRegistryId(); -``` - -Now send the transaction to create a registry on-chain using `dock.revocation.newRegistry`. This method accepts the registry id, -the policy object and a boolean that specifies whether the registry is add-only or not meaning that whether undoing revocations -is allowed or not. Ifs `true`, it makes the registry add-only meaning that undoing revocations is not allowed, if `false`, -undoing is allowed. -```js -// Setting the last argument to false to allow unrevoking the credential (undoing revocation) -await dock.revocation.newRegistry(registryId, policy, false); -``` - -## Revoking a credential -Revoking a credential requires a signature from the owner of the registry. -Now get the registry id, `registryId` and the revocation id (the hash of credential id), `revokeId` and send the transaction on chain. -Revoking an already revoked credential has no effect. - -```js -await dock.revocation.revokeCredentialWithOneOfPolicy(registryId, revokeId, ownerDID, ownerKeypair, {didModule: dock.did}); -``` -Revoking multiple ids in a single transaction is possible but with a lower level method `dock.revocation.revoke`. See tests for its usage - -## Undoing a revocation -Similar to revocation, undoing the revocation also requires a signature from the owner of the registry. - -Get the registry id, `registryId` and the revocation id to undo, `revokeId` and send the transaction on chain. -Unrevoking an unrevoked credential has no effect. - -```js -await dock.revocation.unrevokeCredentialWithOneOfPolicy(registryId, revokeId, ownerDID, ownerKeypair, {didModule: dock.did}); -``` -Undoing revocation for multiple ids in a single transaction is possible but with a lower level method `dock.revocation.unrevoke`. See tests for its usage - -## Checking the revocation status -To check an id is revoked or not, call `dock.revocation.getIsRevoked` with the registry id and revocation id. Returns `true` -if revoked else `false`. -```js -const isRevoked = await dock.revocation.getIsRevoked(registryId, revokeId); -``` - -## Fetching the registry details -To get the details of the registry like policy, add-only status and block number when it was last updated, use `dock.revocation.getRegistryDetail` - -## Removing the registry -A registry can be deleted leading to all the corresponding revocation ids being deleted as well. This requires the signature -from owner like other updates. Use the `dock.revocation.removeRegistry` method to remove a registry. -```js -await dock.revocation.removeRegistryWithOneOfPolicy(registryId, ownerDID, ownerKeypair, {didModule: dock.did}, false); -``` diff --git a/tutorials/src/tutorials.md b/tutorials/src/tutorials.md index e9f56ded3..5e1c5b980 100644 --- a/tutorials/src/tutorials.md +++ b/tutorials/src/tutorials.md @@ -1,6 +1,5 @@ # Tutorials + 1. [DID](./tutorial_did.md) -1. [Revocation](./tutorial_revocation.md) -1. [Verifiable credentials](./tutorial_ipv.md) -1. [Blobs and Schemas](./tutorial_blobs_schemas.md) -1. [EVM integration](./tutorial_evm.md) +2. [Verifiable credentials](./tutorial_ipv.md) +3. [Blobs and Schemas](./tutorial_blobs_schemas.md) diff --git a/yarn.lock b/yarn.lock index f2fbb5f12..06e5b48f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27,20 +27,20 @@ xml2js "^0.6.2" "@ampproject/remapping@^2.2.0": - version "2.2.1" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" - integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" "@babel/cli@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.24.1.tgz#2e11e071e32fe82850b4fe514f56b9c9e1c44911" - integrity sha512-HbmrtxyFUr34LwAlV9jS+sSIjUp4FpdtIMGwgufY3AsxrIfsh/HxlMTywsONAZsU0RMYbZtbZFpUCrSGs7o0EA== + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.24.8.tgz#79eaa55a69c77cafbea3e87537fd1df5a5a2edf8" + integrity sha512-isdp+G6DpRyKc+3Gqxy2rjzgF7Zj9K0mzLNnxz+E/fgeag8qT3vVulX4gY9dGO1q0y+0lUv6V3a+uhUzMzrwXg== dependencies: "@jridgewell/trace-mapping" "^0.3.25" - commander "^4.0.1" + commander "^6.2.0" convert-source-map "^2.0.0" fs-readdir-recursive "^1.1.0" glob "^7.2.0" @@ -50,207 +50,102 @@ "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" chokidar "^3.4.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" - integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== - dependencies: - "@babel/highlight" "^7.18.6" - -"@babel/code-frame@^7.12.13": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" - integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== - dependencies: - "@babel/highlight" "^7.23.4" - chalk "^2.4.2" - -"@babel/code-frame@^7.22.10", "@babel/code-frame@^7.22.5": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.10.tgz#1c20e612b768fefa75f6e90d6ecb86329247f0a3" - integrity sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA== - dependencies: - "@babel/highlight" "^7.22.10" - chalk "^2.4.2" - -"@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.1", "@babel/code-frame@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" - integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== dependencies: - "@babel/highlight" "^7.24.2" + "@babel/highlight" "^7.24.7" picocolors "^1.0.0" -"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" - integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== - -"@babel/compat-data@^7.23.5", "@babel/compat-data@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.1.tgz#31c1f66435f2a9c329bb5716a6d6186c516c3742" - integrity sha512-Pc65opHDliVpRHuKfzI+gSA4zcgr65O4cl64fFJIWEEh8JoHIHh0Oez1Eo8Arz8zq/JhgKodQaxEwUPRtZylVA== - -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.14.6", "@babel/core@^7.23.9": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.0.tgz#56cbda6b185ae9d9bed369816a8f4423c5f2ff1b" - integrity sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.6" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.24.0" - "@babel/parser" "^7.24.0" - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.0" - "@babel/types" "^7.24.0" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.25.2": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" + integrity sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ== -"@babel/core@^7.24.3": - version "7.24.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.3.tgz#568864247ea10fbd4eff04dda1e05f9e2ea985c3" - integrity sha512-5FcvN1JHw2sHJChotgx8Ek0lyuh4kCKelgMTTqhYJJtloNvUfpAFMeNQUtdlIaktwrSV9LtCdqwk48wL2wBacQ== +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.14.6", "@babel/core@^7.23.9", "@babel/core@^7.24.3": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.25.2.tgz#ed8eec275118d7613e77a352894cd12ded8eba77" + integrity sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.24.2" - "@babel/generator" "^7.24.1" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.24.1" - "@babel/parser" "^7.24.1" - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.25.0" + "@babel/helper-compilation-targets" "^7.25.2" + "@babel/helper-module-transforms" "^7.25.2" + "@babel/helpers" "^7.25.0" + "@babel/parser" "^7.25.0" + "@babel/template" "^7.25.0" + "@babel/traverse" "^7.25.2" + "@babel/types" "^7.25.2" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.22.10": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.10.tgz#c92254361f398e160645ac58831069707382b722" - integrity sha512-79KIf7YiWjjdZ81JnLujDRApWtl7BxTqWD88+FFdQEIOG8LJ0etDOM7CXuIgGJa55sGOwZVwuEsaLEm0PJ5/+A== - dependencies: - "@babel/types" "^7.22.10" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" - jsesc "^2.5.1" - -"@babel/generator@^7.23.6", "@babel/generator@^7.7.2": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" - integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== - dependencies: - "@babel/types" "^7.23.6" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" - jsesc "^2.5.1" - -"@babel/generator@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.1.tgz#e67e06f68568a4ebf194d1c6014235344f0476d0" - integrity sha512-DfCRfZsBcrPEHUfuBMgbJ1Ut01Y/itOs+hY2nFLgqsqXd52/iSiVq5TITtUasIUgm+IIKdY2/1I7auiQOEeC9A== +"@babel/generator@^7.25.0", "@babel/generator@^7.7.2": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" + integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== dependencies: - "@babel/types" "^7.24.0" + "@babel/types" "^7.25.0" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" -"@babel/helper-annotate-as-pure@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" - integrity sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-annotate-as-pure@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz#e7f06737b197d580a01edf75d97e2c8be99d3882" - integrity sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-builder-binary-assignment-operator-visitor@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz#5426b109cf3ad47b91120f8328d8ab1be8b0b956" - integrity sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw== +"@babel/helper-annotate-as-pure@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz#5373c7bc8366b12a033b4be1ac13a206c6656aab" + integrity sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg== dependencies: - "@babel/types" "^7.22.15" + "@babel/types" "^7.24.7" -"@babel/helper-compilation-targets@^7.22.6": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz#01d648bbc25dd88f513d862ee0df27b7d4e67024" - integrity sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q== +"@babel/helper-builder-binary-assignment-operator-visitor@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.24.7.tgz#37d66feb012024f2422b762b9b2a7cfe27c7fba3" + integrity sha512-xZeCVVdwb4MsDBkkyZ64tReWYrLRHlMN72vP7Bdm3OUOuyFZExhsHUUnuWnm2/XOlAJzR0LfPpB56WXZn0X/lA== dependencies: - "@babel/compat-data" "^7.22.9" - "@babel/helper-validator-option" "^7.22.5" - browserslist "^4.21.9" - lru-cache "^5.1.1" - semver "^6.3.1" + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" -"@babel/helper-compilation-targets@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" - integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== +"@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.24.7", "@babel/helper-compilation-targets@^7.24.8", "@babel/helper-compilation-targets@^7.25.2": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz#e1d9410a90974a3a5a66e84ff55ef62e3c02d06c" + integrity sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw== dependencies: - "@babel/compat-data" "^7.23.5" - "@babel/helper-validator-option" "^7.23.5" - browserslist "^4.22.2" + "@babel/compat-data" "^7.25.2" + "@babel/helper-validator-option" "^7.24.8" + browserslist "^4.23.1" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.1.tgz#db58bf57137b623b916e24874ab7188d93d7f68f" - integrity sha512-1yJa9dX9g//V6fDebXoEfEsxkZHk3Hcbm+zLhyu6qVgYFLvmTALTeV+jNU9e5RnYtioBrGEOdoI2joMSNQ/+aA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-member-expression-to-functions" "^7.23.0" - "@babel/helper-optimise-call-expression" "^7.22.5" - "@babel/helper-replace-supers" "^7.24.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - semver "^6.3.1" - -"@babel/helper-create-regexp-features-plugin@^7.18.6": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz#7976aca61c0984202baca73d84e2337a5424a41b" - integrity sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.18.6" - regexpu-core "^5.1.0" - -"@babel/helper-create-regexp-features-plugin@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz#5ee90093914ea09639b01c711db0d6775e558be1" - integrity sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w== - dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - regexpu-core "^5.3.1" +"@babel/helper-create-class-features-plugin@^7.24.7": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.0.tgz#a109bf9c3d58dfed83aaf42e85633c89f43a6253" + integrity sha512-GYM6BxeQsETc9mnct+nIIpf63SAyzvyYN7UB/IlTyd+MBg06afFGp0mIeUqGyWgS2mxad6vqbMrHVlaL3m70sQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.24.7" + "@babel/helper-member-expression-to-functions" "^7.24.8" + "@babel/helper-optimise-call-expression" "^7.24.7" + "@babel/helper-replace-supers" "^7.25.0" + "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" + "@babel/traverse" "^7.25.0" semver "^6.3.1" -"@babel/helper-create-regexp-features-plugin@^7.22.5": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.9.tgz#9d8e61a8d9366fe66198f57c40565663de0825f6" - integrity sha512-+svjVa/tFwsNSG4NEy1h85+HQ5imbT92Q5/bgtS7P0GTQlP8WuFdqsiABmQouhiFGyV66oGxZFpeYHza1rNsKw== +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.24.7", "@babel/helper-create-regexp-features-plugin@^7.25.0": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.2.tgz#24c75974ed74183797ffd5f134169316cd1808d9" + integrity sha512-+wqVGP+DFmqwFD3EH6TMTfUNeqDehV3E/dl+Sd54eaXqm17tEUNbEIn4sVivVowbvUpOtIGxdo3GoXyDH9N/9g== dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-annotate-as-pure" "^7.24.7" regexpu-core "^5.3.1" semver "^6.3.1" -"@babel/helper-define-polyfill-provider@^0.6.1": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.1.tgz#fadc63f0c2ff3c8d02ed905dcea747c5b0fb74fd" - integrity sha512-o7SDgTJuvx5vLKD6SFvkydkSMBvahDKGiNJzG22IZYXhiqoe9efY7zocICBgzHV4IRg5wdgl2nEL/tulKIEIbA== +"@babel/helper-define-polyfill-provider@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz#18594f789c3594acb24cfdb4a7f7b7d2e8bd912d" + integrity sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ== dependencies: "@babel/helper-compilation-targets" "^7.22.6" "@babel/helper-plugin-utils" "^7.22.5" @@ -258,291 +153,177 @@ lodash.debounce "^4.0.8" resolve "^1.14.2" -"@babel/helper-environment-visitor@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" - integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== - -"@babel/helper-environment-visitor@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98" - integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q== - -"@babel/helper-function-name@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be" - integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ== - dependencies: - "@babel/template" "^7.22.5" - "@babel/types" "^7.22.5" - -"@babel/helper-function-name@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" - integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== - dependencies: - "@babel/template" "^7.22.15" - "@babel/types" "^7.23.0" - -"@babel/helper-hoist-variables@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" - integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-member-expression-to-functions@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz#9263e88cc5e41d39ec18c9a3e0eced59a3e7d366" - integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== - dependencies: - "@babel/types" "^7.23.0" - -"@babel/helper-module-imports@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" - integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== - dependencies: - "@babel/types" "^7.22.15" - -"@babel/helper-module-imports@^7.24.1": - version "7.24.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz#6ac476e6d168c7c23ff3ba3cf4f7841d46ac8128" - integrity sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg== - dependencies: - "@babel/types" "^7.24.0" - -"@babel/helper-module-transforms@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" - integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-module-imports" "^7.22.15" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.20" - -"@babel/helper-optimise-call-expression@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz#f21531a9ccbff644fdd156b4077c16ff0c3f609e" - integrity sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz#4796bb14961521f0f8715990bee2fb6e51ce21bf" - integrity sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw== - -"@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz#945681931a52f15ce879fd5b86ce2dae6d3d7f2a" - integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w== - -"@babel/helper-plugin-utils@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" - integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== - -"@babel/helper-remap-async-to-generator@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.20.tgz#7b68e1cb4fa964d2996fd063723fb48eca8498e0" - integrity sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-wrap-function" "^7.22.20" - -"@babel/helper-replace-supers@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.24.1.tgz#7085bd19d4a0b7ed8f405c1ed73ccb70f323abc1" - integrity sha512-QCR1UqC9BzG5vZl8BMicmZ28RuUBnHhAMddD8yHFHDRH9lLTZ9uUPehX8ctVPT8l0TKblJidqcgUUKGVrePleQ== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-member-expression-to-functions" "^7.23.0" - "@babel/helper-optimise-call-expression" "^7.22.5" - -"@babel/helper-simple-access@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" - integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-skip-transparent-expression-wrappers@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz#007f15240b5751c537c40e77abb4e89eeaaa8847" - integrity sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-string-parser@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" - integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== - -"@babel/helper-string-parser@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" - integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== - -"@babel/helper-string-parser@^7.23.4": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" - integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== - -"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" - integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== - -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/helper-validator-identifier@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" - integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ== - -"@babel/helper-validator-option@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz#de52000a15a177413c8234fa3a8af4ee8102d0ac" - integrity sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw== - -"@babel/helper-validator-option@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" - integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== - -"@babel/helper-wrap-function@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.20.tgz#15352b0b9bfb10fc9c76f79f6342c00e3411a569" - integrity sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw== - dependencies: - "@babel/helper-function-name" "^7.22.5" - "@babel/template" "^7.22.15" - "@babel/types" "^7.22.19" - -"@babel/helpers@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.0.tgz#a3dd462b41769c95db8091e49cfe019389a9409b" - integrity sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA== - dependencies: - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.0" - "@babel/types" "^7.24.0" - -"@babel/helpers@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.1.tgz#183e44714b9eba36c3038e442516587b1e0a1a94" - integrity sha512-BpU09QqEe6ZCHuIHFphEFgvNSrubve1FtyMton26ekZ85gRGi6LrTF7zArARp2YvyFxloeiRmtSCq5sjh1WqIg== - dependencies: - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" - -"@babel/highlight@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" - integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== - dependencies: - "@babel/helper-validator-identifier" "^7.18.6" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/highlight@^7.22.10": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.10.tgz#02a3f6d8c1cb4521b2fd0ab0da8f4739936137d7" - integrity sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ== - dependencies: - "@babel/helper-validator-identifier" "^7.22.5" - chalk "^2.4.2" - js-tokens "^4.0.0" - -"@babel/highlight@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" - integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== - dependencies: - "@babel/helper-validator-identifier" "^7.22.20" - chalk "^2.4.2" - js-tokens "^4.0.0" - -"@babel/highlight@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.2.tgz#3f539503efc83d3c59080a10e6634306e0370d26" - integrity sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA== - dependencies: - "@babel/helper-validator-identifier" "^7.22.20" +"@babel/helper-member-expression-to-functions@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz#6155e079c913357d24a4c20480db7c712a5c3fb6" + integrity sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA== + dependencies: + "@babel/traverse" "^7.24.8" + "@babel/types" "^7.24.8" + +"@babel/helper-module-imports@^7.18.6", "@babel/helper-module-imports@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" + integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-module-transforms@^7.24.7", "@babel/helper-module-transforms@^7.24.8", "@babel/helper-module-transforms@^7.25.0", "@babel/helper-module-transforms@^7.25.2": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz#ee713c29768100f2776edf04d4eb23b8d27a66e6" + integrity sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ== + dependencies: + "@babel/helper-module-imports" "^7.24.7" + "@babel/helper-simple-access" "^7.24.7" + "@babel/helper-validator-identifier" "^7.24.7" + "@babel/traverse" "^7.25.2" + +"@babel/helper-optimise-call-expression@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz#8b0a0456c92f6b323d27cfd00d1d664e76692a0f" + integrity sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.24.8", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz#94ee67e8ec0e5d44ea7baeb51e571bd26af07878" + integrity sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg== + +"@babel/helper-remap-async-to-generator@^7.24.7", "@babel/helper-remap-async-to-generator@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.0.tgz#d2f0fbba059a42d68e5e378feaf181ef6055365e" + integrity sha512-NhavI2eWEIz/H9dbrG0TuOicDhNexze43i5z7lEqwYm0WEZVTwnPpA0EafUTP7+6/W79HWIP2cTe3Z5NiSTVpw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.24.7" + "@babel/helper-wrap-function" "^7.25.0" + "@babel/traverse" "^7.25.0" + +"@babel/helper-replace-supers@^7.24.7", "@babel/helper-replace-supers@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.25.0.tgz#ff44deac1c9f619523fe2ca1fd650773792000a9" + integrity sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.24.8" + "@babel/helper-optimise-call-expression" "^7.24.7" + "@babel/traverse" "^7.25.0" + +"@babel/helper-simple-access@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" + integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-skip-transparent-expression-wrappers@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz#5f8fa83b69ed5c27adc56044f8be2b3ea96669d9" + integrity sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-string-parser@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" + integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ== + +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + +"@babel/helper-validator-option@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d" + integrity sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q== + +"@babel/helper-wrap-function@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.25.0.tgz#dab12f0f593d6ca48c0062c28bcfb14ebe812f81" + integrity sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ== + dependencies: + "@babel/template" "^7.25.0" + "@babel/traverse" "^7.25.0" + "@babel/types" "^7.25.0" + +"@babel/helpers@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.0.tgz#e69beb7841cb93a6505531ede34f34e6a073650a" + integrity sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw== + dependencies: + "@babel/template" "^7.25.0" + "@babel/types" "^7.25.0" + +"@babel/highlight@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.7" chalk "^2.4.2" js-tokens "^4.0.0" picocolors "^1.0.0" "@babel/node@^7.23.9": - version "7.23.9" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.23.9.tgz#fc40dc371439f1a45535ebf515232f4f046ef7a9" - integrity sha512-/d4ju/POwlGIJlZ+NqWH1qu61wt6ZlTZZZutrK2MOSdaH1JCh726nLw/GSvAjG+LTY6CO9SsB8uWcttnFKm6yg== + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.25.0.tgz#ea4511520a20f16b8d18df2c2db90d443929ac6d" + integrity sha512-fgdlIcf1vLeZ6gUHcl799Wbk6no5tnkGi6t1gpAb1a97ZB+KCRp8Sgb7acGTjnFhOzqzcsbJ4+wzewqb6JM0tA== dependencies: - "@babel/register" "^7.23.7" - commander "^4.0.1" + "@babel/register" "^7.24.6" + commander "^6.2.0" core-js "^3.30.2" node-environment-flags "^1.0.5" regenerator-runtime "^0.14.0" v8flags "^3.1.1" -"@babel/parser@^7.1.0", "@babel/parser@^7.9.4": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.1.tgz#3e045a92f7b4623cafc2425eddcb8cf2e54f9cc5" - integrity sha512-hp0AYxaZJhxULfM1zyp7Wgr+pSUKBcP3M+PHnSzWGdXOzg/kHWIgiUWARvubhUKGOEw3xqY4x+lyZ9ytBVcELw== - -"@babel/parser@^7.14.7", "@babel/parser@^7.23.9": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" - integrity sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.0", "@babel/parser@^7.25.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.4": + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" + integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== + dependencies: + "@babel/types" "^7.25.2" -"@babel/parser@^7.20.7", "@babel/parser@^7.22.10", "@babel/parser@^7.22.5", "@babel/parser@^7.7.0": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.10.tgz#e37634f9a12a1716136c44624ef54283cabd3f55" - integrity sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ== +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.25.3": + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.3.tgz#dca427b45a6c0f5c095a1c639dfe2476a3daba7f" + integrity sha512-wUrcsxZg6rqBXG05HG1FPYgsP6EvwF4WpBbxIpWIIYnH8wG0gzx3yZY3dtEHas4sTAOGkbTsc9EGPxwff8lRoA== + dependencies: + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/traverse" "^7.25.3" -"@babel/parser@^7.24.0", "@babel/parser@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.1.tgz#1e416d3627393fab1cb5b0f2f1796a100ae9133a" - integrity sha512-Zo9c7N3xdOIQrNip7Lc9wvRPzlRtovHVE4lkz8WEDr7uYh/GMQhSiIgFxGIArRHYdJE5kxtZjAf8rT0xhdLCzg== +"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.0.tgz#cd0c583e01369ef51676bdb3d7b603e17d2b3f73" + integrity sha512-Bm4bH2qsX880b/3ziJ8KD711LT7z4u8CFudmjqle65AZj/HNUFhEf90dqYv6O86buWvSBmeQDjv0Tn2aF/bIBA== + dependencies: + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.24.1.tgz#b645d9ba8c2bc5b7af50f0fe949f9edbeb07c8cf" - integrity sha512-y4HqEnkelJIOQGd+3g1bTeKsA5c6qM7eOn7VggGVbBc0y8MLSKHacwcIE2PplNlQSj0PqS9rrXL/nkPVK+kUNg== +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.0.tgz#749bde80356b295390954643de7635e0dffabe73" + integrity sha512-lXwdNZtTmeVOOFtwM/WDe7yg1PL8sYhRk/XH0FzbR2HDQ0xC+EnQ/JHeoMYSavtU115tnUk0q9CDyq8si+LMAA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.24.1.tgz#da8261f2697f0f41b0855b91d3a20a1fbfd271d3" - integrity sha512-Hj791Ii4ci8HqnaKHAlLNs+zaLXb0EzSDhiAWp5VNlyvCNymYfacs64pxTxbH1znW/NcArSmwpmG9IKE/TUVVQ== +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.24.7.tgz#e4eabdd5109acc399b38d7999b2ef66fc2022f89" + integrity sha512-+izXIbke1T33mY4MSNnrqhPXDz01WYhEf3yF5NbnUtkiNnm+XBZJl3kNfoK6NKmYlz/D07+l2GWVK/QfDkNCuQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" - "@babel/plugin-transform-optional-chaining" "^7.24.1" + "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" + "@babel/plugin-transform-optional-chaining" "^7.24.7" -"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.24.1.tgz#1181d9685984c91d657b8ddf14f0487a6bab2988" - integrity sha512-m9m/fXsXLiHfwdgydIFnpk+7jlVbnvlK5B2EKiPdLUb6WX654ZaaEWJUjk8TftRbZpK0XibovlLWX4KIZhV6jw== +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.0.tgz#3a82a70e7cb7294ad2559465ebcb871dfbf078fb" + integrity sha512-tggFrk1AIShG/RUQbEwt2Tr/E+ObkfwrPjR6BjbRvsx24+PSjK8zrq0GWPNCjo8qpRx4DuJzlcvWJqlm+0h3kw== dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/traverse" "^7.25.0" "@babel/plugin-proposal-export-namespace-from@^7.14.5": version "7.18.9" @@ -571,7 +352,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3": +"@babel/plugin-syntax-class-properties@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== @@ -599,21 +380,28 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-import-assertions@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.24.1.tgz#db3aad724153a00eaac115a3fb898de544e34971" - integrity sha512-IuwnI5XnuF189t91XbxmXeCDz3qs6iDRO7GJ++wcfgeXNs/8FmIlKcpDSXNVyuLQxlwvskmI3Ct73wUODkJBlQ== +"@babel/plugin-syntax-import-assertions@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.24.7.tgz#2a0b406b5871a20a841240586b1300ce2088a778" + integrity sha512-Ec3NRUMoi8gskrkBe3fNmEQfxDvY8bgfQpz6jlk/41kX9eUjvpyqWU7PBP/pLAvMaSQjbMNKJmvX57jP+M6bPg== + dependencies: + "@babel/helper-plugin-utils" "^7.24.7" + +"@babel/plugin-syntax-import-attributes@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.24.7.tgz#b4f9ea95a79e6912480c4b626739f86a076624ca" + integrity sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-syntax-import-attributes@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.24.1.tgz#c66b966c63b714c4eec508fcf5763b1f2d381093" - integrity sha512-zhQTMH0X2nVLnb04tz+s7AMuasX8U0FnpE+nHTOhSOINjWMnopoZTxtIKsd45n4GQ/HIZLyfIpoul8e2m0DnRA== +"@babel/plugin-syntax-import-attributes@^7.25.6": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.6.tgz#6d4c78f042db0e82fd6436cd65fec5dc78ad2bde" + integrity sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-syntax-import-meta@^7.10.4", "@babel/plugin-syntax-import-meta@^7.8.3": +"@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== @@ -628,13 +416,13 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473" - integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg== + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz#39a1fa4a7e3d3d7f34e2acc6be585b718d30e02d" + integrity sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-syntax-logical-assignment-operators@^7.10.4", "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== @@ -648,7 +436,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-numeric-separator@^7.10.4", "@babel/plugin-syntax-numeric-separator@^7.8.3": +"@babel/plugin-syntax-numeric-separator@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== @@ -683,7 +471,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-top-level-await@^7.14.5", "@babel/plugin-syntax-top-level-await@^7.8.3": +"@babel/plugin-syntax-top-level-await@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== @@ -691,11 +479,11 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz#24f460c85dbbc983cd2b9c4994178bcc01df958f" - integrity sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ== + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz#58d458271b4d3b6bb27ee6ac9525acbb259bad1c" + integrity sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-unicode-sets-regex@^7.18.6": version "7.18.6" @@ -705,422 +493,421 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.1.tgz#2bf263617060c9cc45bcdbf492b8cc805082bf27" - integrity sha512-ngT/3NkRhsaep9ck9uj2Xhv9+xB1zShY3tM3g6om4xxCELwCDN4g4Aq5dRn48+0hasAql7s2hdBOysCfNpr4fw== +"@babel/plugin-transform-arrow-functions@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.7.tgz#4f6886c11e423bd69f3ce51dbf42424a5f275514" + integrity sha512-Dt9LQs6iEY++gXUwY03DNFat5C2NbO48jj+j/bSAz6b3HgPs39qcPiYt77fDObIcFwj3/C2ICX9YMwGflUoSHQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-async-generator-functions@^7.24.3": - version "7.24.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.24.3.tgz#8fa7ae481b100768cc9842c8617808c5352b8b89" - integrity sha512-Qe26CMYVjpQxJ8zxM1340JFNjZaF+ISWpr1Kt/jGo+ZTUzKkfw/pphEWbRCb+lmSM6k/TOgfYLvmbHkUQ0asIg== +"@babel/plugin-transform-async-generator-functions@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.0.tgz#b785cf35d73437f6276b1e30439a57a50747bddf" + integrity sha512-uaIi2FdqzjpAMvVqvB51S42oC2JEVgh0LDsGfZVDysWE8LrJtQC2jvKmOqEYThKyB7bDEb7BP1GYWDm7tABA0Q== dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-remap-async-to-generator" "^7.22.20" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/helper-remap-async-to-generator" "^7.25.0" "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/traverse" "^7.25.0" -"@babel/plugin-transform-async-to-generator@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.24.1.tgz#0e220703b89f2216800ce7b1c53cb0cf521c37f4" - integrity sha512-AawPptitRXp1y0n4ilKcGbRYWfbbzFWz2NqNu7dacYDtFtz0CMjG64b3LQsb3KIgnf4/obcUL78hfaOS7iCUfw== +"@babel/plugin-transform-async-to-generator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.24.7.tgz#72a3af6c451d575842a7e9b5a02863414355bdcc" + integrity sha512-SQY01PcJfmQ+4Ash7NE+rpbLFbmqA2GPIgqzxfFTL4t1FKRq4zTms/7htKpoCUI9OcFYgzqfmCdH53s6/jn5fA== dependencies: - "@babel/helper-module-imports" "^7.24.1" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-remap-async-to-generator" "^7.22.20" + "@babel/helper-module-imports" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-remap-async-to-generator" "^7.24.7" -"@babel/plugin-transform-block-scoped-functions@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.24.1.tgz#1c94799e20fcd5c4d4589523bbc57b7692979380" - integrity sha512-TWWC18OShZutrv9C6mye1xwtam+uNi2bnTOCBUd5sZxyHOiWbU6ztSROofIMrK84uweEZC219POICK/sTYwfgg== +"@babel/plugin-transform-block-scoped-functions@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.24.7.tgz#a4251d98ea0c0f399dafe1a35801eaba455bbf1f" + integrity sha512-yO7RAz6EsVQDaBH18IDJcMB1HnrUn2FJ/Jslc/WtPPWcjhpUJXU/rjbwmluzp7v/ZzWcEhTMXELnnsz8djWDwQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-block-scoping@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.24.1.tgz#27af183d7f6dad890531256c7a45019df768ac1f" - integrity sha512-h71T2QQvDgM2SmT29UYU6ozjMlAt7s7CSs5Hvy8f8cf/GM/Z4a2zMfN+fjVGaieeCrXR3EdQl6C4gQG+OgmbKw== +"@babel/plugin-transform-block-scoping@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.0.tgz#23a6ed92e6b006d26b1869b1c91d1b917c2ea2ac" + integrity sha512-yBQjYoOjXlFv9nlXb3f1casSHOZkWr29NX+zChVanLg5Nc157CrbEX9D7hxxtTpuFy7Q0YzmmWfJxzvps4kXrQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-transform-class-properties@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.24.1.tgz#bcbf1aef6ba6085cfddec9fc8d58871cf011fc29" - integrity sha512-OMLCXi0NqvJfORTaPQBwqLXHhb93wkBKZ4aNwMl6WtehO7ar+cmp+89iPEQPqxAnxsOKTaMcs3POz3rKayJ72g== +"@babel/plugin-transform-class-properties@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.24.7.tgz#256879467b57b0b68c7ddfc5b76584f398cd6834" + integrity sha512-vKbfawVYayKcSeSR5YYzzyXvsDFWU2mD8U5TFeXtbCPLFUqe7GyCgvO6XDHzje862ODrOwy6WCPmKeWHbCFJ4w== dependencies: - "@babel/helper-create-class-features-plugin" "^7.24.1" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-class-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-class-static-block@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.24.1.tgz#4e37efcca1d9f2fcb908d1bae8b56b4b6e9e1cb6" - integrity sha512-FUHlKCn6J3ERiu8Dv+4eoz7w8+kFLSyeVG4vDAikwADGjUCoHw/JHokyGtr8OR4UjpwPVivyF+h8Q5iv/JmrtA== +"@babel/plugin-transform-class-static-block@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.24.7.tgz#c82027ebb7010bc33c116d4b5044fbbf8c05484d" + integrity sha512-HMXK3WbBPpZQufbMG4B46A90PkuuhN9vBCb5T8+VAHqvAqvcLi+2cKoukcpmUYkszLhScU3l1iudhrks3DggRQ== dependencies: - "@babel/helper-create-class-features-plugin" "^7.24.1" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-class-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-class-static-block" "^7.14.5" -"@babel/plugin-transform-classes@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.24.1.tgz#5bc8fc160ed96378184bc10042af47f50884dcb1" - integrity sha512-ZTIe3W7UejJd3/3R4p7ScyyOoafetUShSf4kCqV0O7F/RiHxVj/wRaRnQlrGwflvcehNA8M42HkAiEDYZu2F1Q== - dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-replace-supers" "^7.24.1" - "@babel/helper-split-export-declaration" "^7.22.6" +"@babel/plugin-transform-classes@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.0.tgz#63122366527d88e0ef61b612554fe3f8c793991e" + integrity sha512-xyi6qjr/fYU304fiRwFbekzkqVJZ6A7hOjWZd+89FVcBqPV3S9Wuozz82xdpLspckeaafntbzglaW4pqpzvtSw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.24.7" + "@babel/helper-compilation-targets" "^7.24.8" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/helper-replace-supers" "^7.25.0" + "@babel/traverse" "^7.25.0" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.24.1.tgz#bc7e787f8e021eccfb677af5f13c29a9934ed8a7" - integrity sha512-5pJGVIUfJpOS+pAqBQd+QMaTD2vCL/HcePooON6pDpHgRp4gNRmzyHTPIkXntwKsq3ayUFVfJaIKPw2pOkOcTw== +"@babel/plugin-transform-computed-properties@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.24.7.tgz#4cab3214e80bc71fae3853238d13d097b004c707" + integrity sha512-25cS7v+707Gu6Ds2oY6tCkUwsJ9YIDbggd9+cu9jzzDgiNq7hR/8dkzxWfKWnTic26vsI3EsCXNd4iEB6e8esQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/template" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" + "@babel/template" "^7.24.7" -"@babel/plugin-transform-destructuring@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.24.1.tgz#b1e8243af4a0206841973786292b8c8dd8447345" - integrity sha512-ow8jciWqNxR3RYbSNVuF4U2Jx130nwnBnhRw6N6h1bOejNkABmcI5X5oz29K4alWX7vf1C+o6gtKXikzRKkVdw== +"@babel/plugin-transform-destructuring@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.24.8.tgz#c828e814dbe42a2718a838c2a2e16a408e055550" + integrity sha512-36e87mfY8TnRxc7yc6M9g9gOB7rKgSahqkIKwLpz4Ppk2+zC2Cy1is0uwtuSG6AE4zlTOUa+7JGz9jCJGLqQFQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-transform-dotall-regex@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.24.1.tgz#d56913d2f12795cc9930801b84c6f8c47513ac13" - integrity sha512-p7uUxgSoZwZ2lPNMzUkqCts3xlp8n+o05ikjy7gbtFJSt9gdU88jAmtfmOxHM14noQXBxfgzf2yRWECiNVhTCw== +"@babel/plugin-transform-dotall-regex@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.24.7.tgz#5f8bf8a680f2116a7207e16288a5f974ad47a7a0" + integrity sha512-ZOA3W+1RRTSWvyqcMJDLqbchh7U4NRGqwRfFSVbOLS/ePIP4vHB5e8T8eXcuqyN1QkgKyj5wuW0lcS85v4CrSw== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.22.15" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-regexp-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-duplicate-keys@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.24.1.tgz#5347a797fe82b8d09749d10e9f5b83665adbca88" - integrity sha512-msyzuUnvsjsaSaocV6L7ErfNsa5nDWL1XKNnDePLgmz+WdU4w/J8+AxBMrWfi9m4IxfL5sZQKUPQKDQeeAT6lA== +"@babel/plugin-transform-duplicate-keys@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.24.7.tgz#dd20102897c9a2324e5adfffb67ff3610359a8ee" + integrity sha512-JdYfXyCRihAe46jUIliuL2/s0x0wObgwwiGxw/UbgJBr20gQBThrokO4nYKgWkD7uBaqM7+9x5TU7NkExZJyzw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-dynamic-import@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.24.1.tgz#2a5a49959201970dd09a5fca856cb651e44439dd" - integrity sha512-av2gdSTyXcJVdI+8aFZsCAtR29xJt0S5tas+Ef8NvBNmD1a+N/3ecMLeMBgfcK+xzsjdLDT6oHt+DFPyeqUbDA== +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.0.tgz#809af7e3339466b49c034c683964ee8afb3e2604" + integrity sha512-YLpb4LlYSc3sCUa35un84poXoraOiQucUTTu8X1j18JV+gNa8E0nyUf/CjZ171IRGr4jEguF+vzJU66QZhn29g== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-regexp-features-plugin" "^7.25.0" + "@babel/helper-plugin-utils" "^7.24.8" + +"@babel/plugin-transform-dynamic-import@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.24.7.tgz#4d8b95e3bae2b037673091aa09cd33fecd6419f4" + integrity sha512-sc3X26PhZQDb3JhORmakcbvkeInvxz+A8oda99lj7J60QRuPZvNAk9wQlTBS1ZynelDrDmTU4pw1tyc5d5ZMUg== + dependencies: + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-dynamic-import" "^7.8.3" -"@babel/plugin-transform-exponentiation-operator@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.24.1.tgz#6650ebeb5bd5c012d5f5f90a26613a08162e8ba4" - integrity sha512-U1yX13dVBSwS23DEAqU+Z/PkwE9/m7QQy8Y9/+Tdb8UWYaGNDYwTLi19wqIAiROr8sXVum9A/rtiH5H0boUcTw== +"@babel/plugin-transform-exponentiation-operator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.24.7.tgz#b629ee22645f412024297d5245bce425c31f9b0d" + integrity sha512-Rqe/vSc9OYgDajNIK35u7ot+KeCoetqQYFXM4Epf7M7ez3lWlOjrDjrwMei6caCVhfdw+mIKD4cgdGNy5JQotQ== dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.22.15" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-export-namespace-from@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.24.1.tgz#f033541fc036e3efb2dcb58eedafd4f6b8078acd" - integrity sha512-Ft38m/KFOyzKw2UaJFkWG9QnHPG/Q/2SkOrRk4pNBPg5IPZ+dOxcmkK5IyuBcxiNPyyYowPGUReyBvrvZs7IlQ== +"@babel/plugin-transform-export-namespace-from@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.24.7.tgz#176d52d8d8ed516aeae7013ee9556d540c53f197" + integrity sha512-v0K9uNYsPL3oXZ/7F9NNIbAj2jv1whUEtyA6aujhekLs56R++JDQuzRcP2/z4WX5Vg/c5lE9uWZA0/iUoFhLTA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" -"@babel/plugin-transform-for-of@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.1.tgz#67448446b67ab6c091360ce3717e7d3a59e202fd" - integrity sha512-OxBdcnF04bpdQdR3i4giHZNZQn7cm8RQKcSwA17wAAqEELo1ZOwp5FFgeptWUQXFyT9kwHo10aqqauYkRZPCAg== +"@babel/plugin-transform-for-of@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.7.tgz#f25b33f72df1d8be76399e1b8f3f9d366eb5bc70" + integrity sha512-wo9ogrDG1ITTTBsy46oGiN1dS9A7MROBTcYsfS8DtsImMkHk9JXJ3EWQM6X2SUw4x80uGPlwj0o00Uoc6nEE3g== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" -"@babel/plugin-transform-function-name@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.24.1.tgz#8cba6f7730626cc4dfe4ca2fa516215a0592b361" - integrity sha512-BXmDZpPlh7jwicKArQASrj8n22/w6iymRnvHYYd2zO30DbE277JO20/7yXJT3QxDPtiQiOxQBbZH4TpivNXIxA== +"@babel/plugin-transform-function-name@^7.25.1": + version "7.25.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.1.tgz#b85e773097526c1a4fc4ba27322748643f26fc37" + integrity sha512-TVVJVdW9RKMNgJJlLtHsKDTydjZAbwIsn6ySBPQaEAUU5+gVvlJt/9nRmqVbsV/IBanRjzWoaAQKLoamWVOUuA== dependencies: - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-compilation-targets" "^7.24.8" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/traverse" "^7.25.1" -"@babel/plugin-transform-json-strings@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.24.1.tgz#08e6369b62ab3e8a7b61089151b161180c8299f7" - integrity sha512-U7RMFmRvoasscrIFy5xA4gIp8iWnWubnKkKuUGJjsuOH7GfbMkB+XZzeslx2kLdEGdOJDamEmCqOks6e8nv8DQ== +"@babel/plugin-transform-json-strings@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.24.7.tgz#f3e9c37c0a373fee86e36880d45b3664cedaf73a" + integrity sha512-2yFnBGDvRuxAaE/f0vfBKvtnvvqU8tGpMHqMNpTN2oWMKIR3NqFkjaAgGwawhqK/pIN2T3XdjGPdaG0vDhOBGw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-json-strings" "^7.8.3" -"@babel/plugin-transform-literals@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.24.1.tgz#0a1982297af83e6b3c94972686067df588c5c096" - integrity sha512-zn9pwz8U7nCqOYIiBaOxoQOtYmMODXTJnkxG4AtX8fPmnCRYWBOHD0qcpwS9e2VDSp1zNJYpdnFMIKb8jmwu6g== +"@babel/plugin-transform-literals@^7.25.2": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.2.tgz#deb1ad14fc5490b9a65ed830e025bca849d8b5f3" + integrity sha512-HQI+HcTbm9ur3Z2DkO+jgESMAMcYLuN/A7NRw9juzxAezN9AvqvUTnpKP/9kkYANz6u7dFlAyOu44ejuGySlfw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-transform-logical-assignment-operators@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.24.1.tgz#719d8aded1aa94b8fb34e3a785ae8518e24cfa40" - integrity sha512-OhN6J4Bpz+hIBqItTeWJujDOfNP+unqv/NJgyhlpSqgBTPm37KkMmZV6SYcOj+pnDbdcl1qRGV/ZiIjX9Iy34w== +"@babel/plugin-transform-logical-assignment-operators@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.24.7.tgz#a58fb6eda16c9dc8f9ff1c7b1ba6deb7f4694cb0" + integrity sha512-4D2tpwlQ1odXmTEIFWy9ELJcZHqrStlzK/dAOWYyxX3zT0iXQB6banjgeOJQXzEc4S0E0a5A+hahxPaEFYftsw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" -"@babel/plugin-transform-member-expression-literals@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.24.1.tgz#896d23601c92f437af8b01371ad34beb75df4489" - integrity sha512-4ojai0KysTWXzHseJKa1XPNXKRbuUrhkOPY4rEGeR+7ChlJVKxFa3H3Bz+7tWaGKgJAXUWKOGmltN+u9B3+CVg== - dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - -"@babel/plugin-transform-modules-amd@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.24.1.tgz#b6d829ed15258536977e9c7cc6437814871ffa39" - integrity sha512-lAxNHi4HVtjnHd5Rxg3D5t99Xm6H7b04hUS7EHIXcUl2EV4yl1gWdqZrNzXnSrHveL9qMdbODlLF55mvgjAfaQ== +"@babel/plugin-transform-member-expression-literals@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.24.7.tgz#3b4454fb0e302e18ba4945ba3246acb1248315df" + integrity sha512-T/hRC1uqrzXMKLQ6UCwMT85S3EvqaBXDGf0FaMf4446Qx9vKwlghvee0+uuZcDUCZU5RuNi4781UQ7R308zzBw== dependencies: - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-modules-commonjs@^7.14.5": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.3.tgz#661ae831b9577e52be57dd8356b734f9700b53b4" - integrity sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA== +"@babel/plugin-transform-modules-amd@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.24.7.tgz#65090ed493c4a834976a3ca1cde776e6ccff32d7" + integrity sha512-9+pB1qxV3vs/8Hdmz/CulFB8w2tuu6EB94JZFsjdqxQokwGa9Unap7Bo2gGBGIvPmDIVvQrom7r5m/TCDMURhg== dependencies: - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-module-transforms" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-modules-commonjs@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.1.tgz#e71ba1d0d69e049a22bf90b3867e263823d3f1b9" - integrity sha512-szog8fFTUxBfw0b98gEWPaEqF42ZUD/T3bkynW/wtgx2p/XCP55WEsb+VosKceRSd6njipdZvNogqdtI4Q0chw== +"@babel/plugin-transform-modules-commonjs@^7.14.5", "@babel/plugin-transform-modules-commonjs@^7.24.1", "@babel/plugin-transform-modules-commonjs@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz#ab6421e564b717cb475d6fff70ae7f103536ea3c" + integrity sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA== dependencies: - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-module-transforms" "^7.24.8" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/helper-simple-access" "^7.24.7" -"@babel/plugin-transform-modules-systemjs@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.24.1.tgz#2b9625a3d4e445babac9788daec39094e6b11e3e" - integrity sha512-mqQ3Zh9vFO1Tpmlt8QPnbwGHzNz3lpNEMxQb1kAemn/erstyqw1r9KeOlOfo3y6xAnFEcOv2tSyrXfmMk+/YZA== +"@babel/plugin-transform-modules-systemjs@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.0.tgz#8f46cdc5f9e5af74f3bd019485a6cbe59685ea33" + integrity sha512-YPJfjQPDXxyQWg/0+jHKj1llnY5f/R6a0p/vP4lPymxLu7Lvl4k2WMitqi08yxwQcCVUUdG9LCUj4TNEgAp3Jw== dependencies: - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-module-transforms" "^7.25.0" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/helper-validator-identifier" "^7.24.7" + "@babel/traverse" "^7.25.0" -"@babel/plugin-transform-modules-umd@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.24.1.tgz#69220c66653a19cf2c0872b9c762b9a48b8bebef" - integrity sha512-tuA3lpPj+5ITfcCluy6nWonSL7RvaG0AOTeAuvXqEKS34lnLzXpDb0dcP6K8jD0zWZFNDVly90AGFJPnm4fOYg== +"@babel/plugin-transform-modules-umd@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.24.7.tgz#edd9f43ec549099620df7df24e7ba13b5c76efc8" + integrity sha512-3aytQvqJ/h9z4g8AsKPLvD4Zqi2qT+L3j7XoFFu1XBlZWEl2/1kWnhmAbxpLgPrHSY0M6UA02jyTiwUVtiKR6A== dependencies: - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-module-transforms" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-named-capturing-groups-regex@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.22.5.tgz#67fe18ee8ce02d57c855185e27e3dc959b2e991f" - integrity sha512-YgLLKmS3aUBhHaxp5hi1WJTgOUb/NCuDHzGT9z9WTt3YG+CPRhJs6nprbStx6DnWM4dh6gt7SU3sZodbZ08adQ== +"@babel/plugin-transform-named-capturing-groups-regex@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.24.7.tgz#9042e9b856bc6b3688c0c2e4060e9e10b1460923" + integrity sha512-/jr7h/EWeJtk1U/uz2jlsCioHkZk1JJZVcc8oQsJ1dUlaJD83f4/6Zeh2aHt9BIFokHIsSeDfhUmju0+1GPd6g== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.22.5" - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-create-regexp-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-new-target@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.24.1.tgz#29c59988fa3d0157de1c871a28cd83096363cc34" - integrity sha512-/rurytBM34hYy0HKZQyA0nHbQgQNFm4Q/BOc9Hflxi2X3twRof7NaE5W46j4kQitm7SvACVRXsa6N/tSZxvPug== +"@babel/plugin-transform-new-target@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.24.7.tgz#31ff54c4e0555cc549d5816e4ab39241dfb6ab00" + integrity sha512-RNKwfRIXg4Ls/8mMTza5oPF5RkOW8Wy/WgMAp1/F1yZ8mMbtwXW+HDoJiOsagWrAhI5f57Vncrmr9XeT4CVapA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-nullish-coalescing-operator@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.1.tgz#0cd494bb97cb07d428bd651632cb9d4140513988" - integrity sha512-iQ+caew8wRrhCikO5DrUYx0mrmdhkaELgFa+7baMcVuhxIkN7oxt06CZ51D65ugIb1UWRQ8oQe+HXAVM6qHFjw== +"@babel/plugin-transform-nullish-coalescing-operator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.7.tgz#1de4534c590af9596f53d67f52a92f12db984120" + integrity sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" -"@babel/plugin-transform-numeric-separator@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.24.1.tgz#5bc019ce5b3435c1cadf37215e55e433d674d4e8" - integrity sha512-7GAsGlK4cNL2OExJH1DzmDeKnRv/LXq0eLUSvudrehVA5Rgg4bIrqEUW29FbKMBRT0ztSqisv7kjP+XIC4ZMNw== +"@babel/plugin-transform-numeric-separator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.24.7.tgz#bea62b538c80605d8a0fac9b40f48e97efa7de63" + integrity sha512-e6q1TiVUzvH9KRvicuxdBTUj4AdKSRwzIyFFnfnezpCfP2/7Qmbb8qbU2j7GODbl4JMkblitCQjKYUaX/qkkwA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-transform-object-rest-spread@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.1.tgz#5a3ce73caf0e7871a02e1c31e8b473093af241ff" - integrity sha512-XjD5f0YqOtebto4HGISLNfiNMTTs6tbkFf2TOqJlYKYmbo+mN9Dnpl4SRoofiziuOWMIyq3sZEUqLo3hLITFEA== +"@babel/plugin-transform-object-rest-spread@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.7.tgz#d13a2b93435aeb8a197e115221cab266ba6e55d6" + integrity sha512-4QrHAr0aXQCEFni2q4DqKLD31n2DL+RxcwnNjDFkSG0eNQ/xCavnRkfCUjsyqGC2OviNJvZOF/mQqZBw7i2C5Q== dependencies: - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-compilation-targets" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.24.1" + "@babel/plugin-transform-parameters" "^7.24.7" -"@babel/plugin-transform-object-super@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.24.1.tgz#e71d6ab13483cca89ed95a474f542bbfc20a0520" - integrity sha512-oKJqR3TeI5hSLRxudMjFQ9re9fBVUU0GICqM3J1mi8MqlhVr6hC/ZN4ttAyMuQR6EZZIY6h/exe5swqGNNIkWQ== +"@babel/plugin-transform-object-super@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.24.7.tgz#66eeaff7830bba945dd8989b632a40c04ed625be" + integrity sha512-A/vVLwN6lBrMFmMDmPPz0jnE6ZGx7Jq7d6sT/Ev4H65RER6pZ+kczlf1DthF5N0qaPHBsI7UXiE8Zy66nmAovg== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-replace-supers" "^7.24.1" + "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-replace-supers" "^7.24.7" -"@babel/plugin-transform-optional-catch-binding@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.24.1.tgz#92a3d0efe847ba722f1a4508669b23134669e2da" - integrity sha512-oBTH7oURV4Y+3EUrf6cWn1OHio3qG/PVwO5J03iSJmBg6m2EhKjkAu/xuaXaYwWW9miYtvbWv4LNf0AmR43LUA== +"@babel/plugin-transform-optional-catch-binding@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.24.7.tgz#00eabd883d0dd6a60c1c557548785919b6e717b4" + integrity sha512-uLEndKqP5BfBbC/5jTwPxLh9kqPWWgzN/f8w6UwAIirAEqiIVJWWY312X72Eub09g5KF9+Zn7+hT7sDxmhRuKA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" -"@babel/plugin-transform-optional-chaining@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.1.tgz#26e588acbedce1ab3519ac40cc748e380c5291e6" - integrity sha512-n03wmDt+987qXwAgcBlnUUivrZBPZ8z1plL0YvgQalLm+ZE5BMhGm94jhxXtA1wzv1Cu2aaOv1BM9vbVttrzSg== +"@babel/plugin-transform-optional-chaining@^7.24.7", "@babel/plugin-transform-optional-chaining@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.8.tgz#bb02a67b60ff0406085c13d104c99a835cdf365d" + integrity sha512-5cTOLSMs9eypEy8JUVvIKOu6NgvbJMnpG62VpIHrTmROdQ+L5mDAaI40g25k5vXti55JWNX5jCkq3HZxXBQANw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" "@babel/plugin-syntax-optional-chaining" "^7.8.3" -"@babel/plugin-transform-parameters@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.24.1.tgz#983c15d114da190506c75b616ceb0f817afcc510" - integrity sha512-8Jl6V24g+Uw5OGPeWNKrKqXPDw2YDjLc53ojwfMcKwlEoETKU9rU0mHUtcg9JntWI/QYzGAXNWEcVHZ+fR+XXg== +"@babel/plugin-transform-parameters@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.24.7.tgz#5881f0ae21018400e320fc7eb817e529d1254b68" + integrity sha512-yGWW5Rr+sQOhK0Ot8hjDJuxU3XLRQGflvT4lhlSY0DFvdb3TwKaY26CJzHtYllU0vT9j58hc37ndFPsqT1SrzA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-private-methods@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.24.1.tgz#a0faa1ae87eff077e1e47a5ec81c3aef383dc15a" - integrity sha512-tGvisebwBO5em4PaYNqt4fkw56K2VALsAbAakY0FjTYqJp7gfdrgr7YX76Or8/cpik0W6+tj3rZ0uHU9Oil4tw== +"@babel/plugin-transform-private-methods@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.24.7.tgz#e6318746b2ae70a59d023d5cc1344a2ba7a75f5e" + integrity sha512-COTCOkG2hn4JKGEKBADkA8WNb35TGkkRbI5iT845dB+NyqgO8Hn+ajPbSnIQznneJTa3d30scb6iz/DhH8GsJQ== dependencies: - "@babel/helper-create-class-features-plugin" "^7.24.1" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-class-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-private-property-in-object@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.24.1.tgz#756443d400274f8fb7896742962cc1b9f25c1f6a" - integrity sha512-pTHxDVa0BpUbvAgX3Gat+7cSciXqUcY9j2VZKTbSB6+VQGpNgNO9ailxTGHSXlqOnX1Hcx1Enme2+yv7VqP9bg== +"@babel/plugin-transform-private-property-in-object@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.24.7.tgz#4eec6bc701288c1fab5f72e6a4bbc9d67faca061" + integrity sha512-9z76mxwnwFxMyxZWEgdgECQglF2Q7cFLm0kMf8pGwt+GSJsY0cONKj/UuO4bOH0w/uAel3ekS4ra5CEAyJRmDA== dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-create-class-features-plugin" "^7.24.1" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-annotate-as-pure" "^7.24.7" + "@babel/helper-create-class-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" -"@babel/plugin-transform-property-literals@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.24.1.tgz#d6a9aeab96f03749f4eebeb0b6ea8e90ec958825" - integrity sha512-LetvD7CrHmEx0G442gOomRr66d7q8HzzGGr4PMHGr+5YIm6++Yke+jxj246rpvsbyhJwCLxcTn6zW1P1BSenqA== +"@babel/plugin-transform-property-literals@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.24.7.tgz#f0d2ed8380dfbed949c42d4d790266525d63bbdc" + integrity sha512-EMi4MLQSHfd2nrCqQEWxFdha2gBCqU4ZcCng4WBGZ5CJL4bBRW0ptdqqDdeirGZcpALazVVNJqRmsO8/+oNCBA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-regenerator@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.1.tgz#625b7545bae52363bdc1fbbdc7252b5046409c8c" - integrity sha512-sJwZBCzIBE4t+5Q4IGLaaun5ExVMRY0lYwos/jNecjMrVCygCdph3IKv0tkP5Fc87e/1+bebAmEAGBfnRD+cnw== +"@babel/plugin-transform-regenerator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.7.tgz#021562de4534d8b4b1851759fd7af4e05d2c47f8" + integrity sha512-lq3fvXPdimDrlg6LWBoqj+r/DEWgONuwjuOuQCSYgRroXDH/IdM1C0IZf59fL5cHLpjEH/O6opIRBbqv7ELnuA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" regenerator-transform "^0.15.2" -"@babel/plugin-transform-reserved-words@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.24.1.tgz#8de729f5ecbaaf5cf83b67de13bad38a21be57c1" - integrity sha512-JAclqStUfIwKN15HrsQADFgeZt+wexNQ0uLhuqvqAUFoqPMjEcFCYZBhq0LUdz6dZK/mD+rErhW71fbx8RYElg== +"@babel/plugin-transform-reserved-words@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.24.7.tgz#80037fe4fbf031fc1125022178ff3938bb3743a4" + integrity sha512-0DUq0pHcPKbjFZCfTss/pGkYMfy3vFWydkUBd9r0GHpIyfs2eCDENvqadMycRS9wZCXR41wucAfJHJmwA0UmoQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-shorthand-properties@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.1.tgz#ba9a09144cf55d35ec6b93a32253becad8ee5b55" - integrity sha512-LyjVB1nsJ6gTTUKRjRWx9C1s9hE7dLfP/knKdrfeH9UPtAGjYGgxIbFfx7xyLIEWs7Xe1Gnf8EWiUqfjLhInZA== +"@babel/plugin-transform-shorthand-properties@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.7.tgz#85448c6b996e122fa9e289746140aaa99da64e73" + integrity sha512-KsDsevZMDsigzbA09+vacnLpmPH4aWjcZjXdyFKGzpplxhbeB4wYtury3vglQkg6KM/xEPKt73eCjPPf1PgXBA== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-spread@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.24.1.tgz#a1acf9152cbf690e4da0ba10790b3ac7d2b2b391" - integrity sha512-KjmcIM+fxgY+KxPVbjelJC6hrH1CgtPmTvdXAfn3/a9CnWGSTY7nH4zm5+cjmWJybdcPSsD0++QssDsjcpe47g== +"@babel/plugin-transform-spread@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.24.7.tgz#e8a38c0fde7882e0fb8f160378f74bd885cc7bb3" + integrity sha512-x96oO0I09dgMDxJaANcRyD4ellXFLLiWhuwDxKZX5g2rWP1bTPkBSwCYv96VDXVT1bD9aPj8tppr5ITIh8hBng== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" -"@babel/plugin-transform-sticky-regex@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.24.1.tgz#f03e672912c6e203ed8d6e0271d9c2113dc031b9" - integrity sha512-9v0f1bRXgPVcPrngOQvLXeGNNVLc8UjMVfebo9ka0WF3/7+aVUHmaJVT3sa0XCzEFioPfPHZiOcYG9qOsH63cw== +"@babel/plugin-transform-sticky-regex@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.24.7.tgz#96ae80d7a7e5251f657b5cf18f1ea6bf926f5feb" + integrity sha512-kHPSIJc9v24zEml5geKg9Mjx5ULpfncj0wRpYtxbvKyTtHCYDkVE3aHQ03FrpEo4gEe2vrJJS1Y9CJTaThA52g== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-template-literals@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.1.tgz#15e2166873a30d8617e3e2ccadb86643d327aab7" - integrity sha512-WRkhROsNzriarqECASCNu/nojeXCDTE/F2HmRgOzi7NGvyfYGq1NEjKBK3ckLfRgGc6/lPAqP0vDOSw3YtG34g== +"@babel/plugin-transform-template-literals@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.7.tgz#a05debb4a9072ae8f985bcf77f3f215434c8f8c8" + integrity sha512-AfDTQmClklHCOLxtGoP7HkeMw56k1/bTQjwsfhL6pppo/M4TOBSq+jjBUBLmV/4oeFg4GWMavIl44ZeCtmmZTw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-typeof-symbol@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.24.1.tgz#6831f78647080dec044f7e9f68003d99424f94c7" - integrity sha512-CBfU4l/A+KruSUoW+vTQthwcAdwuqbpRNB8HQKlZABwHRhsdHZ9fezp4Sn18PeAlYxTNiLMlx4xUBV3AWfg1BA== +"@babel/plugin-transform-typeof-symbol@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.24.8.tgz#383dab37fb073f5bfe6e60c654caac309f92ba1c" + integrity sha512-adNTUpDCVnmAE58VEqKlAA6ZBlNkMnWD0ZcW76lyNFN3MJniyGFZfNwERVk8Ap56MCnXztmDr19T4mPTztcuaw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.8" -"@babel/plugin-transform-unicode-escapes@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.1.tgz#fb3fa16676549ac7c7449db9b342614985c2a3a4" - integrity sha512-RlkVIcWT4TLI96zM660S877E7beKlQw7Ig+wqkKBiWfj0zH5Q4h50q6er4wzZKRNSYpfo6ILJ+hrJAGSX2qcNw== +"@babel/plugin-transform-unicode-escapes@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.7.tgz#2023a82ced1fb4971630a2e079764502c4148e0e" + integrity sha512-U3ap1gm5+4edc2Q/P+9VrBNhGkfnf+8ZqppY71Bo/pzZmXhhLdqgaUl6cuB07O1+AQJtCLfaOmswiNbSQ9ivhw== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-unicode-property-regex@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.24.1.tgz#56704fd4d99da81e5e9f0c0c93cabd91dbc4889e" - integrity sha512-Ss4VvlfYV5huWApFsF8/Sq0oXnGO+jB+rijFEFugTd3cwSObUSnUi88djgR5528Csl0uKlrI331kRqe56Ov2Ng== +"@babel/plugin-transform-unicode-property-regex@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.24.7.tgz#9073a4cd13b86ea71c3264659590ac086605bbcd" + integrity sha512-uH2O4OV5M9FZYQrwc7NdVmMxQJOCCzFeYudlZSzUAHRFeOujQefa92E74TQDVskNHCzOXoigEuoyzHDhaEaK5w== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.22.15" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-regexp-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-unicode-regex@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.24.1.tgz#57c3c191d68f998ac46b708380c1ce4d13536385" - integrity sha512-2A/94wgZgxfTsiLaQ2E36XAOdcZmGAaEEgVmxQWwZXWkGhvoHbaqXcKnU8zny4ycpu3vNqg0L/PcCiYtHtA13g== +"@babel/plugin-transform-unicode-regex@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.24.7.tgz#dfc3d4a51127108099b19817c0963be6a2adf19f" + integrity sha512-hlQ96MBZSAXUq7ltkjtu3FJCCSMx/j629ns3hA3pXnBXjanNP0LHi+JpPeA81zaWgVK1VGH95Xuy7u0RyQ8kMg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.22.15" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-regexp-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-transform-unicode-sets-regex@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.24.1.tgz#c1ea175b02afcffc9cf57a9c4658326625165b7f" - integrity sha512-fqj4WuzzS+ukpgerpAoOnMfQXwUHFxXUZUE84oL2Kao2N8uSlvcpnAidKASgsNgzZHBsHWvcm8s9FPWUhAb8fA== +"@babel/plugin-transform-unicode-sets-regex@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.24.7.tgz#d40705d67523803a576e29c63cef6e516b858ed9" + integrity sha512-2G8aAvF4wy1w/AGZkemprdGMRg5o6zPNhbHVImRz3lss55TYCBd6xStN19rt8XJHq20sqV0JbyWjOWwQRwV/wg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.22.15" - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-create-regexp-features-plugin" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/preset-env@^7.24.3": - version "7.24.3" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.24.3.tgz#f3f138c844ffeeac372597b29c51b5259e8323a3" - integrity sha512-fSk430k5c2ff8536JcPvPWK4tZDwehWLGlBp0wrsBUjZVdeQV6lePbwKWZaZfK2vnh/1kQX1PzAJWsnBmVgGJA== - dependencies: - "@babel/compat-data" "^7.24.1" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-validator-option" "^7.23.5" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.24.1" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.24.1" - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.24.1" + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.25.3.tgz#0bf4769d84ac51d1073ab4a86f00f30a3a83c67c" + integrity sha512-QsYW7UeAaXvLPX9tdVliMJE7MD7M6MLYVTovRTIwhoYQVFHR1rM4wO8wqAezYi3/BpSD+NzVCZ69R6smWiIi8g== + dependencies: + "@babel/compat-data" "^7.25.2" + "@babel/helper-compilation-targets" "^7.25.2" + "@babel/helper-plugin-utils" "^7.24.8" + "@babel/helper-validator-option" "^7.24.8" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.25.3" + "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.25.0" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.25.0" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.24.7" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.25.0" "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-class-properties" "^7.12.13" "@babel/plugin-syntax-class-static-block" "^7.14.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - "@babel/plugin-syntax-import-assertions" "^7.24.1" - "@babel/plugin-syntax-import-attributes" "^7.24.1" + "@babel/plugin-syntax-import-assertions" "^7.24.7" + "@babel/plugin-syntax-import-attributes" "^7.24.7" "@babel/plugin-syntax-import-meta" "^7.10.4" "@babel/plugin-syntax-json-strings" "^7.8.3" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" @@ -1132,59 +919,60 @@ "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" - "@babel/plugin-transform-arrow-functions" "^7.24.1" - "@babel/plugin-transform-async-generator-functions" "^7.24.3" - "@babel/plugin-transform-async-to-generator" "^7.24.1" - "@babel/plugin-transform-block-scoped-functions" "^7.24.1" - "@babel/plugin-transform-block-scoping" "^7.24.1" - "@babel/plugin-transform-class-properties" "^7.24.1" - "@babel/plugin-transform-class-static-block" "^7.24.1" - "@babel/plugin-transform-classes" "^7.24.1" - "@babel/plugin-transform-computed-properties" "^7.24.1" - "@babel/plugin-transform-destructuring" "^7.24.1" - "@babel/plugin-transform-dotall-regex" "^7.24.1" - "@babel/plugin-transform-duplicate-keys" "^7.24.1" - "@babel/plugin-transform-dynamic-import" "^7.24.1" - "@babel/plugin-transform-exponentiation-operator" "^7.24.1" - "@babel/plugin-transform-export-namespace-from" "^7.24.1" - "@babel/plugin-transform-for-of" "^7.24.1" - "@babel/plugin-transform-function-name" "^7.24.1" - "@babel/plugin-transform-json-strings" "^7.24.1" - "@babel/plugin-transform-literals" "^7.24.1" - "@babel/plugin-transform-logical-assignment-operators" "^7.24.1" - "@babel/plugin-transform-member-expression-literals" "^7.24.1" - "@babel/plugin-transform-modules-amd" "^7.24.1" - "@babel/plugin-transform-modules-commonjs" "^7.24.1" - "@babel/plugin-transform-modules-systemjs" "^7.24.1" - "@babel/plugin-transform-modules-umd" "^7.24.1" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.22.5" - "@babel/plugin-transform-new-target" "^7.24.1" - "@babel/plugin-transform-nullish-coalescing-operator" "^7.24.1" - "@babel/plugin-transform-numeric-separator" "^7.24.1" - "@babel/plugin-transform-object-rest-spread" "^7.24.1" - "@babel/plugin-transform-object-super" "^7.24.1" - "@babel/plugin-transform-optional-catch-binding" "^7.24.1" - "@babel/plugin-transform-optional-chaining" "^7.24.1" - "@babel/plugin-transform-parameters" "^7.24.1" - "@babel/plugin-transform-private-methods" "^7.24.1" - "@babel/plugin-transform-private-property-in-object" "^7.24.1" - "@babel/plugin-transform-property-literals" "^7.24.1" - "@babel/plugin-transform-regenerator" "^7.24.1" - "@babel/plugin-transform-reserved-words" "^7.24.1" - "@babel/plugin-transform-shorthand-properties" "^7.24.1" - "@babel/plugin-transform-spread" "^7.24.1" - "@babel/plugin-transform-sticky-regex" "^7.24.1" - "@babel/plugin-transform-template-literals" "^7.24.1" - "@babel/plugin-transform-typeof-symbol" "^7.24.1" - "@babel/plugin-transform-unicode-escapes" "^7.24.1" - "@babel/plugin-transform-unicode-property-regex" "^7.24.1" - "@babel/plugin-transform-unicode-regex" "^7.24.1" - "@babel/plugin-transform-unicode-sets-regex" "^7.24.1" + "@babel/plugin-transform-arrow-functions" "^7.24.7" + "@babel/plugin-transform-async-generator-functions" "^7.25.0" + "@babel/plugin-transform-async-to-generator" "^7.24.7" + "@babel/plugin-transform-block-scoped-functions" "^7.24.7" + "@babel/plugin-transform-block-scoping" "^7.25.0" + "@babel/plugin-transform-class-properties" "^7.24.7" + "@babel/plugin-transform-class-static-block" "^7.24.7" + "@babel/plugin-transform-classes" "^7.25.0" + "@babel/plugin-transform-computed-properties" "^7.24.7" + "@babel/plugin-transform-destructuring" "^7.24.8" + "@babel/plugin-transform-dotall-regex" "^7.24.7" + "@babel/plugin-transform-duplicate-keys" "^7.24.7" + "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.25.0" + "@babel/plugin-transform-dynamic-import" "^7.24.7" + "@babel/plugin-transform-exponentiation-operator" "^7.24.7" + "@babel/plugin-transform-export-namespace-from" "^7.24.7" + "@babel/plugin-transform-for-of" "^7.24.7" + "@babel/plugin-transform-function-name" "^7.25.1" + "@babel/plugin-transform-json-strings" "^7.24.7" + "@babel/plugin-transform-literals" "^7.25.2" + "@babel/plugin-transform-logical-assignment-operators" "^7.24.7" + "@babel/plugin-transform-member-expression-literals" "^7.24.7" + "@babel/plugin-transform-modules-amd" "^7.24.7" + "@babel/plugin-transform-modules-commonjs" "^7.24.8" + "@babel/plugin-transform-modules-systemjs" "^7.25.0" + "@babel/plugin-transform-modules-umd" "^7.24.7" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.24.7" + "@babel/plugin-transform-new-target" "^7.24.7" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.24.7" + "@babel/plugin-transform-numeric-separator" "^7.24.7" + "@babel/plugin-transform-object-rest-spread" "^7.24.7" + "@babel/plugin-transform-object-super" "^7.24.7" + "@babel/plugin-transform-optional-catch-binding" "^7.24.7" + "@babel/plugin-transform-optional-chaining" "^7.24.8" + "@babel/plugin-transform-parameters" "^7.24.7" + "@babel/plugin-transform-private-methods" "^7.24.7" + "@babel/plugin-transform-private-property-in-object" "^7.24.7" + "@babel/plugin-transform-property-literals" "^7.24.7" + "@babel/plugin-transform-regenerator" "^7.24.7" + "@babel/plugin-transform-reserved-words" "^7.24.7" + "@babel/plugin-transform-shorthand-properties" "^7.24.7" + "@babel/plugin-transform-spread" "^7.24.7" + "@babel/plugin-transform-sticky-regex" "^7.24.7" + "@babel/plugin-transform-template-literals" "^7.24.7" + "@babel/plugin-transform-typeof-symbol" "^7.24.8" + "@babel/plugin-transform-unicode-escapes" "^7.24.7" + "@babel/plugin-transform-unicode-property-regex" "^7.24.7" + "@babel/plugin-transform-unicode-regex" "^7.24.7" + "@babel/plugin-transform-unicode-sets-regex" "^7.24.7" "@babel/preset-modules" "0.1.6-no-external-plugins" babel-plugin-polyfill-corejs2 "^0.4.10" babel-plugin-polyfill-corejs3 "^0.10.4" babel-plugin-polyfill-regenerator "^0.6.1" - core-js-compat "^3.31.0" + core-js-compat "^3.37.1" semver "^6.3.1" "@babel/preset-modules@0.1.6-no-external-plugins": @@ -1196,10 +984,10 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/register@^7.23.7": - version "7.23.7" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.23.7.tgz#485a5e7951939d21304cae4af1719fdb887bc038" - integrity sha512-EjJeB6+kvpk+Y5DAkEAmbOBEFkh9OASx0huoEkqYTFxAZHzOAX2Oh5uwAUuL2rUddqfM0SA+KPXV2TbzoZ2kvQ== +"@babel/register@^7.24.6": + version "7.24.6" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.24.6.tgz#59e21dcc79e1d04eed5377633b0f88029a6bef9e" + integrity sha512-WSuFCc2wCqMeXkz/i3yfAAsxwWflEgbVkZzivgAmXl/MxrXeoYFZOOPllbC8R8WTF7u61wSRQtDVZ1879cdu6w== dependencies: clone-deep "^4.0.1" find-cache-dir "^2.0.0" @@ -1212,104 +1000,49 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== +"@babel/runtime@^7.5.5": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.7.tgz#7ffb53c37a8f247c8c4d335e89cdf16a2e0d0fb6" + integrity sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/runtime@^7.8.4": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.1.tgz#1148bb33ab252b165a06698fde7576092a78b4a9" - integrity sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg== - dependencies: - regenerator-runtime "^0.13.10" - -"@babel/template@^7.22.15", "@babel/template@^7.24.0", "@babel/template@^7.3.3": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50" - integrity sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA== - dependencies: - "@babel/code-frame" "^7.23.5" - "@babel/parser" "^7.24.0" - "@babel/types" "^7.24.0" - -"@babel/template@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.5.tgz#0c8c4d944509875849bd0344ff0050756eefc6ec" - integrity sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw== - dependencies: - "@babel/code-frame" "^7.22.5" - "@babel/parser" "^7.22.5" - "@babel/types" "^7.22.5" - -"@babel/traverse@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.0.tgz#4a408fbf364ff73135c714a2ab46a5eab2831b1e" - integrity sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw== - dependencies: - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.6" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.24.0" - "@babel/types" "^7.24.0" - debug "^4.3.1" - globals "^11.1.0" + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.0.tgz#3af9a91c1b739c569d5d80cc917280919c544ecb" + integrity sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw== + dependencies: + regenerator-runtime "^0.14.0" -"@babel/traverse@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.1.tgz#d65c36ac9dd17282175d1e4a3c49d5b7988f530c" - integrity sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ== - dependencies: - "@babel/code-frame" "^7.24.1" - "@babel/generator" "^7.24.1" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.24.1" - "@babel/types" "^7.24.0" +"@babel/template@^7.24.7", "@babel/template@^7.25.0", "@babel/template@^7.3.3": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a" + integrity sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/parser" "^7.25.0" + "@babel/types" "^7.25.0" + +"@babel/traverse@^7.24.7", "@babel/traverse@^7.24.8", "@babel/traverse@^7.25.0", "@babel/traverse@^7.25.1", "@babel/traverse@^7.25.2", "@babel/traverse@^7.25.3", "@babel/traverse@^7.7.0": + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" + integrity sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.25.0" + "@babel/parser" "^7.25.3" + "@babel/template" "^7.25.0" + "@babel/types" "^7.25.2" debug "^4.3.1" globals "^11.1.0" -"@babel/traverse@^7.7.0": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.10.tgz#20252acb240e746d27c2e82b4484f199cf8141aa" - integrity sha512-Q/urqV4pRByiNNpb/f5OSv28ZlGJiFiiTh+GAHktbIrkPhPbl90+uW6SmpoLyZqutrg9AEaEf3Q/ZBRHBXgxig== - dependencies: - "@babel/code-frame" "^7.22.10" - "@babel/generator" "^7.22.10" - "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-function-name" "^7.22.5" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.22.10" - "@babel/types" "^7.22.10" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.3.0", "@babel/types@^7.4.4": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.0.tgz#52c94cf8a7e24e89d2a194c25c35b17a64871479" - integrity sha512-Jlgt3H0TajCW164wkTOTzHkZb075tMQMULzrLUoUeKmO7eFL96GgDxf7/Axhc5CAuKE3KFyVW1p6ysKsi2oXAg== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" + integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" - to-fast-properties "^2.0.0" - -"@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.5", "@babel/types@^7.7.0": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.10.tgz#4a9e76446048f2c66982d1a989dd12b8a2d2dc03" - integrity sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg== - dependencies: - "@babel/helper-string-parser" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.5" - to-fast-properties "^2.0.0" - -"@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.23.0", "@babel/types@^7.23.6", "@babel/types@^7.24.0", "@babel/types@^7.3.3": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" - integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== - dependencies: - "@babel/helper-string-parser" "^7.23.4" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-string-parser" "^7.24.8" + "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -1328,9 +1061,9 @@ integrity sha512-BpNcL8/lji/GM3+vZ/bgRWqJ1q5kwvTFmGPk7pxm/QQZDbaMI98waOHjEymTjq2JmdD/INdNBFOVSyJofXg7ew== "@chainsafe/as-sha256@^0.4.1": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.4.1.tgz#cfc0737e25f8c206767bdb6703e7943e5d44513e" - integrity sha512-IqeeGwQihK6Y2EYLFofqs2eY2ep1I2MvQXHzOAI+5iQN51OZlUkrLgyAugu2x86xZewDk5xas7lNczkzFzF62w== + version "0.4.2" + resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.4.2.tgz#21ad1371e2245e430c1a554a05f10d333c6f42cc" + integrity sha512-HJ8GZBRjLeWtRsAXf3EbNsNzmTGpzTFjfpSf4yHkLYC+E52DhT6hwz+7qpj6I/EmFzSUm5tYYvT9K8GZokLQCQ== "@chainsafe/is-ip@^2.0.1", "@chainsafe/is-ip@^2.0.2": version "2.0.2" @@ -1338,16 +1071,16 @@ integrity sha512-ndGqEMG1W5WkGagaqOZHpPU172AGdxr+LD15sv3WIUvT5oCFUrG1Y0CW/v2Egwj4JXEvSibaIIIqImsm98y1nA== "@chainsafe/libp2p-noise@^15.0.0": - version "15.0.0" - resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-noise/-/libp2p-noise-15.0.0.tgz#c3f38a31d03d96b475f7e35b592a22f5fe9269a0" - integrity sha512-O8Y/WVU4J/qrnG72jwVhbmdXiBzv1dT9B3PMClCRmZ9z/5vVPEGRVXE/SVYeGF3bNuBTLoh+F+GaKG/9UHlMhg== + version "15.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-noise/-/libp2p-noise-15.1.0.tgz#f30caa146d3d11c6dfd6da3c4510b664f8b0881c" + integrity sha512-84S/Uk7ZZRYpSlE5d1odMmQTl5g5Da8etgcf4QI7arTAHkvBs3il7yGHIPt4wV4EV0qIMG+XjdGIYihRXfI2/w== dependencies: "@chainsafe/as-chacha20poly1305" "^0.1.0" "@chainsafe/as-sha256" "^0.4.1" "@libp2p/crypto" "^4.0.0" - "@libp2p/interface" "^1.0.0" + "@libp2p/interface" "^1.5.0" "@libp2p/peer-id" "^4.0.0" - "@noble/ciphers" "^0.4.0" + "@noble/ciphers" "^0.5.1" "@noble/curves" "^1.1.0" "@noble/hashes" "^1.3.1" it-length-prefixed "^9.0.1" @@ -1380,10 +1113,238 @@ dependencies: "@chainsafe/is-ip" "^2.0.1" -"@colors/colors@1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" - integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== +"@changesets/apply-release-plan@^7.0.5": + version "7.0.5" + resolved "https://registry.yarnpkg.com/@changesets/apply-release-plan/-/apply-release-plan-7.0.5.tgz#3323c97afc08abc15e5136488f9c7cf1a864832e" + integrity sha512-1cWCk+ZshEkSVEZrm2fSj1Gz8sYvxgUL4Q78+1ZZqeqfuevPTPk033/yUZ3df8BKMohkqqHfzj0HOOrG0KtXTw== + dependencies: + "@changesets/config" "^3.0.3" + "@changesets/get-version-range-type" "^0.4.0" + "@changesets/git" "^3.0.1" + "@changesets/should-skip-package" "^0.1.1" + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + detect-indent "^6.0.0" + fs-extra "^7.0.1" + lodash.startcase "^4.4.0" + outdent "^0.5.0" + prettier "^2.7.1" + resolve-from "^5.0.0" + semver "^7.5.3" + +"@changesets/assemble-release-plan@^6.0.4": + version "6.0.4" + resolved "https://registry.yarnpkg.com/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.4.tgz#153d5154bb9f4162215ca69ad1c6e0886f686ccb" + integrity sha512-nqICnvmrwWj4w2x0fOhVj2QEGdlUuwVAwESrUo5HLzWMI1rE5SWfsr9ln+rDqWB6RQ2ZyaMZHUcU7/IRaUJS+Q== + dependencies: + "@changesets/errors" "^0.2.0" + "@changesets/get-dependents-graph" "^2.1.2" + "@changesets/should-skip-package" "^0.1.1" + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + semver "^7.5.3" + +"@changesets/changelog-git@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@changesets/changelog-git/-/changelog-git-0.2.0.tgz#1f3de11becafff5a38ebe295038a602403c93a86" + integrity sha512-bHOx97iFI4OClIT35Lok3sJAwM31VbUM++gnMBV16fdbtBhgYu4dxsphBF/0AZZsyAHMrnM0yFcj5gZM1py6uQ== + dependencies: + "@changesets/types" "^6.0.0" + +"@changesets/cli@^2.x.x": + version "2.27.9" + resolved "https://registry.yarnpkg.com/@changesets/cli/-/cli-2.27.9.tgz#7b58a4c9eaf95d81fe0d1386705ecefe94a20062" + integrity sha512-q42a/ZbDnxPpCb5Wkm6tMVIxgeI9C/bexntzTeCFBrQEdpisQqk8kCHllYZMDjYtEc1ZzumbMJAG8H0Z4rdvjg== + dependencies: + "@changesets/apply-release-plan" "^7.0.5" + "@changesets/assemble-release-plan" "^6.0.4" + "@changesets/changelog-git" "^0.2.0" + "@changesets/config" "^3.0.3" + "@changesets/errors" "^0.2.0" + "@changesets/get-dependents-graph" "^2.1.2" + "@changesets/get-release-plan" "^4.0.4" + "@changesets/git" "^3.0.1" + "@changesets/logger" "^0.1.1" + "@changesets/pre" "^2.0.1" + "@changesets/read" "^0.6.1" + "@changesets/should-skip-package" "^0.1.1" + "@changesets/types" "^6.0.0" + "@changesets/write" "^0.3.2" + "@manypkg/get-packages" "^1.1.3" + ansi-colors "^4.1.3" + ci-info "^3.7.0" + enquirer "^2.3.0" + external-editor "^3.1.0" + fs-extra "^7.0.1" + mri "^1.2.0" + p-limit "^2.2.0" + package-manager-detector "^0.2.0" + picocolors "^1.1.0" + resolve-from "^5.0.0" + semver "^7.5.3" + spawndamnit "^2.0.0" + term-size "^2.1.0" + +"@changesets/config@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@changesets/config/-/config-3.0.3.tgz#19196558882b25c8aaf04941d4ac7e151f5a1b36" + integrity sha512-vqgQZMyIcuIpw9nqFIpTSNyc/wgm/Lu1zKN5vECy74u95Qx/Wa9g27HdgO4NkVAaq+BGA8wUc/qvbvVNs93n6A== + dependencies: + "@changesets/errors" "^0.2.0" + "@changesets/get-dependents-graph" "^2.1.2" + "@changesets/logger" "^0.1.1" + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + fs-extra "^7.0.1" + micromatch "^4.0.2" + +"@changesets/errors@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@changesets/errors/-/errors-0.2.0.tgz#3c545e802b0f053389cadcf0ed54e5636ff9026a" + integrity sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow== + dependencies: + extendable-error "^0.1.5" + +"@changesets/get-dependents-graph@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@changesets/get-dependents-graph/-/get-dependents-graph-2.1.2.tgz#108304652d4bf22c9fee9f1d31dcf9908c24ca51" + integrity sha512-sgcHRkiBY9i4zWYBwlVyAjEM9sAzs4wYVwJUdnbDLnVG3QwAaia1Mk5P8M7kraTOZN+vBET7n8KyB0YXCbFRLQ== + dependencies: + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + picocolors "^1.1.0" + semver "^7.5.3" + +"@changesets/get-release-plan@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@changesets/get-release-plan/-/get-release-plan-4.0.4.tgz#e7ef0d84d9079c69febb64f8018a18ac4b77ac90" + integrity sha512-SicG/S67JmPTrdcc9Vpu0wSQt7IiuN0dc8iR5VScnnTVPfIaLvKmEGRvIaF0kcn8u5ZqLbormZNTO77bCEvyWw== + dependencies: + "@changesets/assemble-release-plan" "^6.0.4" + "@changesets/config" "^3.0.3" + "@changesets/pre" "^2.0.1" + "@changesets/read" "^0.6.1" + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + +"@changesets/get-version-range-type@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@changesets/get-version-range-type/-/get-version-range-type-0.4.0.tgz#429a90410eefef4368502c41c63413e291740bf5" + integrity sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ== + +"@changesets/git@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@changesets/git/-/git-3.0.1.tgz#4499a07d35d8e783cd56f8295fb7d4d70282701b" + integrity sha512-pdgHcYBLCPcLd82aRcuO0kxCDbw/yISlOtkmwmE8Odo1L6hSiZrBOsRl84eYG7DRCab/iHnOkWqExqc4wxk2LQ== + dependencies: + "@changesets/errors" "^0.2.0" + "@manypkg/get-packages" "^1.1.3" + is-subdir "^1.1.1" + micromatch "^4.0.2" + spawndamnit "^2.0.0" + +"@changesets/logger@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@changesets/logger/-/logger-0.1.1.tgz#9926ac4dc8fb00472fe1711603b6b4755d64b435" + integrity sha512-OQtR36ZlnuTxKqoW4Sv6x5YIhOmClRd5pWsjZsddYxpWs517R0HkyiefQPIytCVh4ZcC5x9XaG8KTdd5iRQUfg== + dependencies: + picocolors "^1.1.0" + +"@changesets/parse@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@changesets/parse/-/parse-0.4.0.tgz#5cabbd9844b3b213cb83f5edb5768454c70dd2b4" + integrity sha512-TS/9KG2CdGXS27S+QxbZXgr8uPsP4yNJYb4BC2/NeFUj80Rni3TeD2qwWmabymxmrLo7JEsytXH1FbpKTbvivw== + dependencies: + "@changesets/types" "^6.0.0" + js-yaml "^3.13.1" + +"@changesets/pre@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@changesets/pre/-/pre-2.0.1.tgz#3ed60f9d218b3b81d3074d72139582da11a94d5f" + integrity sha512-vvBJ/If4jKM4tPz9JdY2kGOgWmCowUYOi5Ycv8dyLnEE8FgpYYUo1mgJZxcdtGGP3aG8rAQulGLyyXGSLkIMTQ== + dependencies: + "@changesets/errors" "^0.2.0" + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + fs-extra "^7.0.1" + +"@changesets/read@^0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@changesets/read/-/read-0.6.1.tgz#32c91d97e602861717696c49a09c23eb492810f6" + integrity sha512-jYMbyXQk3nwP25nRzQQGa1nKLY0KfoOV7VLgwucI0bUO8t8ZLCr6LZmgjXsiKuRDc+5A6doKPr9w2d+FEJ55zQ== + dependencies: + "@changesets/git" "^3.0.1" + "@changesets/logger" "^0.1.1" + "@changesets/parse" "^0.4.0" + "@changesets/types" "^6.0.0" + fs-extra "^7.0.1" + p-filter "^2.1.0" + picocolors "^1.1.0" + +"@changesets/should-skip-package@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@changesets/should-skip-package/-/should-skip-package-0.1.1.tgz#76218ef4ce7691351a6dffdb356e8893267b0b3a" + integrity sha512-H9LjLbF6mMHLtJIc/eHR9Na+MifJ3VxtgP/Y+XLn4BF7tDTEN1HNYtH6QMcjP1uxp9sjaFYmW8xqloaCi/ckTg== + dependencies: + "@changesets/types" "^6.0.0" + "@manypkg/get-packages" "^1.1.3" + +"@changesets/types@^4.0.1": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@changesets/types/-/types-4.1.0.tgz#fb8f7ca2324fd54954824e864f9a61a82cb78fe0" + integrity sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw== + +"@changesets/types@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@changesets/types/-/types-6.0.0.tgz#e46abda9890610dd1fbe1617730173d2267544bd" + integrity sha512-b1UkfNulgKoWfqyHtzKS5fOZYSJO+77adgL7DLRDr+/7jhChN+QcHnbjiQVOz/U+Ts3PGNySq7diAItzDgugfQ== + +"@changesets/write@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@changesets/write/-/write-0.3.2.tgz#bee64e4ccdff480872df5d1e38f2b913cb940116" + integrity sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw== + dependencies: + "@changesets/types" "^6.0.0" + fs-extra "^7.0.1" + human-id "^1.0.2" + prettier "^2.7.1" + +"@cheqd/sdk@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@cheqd/sdk/-/sdk-4.0.4.tgz#d908fd9ad22eab0491bd0091e36b7b136c02f7ed" + integrity sha512-Jb3cwSeF9fftgnlKSporpDAFCY5jCghaUysFDQEOqAutJHT+UfF+INkQ+sibWPbp8A/x7HsSDrXddfQSpouLcQ== + dependencies: + "@cheqd/ts-proto" "^3.4.4" + "@cosmjs/amino" "^0.32.4" + "@cosmjs/crypto" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/proto-signing" "^0.32.4" + "@cosmjs/stargate" "^0.32.4" + "@cosmjs/tendermint-rpc" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + "@stablelib/ed25519" "^1.0.3" + "@types/secp256k1" "^4.0.6" + cosmjs-types "^0.9.0" + did-jwt "^8.0.4" + did-resolver "^4.1.0" + file-type "^19.5.0" + multiformats "^13.2.2" + secp256k1 "^5.0.0" + uuid "^10.0.0" + +"@cheqd/ts-proto@^3.4.4": + version "3.4.4" + resolved "https://registry.yarnpkg.com/@cheqd/ts-proto/-/ts-proto-3.4.4.tgz#229ad2ecf3d779efd9b1ea0e449942b6e14210d1" + integrity sha512-5/H+5U49g4KCCtu5PpQsMyaViMVcZ8PICAsVPLHoH3cttT1LoTHBYF7H0fmAsVPykG4bKBmWyG8uytS85MqV0g== + dependencies: + long "^5.2.3" + protobufjs "^7.3.2" + +"@colors/colors@1.6.0", "@colors/colors@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0" + integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA== "@comunica/actor-abstract-bindings-hash@^1.22.0": version "1.22.0" @@ -2763,6 +2724,127 @@ "@comunica/context-entries" "^1.22.0" asynciterator "^3.2.0" +"@confio/ics23@^0.6.8": + version "0.6.8" + resolved "https://registry.yarnpkg.com/@confio/ics23/-/ics23-0.6.8.tgz#2a6b4f1f2b7b20a35d9a0745bb5a446e72930b3d" + integrity sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w== + dependencies: + "@noble/hashes" "^1.0.0" + protobufjs "^6.8.8" + +"@cosmjs/amino@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.32.4.tgz#3908946c0394e6d431694c8992c5147079a1c860" + integrity sha512-zKYOt6hPy8obIFtLie/xtygCkH9ZROiQ12UHfKsOkWaZfPQUvVbtgmu6R4Kn1tFLI/SRkw7eqhaogmW/3NYu/Q== + dependencies: + "@cosmjs/crypto" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + +"@cosmjs/crypto@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.32.4.tgz#5d29633b661eaf092ddb3e7ea6299cfd6f4507a2" + integrity sha512-zicjGU051LF1V9v7bp8p7ovq+VyC91xlaHdsFOTo2oVry3KQikp8L/81RkXmUIT8FxMwdx1T7DmFwVQikcSDIw== + dependencies: + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + "@noble/hashes" "^1" + bn.js "^5.2.0" + elliptic "^6.5.4" + libsodium-wrappers-sumo "^0.7.11" + +"@cosmjs/encoding@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.32.4.tgz#646e0e809f7f4f1414d8fa991fb0ffe6c633aede" + integrity sha512-tjvaEy6ZGxJchiizzTn7HVRiyTg1i4CObRRaTRPknm5EalE13SV+TCHq38gIDfyUeden4fCuaBVEdBR5+ti7Hw== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + +"@cosmjs/json-rpc@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.32.4.tgz#be91eb89ea78bd5dc02d0a9fa184dd6790790f0b" + integrity sha512-/jt4mBl7nYzfJ2J/VJ+r19c92mUKF0Lt0JxM3MXEJl7wlwW5haHAWtzRujHkyYMXOwIR+gBqT2S0vntXVBRyhQ== + dependencies: + "@cosmjs/stream" "^0.32.4" + xstream "^11.14.0" + +"@cosmjs/math@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.32.4.tgz#87ac9eadc06696e30a30bdb562a495974bfd0a1a" + integrity sha512-++dqq2TJkoB8zsPVYCvrt88oJWsy1vMOuSOKcdlnXuOA/ASheTJuYy4+oZlTQ3Fr8eALDLGGPhJI02W2HyAQaw== + dependencies: + bn.js "^5.2.0" + +"@cosmjs/proto-signing@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.32.4.tgz#5a06e087c6d677439c8c9b25b5223d5e72c4cd93" + integrity sha512-QdyQDbezvdRI4xxSlyM1rSVBO2st5sqtbEIl3IX03uJ7YiZIQHyv6vaHVf1V4mapusCqguiHJzm4N4gsFdLBbQ== + dependencies: + "@cosmjs/amino" "^0.32.4" + "@cosmjs/crypto" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + cosmjs-types "^0.9.0" + +"@cosmjs/socket@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.32.4.tgz#86ab6adf3a442314774c0810b7a7cfcddf4f2082" + integrity sha512-davcyYziBhkzfXQTu1l5NrpDYv0K9GekZCC9apBRvL1dvMc9F/ygM7iemHjUA+z8tJkxKxrt/YPjJ6XNHzLrkw== + dependencies: + "@cosmjs/stream" "^0.32.4" + isomorphic-ws "^4.0.1" + ws "^7" + xstream "^11.14.0" + +"@cosmjs/stargate@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.32.4.tgz#bd0e4d3bf613b629addbf5f875d3d3b50f640af1" + integrity sha512-usj08LxBSsPRq9sbpCeVdyLx2guEcOHfJS9mHGCLCXpdAPEIEQEtWLDpEUc0LEhWOx6+k/ChXTc5NpFkdrtGUQ== + dependencies: + "@confio/ics23" "^0.6.8" + "@cosmjs/amino" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/proto-signing" "^0.32.4" + "@cosmjs/stream" "^0.32.4" + "@cosmjs/tendermint-rpc" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + cosmjs-types "^0.9.0" + xstream "^11.14.0" + +"@cosmjs/stream@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.32.4.tgz#83e1f2285807467c56d9ea0e1113f79d9fa63802" + integrity sha512-Gih++NYHEiP+oyD4jNEUxU9antoC0pFSg+33Hpp0JlHwH0wXhtD3OOKnzSfDB7OIoEbrzLJUpEjOgpCp5Z+W3A== + dependencies: + xstream "^11.14.0" + +"@cosmjs/tendermint-rpc@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.32.4.tgz#b36f9ec657498e42c97e21bb7368798ef6279752" + integrity sha512-MWvUUno+4bCb/LmlMIErLypXxy7ckUuzEmpufYYYd9wgbdCXaTaO08SZzyFM5PI8UJ/0S2AmUrgWhldlbxO8mw== + dependencies: + "@cosmjs/crypto" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/json-rpc" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/socket" "^0.32.4" + "@cosmjs/stream" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + axios "^1.6.0" + readonly-date "^1.0.0" + xstream "^11.14.0" + +"@cosmjs/utils@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.4.tgz#a9a717c9fd7b1984d9cefdd0ef6c6f254060c671" + integrity sha512-D1Yc+Zy8oL/hkUkFUL/bwxvuDBzRGpc4cF7/SkdhxX4iHpSLgdOuTt1mhCh9+kl6NQREy9t7SYZ6xeW5gFe60w== + "@dabh/diagnostics@^2.0.2": version "2.0.3" resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" @@ -2781,7 +2863,7 @@ ky "^0.25.1" ky-universal "^0.8.2" -"@digitalbazaar/http-client@^4.1.0": +"@digitalbazaar/http-client@^4.1.0", "@digitalbazaar/http-client@^4.1.1": version "4.1.1" resolved "https://registry.yarnpkg.com/@digitalbazaar/http-client/-/http-client-4.1.1.tgz#73d31af4782eadd2440cf0cd487ad591f45d137c" integrity sha512-PG0r9sAEzAmnCSrwKg+HhM6+GNMU24ttiFMBycqhM1vDi8enipuFpW45vn2lzr8+i7I2yLUzNyfrrkQTlzGLmQ== @@ -2841,14 +2923,14 @@ crypto-ld "^6.0.0" "@digitalcredentials/jsonld-signatures@^10.0.0", "@digitalcredentials/jsonld-signatures@^10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@digitalcredentials/jsonld-signatures/-/jsonld-signatures-10.0.1.tgz#88bafaf265cf6a9e3582a88d1d9d2483e940aad1" - integrity sha512-r7yx25SUkyzX7ZGnvzZCtoMH+udbhM3VnHN0rcLv/PW57mpj3lf1lYdu+7Hl24L26H+mUD42otCg4sbVLaZl8Q== + version "10.1.0" + resolved "https://registry.yarnpkg.com/@digitalcredentials/jsonld-signatures/-/jsonld-signatures-10.1.0.tgz#6ee982b70c5cc97455d1be7a41f5ec7423e0ba6d" + integrity sha512-qLRHN4UUBAEoOk6LUL3z4jEP5hv4obJekx8Fy/f+9m8nW/JLAIeIAEfZwYzMytySUHMBpmUSxR7YRBm81FD80w== dependencies: "@digitalbazaar/security-context" "^1.0.0" - "@sphereon/isomorphic-webcrypto" "^2.4.0-unstable.4" + "@sphereon/isomorphic-webcrypto" "^2.5.0-unstable.0" fast-text-encoding "^1.0.3" - jsonld digitalcredentials/jsonld.js#v10.x + jsonld digitalcredentials/jsonld.js#v10.1.x serialize-error "^8.0.1" "@digitalcredentials/open-badges-context@^2.1.0": @@ -2878,15 +2960,15 @@ fix-esm "^1.0.1" jsonld digitalcredentials/jsonld.js#v10.x -"@docknetwork/crypto-wasm-ts@0.66.0": - version "0.66.0" - resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm-ts/-/crypto-wasm-ts-0.66.0.tgz#c579c3f0ace11659c365addb5f2a6b46d89fc09c" - integrity sha512-wjnln7wOpX+RW/lSoy3SOr2NeMfsxfuN6y/8z9YDWIegpggn8eAJ3TWqsT5vShEAx4BloxSVjom7u6MUDAMQ1w== +"@docknetwork/crypto-wasm-ts@^0.63.0": + version "0.63.0" + resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm-ts/-/crypto-wasm-ts-0.63.0.tgz#f1ab39693b63e70d682d362e9eacd85842ae56e0" + integrity sha512-KryDPIf6suwi5NS1iqA76vpuLmZv4PLV1Dt7I6Z4YS3rDKK43m7j8mox6lhQgkVL7QZdJ1DdZGxcPLekXZYQ1w== dependencies: "@types/flat" "^5.0.2" "@types/lodash" "^4.14.195" bs58 "5.0.0" - crypto-wasm-new "npm:@docknetwork/crypto-wasm@0.32.0" + crypto-wasm-new "npm:@docknetwork/crypto-wasm@0.30.0" flat "^5.0.2" json-pointer "^0.6.2" json-stringify-deterministic "^1.0.11" @@ -2899,23 +2981,39 @@ resolved "https://registry.yarnpkg.com/@docknetwork/node-types/-/node-types-0.17.0.tgz#ca0ddb5b819e012e8f2f112353008325de4f3e33" integrity sha512-aSRFtCwLhdhcY1wqX3WfhPpY2QXVqaB9kNB3e5+ajCWXtc0wuKJePpnSZEO4RqUEUKV5Y3LcsQ52ZB+aJ1PpFw== -"@ethereumjs/common@^2.5.0", "@ethereumjs/common@^2.6.4": - version "2.6.5" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz#0a75a22a046272579d91919cb12d84f2756e8d30" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" + eslint-visitor-keys "^3.3.0" -"@ethereumjs/tx@^3.3.2": - version "3.5.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.2.tgz#197b9b6299582ad84f9527ca961466fce2296c1c" - integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== +"@eslint-community/regexpp@^4.6.1": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae" + integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A== + +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: - "@ethereumjs/common" "^2.6.4" - ethereumjs-util "^7.1.5" + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.57.0": + version "8.57.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" + integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -3190,7 +3288,7 @@ "@ethersproject/constants" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -3257,22 +3355,58 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@helia/block-brokers@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@helia/block-brokers/-/block-brokers-2.0.2.tgz#a6493f549bc30c79788ba374e444fd8469433607" - integrity sha512-HfdOMF8eNmJq9wdoRTdX7FidgrjKk6yvvpu3FlCfIyY+ZCmJgCWEKYmn3GKmY8l82DlHzYwo1GYMOV4rdqREeA== +"@helia/bitswap@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@helia/bitswap/-/bitswap-1.1.3.tgz#36ae3fff25551e9831a209205ca9ee304837b906" + integrity sha512-nCszNky/kOxaj1CZrZbzzFz6Fn7uNWigudn4KaLV+ZuFx6xyB8+t6aCmjKQ59me0WA3mwkmHkPtUOi9Y75zLSw== + dependencies: + "@helia/interface" "^4.3.1" + "@helia/utils" "^0.3.3" + "@libp2p/interface" "^1.1.2" + "@libp2p/logger" "^4.0.5" + "@libp2p/peer-collections" "^5.1.6" + "@libp2p/utils" "^5.2.3" + "@multiformats/multiaddr" "^12.1.14" + any-signal "^4.1.1" + interface-blockstore "^5.2.9" + interface-store "^5.1.7" + it-drain "^3.0.5" + it-length-prefixed "^9.0.0" + it-length-prefixed-stream "^1.1.6" + it-map "^3.0.5" + it-pipe "^3.0.1" + it-take "^3.0.1" + multiformats "^13.0.1" + p-defer "^4.0.0" + progress-events "^1.0.0" + protons-runtime "^5.0.0" + race-event "^1.2.0" + uint8-varint "^2.0.3" + uint8arraylist "^2.4.3" + uint8arrays "^5.0.1" + +"@helia/block-brokers@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@helia/block-brokers/-/block-brokers-3.0.3.tgz#4a83cf17ef2e06846b84a88a558f9211fff4a0b9" + integrity sha512-xSnmWv1jgeBJURcdF/KFOHEa1CQygk3jm1qxYPYqnMWxRXhsFG5Qi13EA+QfslCXyywfxbr4yJWleUUV2Mw4oQ== dependencies: - "@helia/interface" "^4.0.1" + "@helia/bitswap" "^1.1.3" + "@helia/interface" "^4.3.1" + "@helia/utils" "^0.3.3" "@libp2p/interface" "^1.1.4" + "@libp2p/utils" "^5.2.6" + "@multiformats/multiaddr" "^12.2.1" + "@multiformats/multiaddr-matcher" "^1.2.0" + "@multiformats/multiaddr-to-uri" "^10.0.1" interface-blockstore "^5.2.10" - ipfs-bitswap "^20.0.2" + interface-store "^5.1.8" multiformats "^13.1.0" progress-events "^1.0.0" "@helia/delegated-routing-v1-http-api-client@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@helia/delegated-routing-v1-http-api-client/-/delegated-routing-v1-http-api-client-3.0.0.tgz#268bd7b80e77fb8504fbdad827c04989ac9a45a5" - integrity sha512-NQRG5djXKI0GcFx35JMKSQ92RscGOhER6ti66ExjreAffaO2/9vk2ZbAbfCoZnjyTnx66HWAgAyB4GDDTAeFLA== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@helia/delegated-routing-v1-http-api-client/-/delegated-routing-v1-http-api-client-3.0.1.tgz#284d21a99a8b80707ded3aa2f38ee89ec7895176" + integrity sha512-Gkaw3B8IjgCCXtasa17j8wQaFdzph2s0RiLyrJTS2htmwVFWZEjLNLUDJeWsMHBoLBza8SrVGvQ9fiN3XD3rfg== dependencies: "@libp2p/interface" "^1.1.1" "@libp2p/logger" "^4.0.4" @@ -3289,59 +3423,63 @@ p-queue "^8.0.1" uint8arrays "^5.0.1" -"@helia/interface@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@helia/interface/-/interface-4.0.1.tgz#45ecc2aab4a03503bcc0cb269094741240a17b65" - integrity sha512-tp9dLlog9x5C/+gE4FF452slemnTQtpS3RneGOatx51nDaE76/HHOmW1hIAASuFtjPHeg/R9BAM8UIX4DEffsg== +"@helia/interface@^4.3.1": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@helia/interface/-/interface-4.3.1.tgz#064ad5a82a3d109c94e16a7a62ccb7faa07ca05b" + integrity sha512-jvuUUAQbLMhvMt+Lon7mJfJt5xJWiwn8aXtI9fHBpMNMsrKJOtefxAzwSr18xe+C9bMdOyRtocj2eFhs74bQ8w== dependencies: "@libp2p/interface" "^1.1.4" + "@multiformats/dns" "^1.0.1" interface-blockstore "^5.2.10" interface-datastore "^8.2.11" interface-store "^5.1.8" multiformats "^13.1.0" progress-events "^1.0.0" -"@helia/routers@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@helia/routers/-/routers-1.0.1.tgz#347b6f57b713c8704b2c8882b0ae3d67f150304d" - integrity sha512-FHkliCcj6TfSJdTFNP61OW2Dtqxn8XBsZIsUUPxw1qsZLEFm33CcIXhF5NPalqyVrjC+y0fo/+OuNAwCNhE/sw== +"@helia/routers@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@helia/routers/-/routers-1.1.1.tgz#fa60ea61ebb02c28eec513a894a3757fccd568a5" + integrity sha512-LsEkUAno4PiQ1cmwxFnYWy5xQicpzjXyYeRJEGLjAnAXin8hq0JPkEouZx8vTlmSf1Rde4RSaTu3+3H1qj5ccw== dependencies: "@helia/delegated-routing-v1-http-api-client" "^3.0.0" - "@helia/interface" "^4.0.1" + "@helia/interface" "^4.3.1" "@libp2p/interface" "^1.1.4" + "@multiformats/uri-to-multiaddr" "^8.0.0" ipns "^9.0.0" it-first "^3.0.4" it-map "^3.0.5" multiformats "^13.1.0" uint8arrays "^5.0.2" -"@helia/strings@^3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@helia/strings/-/strings-3.0.1.tgz#9934aa22f6f66bbc5fc0988b1f5123e0b44d6992" - integrity sha512-V8RHwBhAWp2pVmcD+/CKSCLyCtj46LHsb/VI9PojUg0W7Av3tcSeU4lU2MkySi76YibCV52MK6Wjx4FqEr0uQg== +"@helia/strings@^3.0.1", "@helia/strings@^3.0.5": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@helia/strings/-/strings-3.0.5.tgz#22349d8c0d58fd944c7ec398aa7ef031b31b9943" + integrity sha512-TH2o50P5SQpBKR805joquvDWOQombJnf2VVhd1Mh8Xjd/n4YIq/aReWZqs7yPNmwZ6w1UBfzoZe5azuQoE3nEw== dependencies: - "@helia/interface" "^4.0.1" + "@helia/interface" "^4.3.1" "@libp2p/interfaces" "^3.3.2" interface-blockstore "^5.2.10" multiformats "^13.1.0" progress-events "^1.0.0" uint8arrays "^5.0.2" -"@helia/utils@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@helia/utils/-/utils-0.0.2.tgz#0109d03207ab8530abc7b4883fbf5f2a9ddc9580" - integrity sha512-910HndS3HM2kv+aD8SfLrQkPAw4ZWhipEkaEq/RSGJ8sIqG291cBhIkVTka8+pIDqwKe7mX1djrHL+kV2kJ6cQ== +"@helia/utils@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@helia/utils/-/utils-0.3.3.tgz#0e6522ba14f4db905d038ac4c3743a5bc5236560" + integrity sha512-iCS8dJRULgltfx7aLLoqfjWUpqBWrTyouCToB9RgHpNs4lHcIsZn/VSbHyjC4NUF9nIWsxhH/3UAdvWl23HEgw== dependencies: - "@helia/interface" "^4.0.1" + "@helia/interface" "^4.3.1" "@ipld/dag-cbor" "^9.2.0" "@ipld/dag-json" "^10.2.0" "@ipld/dag-pb" "^4.1.0" + "@libp2p/crypto" "^4.0.6" "@libp2p/interface" "^1.1.4" "@libp2p/logger" "^4.0.7" - "@libp2p/peer-collections" "^5.1.7" "@libp2p/utils" "^5.2.6" + "@multiformats/dns" "^1.0.1" + "@types/murmurhash3js-revisited" "^3.0.3" any-signal "^4.1.1" - blockstore-core "^4.4.0" + blockstore-core "^4.4.1" cborg "^4.0.9" interface-blockstore "^5.2.10" interface-datastore "^8.2.11" @@ -3352,9 +3490,31 @@ it-merge "^3.0.3" mortice "^3.0.4" multiformats "^13.1.0" + murmurhash3js-revisited "^3.0.0" + p-defer "^4.0.1" progress-events "^1.0.0" + uint8arraylist "^2.4.8" uint8arrays "^5.0.2" +"@humanwhocodes/config-array@^0.11.14": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== + dependencies: + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== + "@iden3/bigarray@0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@iden3/bigarray/-/bigarray-0.0.2.tgz#6fc4ba5be18daf8a26ee393f2fb62b80d98c05e9" @@ -3369,25 +3529,25 @@ ffjavascript "^0.2.48" "@ipld/dag-cbor@^9.2.0": - version "9.2.0" - resolved "https://registry.yarnpkg.com/@ipld/dag-cbor/-/dag-cbor-9.2.0.tgz#3a3f0bee02d7e1c2f15582e896843d5b00fbba9f" - integrity sha512-N14oMy0q4gM6OuZkIpisKe0JBSjf1Jb39VI+7jMLiWX9124u1Z3Fdj/Tag1NA0cVxxqWDh0CqsjcVfOKtelPDA== + version "9.2.1" + resolved "https://registry.yarnpkg.com/@ipld/dag-cbor/-/dag-cbor-9.2.1.tgz#e61f413770bb0fb27ffafa9577049869272d2056" + integrity sha512-nyY48yE7r3dnJVlxrdaimrbloh4RokQaNRdI//btfTkcTEZbpmSrbYcBQ4VKTf8ZxXAOUJy4VsRpkJo+y9RTnA== dependencies: cborg "^4.0.0" multiformats "^13.1.0" "@ipld/dag-json@^10.2.0": - version "10.2.0" - resolved "https://registry.yarnpkg.com/@ipld/dag-json/-/dag-json-10.2.0.tgz#32468182ce510284aae75a07e33b3a0da284994e" - integrity sha512-O9YLUrl3d3WbVz7v1WkajFkyfOLEe2Fep+wor4fgVe0ywxzrivrj437NiPcVyB+2EDdFn/Q7tCHFf8YVhDf8ZA== + version "10.2.2" + resolved "https://registry.yarnpkg.com/@ipld/dag-json/-/dag-json-10.2.2.tgz#85f498abf4432df9296ace2e40de95e5e1e2d38d" + integrity sha512-NnU8HdHKwAoGyrW3S09NMa8aZw0tImLRyR64hoafpLpDpAbA9g1+fb24JsdlugbL4sXUQVwDVA+qK4Ud8V83lA== dependencies: cborg "^4.0.0" multiformats "^13.1.0" "@ipld/dag-pb@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@ipld/dag-pb/-/dag-pb-4.1.0.tgz#4ebec92eeb9e8f317b8ef971221c6dac7b12b302" - integrity sha512-LJU451Drqs5zjFm7jI4Hs3kHlilOqkjcSfPiQgVsZnWaYb2C7YdfhnclrVn/X+ucKejlU9BL3+gXFCZUXkMuCg== + version "4.1.2" + resolved "https://registry.yarnpkg.com/@ipld/dag-pb/-/dag-pb-4.1.2.tgz#39db25311aeb2745ec20bfc745d91a577832b6ac" + integrity sha512-BSztO4l3C+ya9HjCaQot26Y4AVsqIKtnn6+23ubc1usucnf6yoTBme18oCCdM6gKBMxuPqju5ye3lh9WEJsdeQ== dependencies: multiformats "^13.1.0" @@ -3599,15 +3759,6 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" -"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" - integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - "@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" @@ -3617,43 +3768,28 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.24" -"@jridgewell/resolve-uri@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== - "@jridgewell/resolve-uri@^3.1.0": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== - -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/set-array@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== -"@jridgewell/source-map@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" - integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== +"@jridgewell/source-map@^0.3.3": + version "0.3.6" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" + integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" -"@jridgewell/sourcemap-codec@^1.4.14": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" @@ -3663,158 +3799,133 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jridgewell/trace-mapping@^0.3.17": - version "0.3.19" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" - integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - -"@jridgewell/trace-mapping@^0.3.9": - version "0.3.17" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" - integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== - dependencies: - "@jridgewell/resolve-uri" "3.1.0" - "@jridgewell/sourcemap-codec" "1.4.14" - -"@juanelas/base64@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@juanelas/base64/-/base64-1.0.5.tgz#abbda3f529947b4d9784619c4fa039a3f9b58399" - integrity sha512-gTIElNo4ohMcYUZzol/Hb6DYJzphxl0b1B4egJJ+JiqxqcOcWx4XLMAB+lhWuMsMX3uR1oc5hwPusU3lgc1FkQ== +"@juanelas/base64@^1.0.5", "@juanelas/base64@^1.1.5": + version "1.1.5" + resolved "https://registry.yarnpkg.com/@juanelas/base64/-/base64-1.1.5.tgz#d43b3c78e32e609d9b17a15e4f1b6342c9ca1238" + integrity sha512-mjAF27LzwfYobdwqnxZgeucbKT5wRRNvILg3h5OvCWK+3F7mw/A1tnjHnNiTYtLmTvT/bM1jA5AX7eQawDGs1w== "@leichtgewicht/ip-codec@^2.0.1": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" - integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== + version "2.0.5" + resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" + integrity sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw== "@libp2p/autonat@^1.0.13": - version "1.0.13" - resolved "https://registry.yarnpkg.com/@libp2p/autonat/-/autonat-1.0.13.tgz#d1418503d0f724cde24e39e9307ea99d04f6444d" - integrity sha512-H0IBYwa89FMTwbQUoC8OiyPLTJ6bPZFb1uSjnqwOzKMwPdH19SkE/OQeW0kW/aVlpDd4QBK9kL+UhMqNr6CC2w== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/peer-id-factory" "^4.0.7" - "@libp2p/utils" "^5.2.6" - "@multiformats/multiaddr" "^12.1.14" - it-first "^3.0.4" + version "1.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/autonat/-/autonat-1.1.4.tgz#d001b8afeb4d024f72caf785e982d5c96f0d0cfd" + integrity sha512-yt/sUisqBLZPM/0lvpRo0enIEIbdyuSraIu4xRlGkdqqAXSo9T6CJppXxNi9VKTmlmD39WYYNP41Ilt3SvQhRQ== + dependencies: + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" + it-first "^3.0.6" it-length-prefixed "^9.0.4" - it-map "^3.0.5" - it-parallel "^3.0.6" + it-map "^3.1.0" + it-parallel "^3.0.7" it-pipe "^3.0.1" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" "@libp2p/bootstrap@^10.0.16": - version "10.0.16" - resolved "https://registry.yarnpkg.com/@libp2p/bootstrap/-/bootstrap-10.0.16.tgz#f8eb364a57e2ca516bec025f8a4b007dd5f38319" - integrity sha512-ZFuq5OtQfdeZVjfWrJpW/OuPVOuAflu1nzq9g6/UiVfSvBaZtwe8hcMCQDXv21V8fCVsd703sblzkBwBYi17rQ== + version "10.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/bootstrap/-/bootstrap-10.1.4.tgz#ce3b5b128efa920ee89b412722d0b57a4709dbc1" + integrity sha512-bt4Tz/DMKnlvZhF4d9Nkv/K7qgnoDBM/N0zwjA/aQg1vSq54/Szc2K3cIDAv9/r9dM4ckDRmIZZENr/bwcIIKw== dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-id" "^4.0.7" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-id" "^4.2.3" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.1.14" + "@multiformats/multiaddr" "^12.2.3" "@libp2p/circuit-relay-v2@^1.0.16": - version "1.0.16" - resolved "https://registry.yarnpkg.com/@libp2p/circuit-relay-v2/-/circuit-relay-v2-1.0.16.tgz#e2681b9d84192abeb6510b94c18426e24a99d0a6" - integrity sha512-QKpMPTdjxKv+6XArEGxRMoQ9WbQeJLjDaRHTybbt25KbHahwdK24kfJsnqUD4BHrax/gWFNfNlsr4tbUjgTOGQ== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/peer-collections" "^5.1.7" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/peer-record" "^7.0.10" - "@libp2p/utils" "^5.2.6" + version "1.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/circuit-relay-v2/-/circuit-relay-v2-1.1.4.tgz#c02ba0ab907b100e78f4f2635bde5da5beea373e" + integrity sha512-WLiisIvRWVSJLzb4MO1aqDOD2A7s99OgpfeKKt9nxSaq34WeQS9aGN9YxSczYkum9hBTdnLJZZDQrd6SId6NbQ== + dependencies: + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/peer-collections" "^5.2.8" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/peer-record" "^7.0.24" + "@libp2p/utils" "^5.4.8" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.1.14" + "@multiformats/multiaddr" "^12.2.3" any-signal "^4.1.1" - it-protobuf-stream "^1.1.2" + it-protobuf-stream "^1.1.3" it-stream-types "^2.0.1" multiformats "^13.1.0" - p-defer "^4.0.0" - p-retry "^6.2.0" + p-defer "^4.0.1" + progress-events "^1.0.0" protons-runtime "^5.4.0" + race-signal "^1.0.2" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" -"@libp2p/crypto@^4.0.0", "@libp2p/crypto@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@libp2p/crypto/-/crypto-4.0.3.tgz#134edd6d9b562b307c02d467d3a9a9c7afad00be" - integrity sha512-UT11dl5Bxi9gyXXSyoIfi+7USk2S+46mY9W3t435tS9Y83BeFcdSLAmuiHaKZB/gtnngKfTdjUqEsPSOc79d+w== +"@libp2p/crypto@^4.0.0", "@libp2p/crypto@^4.0.6", "@libp2p/crypto@^4.1.8": + version "4.1.8" + resolved "https://registry.yarnpkg.com/@libp2p/crypto/-/crypto-4.1.8.tgz#f8b10b3aa53403b5cfc00cc04aa8548807a03e0c" + integrity sha512-j8d1gOS6ypt6CSYgBTJKSTGsht3SFPkhfOkGND6sUCl1w9pRslDlvFnU9UrNHLMiaNmVHaeS9B2IKzKMbLX92Q== dependencies: - "@libp2p/interface" "^1.1.4" - "@noble/curves" "^1.3.0" - "@noble/hashes" "^1.3.3" + "@libp2p/interface" "^1.6.3" + "@noble/curves" "^1.4.0" + "@noble/hashes" "^1.4.0" asn1js "^3.0.5" multiformats "^13.1.0" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" "@libp2p/dcutr@^1.0.13": - version "1.0.13" - resolved "https://registry.yarnpkg.com/@libp2p/dcutr/-/dcutr-1.0.13.tgz#2ce8c21044d7156965ba0a8d113686f7d9344f47" - integrity sha512-b/aHsizMzcXYUI0G4Pl2GnMZneh4mPSOUebvzofhHfjR92lJ2DANhEkIhV1liJAWdjdulDLFHW63tDEOBxA23A== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/utils" "^5.2.6" - "@multiformats/multiaddr" "^12.1.14" - "@multiformats/multiaddr-matcher" "^1.1.2" + version "1.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/dcutr/-/dcutr-1.1.4.tgz#4d4b971a39d2cb62ef1d183b56dc2bc1e6af86cf" + integrity sha512-NjIiAoi5q2Y2q0eON+VCdm8ec2Be1Q9q1vcL6z7RyBWwIkk6PPy8RvBaI6GcGKjk251jLrN6vz2yoL7vWRht2A== + dependencies: + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr-matcher" "^1.2.1" delay "^6.0.0" - it-protobuf-stream "^1.1.2" + it-protobuf-stream "^1.1.3" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" -"@libp2p/identify@^1.0.15": - version "1.0.15" - resolved "https://registry.yarnpkg.com/@libp2p/identify/-/identify-1.0.15.tgz#b8d6f40244bb202fb88be5c56304354c084a0b9d" - integrity sha512-Pve7UJKbEqN6nMpc2yjUiNvjpVwewixL3iX/bvhHQi9P4/x9zJkDIgncbdSUAXT0VePkJRRqvFJOye9Pdw4zRQ== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/peer-record" "^7.0.10" - "@multiformats/multiaddr" "^12.1.14" - "@multiformats/multiaddr-matcher" "^1.1.2" - it-protobuf-stream "^1.1.2" +"@libp2p/identify@^2.0.0": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/identify/-/identify-2.1.4.tgz#7a40b283e460ac22de4d376b688fad1df3aa9d46" + integrity sha512-w2JkmoZkXT3OJnTuyBPlEBicj1J1n90pcusZbs+YIiJ+mhsOvNKnQhJgCG8Q6wnTimcBjinqhRRp0hiaHqX7VQ== + dependencies: + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/peer-record" "^7.0.24" + "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr-matcher" "^1.2.1" + it-drain "^3.0.7" + it-parallel "^3.0.7" + it-protobuf-stream "^1.1.3" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" wherearewe "^2.0.1" -"@libp2p/interface-internal@^1.0.9": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@libp2p/interface-internal/-/interface-internal-1.0.9.tgz#7d0ac6804ad349b01e9d4fac12d26e515a1f77f4" - integrity sha512-c5BzjXdRnuI+xjLiPjGMxh6QbU51wEIdz/OrgQqo2dKDjWz3Qu0due9H2wzzB8nvSNWTLHRr1ucVga3SrmbngQ== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-collections" "^5.1.7" - "@multiformats/multiaddr" "^12.1.14" - uint8arraylist "^2.4.8" - -"@libp2p/interface@^1.0.0", "@libp2p/interface@^1.1.0", "@libp2p/interface@^1.1.1", "@libp2p/interface@^1.1.3", "@libp2p/interface@^1.1.4": - version "1.1.4" - resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.1.4.tgz#21c7bbbe7628419d1e4902f0c953db1423b0f40f" - integrity sha512-gJXQycTF50tI02X/IlReAav4XoGPs3Yr917vNXsTUsZQRzQaPjbvKfXqA5hkLFpZ1lnxQ8wto/EVw4ca4XaL1A== +"@libp2p/interface-internal@^1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@libp2p/interface-internal/-/interface-internal-1.3.3.tgz#29f7f9e183461c03defd3511d131dbf37190b554" + integrity sha512-xng1cBGDhSZmCu0kUEv3363oSgpoPmvpDr11wumhKNEgGOwBVbEr0v7serYcrlORxFmyUBW8y98CkPRJxskPLA== dependencies: - "@multiformats/multiaddr" "^12.1.14" - it-pushable "^3.2.3" - it-stream-types "^2.0.1" - multiformats "^13.1.0" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-collections" "^5.2.8" + "@multiformats/multiaddr" "^12.2.3" progress-events "^1.0.0" uint8arraylist "^2.4.8" -"@libp2p/interface@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.1.5.tgz#25b3c22a20a1b09bd6a6a9f9c4ef2c23c5a7aade" - integrity sha512-BjFgv/3VwEDNRcFKL4KW6g29IcUWUjaTJhyZVGWtodFuPjZsZHJgoQU7T/FFxDcfTdI90qpFbTREycOB+VL9NQ== +"@libp2p/interface@^1.0.0", "@libp2p/interface@^1.1.0", "@libp2p/interface@^1.1.1", "@libp2p/interface@^1.1.2", "@libp2p/interface@^1.1.3", "@libp2p/interface@^1.1.4", "@libp2p/interface@^1.5.0", "@libp2p/interface@^1.6.3": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.6.3.tgz#3673e05d5bfc139e4fc81d8ce44468ce9a98ffc4" + integrity sha512-Tm8W5Q2FsjcSdeA5BvP/GTUq/lp3SjeW6GPmWbbIasBJdv67UGHahu8YDFTME90IxTijnikkfGNkOPsd/4UuvA== dependencies: - "@multiformats/multiaddr" "^12.1.14" + "@multiformats/multiaddr" "^12.2.3" it-pushable "^3.2.3" it-stream-types "^2.0.1" multiformats "^13.1.0" @@ -3827,311 +3938,343 @@ integrity sha512-p/M7plbrxLzuQchvNwww1Was7ZeGE2NaOFulMaZBYIihU8z3fhaV+a033OqnC/0NTX/yhfdNOG7znhYq3XoR/g== "@libp2p/kad-dht@^12.0.8": - version "12.0.9" - resolved "https://registry.yarnpkg.com/@libp2p/kad-dht/-/kad-dht-12.0.9.tgz#6ed11d0236fab937ee939f73cec73317de7b1b42" - integrity sha512-vs5OmlV4DFFqEOCb4WPS++hDHw0yAHxLlPgL6+fkwgPNY2db+5dU8mm0LhLnYBeNZDWt1zQk1aPvmt3zeI4geQ== - dependencies: - "@libp2p/crypto" "^4.0.3" - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/peer-collections" "^5.1.7" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/utils" "^5.2.6" - "@multiformats/multiaddr" "^12.1.14" - "@types/sinon" "^17.0.3" + version "12.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/kad-dht/-/kad-dht-12.1.4.tgz#7935ec13894095fc2fbe87ed43f88b1b1a7b884c" + integrity sha512-TWg3WB/Ghqz2vVOBxZz3PD0gDw1j24GlcQiJw5AieXMY1va8ZxkYyJtpHluhPpjLnlI4zxNLbE30A05Tp6XD4w== + dependencies: + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/peer-collections" "^5.2.8" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/record" "^4.0.4" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" any-signal "^4.1.1" hashlru "^2.3.0" interface-datastore "^8.2.11" - it-drain "^3.0.5" - it-length "^3.0.4" + it-drain "^3.0.7" + it-length "^3.0.6" it-length-prefixed "^9.0.4" - it-map "^3.0.5" - it-merge "^3.0.3" - it-parallel "^3.0.6" + it-map "^3.1.0" + it-merge "^3.0.5" + it-parallel "^3.0.7" it-pipe "^3.0.1" - it-protobuf-stream "^1.1.2" - it-pushable "^3.2.3" - it-take "^3.0.4" + it-protobuf-stream "^1.1.3" + it-take "^3.0.5" multiformats "^13.1.0" - p-defer "^4.0.0" - p-event "^6.0.0" + p-defer "^4.0.1" + p-event "^6.0.1" p-queue "^8.0.1" progress-events "^1.0.0" protons-runtime "^5.4.0" race-signal "^1.0.2" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" "@libp2p/keychain@^4.0.9": - version "4.0.9" - resolved "https://registry.yarnpkg.com/@libp2p/keychain/-/keychain-4.0.9.tgz#6b9847a4c55bc71da0a956661882f52fe0f55d64" - integrity sha512-n50O/m2OgI5J1JLqs8CjlLRf/6r2TEO7zKvmf6W0gld9PPjt5ugs9mUQJm7EeCqm4CZIF1YDK7uAGpYkQ87NPg== + version "4.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/keychain/-/keychain-4.1.4.tgz#8107267e3e689705e1b925bac65b6c4ef98598a5" + integrity sha512-nYMJ1RAuKP7WqtVocZByVyro57ZqLoKrDhC2+VDleFtco1FrTFxqrF7I5Hk6vn9lz94eIcG9ZCh9geRKEs5ecg== dependencies: - "@libp2p/crypto" "^4.0.3" - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-id" "^4.0.7" + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-id" "^4.2.3" interface-datastore "^8.2.11" merge-options "^3.0.4" multiformats "^13.1.0" sanitize-filename "^1.6.3" - uint8arrays "^5.0.2" - -"@libp2p/logger@^4.0.0", "@libp2p/logger@^4.0.1", "@libp2p/logger@^4.0.3", "@libp2p/logger@^4.0.4", "@libp2p/logger@^4.0.6", "@libp2p/logger@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.7.tgz#b5e82135f5c8a6f275c1b2e183333db956f3ed90" - integrity sha512-oyICns7G18S4eDhbFHUwZ7gLQnZTBVQtUMmMgEmrs8LnQu2GvXADxmQAPPkKtLNSCvRudg4hN3hP04Y+vNvlBQ== - dependencies: - "@libp2p/interface" "^1.1.4" - "@multiformats/multiaddr" "^12.1.14" - debug "^4.3.4" - interface-datastore "^8.2.11" - multiformats "^13.1.0" + uint8arrays "^5.1.0" -"@libp2p/logger@^4.0.8": - version "4.0.8" - resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.8.tgz#164ab350f50e98dda383c2211b69c6f1d3f5776f" - integrity sha512-H8vdQdjkPxnR9JbjyWQpyc+hjuE18ONvZet3hyOFqUUi28LkNSNMaW3VozgL+Gvb/JyJ3Hzni4Wbiqs2+EOi3g== +"@libp2p/logger@^4.0.1", "@libp2p/logger@^4.0.19", "@libp2p/logger@^4.0.3", "@libp2p/logger@^4.0.4", "@libp2p/logger@^4.0.5", "@libp2p/logger@^4.0.6", "@libp2p/logger@^4.0.7": + version "4.0.19" + resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.19.tgz#055364d719d3db2e45764ce04b4644e047a29c3b" + integrity sha512-VKpIMbjzs60AaTezh55iEDPJ0W2icbkJkBXSlAMycCT4C+RYxOTRgevasw3mDB6+Lj9etM0nfa4vutoG4fsYCw== dependencies: - "@libp2p/interface" "^1.1.5" - "@multiformats/multiaddr" "^12.1.14" - debug "^4.3.4" + "@libp2p/interface" "^1.6.3" + "@multiformats/multiaddr" "^12.2.3" interface-datastore "^8.2.11" multiformats "^13.1.0" + weald "^1.0.2" "@libp2p/mdns@^10.0.16": - version "10.0.16" - resolved "https://registry.yarnpkg.com/@libp2p/mdns/-/mdns-10.0.16.tgz#bb56d1a18a4544ee1e7c224c207f3073a1a8aa51" - integrity sha512-3RNpTxSYL04SaJkKMkyKuYbPx1C5Gd3Z9Y1DRJG8ict3ejZU0Zq0auMumjIKeeu4ye6sqDJ0UHkgMu51l6X9mw== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/utils" "^5.2.6" - "@multiformats/multiaddr" "^12.1.14" + version "10.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/mdns/-/mdns-10.1.4.tgz#2ae380bd6069407b25997b79bb914b6358258484" + integrity sha512-OlvfOGdNw9jPpTwgS9TYskNNn8kiqVDAIT42XOL9aLIXlX6Uqx1LlKphoWUxL01TsSIBUX5asKdnbGPpV/qqLA== + dependencies: + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" "@types/multicast-dns" "^7.2.4" dns-packet "^5.6.1" multicast-dns "^7.2.5" "@libp2p/mplex@^10.0.16": - version "10.0.16" - resolved "https://registry.yarnpkg.com/@libp2p/mplex/-/mplex-10.0.16.tgz#0c4b96ffbcdd02f6c655232ce8618b47a6df061f" - integrity sha512-F5H322kVCkPoM0FKalmyo5HwVQ/c5vKNpw2uLLyr26bqy7/GQMNkKvs88Rv7O2s2OHe7txC9Uwo9mapF/j4LlQ== + version "10.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/mplex/-/mplex-10.1.4.tgz#daf54a3ef0e2fb4043a883a601b4a207ac4f02bc" + integrity sha512-DxRAeixdbGVEGV+5ekp0C63NyVkKv0bOYkx/dVozcWDHmfClTD070KOhF3gIplKAVInC3FYaO3ahWzMdrD/J6g== dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/utils" "^5.2.6" + "@libp2p/interface" "^1.6.3" + "@libp2p/utils" "^5.4.8" it-pipe "^3.0.1" it-pushable "^3.2.3" it-stream-types "^2.0.1" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" -"@libp2p/multistream-select@^5.1.4": - version "5.1.4" - resolved "https://registry.yarnpkg.com/@libp2p/multistream-select/-/multistream-select-5.1.4.tgz#e9232014d8784e37c8c62a8d655414145df688aa" - integrity sha512-hFK831x8SRQwWO6sZ0PLdLMJdxSw/HFWTZLqwFGsQbgfgBd+Via3Fztb7xe6VRqHpnAwZkVujP+iubAI7AghGg== +"@libp2p/multistream-select@^5.1.16": + version "5.1.16" + resolved "https://registry.yarnpkg.com/@libp2p/multistream-select/-/multistream-select-5.1.16.tgz#ad7f9fdc7c84032f9a96b8c31e3ef78bb8b263dd" + integrity sha512-0IUecYYu++gimGRzG324A6+NE9Vk/6Wvmp2xegfLjUZRegpFbHup3UvFEGxTkpHmsoswJMMTPHQyCNJFga+Z7Q== dependencies: - "@libp2p/interface" "^1.1.4" + "@libp2p/interface" "^1.6.3" it-length-prefixed "^9.0.4" - it-length-prefixed-stream "^1.1.6" + it-length-prefixed-stream "^1.1.7" it-stream-types "^2.0.1" - p-defer "^4.0.0" + p-defer "^4.0.1" race-signal "^1.0.2" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" -"@libp2p/peer-collections@^5.1.7": - version "5.1.7" - resolved "https://registry.yarnpkg.com/@libp2p/peer-collections/-/peer-collections-5.1.7.tgz#e089920c330f5edaf55ec38faea571bab3860150" - integrity sha512-9XXWSJtC7XvbH32h2bK3fygyzd4B2/JeWzsjX8cUDtO69jKNiVJglB8UqajZBuwLZSOQG5aRNWK4RWXJDrsh/w== +"@libp2p/peer-collections@^5.1.6", "@libp2p/peer-collections@^5.2.8": + version "5.2.8" + resolved "https://registry.yarnpkg.com/@libp2p/peer-collections/-/peer-collections-5.2.8.tgz#63910791fed3c2eee2f56554a6662bbd04c93e99" + integrity sha512-dIakIFms3GgFYg4lVgl9afAm+OAxGTofz4KdFnVrlNW1z6VFhTbnRtvTweR6woSr2es1+Fu6WutmZ+62Fn0iOQ== dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-id" "^4.0.7" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/utils" "^5.4.8" -"@libp2p/peer-id-factory@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/peer-id-factory/-/peer-id-factory-4.0.7.tgz#1dedfc85c32f7c23dea6ec6b0b26b592239711d8" - integrity sha512-ueSjkodKPhYw7C0ysRGscY+e9vJ+ixpmJvi5w8vbnOn0ex9cAT+9S7DGL03d8vGMAT3xjEbUsI2GpF17uZ9Rpg== +"@libp2p/peer-id-factory@^4.2.3": + version "4.2.3" + resolved "https://registry.yarnpkg.com/@libp2p/peer-id-factory/-/peer-id-factory-4.2.3.tgz#0a15e9dad847432e55b539244953b983b21a3445" + integrity sha512-4ryh3M4UH+nwlM1o3y3iCpW2jTxjj+Hgb6UNI1nFxZGLA6MI+En8kKiroa970xiVvsA+Xmas8B9gWeMFrZKBKg== dependencies: - "@libp2p/crypto" "^4.0.3" - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-id" "^4.0.7" + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-id" "^4.2.3" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" -"@libp2p/peer-id@^4.0.0", "@libp2p/peer-id@^4.0.3", "@libp2p/peer-id@^4.0.4", "@libp2p/peer-id@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/peer-id/-/peer-id-4.0.7.tgz#e1902bc3dd68813210d37816d52edb9d3523fae9" - integrity sha512-kbslH0VBmcHO1Osr/qQlFljPOYuldUC6OdYM5c6Tdy+KFU/W4P9Ouv/4e7o3uX6LtlQ8QqIsZH+/bR6AJxC8Gw== +"@libp2p/peer-id@^4.0.0", "@libp2p/peer-id@^4.0.3", "@libp2p/peer-id@^4.0.4", "@libp2p/peer-id@^4.2.3": + version "4.2.3" + resolved "https://registry.yarnpkg.com/@libp2p/peer-id/-/peer-id-4.2.3.tgz#21c2e8c265db70fe63670c60ed760316dde4dd64" + integrity sha512-hRqPzcYOz/5q6QvHYdmPMGeFZCjC/9qxQ/+jstSDMnY1DuKEXCre2+tCpG9OeRAFyPBbs5isfaqbY3zNZV2pqA== dependencies: - "@libp2p/interface" "^1.1.4" + "@libp2p/interface" "^1.6.3" multiformats "^13.1.0" - uint8arrays "^5.0.2" - -"@libp2p/peer-record@^7.0.10": - version "7.0.10" - resolved "https://registry.yarnpkg.com/@libp2p/peer-record/-/peer-record-7.0.10.tgz#228dbfa8e0740701cf124a3773b3d7a51a362d4f" - integrity sha512-njVSa2mMcGqQoCnhmZQOadHIQMsO52wqKO6fP1On8sVRmb9yXNGBkZ+b5pRXjjPzUpJeUmC+/SZHpeLqpdpPMQ== - dependencies: - "@libp2p/crypto" "^4.0.3" - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/utils" "^5.2.6" - "@multiformats/multiaddr" "^12.1.14" + uint8arrays "^5.1.0" + +"@libp2p/peer-record@^7.0.24": + version "7.0.24" + resolved "https://registry.yarnpkg.com/@libp2p/peer-record/-/peer-record-7.0.24.tgz#b52e059ece424c56e185e2367efc01ab9098a94e" + integrity sha512-2LYvLqr3XDjA5u2LGD/3IvdgdrwOYdMzQnzr612/Q+yVS+36CN0dAIqU74OEWx+XeeUJSBQnQ0ryBQq/arbXuA== + dependencies: + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" protons-runtime "^5.4.0" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" - -"@libp2p/peer-store@^10.0.11": - version "10.0.11" - resolved "https://registry.yarnpkg.com/@libp2p/peer-store/-/peer-store-10.0.11.tgz#d2e6b827749c7083c4c277711c3da73d694d8ffd" - integrity sha512-egcEzHRQUTW7mQuLPyN/y0Rtunk8zFoxLdTRNjJTrvQRmkCeLIDZ8VsYB0KF7feA85nbpRFR62dVjN46I65yFA== - dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-collections" "^5.1.7" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/peer-record" "^7.0.10" - "@multiformats/multiaddr" "^12.1.14" + uint8arrays "^5.1.0" + +"@libp2p/peer-store@^10.1.4": + version "10.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/peer-store/-/peer-store-10.1.4.tgz#13a96bafafd9dd1161bbd7a4554c8d897f9e0299" + integrity sha512-D/lqEaWZV8xEBQ7b0ZEFYtaa6+LjXjs+PRrFpmnvyuz86o9KQedVoJPufT4g0nKIeQZUtdRfkzWNnwD+fru64g== + dependencies: + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-collections" "^5.2.8" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/peer-record" "^7.0.24" + "@multiformats/multiaddr" "^12.2.3" interface-datastore "^8.2.11" - it-all "^3.0.4" + it-all "^3.0.6" mortice "^3.0.4" multiformats "^13.1.0" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" "@libp2p/ping@^1.0.12": - version "1.0.12" - resolved "https://registry.yarnpkg.com/@libp2p/ping/-/ping-1.0.12.tgz#f97c594744f108be68044fde7e60f3e1cd639026" - integrity sha512-xJjJJO/2HUBLHMNHjgLpGQdYJHDQeLcIqflBIerpoRKNuc8omusTQ2PRrvMZzvK+N7fZYk7tOuBNZ8wWxVSX6w== - dependencies: - "@libp2p/crypto" "^4.0.3" - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@multiformats/multiaddr" "^12.1.14" - it-first "^3.0.4" + version "1.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/ping/-/ping-1.1.4.tgz#ea1686d262d4da61d97533537c22f6516553aafe" + integrity sha512-biwYtLaEHky2hsLzVZnPzrwME2WwaMu2MG+poKepxS36Ib9EM7XPGVUjpoafCQBM+Z67AMiFpKVtk3k9Kb24Gw== + dependencies: + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@multiformats/multiaddr" "^12.2.3" + it-first "^3.0.6" it-pipe "^3.0.1" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" + +"@libp2p/record@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@libp2p/record/-/record-4.0.4.tgz#9300e5a10ebc543f1d8df0b95a7181d633f039f1" + integrity sha512-wEEeHXGNIcc8HtGbgGMuSHbboUWMxKG7OxALFwkE+KACgfRJZTESOp6XIdZnyC0r9lfEFsjF01pFKBTzoBmWEQ== + dependencies: + protons-runtime "^5.4.0" + uint8arraylist "^2.4.8" + uint8arrays "^5.1.0" "@libp2p/tcp@^9.0.16": - version "9.0.16" - resolved "https://registry.yarnpkg.com/@libp2p/tcp/-/tcp-9.0.16.tgz#592a50592d4c1f08208a9ba0bd89741712986c59" - integrity sha512-7R+KaXfcdumVkVe612HfEAcARN8fARkf5DQKLGg0qhj/jEeVh2vS2Ze15d1mRrKBXWbya/Q0IzHEzvNTvd21Ug== + version "9.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/tcp/-/tcp-9.1.4.tgz#6447adbbba45b34ac4dab20b3da4ab6128b16f44" + integrity sha512-0j/aYdMFLhLWUodtyuBt5+smzkmXCiczOxNOwKyTVUuoMMcAPCLxACqCy8213qiwpJ3qP5ZTTTs/JJMgWRC7ag== dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/utils" "^5.2.6" + "@libp2p/interface" "^1.6.3" + "@libp2p/utils" "^5.4.8" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.1.14" + "@multiformats/multiaddr" "^12.2.3" "@types/sinon" "^17.0.3" - stream-to-it "^0.2.4" + progress-events "^1.0.0" + stream-to-it "^1.0.1" "@libp2p/upnp-nat@^1.0.14": - version "1.0.14" - resolved "https://registry.yarnpkg.com/@libp2p/upnp-nat/-/upnp-nat-1.0.14.tgz#a857a4ef212482c8d585849977deaa0690d1cab7" - integrity sha512-xa8Nf4q5PTYbSUNgitY6/0auB/ySrH2dsMVNUnSV8YTbdlKG/yNE96HxTIiPoTbKNHi8fTnMs9ESpyKynwwNag== + version "1.2.4" + resolved "https://registry.yarnpkg.com/@libp2p/upnp-nat/-/upnp-nat-1.2.4.tgz#61984e832ebfa6496aaaea65683e62f4928c1022" + integrity sha512-oI0yAg7GKpiPy4u2u/34wYPJ/CLBraIA5dUh21ZGy3TH88eaTOYfyHSfGw9AI0IT/012xxkpqbA+h5+V+qDoBQ== dependencies: "@achingbrain/nat-port-mapper" "^1.0.13" - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/utils" "^5.2.6" - "@multiformats/multiaddr" "^12.1.14" + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" wherearewe "^2.0.1" -"@libp2p/utils@^5.0.0", "@libp2p/utils@^5.2.5", "@libp2p/utils@^5.2.6": - version "5.2.7" - resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.2.7.tgz#14157f59f74c5ddb507027941259ead43d6e32d5" - integrity sha512-Pxrj52DpLTGdP0IrLZJAvyZmu/mAq7QWTMrggwL6DqAM3CkzdWOwIrMysm2+RM0y60UQt05ZZSMFpKx3m8eeag== +"@libp2p/utils@^5.2.3", "@libp2p/utils@^5.2.5", "@libp2p/utils@^5.2.6", "@libp2p/utils@^5.4.8": + version "5.4.8" + resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.4.8.tgz#f424b953fd74657a6ec5c061f68daac9489be361" + integrity sha512-3ysAjrheDvcrUd8RWOCwa6Hm+5FMsYOlPq9IPllfD0jOyHO2RHc/huvAmjBg/PWrTdUyx1nWQf9wmdQFgTDUDQ== dependencies: "@chainsafe/is-ip" "^2.0.2" - "@libp2p/interface" "^1.1.5" - "@libp2p/logger" "^4.0.8" - "@multiformats/multiaddr" "^12.1.14" - "@multiformats/multiaddr-matcher" "^1.1.2" + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/logger" "^4.0.19" + "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr-matcher" "^1.2.1" + "@sindresorhus/fnv1a" "^3.1.0" + "@types/murmurhash3js-revisited" "^3.0.3" + any-signal "^4.1.1" delay "^6.0.0" get-iterator "^2.0.1" is-loopback-addr "^2.0.2" it-pushable "^3.2.3" it-stream-types "^2.0.1" + murmurhash3js-revisited "^3.0.0" netmask "^2.0.2" - p-defer "^4.0.0" - race-event "^1.2.0" + p-defer "^4.0.1" + race-event "^1.3.0" race-signal "^1.0.2" uint8arraylist "^2.4.8" + uint8arrays "^5.1.0" "@libp2p/webrtc@^4.0.20": - version "4.0.21" - resolved "https://registry.yarnpkg.com/@libp2p/webrtc/-/webrtc-4.0.21.tgz#9db2cbcbfbae7dc91fe6dc86666c92da5c687e19" - integrity sha512-dzB1kkcZukiOd9SL6Ni3vHq5HWB6yndlXcdiy8ljTlnqTyyeJXn3sNzwfUgeU4qicwxV53gLhl6jVxlq8X1MPg== + version "4.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/webrtc/-/webrtc-4.1.4.tgz#622fb0943c2f868ff6f28e4a834a2c50b0d30740" + integrity sha512-vX6FctslugUzZiZNQ8+uNAYN4ZDunnqcecUog0KOonySI8XAJs6ZA9Y2giCoSbkmaAP80gSRp8gGfuri8puLYw== dependencies: "@chainsafe/libp2p-noise" "^15.0.0" - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/utils" "^5.2.6" + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/utils" "^5.4.8" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.1.14" - "@multiformats/multiaddr-matcher" "^1.1.2" + "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr-matcher" "^1.2.1" detect-browser "^5.3.0" it-length-prefixed "^9.0.4" - it-protobuf-stream "^1.1.2" + it-protobuf-stream "^1.1.3" it-pushable "^3.2.3" it-stream-types "^2.0.1" multiformats "^13.1.0" - multihashes "^4.0.3" - node-datachannel "^0.5.3" - p-defer "^4.0.0" - p-event "^6.0.0" + node-datachannel "^0.11.0" + p-defer "^4.0.1" + p-event "^6.0.1" p-timeout "^6.1.2" + progress-events "^1.0.0" protons-runtime "^5.4.0" race-signal "^1.0.2" - react-native-webrtc "^118.0.1" + react-native-webrtc "^118.0.7" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" "@libp2p/websockets@^8.0.16": - version "8.0.16" - resolved "https://registry.yarnpkg.com/@libp2p/websockets/-/websockets-8.0.16.tgz#504fa0dbd3946b856f3b743b1950554384e14f9c" - integrity sha512-8SNuGCDtjzObIAr05mXaY7kB1Bz85Tda3T3byHpUVvn7IPbkdkGe0NiKB+ZvK7ZJhBL/7FdQZmVp3GBffWWrmg== + version "8.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/websockets/-/websockets-8.1.4.tgz#c4e5ca507fb0159800e01494e429c971cfd2c2a7" + integrity sha512-VWVgIo8t4VTzTI+orfGQxeHSXNWQL6dF//nH2p3nI5Z0saR6lrv5pNTsXbIhrZukGRFGgSwqGsd8bGhEohKNrQ== dependencies: - "@libp2p/interface" "^1.1.4" - "@libp2p/utils" "^5.2.6" + "@libp2p/interface" "^1.6.3" + "@libp2p/utils" "^5.4.8" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.1.14" + "@multiformats/multiaddr" "^12.2.3" "@multiformats/multiaddr-to-uri" "^10.0.1" "@types/ws" "^8.5.10" it-ws "^6.1.1" - p-defer "^4.0.0" + p-defer "^4.0.1" + progress-events "^1.0.0" + race-signal "^1.0.2" wherearewe "^2.0.1" - ws "^8.16.0" + ws "^8.17.0" "@libp2p/webtransport@^4.0.20": - version "4.0.21" - resolved "https://registry.yarnpkg.com/@libp2p/webtransport/-/webtransport-4.0.21.tgz#31a932daca69ed1b9f5258f6720f0fc2f1b83be2" - integrity sha512-CEHm28zb2q4ebJW2ig2SCyF+8xEOjh7jcu+bdrUrCoAZV/7NKbt9siechJQyjagHcku4g5fga1q2aq4uj81f7g== + version "4.1.4" + resolved "https://registry.yarnpkg.com/@libp2p/webtransport/-/webtransport-4.1.4.tgz#d37eb5e596af77661b6531d7c46e0ffe1d2e7da0" + integrity sha512-gbQmEZIrDgdHUMVp2NYKrnnK6slMMoB+k9Pd5uTd/mD6kvhgKBKWmWkEX++CUDlv4j78E6tgQEjQ4xNbnl79+A== dependencies: "@chainsafe/libp2p-noise" "^15.0.0" - "@libp2p/interface" "^1.1.4" - "@libp2p/peer-id" "^4.0.7" - "@multiformats/multiaddr" "^12.1.14" - "@multiformats/multiaddr-matcher" "^1.1.2" + "@libp2p/interface" "^1.6.3" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/utils" "^5.4.8" + "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr-matcher" "^1.2.1" it-stream-types "^2.0.1" multiformats "^13.1.0" + progress-events "^1.0.0" + race-signal "^1.0.2" uint8arraylist "^2.4.8" - uint8arrays "^5.0.2" + uint8arrays "^5.1.0" + +"@manypkg/find-root@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@manypkg/find-root/-/find-root-1.1.0.tgz#a62d8ed1cd7e7d4c11d9d52a8397460b5d4ad29f" + integrity sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA== + dependencies: + "@babel/runtime" "^7.5.5" + "@types/node" "^12.7.1" + find-up "^4.1.0" + fs-extra "^8.1.0" + +"@manypkg/get-packages@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@manypkg/get-packages/-/get-packages-1.1.3.tgz#e184db9bba792fa4693de4658cfb1463ac2c9c47" + integrity sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A== + dependencies: + "@babel/runtime" "^7.5.5" + "@changesets/types" "^4.0.1" + "@manypkg/find-root" "^1.1.0" + fs-extra "^8.1.0" + globby "^11.0.0" + read-yaml-file "^1.1.0" "@multiformats/base-x@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@multiformats/base-x/-/base-x-4.0.1.tgz#95ff0fa58711789d53aefb2590a8b7a4e715d121" integrity sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw== -"@multiformats/dns@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@multiformats/dns/-/dns-1.0.1.tgz#087231be468afe76cdc4bb36251f0dcc93c6a44c" - integrity sha512-SuhXtRrj8O8Na+eVmmKh5DlvGDemHIRtENqb8KujA5hOpAHWm4P0QdaTqPnZKjFeUVAuKMGxh91UKf66NIA86w== +"@multiformats/dns@^1.0.1", "@multiformats/dns@^1.0.3", "@multiformats/dns@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@multiformats/dns/-/dns-1.0.6.tgz#b8c7de11459a02a5f4e609d35d3cdb95cb6ad152" + integrity sha512-nt/5UqjMPtyvkG9BQYdJ4GfLK3nMqGpFZOzf4hAmIa0sJh2LlS9YKXZ4FgwBDsaHvzZqR/rUFIywIc7pkHNNuw== dependencies: "@types/dns-packet" "^5.6.5" buffer "^6.0.3" @@ -4148,57 +4291,76 @@ dependencies: "@multiformats/multiaddr" "^12.0.0" -"@multiformats/multiaddr-matcher@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-matcher/-/multiaddr-matcher-1.1.2.tgz#628ec7d4fceddebbf7fba345be5a7c5c093dd6d9" - integrity sha512-O7hO+TYsweMjNCqTYKYn8iki2GXA46mxmgqnsOb2Wpr6ca4dRGnPldWTai2WwTeZpQyRJ/7GE+N9zPTfP0xE+Q== +"@multiformats/multiaddr-matcher@^1.2.0", "@multiformats/multiaddr-matcher@^1.2.1": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-matcher/-/multiaddr-matcher-1.2.4.tgz#affb3c63b5cd83b44156be19583981651373ec2e" + integrity sha512-GgpqzQFL4Mj8t7cLNHC5nuYUuSm0kTtSUyYswiyWwTSUY3XwRAMx0UiFWQg+ETk0u+/IvFaHxfnyEoH3tasvwg== dependencies: "@chainsafe/is-ip" "^2.0.1" "@multiformats/multiaddr" "^12.0.0" multiformats "^13.0.0" "@multiformats/multiaddr-to-uri@^10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-to-uri/-/multiaddr-to-uri-10.0.1.tgz#f26a480d35766e601cd02d48d148c7a4c6ff6e62" - integrity sha512-RtOBRJucMCzINPytvt1y7tJ2jr4aSKJmv3DF7/C515RJO9+nu9sZHdsk9vn251OtN8k21rAGlIHESt/BSJWAnQ== + version "10.1.0" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-to-uri/-/multiaddr-to-uri-10.1.0.tgz#f52312cee11b6ad25997e743d9c575c44726c7d0" + integrity sha512-ZNwSAx3ssBWwd4y0LKrOsq9xG7LBHboQxnUdSduNc2fTh/NS1UjA2slgUy6KHxH5k9S2DSus0iU2CoyJyN0/pg== dependencies: - "@multiformats/multiaddr" "^12.0.0" + "@multiformats/multiaddr" "^12.3.0" -"@multiformats/multiaddr@^12.0.0", "@multiformats/multiaddr@^12.1.0", "@multiformats/multiaddr@^12.1.14", "@multiformats/multiaddr@^12.1.3", "@multiformats/multiaddr@^12.2.0": - version "12.2.0" - resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.2.0.tgz#a68864669e785de23dcc981a7ebf6903ae4bdc98" - integrity sha512-7HfwdG1uBR8t7N7nuK26oXbY0bB9aFJ69NdendqEAbr2mgrng8y+u5qpFem2WjNPARAooejfwCeQVAa39g7ezg== +"@multiformats/multiaddr@^12.0.0", "@multiformats/multiaddr@^12.1.14", "@multiformats/multiaddr@^12.1.3", "@multiformats/multiaddr@^12.2.1", "@multiformats/multiaddr@^12.2.3", "@multiformats/multiaddr@^12.3.0": + version "12.3.0" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.3.0.tgz#b1422813446e5cdec4b0f6cba51f93239f390884" + integrity sha512-JQ8Gc/jgucqqvEaDTFN/AvxlYDHEE7lgEWLMYW7hKZkWggER+GvG/tVxUgUxIP8M0vFpvEHKKHE0lKzyMsgi8Q== dependencies: "@chainsafe/is-ip" "^2.0.1" "@chainsafe/netmask" "^2.0.0" "@libp2p/interface" "^1.0.0" - "@multiformats/dns" "^1.0.1" + "@multiformats/dns" "^1.0.3" multiformats "^13.0.0" - race-signal "^1.0.2" uint8-varint "^2.0.1" uint8arrays "^5.0.0" +"@multiformats/uri-to-multiaddr@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@multiformats/uri-to-multiaddr/-/uri-to-multiaddr-8.0.0.tgz#cd4c3248c0039731504b69ae74ae732e954119f7" + integrity sha512-86O+gY6JTnCv0O/IxTKV+1+GACoEBTr5Cfyh+FdzStWneviz2AZwLK8Hsys5dbfMgT//Vs7FolMiEHURlCel8w== + dependencies: + "@multiformats/multiaddr" "^12.1.14" + is-ip "^5.0.0" + "@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": version "2.1.8-no-fsevents.3" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== -"@noble/ciphers@^0.4.0": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-0.4.1.tgz#977fc35f563a4ca315ebbc4cbb1f9b670bd54456" - integrity sha512-QCOA9cgf3Rc33owG0AYBB9wszz+Ul2kramWN8tXG44Gyciud/tbkEqvxRF/IpqQaBpRBNi9f4jdNxqB2CQCIXg== +"@noble/ciphers@^0.5.0", "@noble/ciphers@^0.5.1": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-0.5.3.tgz#48b536311587125e0d0c1535f73ec8375cd76b23" + integrity sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w== -"@noble/curves@^1.1.0", "@noble/curves@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.3.0.tgz#01be46da4fd195822dab821e72f71bf4aeec635e" - integrity sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA== +"@noble/curves@^1.0.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" + integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ== dependencies: - "@noble/hashes" "1.3.3" + "@noble/hashes" "1.5.0" -"@noble/hashes@1.3.3", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" - integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== +"@noble/curves@^1.1.0", "@noble/curves@^1.3.0", "@noble/curves@^1.4.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.5.0.tgz#7a9b9b507065d516e6dce275a1e31db8d2a100dd" + integrity sha512-J5EKamIHnKPyClwVrzmaf5wSdQXgdHcPZIZLu3bwnbeCx8/7NPK5q2ZBWF+5FvYGByjiQQsJYX6jfgB2wDPn3A== + dependencies: + "@noble/hashes" "1.4.0" + +"@noble/hashes@1.4.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== + +"@noble/hashes@1.5.0", "@noble/hashes@^1", "@noble/hashes@^1.0.0", "@noble/hashes@^1.3.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" + integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -4213,7 +4375,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -4221,19 +4383,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@peculiar/asn1-schema@^2.3.6": - version "2.3.6" - resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.6.tgz#3dd3c2ade7f702a9a94dfb395c192f5fa5d6b922" - integrity sha512-izNRxPoaeJeg/AyH8hER6s+H7p4itk+03QCa4sbxI3lNdseQYCuxzgsuNK8bTXChtLTjpJz6NmXKA73qLa3rCA== - dependencies: - asn1js "^3.0.5" - pvtsutils "^1.3.2" - tslib "^2.4.0" - "@peculiar/asn1-schema@^2.3.8": - version "2.3.8" - resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.8.tgz#04b38832a814e25731232dd5be883460a156da3b" - integrity sha512-ULB1XqHKx1WBU/tTFIA+uARuRoBVZ4pNdOA878RDrRbBfBGcSzi5HBkdScC6ZbHn8z7L8gmKCgPC1LHRrP46tA== + version "2.3.13" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.13.tgz#ec8509cdcbc0da3abe73fd7e690556b57a61b8f4" + integrity sha512-3Xq3a01WkHRZL8X04Zsfg//mGaA21xlL4tlVn4v2xGT0JStiztATRkMwa5b+f/HXmY2smsiLXYK46Gwgzvfg3g== dependencies: asn1js "^3.0.5" pvtsutils "^1.3.5" @@ -4246,27 +4399,16 @@ dependencies: tslib "^2.0.0" -"@peculiar/webcrypto@^1.1.6": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.2.tgz#66d70ee476608fa45ebd60af0aa3c69640d0d85a" - integrity sha512-dMvTarTKRx3FzlRUD7Zi2qEsnWVedb/XNRvfM/JaanhTPm+ug9wPsvLXfPHDdl4mjbGdD+Lo/DXRd9sJRuQV3w== - dependencies: - "@peculiar/asn1-schema" "^2.3.6" - "@peculiar/json-schema" "^1.1.12" - pvtsutils "^1.3.2" - tslib "^2.5.0" - webcrypto-core "^1.7.7" - -"@peculiar/webcrypto@^1.4.1": - version "1.4.5" - resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.5.tgz#424bed6b0d133b772f5cbffd143d0468a90f40a0" - integrity sha512-oDk93QCDGdxFRM8382Zdminzs44dg3M2+E5Np+JWkpqLDyJC9DviMh8F8mEJkYuUcUOGA5jHO5AJJ10MFWdbZw== +"@peculiar/webcrypto@^1.1.6", "@peculiar/webcrypto@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.5.0.tgz#9e57174c02c1291051c553600347e12b81469e10" + integrity sha512-BRs5XUAwiyCDQMsVA9IDvDa7UBR9gAvPHgugOeGng3YN6vJ9JYonyDc0lNczErgtCWtucjR5N7VtaonboD/ezg== dependencies: "@peculiar/asn1-schema" "^2.3.8" "@peculiar/json-schema" "^1.1.12" pvtsutils "^1.3.5" tslib "^2.6.2" - webcrypto-core "^1.7.8" + webcrypto-core "^1.8.0" "@polkadot-api/client@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0": version "0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0" @@ -4641,7 +4783,60 @@ tslib "^2.6.2" ws "^8.15.1" -"@rdfjs/types@*": +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + +"@rdfjs/types@*", "@rdfjs/types@>=1.0.0", "@rdfjs/types@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@rdfjs/types/-/types-1.1.0.tgz#098f180b7cccb03bb416c7b4d03baaa9d480e36b" integrity sha512-5zm8bN2/CC634dTcn/0AhTRLaQRjXDZs3QfcAsQKNturHT7XVWcKy/8p3P5gXl+YkZTAmy7T5M/LyiT/jbkENw== @@ -4649,16 +4844,24 @@ "@types/node" "*" "@rollup/plugin-alias@^4.0.2": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-4.0.2.tgz#fec6c6aff8dd6fce580ae6bc5345084cd702bb62" - integrity sha512-1hv7dBOZZwo3SEupxn4UA2N0EDThqSSS+wI1St1TNTBtOZvUchyIClyHcnDcjjrReTPZ47Faedrhblv4n+T5UQ== + version "4.0.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-4.0.4.tgz#67734ec44a7747916aa52a3b1a0e8d459dbf3ae2" + integrity sha512-0CaAY238SMtYAWEXXptWSR8iz8NYZnH7zNBKuJ14xFJSGwLtPgjvXYsoApAHfzYXXH1ejxpVw7WlHss3zhh9SQ== dependencies: slash "^4.0.0" +"@rollup/plugin-babel@^6.0.4": + version "6.0.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-6.0.4.tgz#bd698e351fa9aa9619fcae780aea2a603d98e4c4" + integrity sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw== + dependencies: + "@babel/helper-module-imports" "^7.18.6" + "@rollup/pluginutils" "^5.0.1" + "@rollup/plugin-commonjs@^24.0.0": - version "24.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.0.tgz#fb7cf4a6029f07ec42b25daa535c75b05a43f75c" - integrity sha512-0w0wyykzdyRRPHOb0cQt14mIBLujfAv6GgP6g8nvg/iBxEm112t3YPPq+Buqe2+imvElTka+bjNlJ/gB56TD8g== + version "24.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-24.1.0.tgz#79e54bd83bb64396761431eee6c44152ef322100" + integrity sha512-eSL45hjhCWI0jCCXcNtLVqM5N1JlBGvlFfY0m6oOYnLCJ6N0qEXoZql4sY2MOUArzhH4SA/qBpTxvvZp2Sc+DQ== dependencies: "@rollup/pluginutils" "^5.0.1" commondir "^1.0.1" @@ -4675,14 +4878,14 @@ "@rollup/pluginutils" "^3.0.8" "@rollup/plugin-node-resolve@^15.0.1": - version "15.0.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz#72be449b8e06f6367168d5b3cd5e2802e0248971" - integrity sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg== + version "15.2.3" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz#e5e0b059bd85ca57489492f295ce88c2d4b0daf9" + integrity sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ== dependencies: "@rollup/pluginutils" "^5.0.1" "@types/resolve" "1.20.2" deepmerge "^4.2.2" - is-builtin-module "^3.2.0" + is-builtin-module "^3.2.1" is-module "^1.0.0" resolve "^1.22.1" @@ -4701,49 +4904,38 @@ picomatch "^2.2.2" "@rollup/pluginutils@^5.0.1": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" - integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA== + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== dependencies: "@types/estree" "^1.0.0" estree-walker "^2.0.2" picomatch "^2.3.1" "@scure/base@^1.1.1", "@scure/base@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" - integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ== - -"@sd-jwt/decode@^0.6.1": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@sd-jwt/decode/-/decode-0.6.1.tgz#141f7782df53bab7159a75d91ed4711e1c14a7ea" - integrity sha512-QgTIoYd5zyKKLgXB4xEYJTrvumVwtsj5Dog0v0L9UH9ZvHekDaeexS247X7A4iSdzTvmZzUpGskgABOa4D8NmQ== - dependencies: - "@sd-jwt/types" "0.6.1" - "@sd-jwt/utils" "0.6.1" + version "1.1.7" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.7.tgz#fe973311a5c6267846aa131bc72e96c5d40d2b30" + integrity sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g== -"@sd-jwt/types@0.6.1": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@sd-jwt/types/-/types-0.6.1.tgz#fc4235e00cf40d35a21d6bc02e44e12d7162aa9b" - integrity sha512-LKpABZJGT77jNhOLvAHIkNNmGqXzyfwBT+6r+DN9zNzMx1CzuNR0qXk1GMUbast9iCfPkGbnEpUv/jHTBvlIvg== +"@scure/base@^1.1.3": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" + integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== -"@sd-jwt/utils@0.6.1": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@sd-jwt/utils/-/utils-0.6.1.tgz#33273b20c9eb1954e4eab34118158b646b574ff9" - integrity sha512-1NHZ//+GecGQJb+gSdDicnrHG0DvACUk9jTnXA5yLZhlRjgkjyfJLNsCZesYeCyVp/SiyvIC9B+JwoY4kI0TwQ== - dependencies: - "@sd-jwt/types" "0.6.1" - js-base64 "^3.7.6" +"@sec-ant/readable-stream@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz#60de891bb126abfdc5410fdc6166aca065f10a0c" + integrity sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg== "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== +"@sindresorhus/fnv1a@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/fnv1a/-/fnv1a-3.1.0.tgz#f8e46597298f6fd4c12dc901cdd4e73beb4d24fa" + integrity sha512-KV321z5m/0nuAg83W1dPLy85HpHDk7Sdi4fJbwvacWsEhAh+rZUW4ZfGcXmUIvjZg4ss2bcwNlRhJ7GBEUG08w== "@sinonjs/commons@^3.0.0": version "3.0.1" @@ -4759,12 +4951,12 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@sphereon/isomorphic-webcrypto@^2.4.0-unstable.4": - version "2.4.0-unstable.4" - resolved "https://registry.yarnpkg.com/@sphereon/isomorphic-webcrypto/-/isomorphic-webcrypto-2.4.0-unstable.4.tgz#c96c4e6bec640cde825b4622311ef2860322d26f" - integrity sha512-7i9GBta0yji3Z5ocyk82fXpqrV/swe7hXZVfVzOXRaGtTUNd+y8W/3cpHRQC2S4UEO/5N3lX7+B6qUunK9wS/Q== +"@sphereon/isomorphic-webcrypto@^2.5.0-unstable.0": + version "2.5.0-unstable.0" + resolved "https://registry.yarnpkg.com/@sphereon/isomorphic-webcrypto/-/isomorphic-webcrypto-2.5.0-unstable.0.tgz#90c51708855307451f6f75eb2fcc20f433829716" + integrity sha512-HEOpZATW7zzYiF8Ak2X0lMvrVQL+6FTeIHm6E815zu7xP5PLjwYPJ0galBjc/F+kex22BzK9hndsdH0/y3bjqA== dependencies: - "@peculiar/webcrypto" "^1.4.1" + "@peculiar/webcrypto" "^1.5.0" asmcrypto.js "^2.3.2" b64-lite "^1.4.0" b64u-lite "^1.1.0" @@ -4778,27 +4970,6 @@ str2buf "^1.3.0" webcrypto-shim "^0.1.7" -"@sphereon/ssi-sdk-ext.did-resolver-jwk@^0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@sphereon/ssi-sdk-ext.did-resolver-jwk/-/ssi-sdk-ext.did-resolver-jwk-0.24.0.tgz#7603028542d1e1f13d13975a436150b0d0e6de43" - integrity sha512-74to/yE8q3A7O935AlvHWhvBItHuC0HCiKq2UiYa5Adw3NVU9mElXUOik7IRJrhuD6wJNaAxDmQYAFIWRdIG1g== - dependencies: - "@sphereon/ssi-types" "0.28.0" - base64url "^3.0.1" - debug "^4.3.4" - did-resolver "^4.1.0" - uint8arrays "^3.1.1" - -"@sphereon/ssi-types@0.28.0": - version "0.28.0" - resolved "https://registry.yarnpkg.com/@sphereon/ssi-types/-/ssi-types-0.28.0.tgz#3eccb6dd7be19af26c5820885f35f3232d038a2d" - integrity sha512-NkTkrsBoQUZzJutlk5XD3snBxL9kfsxKdQvBbGUEaUDOiW8siTNUoJuQFeA+bI0eJY99up95bmMKdJeDc1VDfg== - dependencies: - "@sd-jwt/decode" "^0.6.1" - debug "^4.3.5" - events "^3.3.0" - jwt-decode "^3.1.2" - "@stablelib/aead@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/aead/-/aead-1.0.1.tgz#c4b1106df9c23d1b867eb9b276d8f42d5fc4c0c3" @@ -4831,6 +5002,13 @@ dependencies: "@stablelib/int" "^1.0.1" +"@stablelib/binary@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/binary/-/binary-2.0.0.tgz#2f23f6f7d4fe11044f9108925b258a2c71f3c82f" + integrity sha512-dHejKHMtq5OtNwDSMcFx+djhixVAnZ76Rqga3WOOKe6KV3NlnE7JBXlmdLIn04G4FxqhRSEx+zkoO4Izdw10ZA== + dependencies: + "@stablelib/int" "^2.0.0" + "@stablelib/blockcipher@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/blockcipher/-/blockcipher-1.0.1.tgz#535f067d147ecdc9625ccd2b0d129f6d53d563d2" @@ -4866,7 +5044,7 @@ resolved "https://registry.yarnpkg.com/@stablelib/constant-time/-/constant-time-1.0.1.tgz#bde361465e1cf7b9753061b77e376b0ca4c77e35" integrity sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg== -"@stablelib/ed25519@^1.0.1", "@stablelib/ed25519@^1.0.2": +"@stablelib/ed25519@^1.0.1", "@stablelib/ed25519@^1.0.2", "@stablelib/ed25519@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@stablelib/ed25519/-/ed25519-1.0.3.tgz#f8fdeb6f77114897c887bb6a3138d659d3f35996" integrity sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg== @@ -4875,16 +5053,35 @@ "@stablelib/sha512" "^1.0.1" "@stablelib/wipe" "^1.0.1" +"@stablelib/ed25519@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/ed25519/-/ed25519-2.0.0.tgz#304e033a5233bc6b0f3cec2321869d901ef5d443" + integrity sha512-4q/Kv7/yl0VcL1ZCbX63BG7wkDhiJR6QBPYV10WO37jjWhQhdUCcnSsKYwZ4t9fQngrULo5thnCc8jZqqufM4g== + dependencies: + "@stablelib/random" "^2.0.0" + "@stablelib/sha512" "^2.0.0" + "@stablelib/wipe" "^2.0.0" + "@stablelib/hash@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/hash/-/hash-1.0.1.tgz#3c944403ff2239fad8ebb9015e33e98444058bc5" integrity sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg== +"@stablelib/hash@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/hash/-/hash-2.0.0.tgz#7b74c372dc07187e273844e970a475f1338e92cf" + integrity sha512-u3WPSqGido8lwJuMcrBgM5K54LrPGhkWAdtsyccf7dGsLixAZUds77zOAbu7bvKPwQlmoByH0txBi5rTmEKuHg== + "@stablelib/int@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/int/-/int-1.0.1.tgz#75928cc25d59d73d75ae361f02128588c15fd008" integrity sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w== +"@stablelib/int@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/int/-/int-2.0.0.tgz#2b19f82c7831e91ed1a00a75cb2f23839c767c9d" + integrity sha512-EiSYDisTYKk1wuCqoh7wuBySmE0A1isq7TQbsijQ6XFi6nIAozchgAT7Zv2PCl2iY8BTe0URScC4PdYHOe3Yow== + "@stablelib/keyagreement@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz#4612efb0a30989deb437cd352cee637ca41fc50f" @@ -4908,6 +5105,14 @@ "@stablelib/binary" "^1.0.1" "@stablelib/wipe" "^1.0.1" +"@stablelib/random@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/random/-/random-2.0.0.tgz#538f796e1689e2d24125a57bf03e7d44c9cd6ab7" + integrity sha512-qvOSbiPq2B3ajvn/IDftC1mzL/W89OGv59gdJ7klMjm327Yk/54NyGl4Jtrwcz35GjCPy/ScVnQXC8YQk8uAUQ== + dependencies: + "@stablelib/binary" "^2.0.0" + "@stablelib/wipe" "^2.0.0" + "@stablelib/sha512@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/sha512/-/sha512-1.0.1.tgz#6da700c901c2c0ceacbd3ae122a38ac57c72145f" @@ -4917,11 +5122,25 @@ "@stablelib/hash" "^1.0.1" "@stablelib/wipe" "^1.0.1" +"@stablelib/sha512@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/sha512/-/sha512-2.0.0.tgz#ea75ffc36ff57507f482f285f45ab68e3142d80e" + integrity sha512-JiIub0BfK+dDsymA8b4mUdT9hnFMPfbXqEp/NXR3MUsunf1WMyUQPQr/dhCVL8tt63oYLV9ItUFDP7B2wyIRwA== + dependencies: + "@stablelib/binary" "^2.0.0" + "@stablelib/hash" "^2.0.0" + "@stablelib/wipe" "^2.0.0" + "@stablelib/wipe@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/wipe/-/wipe-1.0.1.tgz#d21401f1d59ade56a62e139462a97f104ed19a36" integrity sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg== +"@stablelib/wipe@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@stablelib/wipe/-/wipe-2.0.0.tgz#b4b17fedfad02dbfc7120c10160f2b71a7dadc41" + integrity sha512-VBMpCJx8py9j9F5DxV5dGmSSO+vkYDnXHXG4alkfpaD08UTfNTqsQoRlUh5obeqBNHiO+3Iv40GxKpM0gfd5xA== + "@stablelib/x25519@^1.0.0": version "1.0.3" resolved "https://registry.yarnpkg.com/@stablelib/x25519/-/x25519-1.0.3.tgz#13c8174f774ea9f3e5e42213cbf9fc68a3c7b7fd" @@ -4951,15 +5170,23 @@ "@stablelib/wipe" "^1.0.1" "@stablelib/xchacha20" "^1.0.1" +"@subsquid/ss58-codec@latest": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@subsquid/ss58-codec/-/ss58-codec-1.2.3.tgz#7a139ea59357cac7290719f08452a15828fbd3f6" + integrity sha512-PFWGOYDVEa1F+u5NoH4pJcBRCe4vv6B0U4nvgmwTA+PShhVB8aC6TjZZmMOE8/BLEDjRIpT7avpz7VR7zI6H0A== + dependencies: + base-x "^4.0.0" + blake2b "^2.1.4" + "@substrate/connect-extension-protocol@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.0.0.tgz#badaa6e6b5f7c7d56987d778f4944ddb83cd9ea7" integrity sha512-nKu8pDrE3LNCEgJjZe1iGXzaD6OSIDD4Xzz/yo4KO9mQ6LBvf49BVrt4qxBFGL6++NneLiWUZGoh+VSd4PyVIg== "@substrate/connect-known-chains@^1.1.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@substrate/connect-known-chains/-/connect-known-chains-1.1.2.tgz#987952dd46a87485285b4fd74a3d3051efe90181" - integrity sha512-XvyemTVqon+6EF2G7QL0fEXxjuz3nUNFgFV0TSWhSVpPb+Sfs+vfipbEZxGNouxvjCoJdr6CF0rwgGsrrKOnAA== + version "1.2.2" + resolved "https://registry.yarnpkg.com/@substrate/connect-known-chains/-/connect-known-chains-1.2.2.tgz#fd0b290d9270d7bfc1e60cd9b6f1d39ecd9e11eb" + integrity sha512-gOGrXSWA2d/3kf8Yco00VlHZl48smzAGW5Z9MDxMht98hRpT2yEEN4N5QdoEKMI4ihDW8goXGzmp79D0hFPpuA== "@substrate/connect@0.8.8": version "0.8.8" @@ -4985,37 +5212,28 @@ rxjs "^7.8.1" "@substrate/ss58-registry@^1.44.0": - version "1.46.0" - resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.46.0.tgz#bfe3e6a30d39929f57ecc178acde4e74a773e2b6" - integrity sha512-rBvWnlrBeFTd5LVG7oX3rOHzR16yqyffOFHKmUiVcblpXI3D89CXOvAljW9tWlA1H/2/FegaZnHPhdObPsvi+w== + version "1.49.0" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.49.0.tgz#ed9507316d13f49b2bccb65f08ec97180f71fc39" + integrity sha512-leW6Ix4LD7XgvxT7+aobPWSw+WvPcN2Rxof1rmd0mNC5t2n99k1N7UNEvz7YEFSOUeHWmKIY7F5q8KeIqYoHfA== -"@szmarczak/http-timer@^4.0.5": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" - integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== - dependencies: - defer-to-connect "^2.0.0" +"@tokenizer/token@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276" + integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== - dependencies: - defer-to-connect "^2.0.1" - -"@transmute/ed25519-key-pair@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/ed25519-key-pair/-/ed25519-key-pair-0.7.0-unstable.81.tgz#aa91769c1751aeea63e2488e6c8b17fe55974af8" - integrity sha512-Jz3PhNe/2pMxfz5/6q7MizaWLSMUEzgI2Lc1UFEMIW59TjTkgbE9LZ5e+QK+fh59KWwYpUG4AFk6VGHBZgUCDA== +"@transmute/ed25519-key-pair@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/ed25519-key-pair/-/ed25519-key-pair-0.7.0-unstable.82.tgz#6dab673381236a50d1f3997c7427afd0a52d4406" + integrity sha512-ZPMlPXAzQ59ImUP5j0EPp05ZA7H3voM23+zWINZawd4tehTaUpyCXVBPyAyHscJ4isS/l+XZnnOnYcvl9+YrXg== dependencies: "@stablelib/ed25519" "^1.0.1" - "@transmute/ld-key-pair" "^0.7.0-unstable.81" - "@transmute/x25519-key-pair" "^0.7.0-unstable.81" + "@transmute/ld-key-pair" "^0.7.0-unstable.82" + "@transmute/x25519-key-pair" "^0.7.0-unstable.82" -"@transmute/jose-ld@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/jose-ld/-/jose-ld-0.7.0-unstable.81.tgz#d8b47c103d832ea4da3c2001b2a267d6b7ba93d5" - integrity sha512-xLwqoweaBjeuK9qvl8WZBPkwn0ubSgiaE0Vf6QuZgUZqwB7LhBI0wopUNFmINnbfuTfUbGuC4kdH1W+1HM445g== +"@transmute/jose-ld@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/jose-ld/-/jose-ld-0.7.0-unstable.82.tgz#6f4e261dd1eb25c53bbd94e4d07fee467fc02f23" + integrity sha512-FBDbb0bGs7Ssd1H6NXEXqzfF2cnIGRW2ggR13MaTeQR51CEX2lfWlf2fdioOZa0Bk1GZlmUtyEvhPTEjp302WQ== dependencies: "@peculiar/webcrypto" "^1.1.6" "@stablelib/aes-kw" "^1.0.0" @@ -5024,17 +5242,17 @@ jose "^4.3.8" web-streams-polyfill "^3.0.3" -"@transmute/json-web-signature@^0.7.0-unstable.80": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/json-web-signature/-/json-web-signature-0.7.0-unstable.81.tgz#a0c95e49982f1642ca3cf4e19c8909b2397f3da8" - integrity sha512-RFC34CnF571dK/K8uRr8dLLZySgrAr5vhhMB2YgGEy51cWzgYeLuhJw6Pzmm67E/r4CAa+r7/+hqVUfgihkNXw== +"@transmute/json-web-signature@^0.7.0-unstable.80", "@transmute/json-web-signature@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/json-web-signature/-/json-web-signature-0.7.0-unstable.82.tgz#17320a06349d2320be4636e320f9940c60064f80" + integrity sha512-Snku9yg5sN10zkSy678n7VnHZgd7s0EQmjRylhW+mg4n9aL1SXPSbmRx6wUXfdXe1RGY1oNfDd7R5WegZVg9ew== dependencies: - "@transmute/ed25519-key-pair" "^0.7.0-unstable.81" - "@transmute/jose-ld" "^0.7.0-unstable.81" + "@transmute/ed25519-key-pair" "^0.7.0-unstable.82" + "@transmute/jose-ld" "^0.7.0-unstable.82" "@transmute/jsonld" "0.0.4" - "@transmute/secp256k1-key-pair" "^0.7.0-unstable.81" - "@transmute/security-context" "^0.7.0-unstable.81" - "@transmute/web-crypto-key-pair" "^0.7.0-unstable.81" + "@transmute/secp256k1-key-pair" "^0.7.0-unstable.82" + "@transmute/security-context" "^0.7.0-unstable.82" + "@transmute/web-crypto-key-pair" "^0.7.0-unstable.82" "@transmute/jsonld@0.0.4": version "0.0.4" @@ -5044,41 +5262,41 @@ json-pointer "^0.6.2" jsonld "5.2.0" -"@transmute/ld-key-pair@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/ld-key-pair/-/ld-key-pair-0.7.0-unstable.81.tgz#858655919f31dabaf5dac86f2535a98fcdbfd02e" - integrity sha512-GNfUEkWWCUUikxvLUgQssVSDRCw8x8ktYZD27ssoDtB9gp0oqQ5a9DxAWv8onH126F3Z4KGSSegmGWjkvgdL9g== +"@transmute/ld-key-pair@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/ld-key-pair/-/ld-key-pair-0.7.0-unstable.82.tgz#540bf28dcd83793ff23c1eca8a18c8fc2356a112" + integrity sha512-XWnVNCL1LeohldBLu7O12tc53rzdCYjZiaMrWvEH/sNpqnZBiNWAsdLWengXhF67LqAXWMwstfbCLNTPCD+EGg== -"@transmute/secp256k1-key-pair@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/secp256k1-key-pair/-/secp256k1-key-pair-0.7.0-unstable.81.tgz#0da1189b9a94419dbd279f378d4629aa44997c7f" - integrity sha512-kofomMOOLkdTOAV2bQAEZAC0REuiI/RDqxYJJg/qpXnguyGTtv5DVHD8UXmUDKJLJkAql1lbksfs/roYYVBN7g== +"@transmute/secp256k1-key-pair@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/secp256k1-key-pair/-/secp256k1-key-pair-0.7.0-unstable.82.tgz#8e8e839f672c66b3d836781e24e29ca887312174" + integrity sha512-X+txATKPpwodcr0B5TPvcsi2UnSrS3UFkrALa2ui0B1zNLj56pUVMJ0FdX9eHUKdP7t5tB9iE73Y7/8NWL6exA== dependencies: "@bitauth/libauth" "^1.18.1" - "@transmute/ld-key-pair" "^0.7.0-unstable.81" + "@transmute/ld-key-pair" "^0.7.0-unstable.82" secp256k1 "^4.0.2" -"@transmute/security-context@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/security-context/-/security-context-0.7.0-unstable.81.tgz#15bfd439f5b4e2c762b6205637eecfbbc09b58cb" - integrity sha512-5y7N/LIGPl1LtSCWyAlkIK/nDofsxM+AV0GoXuIIXFfgN8jnP9vuCRaMxsUCnoNQ+Aihe0fVNH7PkEm5y9HlKg== +"@transmute/security-context@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/security-context/-/security-context-0.7.0-unstable.82.tgz#701e0304f827e0f254a609208b6e68ed7f1c9c3a" + integrity sha512-Hih4A3iatK8daSREtuF/y9hGnrLZGRTfBYBUlUeaGEoCrcnhNcZrn8EQmW2dqj/7VZ2W5ResxQLPljA9pVJt5w== -"@transmute/web-crypto-key-pair@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/web-crypto-key-pair/-/web-crypto-key-pair-0.7.0-unstable.81.tgz#2611cd6c7b8064128ae3388b5640418337d7b69c" - integrity sha512-oTHub0iFdwJdugQxohcuG1CZaxfuSUPisDkPsxaEHGEOU9+hBBym2Ugr3ZX9H+nT29UNXPlTKNKsSxV4UCtc5w== +"@transmute/web-crypto-key-pair@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/web-crypto-key-pair/-/web-crypto-key-pair-0.7.0-unstable.82.tgz#d0b13db1d63956469b20f6d2336bfb0a4159314e" + integrity sha512-xhaFpW/jcYgmOZanBVkm034YX728ukVVPO0Bb53d5IcL5MiMSWjPDQfhOyX8+EZfa7rSNDOAi6zCsZMggtB9fg== dependencies: "@peculiar/webcrypto" "^1.1.6" - "@transmute/ld-key-pair" "^0.7.0-unstable.81" + "@transmute/ld-key-pair" "^0.7.0-unstable.82" big-integer "^1.6.48" -"@transmute/x25519-key-pair@^0.7.0-unstable.81": - version "0.7.0-unstable.81" - resolved "https://registry.yarnpkg.com/@transmute/x25519-key-pair/-/x25519-key-pair-0.7.0-unstable.81.tgz#e494777831c39a1adfefb16c16ece0556d2cfd34" - integrity sha512-cr/yjSP4ErZMKwoU/scqkfKL63AJupE27xakCHZVEfGzQChQH2RDXsNDGCXxsf2+DGfayGBhxayCXRdOcvvzng== +"@transmute/x25519-key-pair@^0.7.0-unstable.82": + version "0.7.0-unstable.82" + resolved "https://registry.yarnpkg.com/@transmute/x25519-key-pair/-/x25519-key-pair-0.7.0-unstable.82.tgz#0be791d05aec261b471fd7974b7a9ca35ac399a6" + integrity sha512-y4lPzk/SY/Cy1dUCa17ES3kqvShNQwevTO16dvbuevu6YcTYBAdSCYvW9JL+ppFqPYI5NSDPUwT6kkd4wNWmsA== dependencies: "@stablelib/x25519" "^1.0.0" - "@transmute/ld-key-pair" "^0.7.0-unstable.81" + "@transmute/ld-key-pair" "^0.7.0-unstable.82" "@types/babel__core@^7.1.14": version "7.20.5" @@ -5092,33 +5310,26 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.6.4" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" - integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + version "7.6.8" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" + integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== + version "7.4.4" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.2.tgz#235bf339d17185bdec25e024ca19cce257cc7309" - integrity sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg== - dependencies: - "@babel/types" "^7.3.0" - -"@types/bn.js@^5.1.0": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz#b51e1b55920a4ca26e9285ff79936bbdec910682" - integrity sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g== + version "7.20.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" + integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== dependencies: - "@types/node" "*" + "@babel/types" "^7.20.7" "@types/bn.js@^5.1.5": version "5.1.5" @@ -5127,16 +5338,6 @@ dependencies: "@types/node" "*" -"@types/cacheable-request@^6.0.1", "@types/cacheable-request@^6.0.2": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.2.tgz#c324da0197de0a98a2312156536ae262429ff6b9" - integrity sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA== - dependencies: - "@types/http-cache-semantics" "*" - "@types/keyv" "*" - "@types/node" "*" - "@types/responselike" "*" - "@types/dns-packet@*", "@types/dns-packet@^5.6.5": version "5.6.5" resolved "https://registry.yarnpkg.com/@types/dns-packet/-/dns-packet-5.6.5.tgz#49fc29a40f5d30227ed028fa1ee82601d3745e15" @@ -5145,9 +5346,9 @@ "@types/node" "*" "@types/estree@*", "@types/estree@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" - integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" + integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== "@types/estree@0.0.39": version "0.0.39" @@ -5155,14 +5356,14 @@ integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== "@types/flat@^5.0.2": - version "5.0.3" - resolved "https://registry.yarnpkg.com/@types/flat/-/flat-5.0.3.tgz#1f8045859a7e0955acf2a50e8c2979899e7b1801" - integrity sha512-uG/4x6EXYbq4VDsBJLNDHQAQmtRPg3x4tAXcBspxlnEknz8NiJxnHoxSiJKGNExiS00q4mJNvuEBgVA3jsDIdQ== + version "5.0.5" + resolved "https://registry.yarnpkg.com/@types/flat/-/flat-5.0.5.tgz#2304df0b2b1e6dde50d81f029593e0a1bc2474d3" + integrity sha512-nPLljZQKSnac53KDUDzuzdRfGI0TDb5qPrb+SrQyN3MtdQrOnGsKniHN1iYZsJEBIVQve94Y6gNz22sgISZq+Q== "@types/fs-extra@^8.0.1": - version "8.1.2" - resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.2.tgz#7125cc2e4bdd9bd2fc83005ffdb1d0ba00cca61f" - integrity sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg== + version "8.1.5" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.5.tgz#33aae2962d3b3ec9219b5aca2555ee00274f5927" + integrity sha512-0dzKcwO+S8s2kuF5Z9oUWatQJj5Uq/iqphEtE3GQJVRRYm/tD1LglU2UnXi2A8jLq5umkGouOXOR9y0n613ZwQ== dependencies: "@types/node" "*" @@ -5181,39 +5382,29 @@ dependencies: "@types/node" "*" -"@types/http-cache-semantics@*": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" - integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== - "@types/http-link-header@^1.0.1": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@types/http-link-header/-/http-link-header-1.0.3.tgz#899adf1d8d2036074514f3dbd148fb901ceff920" - integrity sha512-y8HkoD/vyid+5MrJ3aas0FvU3/BVBGcyG9kgxL0Zn4JwstA8CglFPnrR0RuzOjRCXwqzL5uxWC2IO7Ub0rMU2A== + version "1.0.7" + resolved "https://registry.yarnpkg.com/@types/http-link-header/-/http-link-header-1.0.7.tgz#bb1a1671a8c6d93717e0057072e9253113fdc875" + integrity sha512-snm5oLckop0K3cTDAiBnZDy6ncx9DJ3mCRDvs42C884MbVYPP74Tiq2hFsSDRTyjK6RyDYDIulPiW23ge+g5Lw== dependencies: "@types/node" "*" -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" - integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== - -"@types/istanbul-lib-coverage@^2.0.1": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== "@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== dependencies: "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" - integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: "@types/istanbul-lib-report" "*" @@ -5225,32 +5416,30 @@ expect "^29.0.0" pretty-format "^29.0.0" -"@types/json-schema@^7.0.7": - version "7.0.11" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== +"@types/json-schema@^7.0.9": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/keyv@*": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-4.2.0.tgz#65b97868ab757906f2dbb653590d7167ad023fa0" - integrity sha512-xoBtGl5R9jeKUhc8ZqeYaRDx04qqJ10yhhXYGmJ4Jr8qKpvMsDQQrNUvF/wUJ4klOtmJeJM+p2Xo3zp9uaC3tw== - dependencies: - keyv "*" - "@types/linkify-it@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.2.tgz#fd2cd2edbaa7eaac7e7f3c1748b52a19143846c9" - integrity sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA== + version "5.0.0" + resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-5.0.0.tgz#21413001973106cda1c3a9b91eedd4ccd5469d76" + integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q== "@types/lodash@^4.14.195": - version "4.14.199" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.199.tgz#c3edb5650149d847a277a8961a7ad360c474e9bf" - integrity sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg== + version "4.17.7" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.7.tgz#2f776bcb53adc9e13b2c0dfd493dfcbd7de43612" + integrity sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA== + +"@types/long@^4.0.1": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== "@types/lru-cache@^5.1.0": version "5.1.1" @@ -5266,9 +5455,9 @@ "@types/mdurl" "*" "@types/mdurl@*": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" - integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd" + integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg== "@types/minimatch@*": version "5.1.2" @@ -5276,9 +5465,9 @@ integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== "@types/minimist@^1.2.0": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" - integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== + version "1.2.5" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" + integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== "@types/multicast-dns@^7.2.4": version "7.2.4" @@ -5288,20 +5477,34 @@ "@types/dns-packet" "*" "@types/node" "*" +"@types/murmurhash3js-revisited@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.3.tgz#94e247168a18342477639126da8f01353437e8d0" + integrity sha512-QvlqvYtGBYIDeO8dFdY4djkRubcrc+yTJtBc7n8VZPlJDUS/00A+PssbvERM8f9bYRmcaSEHPZgZojeQj7kzAA== + "@types/n3@^1.4.4": - version "1.10.4" - resolved "https://registry.yarnpkg.com/@types/n3/-/n3-1.10.4.tgz#fd23d15fd7e47cf6d199d1f44ac5d6930cc50905" - integrity sha512-FfRTwcbXcScVHuAjIASveRWL6Fi6fPALl1Ge8tMESYLqU7R42LJvtdBpUi+f9YK0oQPqIN+zFFgMDFJfLMx0bg== + version "1.16.4" + resolved "https://registry.yarnpkg.com/@types/n3/-/n3-1.16.4.tgz#007f489eb848a6a8ac586b037b8eea281da5730f" + integrity sha512-6PmHRYCCdjbbBV2UVC/HjtL6/5Orx9ku2CQjuojucuHvNvPmnm6+02B18YGhHfvU25qmX2jPXyYPHsMNkn+w2w== dependencies: + "@rdfjs/types" "^1.1.0" "@types/node" "*" - rdf-js "^4.0.2" -"@types/node@*", "@types/node@^18.0.0": - version "18.11.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" - integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== +"@types/node@*": + version "22.2.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.2.0.tgz#7cf046a99f0ba4d628ad3088cb21f790df9b0c5b" + integrity sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ== + dependencies: + undici-types "~6.13.0" + +"@types/node@>=13.7.0": + version "22.5.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.5.tgz#52f939dd0f65fc552a4ad0b392f3c466cc5d7a44" + integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA== + dependencies: + undici-types "~6.19.2" -"@types/node@^12.12.6": +"@types/node@^12.7.1": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== @@ -5312,22 +5515,22 @@ integrity sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ== "@types/node@^14.14.7": - version "14.18.33" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.33.tgz#8c29a0036771569662e4635790ffa9e057db379b" - integrity sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg== + version "14.18.63" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.63.tgz#1788fa8da838dbb5f9ea994b834278205db6ca2b" + integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ== + +"@types/node@^18.0.0": + version "18.19.44" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.44.tgz#875a8322d17ff12bf82b3af8c07b9310a00e72f8" + integrity sha512-ZsbGerYg72WMXUIE9fYxtvfzLEuq6q8mKERdWFnqTmOvudMxnz+CBNRoOwJ2kNpFOncrKjT1hZwxjlFgQ9qvQA== + dependencies: + undici-types "~5.26.4" "@types/parse-link-header@^1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/parse-link-header/-/parse-link-header-1.0.1.tgz#6eade790736a050b9242c7c6b2fceda9b3dc394a" integrity sha512-E2+Go9rQgPbmpkeA2iFXTWSTxX38KXlXwcdiIbt71Oorqr+G5QtH4AhpuDdxwRVyiTzdUrHnaaIumW/LhiZwVg== -"@types/pbkdf2@^3.0.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" - integrity sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ== - dependencies: - "@types/node" "*" - "@types/readable-stream@^2.3.11": version "2.3.15" resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.15.tgz#3d79c9ceb1b6a57d5f6e6976f489b9b5384321ae" @@ -5341,29 +5544,17 @@ resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== -"@types/responselike@*", "@types/responselike@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29" - integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== - dependencies: - "@types/node" "*" - -"@types/retry@0.12.2": - version "0.12.2" - resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a" - integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow== - -"@types/secp256k1@^4.0.1": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.3.tgz#1b8e55d8e00f08ee7220b4d59a6abe89c37a901c" - integrity sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w== +"@types/secp256k1@^4.0.6": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" + integrity sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ== dependencies: "@types/node" "*" -"@types/semver@^7.3.4": - version "7.3.13" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" - integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== +"@types/semver@^7.3.12", "@types/semver@^7.3.4": + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@types/sinon@^17.0.3": version "17.0.3" @@ -5378,115 +5569,115 @@ integrity sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ== "@types/spark-md5@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/spark-md5/-/spark-md5-3.0.2.tgz#da2e8a778a20335fc4f40b6471c4b0d86b70da55" - integrity sha512-82E/lVRaqelV9qmRzzJ1PKTpyrpnT7mwdneKNJB9hUtypZDMggloDfFUCIqRRx3lYRxteCwXSq9c+W71Vf0QnQ== + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/spark-md5/-/spark-md5-3.0.4.tgz#c1221d63c069d95aba0c06a765b80661cacc12bf" + integrity sha512-qtOaDz+IXiNndPgYb6t1YoutnGvFRtWSNzpVjkAPCfB2UzTyybuD4Tjgs7VgRawum3JnJNRwNQd4N//SvrHg1Q== "@types/sparqljs@^3.0.0", "@types/sparqljs@^3.1.2", "@types/sparqljs@^3.1.3": - version "3.1.3" - resolved "https://registry.yarnpkg.com/@types/sparqljs/-/sparqljs-3.1.3.tgz#e4b9a2511bc2f14f564559ed6cf567835791a7e9" - integrity sha512-nmFgmR6ns4i8sg9fYu+293H+PMLKmDOZy34sgwgAeUEEiIqSs4guj5aCZRt3gq1g0yuKXkqrxLDq/684g7pGtQ== + version "3.1.11" + resolved "https://registry.yarnpkg.com/@types/sparqljs/-/sparqljs-3.1.11.tgz#c383f5751f5c9d8c58bad7907bf46451ab003bea" + integrity sha512-C6nWzeACV4owPvPvuFQU/m0MGiqhs8M56sm3okHOQz3DW593eZRU306xUIM/XvUIEPfc9Cn/AzaA1J5NpF1VpA== dependencies: - rdf-js "^4.0.2" + "@rdfjs/types" ">=1.0.0" "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/triple-beam@^1.3.2": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" + integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw== + "@types/uritemplate@^0.3.4": - version "0.3.4" - resolved "https://registry.yarnpkg.com/@types/uritemplate/-/uritemplate-0.3.4.tgz#c7a7f2b7e16b212baa69623183cde641659a4b97" - integrity sha512-1D8mJEeQEXynoPQKJkneIK+tXaM2Qnk6c80RBQPV/O2ToypI4mlqXy5jojnYKjTX2Q+EMNMOWt0wNdLbb2MUpA== + version "0.3.6" + resolved "https://registry.yarnpkg.com/@types/uritemplate/-/uritemplate-0.3.6.tgz#1eb0e8075ece916869d88c9542824c91db80703e" + integrity sha512-31BMGZ8GgLxgXxLnqg4KbbyYJjU1flhTTD2+PVQStVUPXSk0IIpK0zt+tH3eLT7ZRwLnzQw6JhYx69qza3U0wg== -"@types/uuid@^8.0.0": +"@types/uuid@8.3.4", "@types/uuid@^8.0.0": version "8.3.4" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== "@types/ws@^8.2.2", "@types/ws@^8.5.10": - version "8.5.10" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" - integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A== + version "8.5.12" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.12.tgz#619475fe98f35ccca2a2f6c137702d85ec247b7e" + integrity sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ== dependencies: "@types/node" "*" "@types/xml@^1.0.2": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@types/xml/-/xml-1.0.8.tgz#97c0692b29943fd26bc3da0ea155e26bba017536" - integrity sha512-IptEZBtDwSPayCP8FmbordhAdjdxsif4zH29xTbBRacZeCHFHZp8OxyG1/CrS8AS0MziJUPTGWCTKbYtvHGYPg== + version "1.0.11" + resolved "https://registry.yarnpkg.com/@types/xml/-/xml-1.0.11.tgz#644eaa2e36d4f9f7baec150ae93de9c1fd6b1c49" + integrity sha512-9gktTjxBWoz4+X8ZOS+QRFM2/liMQgBv8Z36wuNnomK5jtXFq4IJa7Az4Hzoy+rYux343NkH9Dq+nzIdejVrjw== dependencies: "@types/node" "*" "@types/yargs-parser@*": - version "21.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" - integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== - -"@types/yargs@^17.0.2": - version "17.0.13" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76" - integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg== - dependencies: - "@types/yargs-parser" "*" + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== -"@types/yargs@^17.0.8": - version "17.0.32" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" - integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== +"@types/yargs@^17.0.2", "@types/yargs@^17.0.8": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" + integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/experimental-utils@^4.0.1": - version "4.33.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz#6f2a786a4209fa2222989e9380b5331b2810f7fd" - integrity sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q== - dependencies: - "@types/json-schema" "^7.0.7" - "@typescript-eslint/scope-manager" "4.33.0" - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/typescript-estree" "4.33.0" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - -"@typescript-eslint/scope-manager@4.33.0": - version "4.33.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz#d38e49280d983e8772e29121cf8c6e9221f280a3" - integrity sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ== +"@typescript-eslint/scope-manager@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" + integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== dependencies: - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/visitor-keys" "4.33.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" -"@typescript-eslint/types@4.33.0": - version "4.33.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" - integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ== +"@typescript-eslint/types@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" + integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== -"@typescript-eslint/typescript-estree@4.33.0": - version "4.33.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609" - integrity sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA== +"@typescript-eslint/typescript-estree@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" + integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== dependencies: - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/visitor-keys" "4.33.0" - debug "^4.3.1" - globby "^11.0.3" - is-glob "^4.0.1" - semver "^7.3.5" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/visitor-keys@4.33.0": - version "4.33.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd" - integrity sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg== +"@typescript-eslint/utils@^5.10.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" + integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.62.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/typescript-estree" "5.62.0" + eslint-scope "^5.1.1" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" + integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== dependencies: - "@typescript-eslint/types" "4.33.0" - eslint-visitor-keys "^2.0.0" + "@typescript-eslint/types" "5.62.0" + eslint-visitor-keys "^3.3.0" -"@vascosantos/moving-average@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@vascosantos/moving-average/-/moving-average-1.1.0.tgz#8d5793b09b2d6021ba5e620c6a0f876c20db7eaa" - integrity sha512-MVEJ4vWAPNbrGLjz7ITnHYg+YXZ6ijAqtH5/cHwSoCpbvuJ98aLXwFfPKAUfZpJMQR5uXB58UJajbY130IRF/w== +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== JSONStream@^1.3.3: version "1.3.5" @@ -5503,40 +5694,22 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" -abortcontroller-polyfill@^1.7.3: - version "1.7.5" - resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" - integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== - -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - -acorn-jsx@^5.2.0: +acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn@^7.1.1: - version "7.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" - integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== - -acorn@^8.5.0: - version "8.8.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" - integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== +acorn@^8.8.2, acorn@^8.9.0: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== -ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3: +ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -5546,6 +5719,11 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ansi-colors@^4.1.1, ansi-colors@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== + ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -5553,17 +5731,12 @@ ansi-escapes@^4.2.1: dependencies: type-fest "^0.21.3" -ansi-regex@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" - integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== - ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -5587,7 +5760,7 @@ any-signal@^4.1.1: resolved "https://registry.yarnpkg.com/any-signal/-/any-signal-4.1.1.tgz#928416c355c66899e6b2a91cad4488f0324bae03" integrity sha512-iADenERppdC+A2YKbOXXB2WUeABLaM6qnpZ70kZbPZ1cZMMJ7eF+3CaYm+/PhBizgkzlvssC7QuHS30oOiQYWA== -anymatch@^3.0.3: +anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== @@ -5595,14 +5768,6 @@ anymatch@^3.0.3: normalize-path "^3.0.0" picomatch "^2.0.4" -anymatch@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -5615,20 +5780,24 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - -array-includes@^3.1.4: - version "3.1.5" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.5.tgz#2c320010db8d31031fd2a5f6b3bbd4b1aad31bdb" - integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.19.5" - get-intrinsic "^1.1.1" +array-buffer-byte-length@^1.0.0, array-buffer-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz#1e5583ec16763540a27ae52eed99ff899223568f" + integrity sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg== + dependencies: + call-bind "^1.0.5" + is-array-buffer "^3.0.4" + +array-includes@^3.1.7: + version "3.1.8" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.8.tgz#5e370cbe172fdd5dd6530c1d4aadda25281ba97d" + integrity sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" + get-intrinsic "^1.2.4" is-string "^1.0.7" array-union@^2.1.0: @@ -5636,27 +5805,65 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -array.prototype.flat@^1.2.5: - version "1.3.0" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz#0b0c1567bf57b38b56b4c97b8aa72ab45e4adc7b" - integrity sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw== +array.prototype.findlastindex@^1.2.3: + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz#8c35a755c72908719453f87145ca011e39334d0d" + integrity sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + es-shim-unscopables "^1.0.2" + +array.prototype.flat@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18" + integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" es-shim-unscopables "^1.0.0" -array.prototype.reduce@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/array.prototype.reduce/-/array.prototype.reduce-1.0.4.tgz#8167e80089f78bff70a99e20bd4201d4663b0a6f" - integrity sha512-WnM+AjG/DvLRLo4DDl+r+SvCzYtD2Jd9oeBYMcEaI7t3fFrHY9M53/wdLcTvmZNQ70IU6Htj0emFkZ5TS+lrdw== +array.prototype.flatmap@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz#c9a7c6831db8e719d6ce639190146c24bbd3e527" + integrity sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +array.prototype.reduce@^1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/array.prototype.reduce/-/array.prototype.reduce-1.0.7.tgz#6aadc2f995af29cb887eb866d981dc85ab6f7dc7" + integrity sha512-mzmiUCVwtiD4lgxYP8g7IYy8El8p2CSMePvIbTS7gchKir/L1fgJrk0yDKmAX6mnRQFKNADYIk8nNlTris5H1Q== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" es-array-method-boxes-properly "^1.0.0" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" is-string "^1.0.7" +arraybuffer.prototype.slice@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz#097972f4255e41bc3425e37dc3f6421cf9aefde6" + integrity sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A== + dependencies: + array-buffer-byte-length "^1.0.1" + call-bind "^1.0.5" + define-properties "^1.2.1" + es-abstract "^1.22.3" + es-errors "^1.2.1" + get-intrinsic "^1.2.3" + is-array-buffer "^3.0.4" + is-shared-array-buffer "^1.0.2" + arrayify-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/arrayify-stream/-/arrayify-stream-1.0.0.tgz#9e8e113d43325c3a44e965c59b5b89d962b9a37f" @@ -5667,23 +5874,6 @@ asmcrypto.js@^2.3.2: resolved "https://registry.yarnpkg.com/asmcrypto.js/-/asmcrypto.js-2.3.2.tgz#b9f84bd0a1fb82f21f8c29cc284a707ad17bba2e" integrity sha512-3FgFARf7RupsZETQ1nHnhLUUvpcttcCq1iZCaVAbJZbCZ5VNRrNyvpDyHTOb0KC3llFcsyOT/a99NZcCbeiEsA== -asn1.js@^5.2.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" - integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - safer-buffer "^2.1.0" - -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - asn1js@^3.0.1, asn1js@^3.0.5: version "3.0.5" resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" @@ -5693,52 +5883,39 @@ asn1js@^3.0.1, asn1js@^3.0.5: pvutils "^1.1.3" tslib "^2.4.0" -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== - -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - async@^3.2.3: - version "3.2.4" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" - integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ== + version "3.2.5" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" + integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== -asynciterator@^3.2.0, asynciterator@^3.6.0: - version "3.7.1" - resolved "https://registry.yarnpkg.com/asynciterator/-/asynciterator-3.7.1.tgz#53a4c515a03c1f858fce6f8f76aca562cbbffca9" - integrity sha512-D8/fAbq0qVtNkshNRmKomEtpoYJRXAis4sTupFLOrJLLnZOMF6rd0KTS7Jx2Xmp1XORTeSGBqISB5rBq8FsClA== +asynciterator@^3.2.0, asynciterator@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/asynciterator/-/asynciterator-3.9.0.tgz#6e9a69623c4cec07e4cd85130416d52899f4e93f" + integrity sha512-bwLLTAnoE6Ap6XdjK/j8vDk2Vi9p3ojk0PFwM0SwktAG1k8pfRJF9ng+mmkaRFKdZCQQlOxcWnvOmX2NQ1HV0g== asyncjoin@^1.0.3: - version "1.1.1" - resolved "https://registry.yarnpkg.com/asyncjoin/-/asyncjoin-1.1.1.tgz#4a5c6a25381914dcecd380bf9c89aafabbf06370" - integrity sha512-8IqFEIQ3HVec3dLQBvLRx/EFDOof8o+r4nCahRGqGE6WDPTXk7IBEaL6clPZ87DHku7u4yxHGzGWqMN08YwErg== + version "1.2.3" + resolved "https://registry.yarnpkg.com/asyncjoin/-/asyncjoin-1.2.3.tgz#f38f725f6a9ce222c01d0126d37cc025df3e0f0d" + integrity sha512-4OJH73zYDfIfbgr7wKfAKTgu/P2e/9r0o0NZ4KZu2tFtSf5uUVs/DjzpfY5BueOkkZcBhnq788MbZ57tjwyPIQ== dependencies: - asynciterator "^3.6.0" + asynciterator "^3.9.0" asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -available-typed-arrays@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" - integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== +available-typed-arrays@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" + integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== + dependencies: + possible-typed-array-names "^1.0.0" aws-sdk@^2.1057.0: - version "2.1245.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1245.0.tgz#cee09dd6a83badbe7692cb512cbce5e9daa0c702" - integrity sha512-LXNmuT33+k4ymWijm6dhLRm0OX14ki9OOK1BYn8AUWWPuh+GMlFIuIFH+sWORVdhZqaQNsvF72cB6CeMBqaJWg== + version "2.1673.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1673.0.tgz#08dd3196c0f305457a184ec0e86b15de08026505" + integrity sha512-7tcc+y7XmCt2aq3vq46xpJTDMNqukFhJOXsQuuwsMZiydZpGG7l7wbpTOtfFhktieSjLg4V9eyznpnZNz5aooA== dependencies: buffer "4.9.2" events "1.1.1" @@ -5749,22 +5926,21 @@ aws-sdk@^2.1057.0: url "0.10.3" util "^0.12.4" uuid "8.0.0" - xml2js "0.4.19" - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== + xml2js "0.6.2" -aws4@^1.8.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" - integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== +axios@^1.6.0: + version "1.7.7" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" + integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" b4a@^1.0.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.1.tgz#9effac93a469a868d024e16fd77162c653544cbd" - integrity sha512-AsKjNhz72yxteo/0EtQEiwkMUgk/tGmycXlbG4g3Ard2/ULtNLUykGOkeK0egmN27h0xMAhb76jYccW+XTBExA== + version "1.6.6" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.6.tgz#a4cc349a3851987c3c4ac2d7785c18744f6da9ba" + integrity sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg== b64-lite@^1.4.0: version "1.4.0" @@ -5827,46 +6003,49 @@ babel-plugin-jest-hoist@^29.6.3: "@types/babel__traverse" "^7.0.6" babel-plugin-polyfill-corejs2@^0.4.10: - version "0.4.10" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.10.tgz#276f41710b03a64f6467433cab72cbc2653c38b1" - integrity sha512-rpIuu//y5OX6jVU+a5BCn1R5RSZYWAl2Nar76iwaOdycqb6JPxediskWFMMl7stfwNJR4b7eiQvh5fB5TEQJTQ== + version "0.4.11" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz#30320dfe3ffe1a336c15afdcdafd6fd615b25e33" + integrity sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q== dependencies: "@babel/compat-data" "^7.22.6" - "@babel/helper-define-polyfill-provider" "^0.6.1" + "@babel/helper-define-polyfill-provider" "^0.6.2" semver "^6.3.1" babel-plugin-polyfill-corejs3@^0.10.4: - version "0.10.4" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.4.tgz#789ac82405ad664c20476d0233b485281deb9c77" - integrity sha512-25J6I8NGfa5YkCDogHRID3fVCadIR8/pGl1/spvCkzb6lVn6SR3ojpx9nOn9iEBcUsjY24AmdKm5khcfKdylcg== + version "0.10.6" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz#2deda57caef50f59c525aeb4964d3b2f867710c7" + integrity sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA== dependencies: - "@babel/helper-define-polyfill-provider" "^0.6.1" - core-js-compat "^3.36.1" + "@babel/helper-define-polyfill-provider" "^0.6.2" + core-js-compat "^3.38.0" babel-plugin-polyfill-regenerator@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.1.tgz#4f08ef4c62c7a7f66a35ed4c0d75e30506acc6be" - integrity sha512-JfTApdE++cgcTWjsiCQlLyFBMbTUft9ja17saCc93lgV33h4tuCVj7tlvu//qpLwaG+3yEz7/KhahGrUMkVq9g== + version "0.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz#addc47e240edd1da1058ebda03021f382bba785e" + integrity sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg== dependencies: - "@babel/helper-define-polyfill-provider" "^0.6.1" + "@babel/helper-define-polyfill-provider" "^0.6.2" babel-preset-current-node-syntax@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" - integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== + version "1.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" + integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-import-attributes" "^7.24.7" + "@babel/plugin-syntax-import-meta" "^7.10.4" "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-top-level-await" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" babel-preset-jest@^29.6.3: version "29.6.3" @@ -5894,19 +6073,12 @@ base-64@^0.1.0: resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" integrity sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA== -base-x@^3.0.2, base-x@^3.0.8: - version "3.0.9" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" - integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== - dependencies: - safe-buffer "^5.0.1" - base-x@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a" integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw== -base64-js@1.5.1, base64-js@^1.0.2, base64-js@^1.3.1: +base64-js@1.5.1, base64-js@^1.0.2, base64-js@^1.3.0, base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -5923,32 +6095,27 @@ base64url@3.0.1, base64url@^3.0.0, base64url@^3.0.1: resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - -bech32@1.1.4: +bech32@1.1.4, bech32@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== -big-integer@^1.6.48: - version "1.6.51" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" - integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== +better-path-resolve@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/better-path-resolve/-/better-path-resolve-1.0.0.tgz#13a35a1104cdd48a7b74bf8758f96a1ee613f99d" + integrity sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g== + dependencies: + is-windows "^1.0.0" -bignumber.js@^9.0.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.0.tgz#8d340146107fe3a6cb8d40699643c302e8773b62" - integrity sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A== +big-integer@^1.6.48: + version "1.6.52" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" + integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== binary-extensions@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" - integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + version "2.3.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" + integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== bl@^4.0.3: version "4.1.0" @@ -5967,7 +6134,7 @@ blake2b-wasm@^2.4.0: b4a "^1.0.1" nanoassert "^2.0.0" -blake2b@2.1.4: +blake2b@2.1.4, blake2b@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/blake2b/-/blake2b-2.1.4.tgz#817d278526ddb4cd673bfb1af16d1ad61e393ba3" integrity sha512-AyBuuJNI64gIvwx13qiICz6H6hpmjvYS5DGkG6jbXMOT8Z3WUJ3V1X0FlhIoT1b/5JtHE3ki+xjtMvu1nn+t9A== @@ -5975,15 +6142,15 @@ blake2b@2.1.4: blake2b-wasm "^2.4.0" nanoassert "^2.0.0" -blakejs@^1.1.0: +blakejs@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -blockstore-core@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/blockstore-core/-/blockstore-core-4.4.0.tgz#822b977e9cd9989ef0c29224a4712728323b9696" - integrity sha512-tjOJAJMPWlqahqCjn5awLJz2eZeJnrGOBA0OInBFK69/FfPZbSID2t7s5jFcBRhGaglca56BzG4t5XOV3MPxOQ== +blockstore-core@^4.4.0, blockstore-core@^4.4.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/blockstore-core/-/blockstore-core-4.4.1.tgz#0804c8a00f096c43e1b679b1711a66157a421c5e" + integrity sha512-peXfL9ZLx1cb84QALocMjhT8CsQ4JsreI/AitlN1inipSdC/G+jcYVJCqeCD5ecSTv/0LMpg8NlAPH/eBYZLjA== dependencies: "@libp2p/logger" "^4.0.6" err-code "^3.0.1" @@ -5995,7 +6162,7 @@ blockstore-core@^4.4.0: it-pushable "^3.2.3" multiformats "^13.0.1" -bluebird@^3.5.0, bluebird@^3.7.2: +bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -6005,52 +6172,16 @@ bn.js@4.11.6: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.6, bn.js@^4.11.9: +bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.0.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: +bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -body-parser@1.20.2: - version "1.20.2" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" - integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" - -body-parser@^1.16.0: - version "1.20.1" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" - integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== - dependencies: - bytes "3.1.2" - content-type "~1.0.4" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.1" - type-is "~1.6.18" - unpipe "1.0.0" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -6066,120 +6197,40 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.2, braces@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== +braces@^3.0.3, braces@~3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" -brorand@^1.0.1, brorand@^1.1.0: +brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== browser-readablestream-to-it@^2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/browser-readablestream-to-it/-/browser-readablestream-to-it-2.0.5.tgz#61539778c800930dfee1d4c361a060c99bbaa760" - integrity sha512-obLCT9jnxAeZlbaRWluUiZrcSJEoi2JkM0eoiJqlIP7MFwZwZjcB6giZvD343PXfr96ilD91M/wFqFvyAZq+Gg== - -browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0, browserify-rsa@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" - integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== - dependencies: - bn.js "^5.0.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.2.2" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.2.tgz#e78d4b69816d6e3dd1c747e64e9947f9ad79bc7e" - integrity sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg== - dependencies: - bn.js "^5.2.1" - browserify-rsa "^4.1.0" - create-hash "^1.2.0" - create-hmac "^1.1.7" - elliptic "^6.5.4" - inherits "^2.0.4" - parse-asn1 "^5.1.6" - readable-stream "^3.6.2" - safe-buffer "^5.2.1" - -browserslist@^4.21.9: - version "4.21.10" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.10.tgz#dbbac576628c13d3b2231332cb2ec5a46e015bb0" - integrity sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ== - dependencies: - caniuse-lite "^1.0.30001517" - electron-to-chromium "^1.4.477" - node-releases "^2.0.13" - update-browserslist-db "^1.0.11" + version "2.0.7" + resolved "https://registry.yarnpkg.com/browser-readablestream-to-it/-/browser-readablestream-to-it-2.0.7.tgz#ddcc4b34a4b08ef415f89eb215297acea3e05fd0" + integrity sha512-g1Aznml3HmqTLSXylZhGwdfnAa67+vlNAYhT9ROJZkAxY7yYmWusND10olvCMPe4sVhZyVwn5tPkRzOg85kBEg== -browserslist@^4.22.2, browserslist@^4.23.0: - version "4.23.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.0.tgz#8f3acc2bbe73af7213399430890f86c63a5674ab" - integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== +browserslist@^4.23.1, browserslist@^4.23.3: + version "4.23.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.3.tgz#debb029d3c93ebc97ffbc8d9cbb03403e227c800" + integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== dependencies: - caniuse-lite "^1.0.30001587" - electron-to-chromium "^1.4.668" - node-releases "^2.0.14" - update-browserslist-db "^1.0.13" + caniuse-lite "^1.0.30001646" + electron-to-chromium "^1.5.4" + node-releases "^2.0.18" + update-browserslist-db "^1.1.0" -bs58@5.0.0: +bs58@5.0.0, bs58@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/bs58/-/bs58-5.0.0.tgz#865575b4d13c09ea2a84622df6c8cbeb54ffc279" integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ== dependencies: base-x "^4.0.0" -bs58@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" - integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== - dependencies: - base-x "^3.0.2" - -bs58check@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" - integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== - dependencies: - bs58 "^4.0.0" - create-hash "^1.1.0" - safe-buffer "^5.1.2" - bser@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" @@ -6192,16 +6243,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-to-arraybuffer@^0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" - integrity sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ== - -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== - buffer@4.9.2: version "4.9.2" resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8" @@ -6211,7 +6252,7 @@ buffer@4.9.2: ieee754 "^1.1.4" isarray "^1.0.0" -buffer@^5.0.5, buffer@^5.1.0, buffer@^5.5.0, buffer@^5.6.0: +buffer@^5.1.0, buffer@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -6227,53 +6268,21 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -bufferutil@^4.0.1: - version "4.0.7" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" - integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== - dependencies: - node-gyp-build "^4.3.0" - builtin-modules@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== -bytes@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" - integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== - -cacheable-lookup@^5.0.3: - version "5.0.4" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz#5a6b865b2c44357be3d5ebc2a467b032719a7005" - integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== - -cacheable-lookup@^6.0.4: - version "6.1.0" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz#0330a543471c61faa4e9035db583aad753b36385" - integrity sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww== - -cacheable-request@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.2.tgz#ea0d0b889364a25854757301ca12b2da77f91d27" - integrity sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew== - dependencies: - clone-response "^1.0.2" - get-stream "^5.1.0" - http-cache-semantics "^4.0.0" - keyv "^4.0.0" - lowercase-keys "^2.0.0" - normalize-url "^6.0.1" - responselike "^2.0.0" - -call-bind@^1.0.0, call-bind@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" - integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== +call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.2" + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" callsites@^3.0.0: version "3.1.0" @@ -6290,25 +6299,20 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001517: - version "1.0.30001519" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001519.tgz#3e7b8b8a7077e78b0eb054d69e6edf5c7df35601" - integrity sha512-0QHgqR+Jv4bxHMp8kZ1Kn8CH55OikjKJ6JmKkZYP1F3D7w+lnFXF70nG5eNfsZS89jadi5Ywy5UCSKLAglIRkg== - -caniuse-lite@^1.0.30001587: - version "1.0.30001600" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001600.tgz#93a3ee17a35aa6a9f0c6ef1b2ab49507d1ab9079" - integrity sha512-+2S9/2JFhYmYaDpZvo0lKkfvuKIglrx68MwOBqMGHhQsNkLjB5xtc/TGoEPs+MxjSyN/72qer2g97nzR641mOQ== +caniuse-lite@^1.0.30001646: + version "1.0.30001651" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" + integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== canonicalize@^1.0.1: version "1.0.8" resolved "https://registry.yarnpkg.com/canonicalize/-/canonicalize-1.0.8.tgz#24d1f1a00ed202faafd9bf8e63352cd4450c6df1" integrity sha512-0CNTVCLZggSh7bc5VkX5WWPWO+cyZbNd07IHIsSXLia/eAq+r836hgk+8BKoEh7949Mda87VUOitx5OddVj64A== -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== +canonicalize@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/canonicalize/-/canonicalize-2.0.0.tgz#32be2cef4446d67fd5348027a384cae28f17226a" + integrity sha512-ulDEYPv7asdKvqahuAY35c1selLdzDwHqugK92hfkzvlDCwXRRelDkR+Er33md/PtnpqHemgkuDPanZ4fiYZ8w== catharsis@^0.9.0: version "0.9.0" @@ -6318,11 +6322,11 @@ catharsis@^0.9.0: lodash "^4.17.15" cborg@^4.0.0, cborg@^4.0.1, cborg@^4.0.9: - version "4.1.1" - resolved "https://registry.yarnpkg.com/cborg/-/cborg-4.1.1.tgz#c0730ba32028dc766b684b1d80927769924d093f" - integrity sha512-XBEXWdr1N0pjAX0l2a+BKmWGIMDYoLrrqgAWWETtaqn3HC4zn0dZoNO8vC+8oDZfDLMyVRfRD3kMuoYgT67KBQ== + version "4.2.3" + resolved "https://registry.yarnpkg.com/cborg/-/cborg-4.2.3.tgz#0c16217022c085579edc5b204f693a261a12eb49" + integrity sha512-XBFbEJ6WMfn9L7woc2t+EzOxF8vGqddoopKBbrhIvZBt2WIUgSlT8xLmM6Aq1xv8eWt4yOSjwxWjYeuHU3CpJA== -chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: +chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -6331,7 +6335,7 @@ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: +chalk@^4.0.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -6350,9 +6354,9 @@ chardet@^0.7.0: integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== chokidar@^3.4.0: - version "3.5.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + version "3.6.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== dependencies: anymatch "~3.1.2" braces "~3.0.2" @@ -6364,28 +6368,17 @@ chokidar@^3.4.0: optionalDependencies: fsevents "~2.3.2" -chownr@^1.1.1, chownr@^1.1.4: +chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== -ci-info@^3.2.0: +ci-info@^3.2.0, ci-info@^3.7.0: version "3.9.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== -cids@^0.7.1: - version "0.7.5" - resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" - integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== - dependencies: - buffer "^5.5.0" - class-is "^1.1.0" - multibase "~0.6.0" - multicodec "^1.0.0" - multihashes "~0.4.15" - -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3, cipher-base@^1.0.4: +cipher-base@^1.0.1, cipher-base@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== @@ -6394,26 +6387,9 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3, cipher-base@^1.0.4: safe-buffer "^5.0.1" cjs-module-lexer@^1.0.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107" - integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== - -class-is@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" - integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== - -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" - integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + version "1.3.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" + integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== cliui@^8.0.1: version "8.0.1" @@ -6433,12 +6409,12 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" -clone-response@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz#af2032aa47816399cf5f0a1d0db902f517abb8c3" - integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA== +clone-regexp@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-3.0.0.tgz#c6dd5c6b85482306778f3dc4ac2bb967079069c2" + integrity sha512-ujdnoq2Kxb8s3ItNBtnYeXdm07FcU0u8ARAT1lQ2YdMwQC+cdiXX8KoqMVuglztILivceTtp4ivqGSmEmhBUJw== dependencies: - mimic-response "^1.0.0" + is-regexp "^3.0.0" co@^4.6.0: version "4.6.0" @@ -6503,7 +6479,7 @@ colorspace@1.1.x: color "^3.1.3" text-hex "1.0.x" -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -6515,10 +6491,10 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== +commander@^6.2.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== commondir@^1.0.1: version "1.0.1" @@ -6554,106 +6530,42 @@ confusing-browser-globals@^1.0.10: resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz#ae40e9b57cdd3915408a2805ebd3a5585608dc81" integrity sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA== -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-hash@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/content-hash/-/content-hash-2.5.2.tgz#bbc2655e7c21f14fd3bfc7b7d4bfe6e454c9e211" - integrity sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw== - dependencies: - cids "^0.7.1" - multicodec "^0.5.5" - multihashes "^0.4.15" - -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== - -content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== +convert-hrtime@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/convert-hrtime/-/convert-hrtime-5.0.0.tgz#f2131236d4598b95de856926a67100a0a97e9fa3" + integrity sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg== convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" - integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== - -core-js-compat@^3.31.0: - version "3.32.0" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.32.0.tgz#f41574b6893ab15ddb0ac1693681bd56c8550a90" - integrity sha512-7a9a3D1k4UCVKnLhrgALyFcP7YCsLOQIxPd0dKjf/6GuPcgyiGP70ewWdCGrSK7evyhymi0qO4EqCmSJofDeYw== - dependencies: - browserslist "^4.21.9" - -core-js-compat@^3.36.1: - version "3.36.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.36.1.tgz#1818695d72c99c25d621dca94e6883e190cea3c8" - integrity sha512-Dk997v9ZCt3X/npqzyGdTlq6t7lDBhZwGvV94PKzDArjp7BTRm7WlDAXYd/OWdeFHO8OChQYRJNJvUCqCbrtKA== +core-js-compat@^3.37.1, core-js-compat@^3.38.0: + version "3.38.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.38.0.tgz#d93393b1aa346b6ee683377b0c31172ccfe607aa" + integrity sha512-75LAicdLa4OJVwFxFbQR3NdnZjNgX6ILpVcVzcC4T2smerB5lELMrJQQQoWV6TiuC/vlaFqgU2tKQx9w5s0e0A== dependencies: - browserslist "^4.23.0" + browserslist "^4.23.3" core-js@^2.4.0: version "2.6.12" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== -core-js@^3.1.3: - version "3.26.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.26.0.tgz#a516db0ed0811be10eac5d94f3b8463d03faccfe" - integrity sha512-+DkDrhoR4Y0PxDz6rurahuB+I45OsEUv8E1maPTB6OuHRohMMcznBq9TMpdpDMm/hUPob/mJJS3PqgbHpMTQgw== - core-js@^3.30.2: - version "3.32.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.32.0.tgz#7643d353d899747ab1f8b03d2803b0312a0fb3b6" - integrity sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww== + version "3.38.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.38.0.tgz#8acb7c050bf2ccbb35f938c0d040132f6110f636" + integrity sha512-XPpwqEodRljce9KswjZShh95qJ1URisBeKCjUdq27YdenkslVe7OO0ZJhlYXAChW7OhXaRLl8AAba7IBfoIHug== -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== +cosmjs-types@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.9.0.tgz#c3bc482d28c7dfa25d1445093fdb2d9da1f6cfcc" + integrity sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ== -cors@^2.8.1: - version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - -crc-32@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" - integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== - -create-ecdh@^4.0.0: - version "4.0.4" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" - integrity sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A== - dependencies: - bn.js "^4.1.0" - elliptic "^6.5.3" - -create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== +create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== dependencies: cipher-base "^1.0.1" inherits "^2.0.1" @@ -6661,18 +6573,6 @@ create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: ripemd160 "^2.0.1" sha.js "^2.4.0" -create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - create-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" @@ -6698,25 +6598,23 @@ cross-fetch@3.1.6: dependencies: node-fetch "^2.6.11" -cross-fetch@^3.0.5, cross-fetch@^3.0.6, cross-fetch@^3.1.4: - version "3.1.5" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" - integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== +cross-fetch@^3.0.5, cross-fetch@^3.0.6: + version "3.1.8" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" + integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== dependencies: - node-fetch "2.6.7" + node-fetch "^2.6.12" -cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== +cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A== dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" + lru-cache "^4.0.1" shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -6725,61 +6623,56 @@ cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -crypto-browserify@3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - crypto-ld@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/crypto-ld/-/crypto-ld-6.0.0.tgz#cf8dcf566cb3020bdb27f0279e6cc9b46d031cd7" integrity sha512-XWL1LslqggNoaCI/m3I7HcvaSt9b2tYzdrXO+jHLUj9G1BvRfvV7ZTFDVY5nifYuIGAPdAGu7unPxLRustw3VA== -"crypto-wasm-new@npm:@docknetwork/crypto-wasm@0.32.0": - version "0.32.0" - resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm/-/crypto-wasm-0.32.0.tgz#636c67447179b59dbd82d46c93f3921186387dc6" - integrity sha512-Xdppk2zted+7GmeSgVYz5mTML5NHOSKlZLwYbbpekHaX32NJ5VjnJ12frilXyEGaPDgW0sdX9rxWU2hUBz27JA== +"crypto-wasm-new@npm:@docknetwork/crypto-wasm@0.30.0": + version "0.30.0" + resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm/-/crypto-wasm-0.30.0.tgz#d54a56989cf98847e6e4ebe8119b6eb6012d8da4" + integrity sha512-xwDtakDBaiOf0Cm6H74JsJ2I610rc+d9tSrgjuACE7QBpmkTug6QX4Q4OzxXA12wp86K5QqRMHoCzc6geS1Z0g== dependencies: buffer "^6.0.3" -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - data-uri-to-buffer@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636" integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og== data-uri-to-buffer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b" - integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA== + version "4.0.1" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" + integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== + +data-view-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" + integrity sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-data-view "^1.0.1" + +data-view-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz#90721ca95ff280677eb793749fce1011347669e2" + integrity sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + is-data-view "^1.0.1" + +data-view-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz#5e0bbfb4828ed2d1b9b400cd8a7d119bca0ff18a" + integrity sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-data-view "^1.0.1" -datastore-core@^9.2.8, datastore-core@^9.2.9: +datastore-core@^9.2.9: version "9.2.9" resolved "https://registry.yarnpkg.com/datastore-core/-/datastore-core-9.2.9.tgz#74b4dd53d4597b59038488ba5f92a7f81769f8df" integrity sha512-wraWTPsbtdE7FFaVo3pwPuTB/zXsgwGGAm8BgBYwYAuzZCTS0MfXmd/HH1vR9s0/NFFjOVmBkGiWCvKxZ+QjVw== @@ -6797,14 +6690,7 @@ datastore-core@^9.2.8, datastore-core@^9.2.9: it-sort "^3.0.4" it-take "^3.0.4" -debug@2.6.9, debug@^2.2.0, debug@^2.6.9, debug@~2: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@4.3.4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.4: +debug@4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -6818,29 +6704,24 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.3.5: +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.6" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== dependencies: ms "2.1.2" -decimal.js@^10.2.0: - version "10.4.2" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.2.tgz#0341651d1d997d86065a2ce3a441fbd0d8e8b98e" - integrity sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA== - -decode-uri-component@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" - integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== - -decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" - integrity sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA== +debug@~2: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: - mimic-response "^1.0.0" + ms "2.0.0" + +decimal.js@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" + integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== decompress-response@^6.0.0: version "6.0.0" @@ -6850,9 +6731,9 @@ decompress-response@^6.0.0: mimic-response "^3.1.0" dedent@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" - integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== + version "1.5.3" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" + integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== deep-equal@2.0.5: version "2.0.5" @@ -6875,20 +6756,44 @@ deep-equal@2.0.5: which-collection "^1.0.1" which-typed-array "^1.1.2" +deep-equal@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.2.3.tgz#af89dafb23a396c7da3e862abc0be27cf51d56e1" + integrity sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA== + dependencies: + array-buffer-byte-length "^1.0.0" + call-bind "^1.0.5" + es-get-iterator "^1.1.3" + get-intrinsic "^1.2.2" + is-arguments "^1.1.1" + is-array-buffer "^3.0.2" + is-date-object "^1.0.5" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + isarray "^2.0.5" + object-is "^1.1.5" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.5.1" + side-channel "^1.0.4" + which-boxed-primitive "^1.0.2" + which-collection "^1.0.1" + which-typed-array "^1.1.13" + deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-is@~0.1.3: +deep-is@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" - integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== default-gateway@^7.2.2: version "7.2.2" @@ -6897,16 +6802,21 @@ default-gateway@^7.2.2: dependencies: execa "^7.1.1" -defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" - integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== - -define-properties@^1.1.3, define-properties@^1.1.4: +define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" - integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + +define-properties@^1.2.0, define-properties@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== dependencies: + define-data-property "^1.0.1" has-property-descriptors "^1.0.0" object-keys "^1.1.1" @@ -6920,39 +6830,41 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -depd@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -des.js@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" - integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - detect-browser@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.3.0.tgz#9705ef2bddf46072d0f7265a1fe300e36fe7ceca" integrity sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w== +detect-indent@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" + integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== + detect-libc@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.2.tgz#8ccf2ba9315350e1241b88d0ac3b0e1fbd99605d" - integrity sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw== + version "2.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" + integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== +did-jwt@^8.0.4: + version "8.0.4" + resolved "https://registry.yarnpkg.com/did-jwt/-/did-jwt-8.0.4.tgz#f5fce5cfc3064dcede146c8547d335703756e353" + integrity sha512-KPtG7H+8GgKGMiDqFvOdNy5BBN3hpA+8xV7VygEnpst5oPIqjvcH3rTtnPF55a8bOxIzE2PudKGIXIQhekv7WA== + dependencies: + "@noble/ciphers" "^0.5.0" + "@noble/curves" "^1.0.0" + "@noble/hashes" "^1.3.0" + "@scure/base" "^1.1.3" + canonicalize "^2.0.0" + did-resolver "^4.1.0" + multibase "^4.0.6" + multiformats "^9.6.2" + uint8arrays "3.1.1" + did-resolver@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/did-resolver/-/did-resolver-2.1.1.tgz#43796f8a3e921644e5fb15a8147684ca87019cfd" @@ -6968,15 +6880,6 @@ diff-sequences@^29.6.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -7014,11 +6917,6 @@ dom-serializer@^1.0.1: domhandler "^4.2.0" entities "^2.0.0" -dom-walk@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" - integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== - domelementtype@^2.0.1, domelementtype@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" @@ -7045,14 +6943,6 @@ dotenv@16.0.1: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d" integrity sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ== -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - ed25519-signature-2018-context@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ed25519-signature-2018-context/-/ed25519-signature-2018-context-1.1.0.tgz#68002ea7497c32e8170667cfd67468dedf7d220e" @@ -7063,22 +6953,12 @@ ed25519-signature-2020-context@^1.0.1: resolved "https://registry.yarnpkg.com/ed25519-signature-2020-context/-/ed25519-signature-2020-context-1.1.0.tgz#b2f724f07db154ddf0fd6605410d88736e56fd07" integrity sha512-dBGSmoUIK6h2vadDctrDnhhTO01PR2hJk0mRNEfrRDPCjaIwrfy4J+eziEQ9Q1m8By4f/CSRgKM1h53ydKfdNg== -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - -electron-to-chromium@^1.4.477: - version "1.4.488" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.488.tgz#442b1855f8c84fb1ed79f518985c65db94f64cc9" - integrity sha512-Dv4sTjiW7t/UWGL+H8ZkgIjtUAVZDgb/PwGWvMsCT7jipzUV/u5skbLXPFKb6iV0tiddVi/bcS2/kUrczeWgIQ== - -electron-to-chromium@^1.4.668: - version "1.4.717" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.717.tgz#99db370cae8cd090d5b01f8748e9ad369924d0f8" - integrity sha512-6Fmg8QkkumNOwuZ/5mIbMU9WI3H2fmn5ajcVya64I5Yr5CcNmO7vcLt0Y7c96DCiMO5/9G+4sI2r6eEvdg1F7A== +electron-to-chromium@^1.5.4: + version "1.5.6" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz#c81d9938b5a877314ad370feb73b4e5409b36abd" + integrity sha512-jwXWsM5RPf6j9dPYzaorcBSUg6AiqocPEyMpkchkvntaH9HGfOOMZwxMJjDY/XEs3T5dM7uyH1VhRMkqUU9qVw== -elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4: +elliptic@6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -7091,16 +6971,24 @@ elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" +elliptic@^6.5.3, elliptic@^6.5.4, elliptic@^6.5.5: + version "6.5.6" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.6.tgz#ee5f7c3a00b98a2144ac84d67d01f04d438fa53e" + integrity sha512-mpzdtpeCLuS3BmE3pO3Cpp5bbjlOPY2Q0PgoF+Od1XZrHLYI28Xe3ossCmYCQt11FQKEYd9+PF8jymTvtWJSHQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -7111,11 +6999,6 @@ enabled@2.0.x: resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2" integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ== -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - end-of-stream@^1.1.0, end-of-stream@^1.4.1: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" @@ -7123,6 +7006,14 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" +enquirer@^2.3.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.4.1.tgz#93334b3fbd74fc7097b224ab4a8fb7e40bf4ae56" + integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ== + dependencies: + ansi-colors "^4.1.1" + strip-ansi "^6.0.1" + entities@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" @@ -7150,61 +7041,112 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5, es-abstract@^1.20.0, es-abstract@^1.20.1: - version "1.20.4" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.4.tgz#1d103f9f8d78d4cf0713edcd6d0ed1a46eed5861" - integrity sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA== - dependencies: - call-bind "^1.0.2" +es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.2: + version "1.23.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0" + integrity sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A== + dependencies: + array-buffer-byte-length "^1.0.1" + arraybuffer.prototype.slice "^1.0.3" + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" + data-view-buffer "^1.0.1" + data-view-byte-length "^1.0.1" + data-view-byte-offset "^1.0.0" + es-define-property "^1.0.0" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + es-set-tostringtag "^2.0.3" es-to-primitive "^1.2.1" - function-bind "^1.1.1" - function.prototype.name "^1.1.5" - get-intrinsic "^1.1.3" - get-symbol-description "^1.0.0" - has "^1.0.3" - has-property-descriptors "^1.0.0" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.4" + get-symbol-description "^1.0.2" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + has-proto "^1.0.3" has-symbols "^1.0.3" - internal-slot "^1.0.3" + hasown "^2.0.2" + internal-slot "^1.0.7" + is-array-buffer "^3.0.4" is-callable "^1.2.7" - is-negative-zero "^2.0.2" + is-data-view "^1.0.1" + is-negative-zero "^2.0.3" is-regex "^1.1.4" - is-shared-array-buffer "^1.0.2" + is-shared-array-buffer "^1.0.3" is-string "^1.0.7" + is-typed-array "^1.1.13" is-weakref "^1.0.2" - object-inspect "^1.12.2" + object-inspect "^1.13.1" object-keys "^1.1.1" - object.assign "^4.1.4" - regexp.prototype.flags "^1.4.3" - safe-regex-test "^1.0.0" - string.prototype.trimend "^1.0.5" - string.prototype.trimstart "^1.0.5" + object.assign "^4.1.5" + regexp.prototype.flags "^1.5.2" + safe-array-concat "^1.1.2" + safe-regex-test "^1.0.3" + string.prototype.trim "^1.2.9" + string.prototype.trimend "^1.0.8" + string.prototype.trimstart "^1.0.8" + typed-array-buffer "^1.0.2" + typed-array-byte-length "^1.0.1" + typed-array-byte-offset "^1.0.2" + typed-array-length "^1.0.6" unbox-primitive "^1.0.2" + which-typed-array "^1.1.15" es-array-method-boxes-properly@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== -es-get-iterator@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.2.tgz#9234c54aba713486d7ebde0220864af5e2b283f7" - integrity sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ== +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.2.1, es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-get-iterator@^1.1.1, es-get-iterator@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.3.tgz#3ef87523c5d464d41084b2c3c9c214f1199763d6" + integrity sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw== dependencies: call-bind "^1.0.2" - get-intrinsic "^1.1.0" - has-symbols "^1.0.1" - is-arguments "^1.1.0" + get-intrinsic "^1.1.3" + has-symbols "^1.0.3" + is-arguments "^1.1.1" is-map "^2.0.2" is-set "^2.0.2" - is-string "^1.0.5" + is-string "^1.0.7" isarray "^2.0.5" + stop-iteration-iterator "^1.0.0" -es-shim-unscopables@^1.0.0: +es-object-atoms@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" - integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.0.0.tgz#ddb55cd47ac2e240701260bc2a8e31ecb643d941" + integrity sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw== + dependencies: + es-errors "^1.3.0" + +es-set-tostringtag@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz#8bb60f0a440c2e4281962428438d58545af39777" + integrity sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ== + dependencies: + get-intrinsic "^1.2.4" + has-tostringtag "^1.0.2" + hasown "^2.0.1" + +es-shim-unscopables@^1.0.0, es-shim-unscopables@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz#1f6942e71ecc7835ed1c8a83006d8771a63a3763" + integrity sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw== dependencies: - has "^1.0.3" + hasown "^2.0.0" es-to-primitive@^1.2.1: version "1.2.1" @@ -7215,47 +7157,10 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.50, es5-ext@^0.10.62, es5-ext@~0.10.14: - version "0.10.64" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" - integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - esniff "^2.0.1" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-promise@^4.2.8: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== +escalade@^3.1.1, escalade@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" + integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== escape-string-regexp@^1.0.5: version "1.0.5" @@ -7267,6 +7172,11 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + eslint-config-airbnb-base@^14.1.0: version "14.2.1" resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz#8a2eb38455dc5a312550193b319cdaeef042cd1e" @@ -7276,46 +7186,51 @@ eslint-config-airbnb-base@^14.1.0: object.assign "^4.1.2" object.entries "^1.1.2" -eslint-import-resolver-node@^0.3.6: - version "0.3.6" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" - integrity sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== +eslint-import-resolver-node@^0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== dependencies: debug "^3.2.7" - resolve "^1.20.0" + is-core-module "^2.13.0" + resolve "^1.22.4" -eslint-module-utils@^2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz#4f3e41116aaf13a20792261e61d3a2e7e0583974" - integrity sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA== +eslint-module-utils@^2.8.0: + version "2.8.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz#52f2404300c3bd33deece9d7372fb337cc1d7c34" + integrity sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q== dependencies: debug "^3.2.7" eslint-plugin-import@^2.20.2: - version "2.26.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b" - integrity sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA== - dependencies: - array-includes "^3.1.4" - array.prototype.flat "^1.2.5" - debug "^2.6.9" + version "2.29.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643" + integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw== + dependencies: + array-includes "^3.1.7" + array.prototype.findlastindex "^1.2.3" + array.prototype.flat "^1.3.2" + array.prototype.flatmap "^1.3.2" + debug "^3.2.7" doctrine "^2.1.0" - eslint-import-resolver-node "^0.3.6" - eslint-module-utils "^2.7.3" - has "^1.0.3" - is-core-module "^2.8.1" + eslint-import-resolver-node "^0.3.9" + eslint-module-utils "^2.8.0" + hasown "^2.0.0" + is-core-module "^2.13.1" is-glob "^4.0.3" minimatch "^3.1.2" - object.values "^1.1.5" - resolve "^1.22.0" - tsconfig-paths "^3.14.1" + object.fromentries "^2.0.7" + object.groupby "^1.0.1" + object.values "^1.1.7" + semver "^6.3.1" + tsconfig-paths "^3.15.0" -eslint-plugin-jest@^24.5.0: - version "24.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.7.0.tgz#206ac0833841e59e375170b15f8d0955219c4889" - integrity sha512-wUxdF2bAZiYSKBclsUMrYHH6WxiBreNjyDxbRv345TIvPeoCEgPNEn3Sa+ZrSqsf1Dl9SqqSREXMHExlMMu1DA== +eslint-plugin-jest@^26.0.0: + version "26.9.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-26.9.0.tgz#7931c31000b1c19e57dbfb71bbf71b817d1bf949" + integrity sha512-TWJxWGp1J628gxh2KhaH1H1paEdgE2J61BBF1I59c6xWeL5+D1BzMxGDN/nXAfX+aSkR5u80K+XhskK6Gwq9ng== dependencies: - "@typescript-eslint/experimental-utils" "^4.0.1" + "@typescript-eslint/utils" "^5.10.0" eslint-plugin-sonarjs@0.5.0: version "0.5.0" @@ -7323,9 +7238,9 @@ eslint-plugin-sonarjs@0.5.0: integrity sha512-XW5MnzlRjhXpIdbULC/qAdJYHWw3rRLws/DyawdlPU/IdVr9AmRK1r2LaCvabwKOAW2XYYSo3kDX58E4MrB7PQ== eslint-plugin-unused-imports@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz#d25175b0072ff16a91892c3aa72a09ca3a9e69e7" - integrity sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw== + version "3.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.2.0.tgz#63a98c9ad5f622cd9f830f70bc77739f25ccfe0d" + integrity sha512-6uXyn6xdINEpxE1MtDjxQsyXB37lfyO2yKGVVgtD7WEWQGORSOZjgrD6hBhvGv4/SO+TOlS+UnC6JppRqbuwGQ== dependencies: eslint-rule-composer "^0.3.0" @@ -7334,7 +7249,7 @@ eslint-rule-composer@^0.3.0: resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== -eslint-scope@^5.0.0, eslint-scope@^5.1.1: +eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -7342,106 +7257,91 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" - integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== - dependencies: - eslint-visitor-keys "^1.1.0" - -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: - eslint-visitor-keys "^2.0.0" + esrecurse "^4.3.0" + estraverse "^5.2.0" -eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: +eslint-visitor-keys@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint@^6.8.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" - integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== - dependencies: - "@babel/code-frame" "^7.0.0" - ajv "^6.10.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^4.0.1" +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@^8.0.0: + version "8.57.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" + integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.0" + "@humanwhocodes/config-array" "^0.11.14" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" doctrine "^3.0.0" - eslint-scope "^5.0.0" - eslint-utils "^1.4.3" - eslint-visitor-keys "^1.1.0" - espree "^6.1.2" - esquery "^1.0.1" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" esutils "^2.0.2" - file-entry-cache "^5.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" - globals "^12.1.0" - ignore "^4.0.6" - import-fresh "^3.0.0" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" imurmurhash "^0.1.4" - inquirer "^7.0.0" is-glob "^4.0.0" - js-yaml "^3.13.1" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.14" - minimatch "^3.0.4" - mkdirp "^0.5.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" natural-compare "^1.4.0" - optionator "^0.8.3" - progress "^2.0.0" - regexpp "^2.0.1" - semver "^6.1.2" - strip-ansi "^5.2.0" - strip-json-comments "^3.0.1" - table "^5.2.3" + optionator "^0.9.3" + strip-ansi "^6.0.1" text-table "^0.2.0" - v8-compile-cache "^2.0.3" esm@^3.2.22: version "3.2.25" resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== -esniff@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" - integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== - dependencies: - d "^1.0.1" - es5-ext "^0.10.62" - event-emitter "^0.3.5" - type "^2.7.2" - -espree@^6.1.2: - version "6.2.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" - integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: - acorn "^7.1.1" - acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.1.0" + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.0.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== +esquery@^1.4.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== dependencies: estraverse "^5.1.0" @@ -7482,40 +7382,6 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - -eth-ens-namehash@2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" - integrity sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw== - dependencies: - idna-uts46-hx "^2.3.1" - js-sha3 "^0.5.7" - -eth-lib@0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" - integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - xhr-request-promise "^0.1.2" - -eth-lib@^0.1.26: - version "0.1.29" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.1.29.tgz#0c11f5060d42da9f931eab6199084734f4dbd1d9" - integrity sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - nano-json-stream-parser "^0.1.2" - servify "^0.1.12" - ws "^3.0.0" - xhr-request-promise "^0.1.2" - eth-revert-reason@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/eth-revert-reason/-/eth-revert-reason-1.0.3.tgz#aa287b81b2b262196bec7cb98b87eb216e5cb0ef" @@ -7523,45 +7389,6 @@ eth-revert-reason@^1.0.3: dependencies: ethers "^4.0.46" -ethereum-bloom-filters@^1.0.6: - version "1.0.10" - resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz#3ca07f4aed698e75bd134584850260246a5fed8a" - integrity sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA== - dependencies: - js-sha3 "^0.8.0" - -ethereum-cryptography@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" - integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== - dependencies: - "@types/pbkdf2" "^3.0.0" - "@types/secp256k1" "^4.0.1" - blakejs "^1.1.0" - browserify-aes "^1.2.0" - bs58check "^2.1.2" - create-hash "^1.2.0" - create-hmac "^1.1.7" - hash.js "^1.1.7" - keccak "^3.0.0" - pbkdf2 "^3.0.17" - randombytes "^2.1.0" - safe-buffer "^5.1.2" - scrypt-js "^3.0.0" - secp256k1 "^4.0.1" - setimmediate "^1.0.5" - -ethereumjs-util@^7.0.10, ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.5: - version "7.1.5" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" - integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== - dependencies: - "@types/bn.js" "^5.1.0" - bn.js "^5.1.2" - create-hash "^1.1.2" - ethereum-cryptography "^0.1.3" - rlp "^2.2.4" - ethers@^4.0.46: version "4.0.49" resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.49.tgz#0eb0e9161a0c8b4761be547396bbe2fb121a8894" @@ -7688,14 +7515,6 @@ ethjs-schema@0.2.1: resolved "https://registry.yarnpkg.com/ethjs-schema/-/ethjs-schema-0.2.1.tgz#47e138920421453617069034684642e26bb310f4" integrity sha512-DXd8lwNrhT9sjsh/Vd2Z+4pfyGxhc0POVnLBUfwk5udtdoBzADyq+sK39dcb48+ZU+2VgtwHxtGWnLnCfmfW5g== -ethjs-unit@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" - integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== - dependencies: - bn.js "4.11.6" - number-to-bn "1.7.0" - ethjs-util@0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.3.tgz#dfd5ea4a400dc5e421a889caf47e081ada78bb55" @@ -7724,14 +7543,6 @@ ethr-did-resolver@^2.2.0: ethr-did-registry "^0.0.3" js-sha3 "^0.8.0" -event-emitter@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== - dependencies: - d "1" - es5-ext "~0.10.14" - event-iterator@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/event-iterator/-/event-iterator-2.0.0.tgz#10f06740cc1e9fd6bc575f334c2bc1ae9d2dbf62" @@ -7747,11 +7558,6 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter3@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" - integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ== - eventemitter3@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" @@ -7767,14 +7573,6 @@ events@^3.3.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -7826,56 +7624,12 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -express@^4.14.0: - version "4.19.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" - integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.2" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.6.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.2.0" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.7" - qs "6.11.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.18.0" - serve-static "1.15.0" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -ext@^1.1.2: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== +extendable-error@^0.1.5: + version "0.1.7" + resolved "https://registry.yarnpkg.com/extendable-error/-/extendable-error-0.1.7.tgz#60b9adf206264ac920058a7395685ae4670c2b96" + integrity sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg== -external-editor@^3.0.3: +external-editor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== @@ -7884,25 +7638,15 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.0.0, fast-glob@^3.0.3, fast-glob@^3.2.9: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== +fast-glob@3.3.2, fast-glob@^3.0.3, fast-glob@^3.2.9: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -7915,7 +7659,7 @@ fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== @@ -7931,9 +7675,9 @@ fastfile@0.0.20: integrity sha512-r5ZDbgImvVWCP0lA/cGNgQcZqR+aYdFx3u+CtJqUE510pBUVGMn4ulL/iRTI4tACTYsNJ736uzFxEBXesPAktA== fastq@^1.6.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" - integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== + version "1.17.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" @@ -7992,48 +7736,38 @@ ffjavascript@0.2.56: web-worker "^1.2.0" ffjavascript@^0.2.48: - version "0.2.57" - resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.57.tgz#ba1be96015b2688192e49f2f4de2cc5150fd8594" - integrity sha512-V+vxZ/zPNcthrWmqfe/1YGgqdkTamJeXiED0tsk7B84g40DKlrTdx47IqZuiygqAVG6zMw4qYuvXftIJWsmfKQ== + version "0.2.63" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.63.tgz#0c1216a1f123dc9181df69e144473704d2f115eb" + integrity sha512-dBgdsfGks58b66JnUZeZpGxdMIDQ4QsD3VYlRJyFVrKQHb2kJy4R2gufx5oetrTxXPT+aEjg0dOvOLg1N0on4A== dependencies: wasmbuilder "0.0.16" - wasmcurves "0.2.0" - web-worker "^1.2.0" + wasmcurves "0.2.2" + web-worker "1.2.0" -figures@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - escape-string-regexp "^1.0.5" + flat-cache "^3.0.4" -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== +file-type@^19.5.0: + version "19.5.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-19.5.0.tgz#c13c5eca9c1c7270f6d5fbff70331b3c976f92b5" + integrity sha512-dMuq6WWnP6BpQY0zYJNpTtQWgeCImSMG0BTIzUBXvxbwc1HWP/E7AE4UWU9XSCOPGJuOHda0HpDnwM2FW+d90A== dependencies: - flat-cache "^2.0.1" + get-stream "^9.0.1" + strtok3 "^8.1.0" + token-types "^6.0.0" + uint8array-extras "^1.3.0" -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" -finalhandler@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" - integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - find-cache-dir@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" @@ -8058,6 +7792,14 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + fix-esm@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/fix-esm/-/fix-esm-1.0.1.tgz#e0e2199d841e43ff7db9b5f5ba7496bc45130ebb" @@ -8067,30 +7809,35 @@ fix-esm@^1.0.1: "@babel/plugin-proposal-export-namespace-from" "^7.14.5" "@babel/plugin-transform-modules-commonjs" "^7.14.5" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== +flat-cache@^3.0.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" + flatted "^3.2.9" + keyv "^4.5.3" + rimraf "^3.0.2" flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flatted@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" - integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +flatted@^3.2.9: + version "3.3.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== fn.name@1.x.x: version "1.1.0" resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== +follow-redirects@^1.15.6: + version "1.15.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== + follow-redirects@^1.5.1: version "1.15.6" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" @@ -8108,23 +7855,13 @@ foreach@^2.0.4: resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.6.tgz#87bcc8a1a0e74000ff2bf9802110708cfb02eb6e" integrity sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg== -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - -form-data-encoder@1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" - integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== dependencies: asynckit "^0.4.0" - combined-stream "^1.0.6" + combined-stream "^1.0.8" mime-types "^2.1.12" formdata-polyfill@^4.0.10: @@ -8134,30 +7871,20 @@ formdata-polyfill@^4.0.10: dependencies: fetch-blob "^3.1.2" -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - freeport-promise@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/freeport-promise/-/freeport-promise-2.0.0.tgz#11e4f81e24d680b88a20c15b2103551f4b6663d8" integrity sha512-dwWpT1DdQcwrhmRwnDnPM/ZFny+FtzU+k50qF2eid3KxaQDsMiBrwo1i0G3qSugkN5db6Cb0zgfc68QeTOpEFg== -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" - integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== +fs-extra@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== dependencies: graceful-fs "^4.1.2" jsonfile "^4.0.0" @@ -8172,13 +7899,6 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs-readdir-recursive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" @@ -8189,37 +7909,32 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2: +fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-timeout@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/function-timeout/-/function-timeout-0.1.1.tgz#6bf71d3d24c894d43b2bec312cabb8c5add2e9da" + integrity sha512-0NVVC0TaP7dSTvn1yMiy6d6Q8gifzbvQafO46RtLG/kHJUBNd+pVRGOBoK44wNBvtSPUJRfdVvkFdD3p0xvyZg== -function.prototype.name@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" - integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== +function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.0" - functions-have-names "^1.2.2" - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" -functions-have-names@^1.2.2: +functions-have-names@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== @@ -8234,19 +7949,16 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.0.1, get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385" - integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== +get-intrinsic@^1.0.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== dependencies: - function-bind "^1.1.1" - has "^1.0.3" + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" has-symbols "^1.0.3" - -get-iterator@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-iterator/-/get-iterator-1.0.2.tgz#cd747c02b4c084461fac14f48f6b45a80ed25c82" - integrity sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg== + hasown "^2.0.0" get-iterator@^2.0.1: version "2.0.1" @@ -8258,45 +7970,47 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-stream@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -get-symbol-description@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" - integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== +get-stream@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-9.0.1.tgz#95157d21df8eb90d1647102b63039b1df60ebd27" + integrity sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA== dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.1" + "@sec-ant/readable-stream" "^0.4.1" + is-stream "^4.0.1" -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== +get-symbol-description@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.2.tgz#533744d5aa20aca4e079c8e5daf7fd44202821f5" + integrity sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg== dependencies: - assert-plus "^1.0.0" + call-bind "^1.0.5" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" github-from-package@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== -glob-parent@^5.0.0, glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -8310,9 +8024,9 @@ glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0: path-is-absolute "^1.0.0" glob@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" - integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -8320,25 +8034,25 @@ glob@^8.0.3: minimatch "^5.0.1" once "^1.3.0" -global@~4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" - integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== - dependencies: - min-document "^2.19.0" - process "^0.11.10" - globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^12.1.0: - version "12.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" - integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== +globals@^13.19.0: + version "13.24.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== + dependencies: + type-fest "^0.20.2" + +globalthis@^1.0.1, globalthis@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" + integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== dependencies: - type-fest "^0.8.1" + define-properties "^1.2.1" + gopd "^1.0.1" globby@10.0.1: version "10.0.1" @@ -8354,7 +8068,7 @@ globby@10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.3: +globby@^11.0.0, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -8366,56 +8080,27 @@ globby@^11.0.3: merge2 "^1.4.1" slash "^3.0.0" -got@12.1.0: - version "12.1.0" - resolved "https://registry.yarnpkg.com/got/-/got-12.1.0.tgz#099f3815305c682be4fd6b0ee0726d8e4c6b0af4" - integrity sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig== - dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" - "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^2.0.0" - -got@^11.8.5: - version "11.8.5" - resolved "https://registry.yarnpkg.com/got/-/got-11.8.5.tgz#ce77d045136de56e8f024bebb82ea349bc730046" - integrity sha512-o0Je4NvQObAuZPHLFoRSkdG2lTgtcynqymzg2Vupdx6PorhaT5MCbIyXG6d4D94kk8ZG57QeosgdiqfJWhEhlQ== - dependencies: - "@sindresorhus/is" "^4.0.0" - "@szmarczak/http-timer" "^4.0.5" - "@types/cacheable-request" "^6.0.1" - "@types/responselike" "^1.0.0" - cacheable-lookup "^5.0.3" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - http2-wrapper "^1.0.0-beta.5.2" - lowercase-keys "^2.0.0" - p-cancelable "^2.0.0" - responselike "^2.0.0" - -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" -graceful-fs@^4.2.9: +graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -graphql-ld@^1.4.0: +graphemer@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/graphql-ld/-/graphql-ld-1.4.0.tgz#aab1a42459ad25b589ddfbddf2202a6eb9aa975b" - integrity sha512-HCxUJ6Rm+6xj9iK8D2FW/Nd2kKBiEe8j1AsNpl5mdEAan3LJWwfG4Fb1gUaaVkRIswrROM6HdSfyd73+vmZoBg== + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + +graphql-ld@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/graphql-ld/-/graphql-ld-1.4.1.tgz#3fd4e187273c41a79443664eebdef3ef773f0d3a" + integrity sha512-oJ8o/1DdAbM+oNE9FBnc0bbWgzvImnl/o2fty2NzA4nyj4T6HNbAkr1CcUL9OieSZPEAW7QcU7W66OVHkxDwVw== dependencies: "@rdfjs/types" "*" graphql-to-sparql "^2.4.0" @@ -8436,22 +8121,9 @@ graphql-to-sparql@^2.4.0: sparqlalgebrajs "^3.0.2" graphql@^15.0.0: - version "15.8.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38" - integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw== - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" + version "15.9.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.9.0.tgz#4e8ca830cfd30b03d44d3edd9cac2b0690304b53" + integrity sha512-GCOQdvm7XxV1S4U4CGrsdlEN37245eC8P9zaYCMr6K1BG0IPGy5lUwmJsEOGyl1GD6HXjOtl2keCP9asRBwNvA== has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" @@ -8468,31 +8140,29 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-property-descriptors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" - integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== +has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== dependencies: - get-intrinsic "^1.1.1" + es-define-property "^1.0.0" + +has-proto@^1.0.1, has-proto@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== -has-symbols@^1.0.1, has-symbols@^1.0.2, has-symbols@^1.0.3: +has-symbols@^1.0.2, has-symbols@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== -has-tostringtag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" - integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== - dependencies: - has-symbols "^1.0.2" - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== +has-tostringtag@^1.0.0, has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== dependencies: - function-bind "^1.1.1" + has-symbols "^1.0.3" hash-base@^3.0.0: version "3.1.0" @@ -8524,23 +8194,30 @@ hashlru@^2.3.0: resolved "https://registry.yarnpkg.com/hashlru/-/hashlru-2.3.0.tgz#5dc15928b3f6961a2056416bb3a4910216fdfb51" integrity sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A== -helia@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/helia/-/helia-4.0.2.tgz#f32bb17b2ffc383d90295a49d5b303574ca739fc" - integrity sha512-+UJYk+R6fsND6U8freK4Mifj5v3h09Lx3931cvf2ZWhSWBPyLAWTlsV7KxQaWktr70fzWBvRazx5pyRXAPYfLg== +hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +helia@^4.0.1, helia@^4.2.5: + version "4.2.5" + resolved "https://registry.yarnpkg.com/helia/-/helia-4.2.5.tgz#9f8025d182bd4f4502e55fac0a74c99547dbdd85" + integrity sha512-0X4Kb1jIwGGROcIcfS5xSjQHH8uisBbMGvktnWjziGkmlcgb8JXzilLXTtH+jDpkTkpo0s1VTKZkHo9rozjWkw== dependencies: "@chainsafe/libp2p-noise" "^15.0.0" "@chainsafe/libp2p-yamux" "^6.0.2" - "@helia/block-brokers" "^2.0.2" + "@helia/block-brokers" "^3.0.3" "@helia/delegated-routing-v1-http-api-client" "^3.0.0" - "@helia/interface" "^4.0.1" - "@helia/routers" "^1.0.1" - "@helia/utils" "^0.0.2" + "@helia/interface" "^4.3.1" + "@helia/routers" "^1.1.1" + "@helia/utils" "^0.3.3" "@libp2p/autonat" "^1.0.13" "@libp2p/bootstrap" "^10.0.16" "@libp2p/circuit-relay-v2" "^1.0.16" "@libp2p/dcutr" "^1.0.13" - "@libp2p/identify" "^1.0.15" + "@libp2p/identify" "^2.0.0" "@libp2p/interface" "^1.1.4" "@libp2p/kad-dht" "^12.0.8" "@libp2p/keychain" "^4.0.9" @@ -8553,12 +8230,13 @@ helia@^4.0.1: "@libp2p/webrtc" "^4.0.20" "@libp2p/websockets" "^8.0.16" "@libp2p/webtransport" "^4.0.20" + "@multiformats/dns" "^1.0.1" blockstore-core "^4.4.0" datastore-core "^9.2.9" interface-blockstore "^5.2.10" interface-datastore "^8.2.11" ipns "^9.0.0" - libp2p "^1.2.4" + libp2p "^1.3.0" multiformats "^13.1.0" hmac-drbg@^1.0.1: @@ -8602,56 +8280,15 @@ htmlparser2@^7.0.0: domutils "^2.8.0" entities "^3.0.1" -http-cache-semantics@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" - integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== - -http-errors@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== - dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" - -http-https@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" - integrity sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg== - http-link-header@^1.0.2: - version "1.0.5" - resolved "https://registry.yarnpkg.com/http-link-header/-/http-link-header-1.0.5.tgz#8e6d9ed1d393e8d5e01aa5c48bd97aa38d7e261c" - integrity sha512-msKrMbv/xHzhdOD4sstbEr+NbGqpv8ZtZliiCeByGENJo1jK1GZ/81zHF9HpWtEH5ihovPpdqHXniwZapJCKEA== - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -http2-wrapper@^1.0.0-beta.5.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz#b8f55e0c1f25d4ebd08b3b0c2c079f9590800b3d" - integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.0.0" + version "1.1.3" + resolved "https://registry.yarnpkg.com/http-link-header/-/http-link-header-1.1.3.tgz#b367b7a0ad1cf14027953f31aa1df40bb433da2a" + integrity sha512-3cZ0SRL8fb9MUlU3mKM61FcQvPfXx2dBrZW3Vbg5CXa8jFlK8OaEpePenLe1oEXQduhz8b0QjsqfS59QP4AJDQ== -http2-wrapper@^2.1.10: - version "2.1.11" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.1.11.tgz#d7c980c7ffb85be3859b6a96c800b2951ae257ef" - integrity sha512-aNAk5JzLturWEUiuhAN73Jcbq96R7rTitAoXV54FYMatvihnpD2+6PUgU4ce3D/m5VDbw+F5CsyKSF176ptitQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" +human-id@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/human-id/-/human-id-1.0.2.tgz#e654d4b2b0d8b07e45da9f6020d8af17ec0a5df3" + integrity sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw== human-signals@^2.1.0: version "2.1.0" @@ -8663,20 +8300,13 @@ human-signals@^4.3.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== -iconv-lite@0.4.24, iconv-lite@^0.4.24: +iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" -idna-uts46-hx@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" - integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== - dependencies: - punycode "2.1.0" - ieee754@1.1.13: version "1.1.13" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" @@ -8687,27 +8317,17 @@ ieee754@^1.1.13, ieee754@^1.1.4, ieee754@^1.2.1: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== - -ignore@^5.1.1: - version "5.2.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" - integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== - -ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== +ignore@^5.1.1, ignore@^5.2.0: + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== immutable@^3.8.2: version "3.8.2" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" integrity sha512-15gZoQ38eYjEjxkorfbcgBKBL6R7T459OuK+CpcWt7O3KF4uPCx2tD0uFETlUDIyo+1789crbMhTvQBSR5yBMg== -import-fresh@^3.0.0: +import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -8716,9 +8336,9 @@ import-fresh@^3.0.0: resolve-from "^4.0.0" import-local@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" - integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -8736,7 +8356,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -8746,94 +8366,50 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -inquirer@^7.0.0: - version "7.3.3" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" - integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA== - dependencies: - ansi-escapes "^4.2.1" - chalk "^4.1.0" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - external-editor "^3.0.3" - figures "^3.0.0" - lodash "^4.17.19" - mute-stream "0.0.8" - run-async "^2.4.0" - rxjs "^6.6.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - -interface-blockstore@^5.0.0, interface-blockstore@^5.2.10: - version "5.2.10" - resolved "https://registry.yarnpkg.com/interface-blockstore/-/interface-blockstore-5.2.10.tgz#b01101dd70eda2ab713cc00a492921949934c861" - integrity sha512-9K48hTvBCGsKVD3pF4ILgDcf+W2P/gq0oxLcsHGB6E6W6nDutYkzR+7k7bCs9REHrBEfKzcVDEKieiuNM9WRZg== +interface-blockstore@^5.0.0, interface-blockstore@^5.2.10, interface-blockstore@^5.2.9: + version "5.3.0" + resolved "https://registry.yarnpkg.com/interface-blockstore/-/interface-blockstore-5.3.0.tgz#1b22f415fcd3e59ef586a647bfd3eb01dc784bc1" + integrity sha512-MsOE2H9duZdpxXk7KVOQLaQnX4LfqHegshKxSr4b/YD44t13koT5Lg4lphZ0FwB5uvtvqQPm7LNcS0T/5Z2YUQ== dependencies: - interface-store "^5.0.0" + interface-store "6.0.0" multiformats "^13.0.1" interface-datastore@^8.0.0, interface-datastore@^8.1.0, interface-datastore@^8.2.11: - version "8.2.11" - resolved "https://registry.yarnpkg.com/interface-datastore/-/interface-datastore-8.2.11.tgz#1d555ce6218ab6cba6291fc361debe9713590207" - integrity sha512-9E0iXehfp/j0UbZ2mvlYB4K9pP7uQBCppfuy8WHs1EHF6wLQrM9+zwyX+8Qt6HnH4GKZRyXX/CNXm6oD4+QYgA== + version "8.3.0" + resolved "https://registry.yarnpkg.com/interface-datastore/-/interface-datastore-8.3.0.tgz#0ce9a2f0f61f9fbe1c1734c6d10a0265193689f7" + integrity sha512-RM/rTSmRcnoCwGZIHrPm+nlGYVoT4R0lcFvNnDyhdFT4R6BuHHhfFP47UldVEjs98SfxLuMhaNMsyjI918saHw== dependencies: - interface-store "^5.0.0" + interface-store "6.0.0" uint8arrays "^5.0.2" -interface-store@^5.0.0, interface-store@^5.1.0, interface-store@^5.1.8: +interface-store@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-6.0.0.tgz#8d8277a582f69d819134e125b686e147099a4728" + integrity sha512-HkjsDPsjA7SKkCr+TH1elUQApAAM3X3JPwrz3vFzaf614wI+ZD6GVvwKGZCHYcbSRqeZP/uzVPqezzeISeo5kA== + +interface-store@^5.0.0, interface-store@^5.1.7, interface-store@^5.1.8: version "5.1.8" resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-5.1.8.tgz#94bf867d165b5c904cccf09adeba215a5b0f459e" integrity sha512-7na81Uxkl0vqk0CBPO5PvyTkdaJBaezwUJGsMOz7riPOq0rJt+7W31iaopaMICWea/iykUsvNlPx/Tc+MxC3/w== -internal-slot@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" - integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== +internal-slot@^1.0.4, internal-slot@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802" + integrity sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g== dependencies: - get-intrinsic "^1.1.0" - has "^1.0.3" + es-errors "^1.3.0" + hasown "^2.0.0" side-channel "^1.0.4" -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -ipfs-bitswap@^20.0.2: - version "20.0.2" - resolved "https://registry.yarnpkg.com/ipfs-bitswap/-/ipfs-bitswap-20.0.2.tgz#d607656403d45063cdd7e3187c4140e25a22f447" - integrity sha512-B/pPf0Dvnp/TzZ/jk7IElxCH+MwxTCe8YvyQzsQ4i8RhUh0IwyyaHPy0LSVGuJpADNjaaZQffe6DSxwmRKF7uA== - dependencies: - "@libp2p/interface" "^1.0.0" - "@libp2p/logger" "^4.0.0" - "@libp2p/utils" "^5.0.0" - "@multiformats/multiaddr" "^12.1.0" - "@vascosantos/moving-average" "^1.1.0" - any-signal "^4.1.1" - events "^3.3.0" - interface-blockstore "^5.0.0" - interface-store "^5.1.0" - it-drain "^3.0.5" - it-foreach "^2.0.2" - it-length-prefixed "^9.0.0" - it-map "^3.0.2" - it-pipe "^3.0.1" - it-take "^3.0.1" - just-debounce-it "^3.0.1" - multiformats "^13.0.0" - progress-events "^1.0.0" - protons-runtime "^5.0.0" - timeout-abort-controller "^3.0.0" - uint8arraylist "^2.4.3" - uint8arrays "^5.0.1" - varint "^6.0.0" - varint-decoder "^1.0.0" +ip-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-5.0.0.tgz#cd313b2ae9c80c07bd3851e12bf4fa4dc5480632" + integrity sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw== ipns@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/ipns/-/ipns-9.0.0.tgz#df1bda9e9f688fb16f811a566202b1ce3041a32d" - integrity sha512-z/C/SfikvR23y0rhUOxL+zF5nG8bKv9xcdEcL8iO1IEnSBa0Y2pzke22V9YXw1r4uZ7CWukRQTC68+XHRu8y5Q== + version "9.1.0" + resolved "https://registry.yarnpkg.com/ipns/-/ipns-9.1.0.tgz#de718378309f49b03f5eb6c5990c3db92ad38220" + integrity sha512-up2o1Qx9tSSfh73k69j3/Acacua6JbffTe5xA8+/fv6ibkQyhriMPHlgae1896DwmQkJrusKgBs7EAOi3yrO2w== dependencies: "@libp2p/crypto" "^4.0.0" "@libp2p/interface" "^1.1.0" @@ -8848,7 +8424,7 @@ ipns@^9.0.0: uint8arraylist "^2.4.8" uint8arrays "^5.0.1" -is-arguments@^1.0.4, is-arguments@^1.1.0: +is-arguments@^1.0.4, is-arguments@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== @@ -8856,6 +8432,14 @@ is-arguments@^1.0.4, is-arguments@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" +is-array-buffer@^3.0.2, is-array-buffer@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.4.tgz#7a1f92b3d61edd2bc65d24f130530ea93d7fae98" + integrity sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -8888,10 +8472,10 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-builtin-module@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.0.tgz#bb0310dfe881f144ca83f30100ceb10cf58835e0" - integrity sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw== +is-builtin-module@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" + integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== dependencies: builtin-modules "^3.3.0" @@ -8900,21 +8484,21 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.13.0: - version "2.13.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db" - integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ== +is-core-module@^2.13.0, is-core-module@^2.13.1: + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== dependencies: - has "^1.0.3" + hasown "^2.0.2" -is-core-module@^2.8.1, is-core-module@^2.9.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" - integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== +is-data-view@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-data-view/-/is-data-view-1.0.1.tgz#4b4d3a511b70f3dc26d42c03ca9ca515d847759f" + integrity sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w== dependencies: - has "^1.0.3" + is-typed-array "^1.1.13" -is-date-object@^1.0.1, is-date-object@^1.0.2: +is-date-object@^1.0.1, is-date-object@^1.0.2, is-date-object@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== @@ -8922,9 +8506,9 @@ is-date-object@^1.0.1, is-date-object@^1.0.2: has-tostringtag "^1.0.0" is-electron@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.1.tgz#751b1dd8a74907422faa5c35aaa0cf66d98086e9" - integrity sha512-r8EEQQsqT+Gn0aXFx7lTFygYQhILLCB+wn0WCDL5LZRINeLH/Rvw1j2oKodELLXYNImQ3CRlVsY8wW4cGOsyuw== + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.2.tgz#3778902a2044d76de98036f5dc58089ac4d80bb9" + integrity sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg== is-extglob@^2.1.1: version "2.1.1" @@ -8936,21 +8520,11 @@ is-fn@^1.0.0: resolved "https://registry.yarnpkg.com/is-fn/-/is-fn-1.0.0.tgz#9543d5de7bcf5b08a22ec8a20bae6e286d510d8c" integrity sha512-XoFPJQmsAShb3jEQRfzf2rqXavq7fIqF/jOekp308JlThqrODnMpweVSGilKTCXELfLhltGP2AGgbQGVP8F1dg== -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== - is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-function@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" - integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== - is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" @@ -8975,30 +8549,33 @@ is-hex-prefixed@1.0.0: resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== +is-ip@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-5.0.1.tgz#bec44442c823e591aa6f4d6fb9081d6a9be17e44" + integrity sha512-FCsGHdlrOnZQcp0+XT5a+pYowf33itBalCl+7ovNXC/7o5BhIpG14M3OrpPPdBSIQJCm+0M5+9mO7S9VVTTCFw== + dependencies: + ip-regex "^5.0.0" + super-regex "^0.2.0" + is-loopback-addr@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-loopback-addr/-/is-loopback-addr-2.0.2.tgz#70a6668fa3555d47caebdcee045745ab80adf5e4" integrity sha512-26POf2KRCno/KTNL5Q0b/9TYnL00xEsSaLfiFRmjM7m7Lw7ZMmFybzzuX4CcsLAluZGd+niLUiMRxEooVE3aqg== -is-map@^2.0.1, is-map@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" - integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== +is-map@^2.0.2, is-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.3.tgz#ede96b7fe1e270b3c4465e3a465658764926d62e" + integrity sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw== is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g== -is-negative-zero@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" - integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== - -is-network-error@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-network-error/-/is-network-error-1.0.1.tgz#a68061a20387e9144e145571bea693056a370b92" - integrity sha512-OwQXkwBJeESyhFw+OumbJVD58BFBJJI5OM5S1+eyrDKlgDZPX2XNT5gXS56GSD3NPbbwUuMlR1Q71SRp5SobuQ== +is-negative-zero@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" + integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== is-number-object@^1.0.4: version "1.0.7" @@ -9012,6 +8589,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" @@ -9044,17 +8626,22 @@ is-regex@^1.1.1, is-regex@^1.1.4: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-set@^2.0.1, is-set@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" - integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== +is-regexp@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-3.1.0.tgz#0235eab9cda5b83f96ac4a263d8c32c9d5ad7422" + integrity sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA== -is-shared-array-buffer@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" - integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== +is-set@^2.0.2, is-set@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.3.tgz#8ab209ea424608141372ded6e0cb200ef1d9d01d" + integrity sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg== + +is-shared-array-buffer@^1.0.2, is-shared-array-buffer@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz#1237f1cba059cdb62431d378dcc37d9680181688" + integrity sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg== dependencies: - call-bind "^1.0.2" + call-bind "^1.0.7" is-stream@^1.1.0: version "1.1.0" @@ -9071,6 +8658,11 @@ is-stream@^3.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== +is-stream@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-4.0.1.tgz#375cf891e16d2e4baec250b85926cffc14720d9b" + integrity sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A== + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -9078,6 +8670,13 @@ is-string@^1.0.5, is-string@^1.0.7: dependencies: has-tostringtag "^1.0.0" +is-subdir@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-subdir/-/is-subdir-1.2.0.tgz#b791cd28fab5202e91a08280d51d9d7254fd20d4" + integrity sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw== + dependencies: + better-path-resolve "1.0.0" + is-symbol@^1.0.2, is-symbol@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" @@ -9085,26 +8684,17 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: dependencies: has-symbols "^1.0.2" -is-typed-array@^1.1.3, is-typed-array@^1.1.9: - version "1.1.9" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.9.tgz#246d77d2871e7d9f5aeb1d54b9f52c71329ece67" - integrity sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A== +is-typed-array@^1.1.13, is-typed-array@^1.1.3: + version "1.1.13" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.13.tgz#d6c5ca56df62334959322d7d7dd1cca50debe229" + integrity sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw== dependencies: - available-typed-arrays "^1.0.5" - call-bind "^1.0.2" - es-abstract "^1.20.0" - for-each "^0.3.3" - has-tostringtag "^1.0.0" - -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== + which-typed-array "^1.1.14" -is-weakmap@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" - integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== +is-weakmap@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.2.tgz#bf72615d649dfe5f699079c54b83e47d1ae19cfd" + integrity sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w== is-weakref@^1.0.2: version "1.0.2" @@ -9113,13 +8703,18 @@ is-weakref@^1.0.2: dependencies: call-bind "^1.0.2" -is-weakset@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.2.tgz#4569d67a747a1ce5a994dfd4ef6dcea76e7c0a1d" - integrity sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg== +is-weakset@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.3.tgz#e801519df8c0c43e12ff2834eead84ec9e624007" + integrity sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ== dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.1" + call-bind "^1.0.7" + get-intrinsic "^1.2.4" + +is-windows@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== isarray@^1.0.0: version "1.0.0" @@ -9141,10 +8736,10 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== +isomorphic-ws@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" + integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.2" @@ -9163,9 +8758,9 @@ istanbul-lib-instrument@^5.0.4: semver "^6.3.0" istanbul-lib-instrument@^6.0.0: - version "6.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.2.tgz#91655936cf7380e4e473383081e38478b69993b1" - integrity sha512-1WUsZ9R1lA0HtBSohTkm39WTPlNKSJ5iFk7UwqXkBLoHQT+hfqPsfsTDVuZdKGaBwn7din9bS7SsnoAr943hvw== + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== dependencies: "@babel/core" "^7.23.9" "@babel/parser" "^7.23.9" @@ -9199,90 +8794,88 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -it-all@^3.0.0, it-all@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/it-all/-/it-all-3.0.4.tgz#08f2e3eb3df04fa4525a343dcacfbdf91ffee162" - integrity sha512-UMiy0i9DqCHBdWvMbzdYvVGa5/w4t1cc4nchpbnjdLhklglv8mQeEYnii0gvKESJuL1zV32Cqdb33R6/GPfxpQ== +it-all@^3.0.0, it-all@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/it-all/-/it-all-3.0.6.tgz#30a4f922ae9ca0945b0f720d3478ae6f5b6707ab" + integrity sha512-HXZWbxCgQZJfrv5rXvaVeaayXED8nTKx9tj9fpBhmcUJcedVZshMMMqTj0RG2+scGypb9Ut1zd1ifbf3lA8L+Q== it-byte-stream@^1.0.0: - version "1.0.8" - resolved "https://registry.yarnpkg.com/it-byte-stream/-/it-byte-stream-1.0.8.tgz#c0d91a7f5adbfdb5e411eef9caf119b85f695126" - integrity sha512-H32LbN6kdX8HXqH68z5uivfkVYJEi5tIPRwIQNR5Qsx3uoDRhYdBRHzf3NOVAf6vqulFUSQLuU+Y0rs/QeWn3A== + version "1.1.0" + resolved "https://registry.yarnpkg.com/it-byte-stream/-/it-byte-stream-1.1.0.tgz#f5b80b713fb71a34cbff2390b7232b103cf625bb" + integrity sha512-WWponBWdKEa6o2U3NX+wGMY8X1EkWXcQvpC+3CUqKb4ZzK30q3EPqiTjFxLf9tNVgdF/MNAtx/XclpVfgaz9KQ== dependencies: + it-queueless-pushable "^1.0.0" it-stream-types "^2.0.1" - p-defer "^4.0.0" - race-signal "^1.0.1" - uint8arraylist "^2.4.1" + uint8arraylist "^2.4.8" -it-drain@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/it-drain/-/it-drain-3.0.5.tgz#d7aed18a16a12c157fa477653fb42c1b4f08491c" - integrity sha512-qYFe4SWdvs9oJGUY5bSjvmiLUMLzFEODNOQUdYdCIkuIgQF+AUB2INhM4yQ09buJ2rhHKDFxvTD/+yUq6qg0XA== +it-drain@^3.0.5, it-drain@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/it-drain/-/it-drain-3.0.7.tgz#671a5d0220802c5bce9e68fc2b07088540fbc674" + integrity sha512-vy6S1JKjjHSIFHgBpLpD1zhkCRl3z1zYWUxE14+kAYf+BL9ssWSFImJfhl361IIcwr0ofw8etzg11VqqB+ntUA== it-filter@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/it-filter/-/it-filter-3.0.4.tgz#f8af5919ca7fc72f718edb3e7c0d71581aa149c6" - integrity sha512-e0sz+st4sudK/zH6GZ/gRTRP8A/ADuJFCYDmRgMbZvR79y5+v4ZXav850bBZk5wL9zXaYZFxS1v/6Qi+Vjwh5g== + version "3.1.1" + resolved "https://registry.yarnpkg.com/it-filter/-/it-filter-3.1.1.tgz#d9f55ecb26200baca41e5e330e5808b3afdfa7b7" + integrity sha512-TOXmVuaSkxlLp2hXKoMTra0WMZMKVFxE3vSsbIA+PbADNCBAHhjJ/lM31vBOUTddHMO34Ku++vU8T9PLlBxQtg== dependencies: it-peekable "^3.0.0" -it-first@^3.0.1, it-first@^3.0.3, it-first@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/it-first/-/it-first-3.0.4.tgz#d68c8ae646ea402cd5e650c352da69988a310342" - integrity sha512-FtQl84iTNxN5EItP/JgL28V2rzNMkCzTUlNoj41eVdfix2z1DBuLnBqZ0hzYhGGa1rMpbQf0M7CQSA2adlrLJg== +it-first@^3.0.1, it-first@^3.0.3, it-first@^3.0.4, it-first@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/it-first/-/it-first-3.0.6.tgz#f532f0f36fe9bf0c291e0162b9d3375d59fe8f05" + integrity sha512-ExIewyK9kXKNAplg2GMeWfgjUcfC1FnUXz/RPfAvIXby+w7U4b3//5Lic0NV03gXT8O/isj5Nmp6KiY0d45pIQ== -it-foreach@^2.0.2, it-foreach@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/it-foreach/-/it-foreach-2.0.6.tgz#6e753be551168d746236ca214d19961729470eee" - integrity sha512-OVosBHJsdXpAyeFlCbe3IGZia+65UykyAznakNsKXK+b99dbhuu/mOnXxTadDEo1GWhKx+WA8RNanKkMf07zQw== +it-foreach@^2.0.6: + version "2.1.1" + resolved "https://registry.yarnpkg.com/it-foreach/-/it-foreach-2.1.1.tgz#93e311a1057dd0ff7631f914dc9c2c963f27a4b8" + integrity sha512-ID4Gxnavk/LVQLQESAQ9hR6dR63Ih6X+8VdxEktX8rpz2dCGAbZpey/eljTNbMfV2UKXHiu6UsneoNBZuac97g== dependencies: it-peekable "^3.0.0" -it-length-prefixed-stream@^1.0.0, it-length-prefixed-stream@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/it-length-prefixed-stream/-/it-length-prefixed-stream-1.1.6.tgz#b757b96d352da6e97b66002dd2ead32893ba2337" - integrity sha512-MEby4r8n3XIYXjaWT3DweCuhBPQmFVT8RdI1BNjYQ5gelbFD3NLdjYpTI3TVmSEs/aJfgpfVFZzy6iP7OCxIgw== +it-length-prefixed-stream@^1.0.0, it-length-prefixed-stream@^1.1.6, it-length-prefixed-stream@^1.1.7: + version "1.2.0" + resolved "https://registry.yarnpkg.com/it-length-prefixed-stream/-/it-length-prefixed-stream-1.2.0.tgz#1f6ad78c60dea3b16364f86a0b78058f4d66a04e" + integrity sha512-vX7dzSl/2UMYYsAr0FQdPNVR5xYEETaeboZ+eXxNBjgARuvxnWA6OedW8lC5/J3ebMTC98JhA3eH76eTijUOsA== dependencies: it-byte-stream "^1.0.0" it-stream-types "^2.0.1" - uint8-varint "^2.0.1" - uint8arraylist "^2.4.1" + uint8-varint "^2.0.4" + uint8arraylist "^2.4.8" it-length-prefixed@^9.0.0, it-length-prefixed@^9.0.1, it-length-prefixed@^9.0.4: - version "9.0.4" - resolved "https://registry.yarnpkg.com/it-length-prefixed/-/it-length-prefixed-9.0.4.tgz#8096c3270420fe8abaa920c7b4d5e5895144008e" - integrity sha512-lz28fykbG0jq7s5XtvlzGxO5BeSOw6ikymkRllxjL21V5VKLcvB4pHr9wPvEnsAJ2et1xpOk3BRTMq9XrhgKsg== + version "9.1.0" + resolved "https://registry.yarnpkg.com/it-length-prefixed/-/it-length-prefixed-9.1.0.tgz#19d5d336068fdcbbadfafb1eb33331a9370d4cac" + integrity sha512-kx2UTJuy7/lsT3QUzf50NjfxU1Z4P4wlvYp6YnR5Nc61P8XKfy+QtiJi1VLojA+Kea7vMbB4002rIij1Ol9hcw== dependencies: - err-code "^3.0.1" it-reader "^6.0.1" it-stream-types "^2.0.1" uint8-varint "^2.0.1" uint8arraylist "^2.0.0" uint8arrays "^5.0.1" -it-length@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/it-length/-/it-length-3.0.4.tgz#d178a18a6baf2cb448aeed53b6c854262abf38a1" - integrity sha512-RS3thYkvqtWksrV7SaAnTv+pgY7ozpS17HlRvWvcnoRjVyNJMuffdCkIKpKNPTq5uZw9zVnkVKLO077pJn5Yhg== +it-length@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/it-length/-/it-length-3.0.6.tgz#4105934e10b4d5e158e11cbd7da4073fc441fcd3" + integrity sha512-R7bxHAzpRzYz7vghc2DDH7x4KXvEkeLfN/h316++jzbkEHIRXbEPLbE20p5yrqqBdOeK6/FRUDuHlTJ0H1hysw== -it-map@^3.0.2, it-map@^3.0.4, it-map@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/it-map/-/it-map-3.0.5.tgz#30b1e1324cdb4aaadba29cd989485168d1dc4136" - integrity sha512-hB0TDXo/h4KSJJDSRLgAPmDroiXP6Fx1ck4Bzl3US9hHfZweTKsuiP0y4gXuTMcJlS6vj0bb+f70rhkD47ZA3w== +it-map@^3.0.4, it-map@^3.0.5, it-map@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/it-map/-/it-map-3.1.1.tgz#637877e93be93a7aa7d7fc103b70a5939fc6f7a1" + integrity sha512-9bCSwKD1yN1wCOgJ9UOl+46NQtdatosPWzxxUk2NdTLwRPXLh+L7iwCC9QKsbgM60RQxT/nH8bKMqm3H/o8IHQ== dependencies: it-peekable "^3.0.0" -it-merge@^3.0.0, it-merge@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/it-merge/-/it-merge-3.0.3.tgz#c7d407c8e0473accf7f9958ce2e0f60276002e84" - integrity sha512-FYVU15KC5pb/GQX1Ims+lee8d4pdqGVCpWr0lkNj8o4xuNo7jY71k6GuEiWdP+T7W1bJqewSxX5yoTy5yZpRVA== +it-merge@^3.0.0, it-merge@^3.0.3, it-merge@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/it-merge/-/it-merge-3.0.5.tgz#2b0d1d07c825b9d20c4c2889aab8e07322fd803e" + integrity sha512-2l7+mPf85pyRF5pqi0dKcA54E5Jm/2FyY5GsOaN51Ta0ipC7YZ3szuAsH8wOoB6eKY4XsU4k2X+mzPmFBMayEA== dependencies: - it-pushable "^3.2.0" + it-pushable "^3.2.3" it-ndjson@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/it-ndjson/-/it-ndjson-1.0.5.tgz#088633ddd22110bec2d5417492e9831e24ac7298" - integrity sha512-2UEROCo458dDu9dABKb9fvD34p2YL6SqV5EOXN8SysX2Fpx0MSN69EiBmLLDDYSpQlrW0I5j3Tm8DtEIL5NsIw== + version "1.0.7" + resolved "https://registry.yarnpkg.com/it-ndjson/-/it-ndjson-1.0.7.tgz#017e5e3e1b5fa8c10b8d9a0771bcc9b55baaa6b3" + integrity sha512-V3IskT5RCVtov1u6sC9gkg0uD02qe8yPoVzBZVaRx+YkuMdpFd6opiAwfYovNd/NEbqo9mBN8wJLtw6vD0Xiqg== it-pair@^2.0.6: version "2.0.6" @@ -9292,17 +8885,17 @@ it-pair@^2.0.6: it-stream-types "^2.0.1" p-defer "^4.0.0" -it-parallel@^3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/it-parallel/-/it-parallel-3.0.6.tgz#d8f9efa56dac5f960545b3a148d2ca171694d228" - integrity sha512-i7UM7I9LTkDJw3YIqXHFAPZX6CWYzGc+X3irdNrVExI4vPazrJdI7t5OqrSVN8CONXLAunCiqaSV/zZRbQR56A== +it-parallel@^3.0.7: + version "3.0.8" + resolved "https://registry.yarnpkg.com/it-parallel/-/it-parallel-3.0.8.tgz#fb4a5344732ddae9eff7c7b21908aa1f223638d4" + integrity sha512-URLhs6eG4Hdr4OdvgBBPDzOjBeSSmI+Kqex2rv/aAyYClME26RYHirLVhZsZP5M+ZP6M34iRlXk8Wlqtezuqpg== dependencies: - p-defer "^4.0.0" + p-defer "^4.0.1" it-peekable@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/it-peekable/-/it-peekable-3.0.3.tgz#5f5741f34f3acd5735804f40d198652c54a3d8c1" - integrity sha512-Wx21JX/rMzTEl9flx3DGHuPV1KQFGOl8uoKfQtmZHgPQtGb89eQ6RyVd82h3HuP9Ghpt0WgBDlmmdWeHXqyx7w== + version "3.0.5" + resolved "https://registry.yarnpkg.com/it-peekable/-/it-peekable-3.0.5.tgz#63b0c750e27e2ba0c1db6d6a3496b7ef51a6547d" + integrity sha512-JWQOGMt6rKiPcY30zUVMR4g6YxkpueTwHVE7CMs/aGqCf4OydM6w+7ZM3PvmO1e0TocjuR4aL8xyZWR46cTqCQ== it-pipe@^3.0.1: version "3.0.1" @@ -9313,23 +8906,30 @@ it-pipe@^3.0.1: it-pushable "^3.1.2" it-stream-types "^2.0.1" -it-protobuf-stream@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/it-protobuf-stream/-/it-protobuf-stream-1.1.2.tgz#4444d78fcae0fce949b4cbea622bf1d92667e64f" - integrity sha512-epZBuG+7cPaTxCR/Lf3ApshBdA9qfflGPQLfLLrp9VQ0w67Z2xo4H+SLLetav57/29oPtAXwVaoyemg99JOWzA== +it-protobuf-stream@^1.1.3: + version "1.1.5" + resolved "https://registry.yarnpkg.com/it-protobuf-stream/-/it-protobuf-stream-1.1.5.tgz#70da43abfb6beaaf7c53262d8cfd176d463b08f0" + integrity sha512-H70idW45As3cEbU4uSoZ9IYHUIV3YM69/2mmXYR7gOlPabWjuyNi3/abK11geiiq3la27Sos/mXr68JljjKtEQ== dependencies: it-length-prefixed-stream "^1.0.0" it-stream-types "^2.0.1" - protons-runtime "^5.0.0" - uint8arraylist "^2.4.1" + uint8arraylist "^2.4.8" -it-pushable@^3.1.2, it-pushable@^3.2.0, it-pushable@^3.2.3: +it-pushable@^3.1.2, it-pushable@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/it-pushable/-/it-pushable-3.2.3.tgz#e2b80aed90cfbcd54b620c0a0785e546d4e5f334" integrity sha512-gzYnXYK8Y5t5b/BnJUr7glfQLO4U5vyb05gPx/TyTw+4Bv1zM9gFk4YsOrnulWefMewlphCjKkakFvj1y99Tcg== dependencies: p-defer "^4.0.0" +it-queueless-pushable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/it-queueless-pushable/-/it-queueless-pushable-1.0.0.tgz#917b52964cd6465d6436f923552c407c5ee3d11c" + integrity sha512-HbcAbcuQj7a9EBxiRCZ+77FxWutgs/pY5ZvEyQnylWPGNFojCLAUwhcZjf5OuEQ9+y+vSa7w1GQBe8xJdmIn5A== + dependencies: + p-defer "^4.0.1" + race-signal "^1.0.2" + it-reader@^6.0.1: version "6.0.4" resolved "https://registry.yarnpkg.com/it-reader/-/it-reader-6.0.4.tgz#439cb88225dcd15116be0ffde9e846a928c3871a" @@ -9339,9 +8939,9 @@ it-reader@^6.0.1: uint8arraylist "^2.0.0" it-sort@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/it-sort/-/it-sort-3.0.4.tgz#250152bf4abf3fa9572954305424bafb3199fa63" - integrity sha512-tvnC93JZZWjX4UxALy0asow0dzXabkoaRbrPJKClTKhNCqw4gzHr+H5axf1gohcthedRRkqd/ae+wl7WqoxFhw== + version "3.0.6" + resolved "https://registry.yarnpkg.com/it-sort/-/it-sort-3.0.6.tgz#58af5dec478c411ae5adf30f90078a6fc286484d" + integrity sha512-aNrlZAXB8vWBd42tCpaXGL6CJVJNDW3OLczmdt6g0k/s9Z6evkTdgU2LjwW5SNNeX41sF+C8MjV+OcVf93PsPw== dependencies: it-all "^3.0.0" @@ -9350,15 +8950,15 @@ it-stream-types@^2.0.1: resolved "https://registry.yarnpkg.com/it-stream-types/-/it-stream-types-2.0.1.tgz#69cb4d7e79e707b8257a8997e02751ccb6c3af32" integrity sha512-6DmOs5r7ERDbvS4q8yLKENcj6Yecr7QQTqWApbZdfAUTEC947d+PEha7PCqhm//9oxaLYL7TWRekwhoXl2s6fg== -it-take@^3.0.1, it-take@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/it-take/-/it-take-3.0.4.tgz#a1614d6ee03f1bee9af89255897de3e249e49d1d" - integrity sha512-RG8HDjAZlvkzz5Nav4xq6gK5zNT+Ff1UTIf+CrSJW8nIl6N1FpBH5e7clUshiCn+MmmMoSdIEpw4UaTolszxhA== +it-take@^3.0.1, it-take@^3.0.4, it-take@^3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/it-take/-/it-take-3.0.6.tgz#509283b69b88f823350b256392525267609f1925" + integrity sha512-uqw3MRzf9to1SOLxaureGa73lK8k8ZB/asOApTAkvrzUqCznGtKNgPFH7uYIWlt4UuWq/hU6I+U4Fm5xpjN8Vg== it-ws@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/it-ws/-/it-ws-6.1.1.tgz#925d37955cc5bfa3e718ee5c98bf395a138daab9" - integrity sha512-oyk4eCeZto2lzWDnJOa3j1S2M+VOGKUh8isEf94ySoaL6IFlyie0T4P9E0ZUaIvX8LyJxYFHFKCt8Zk7Sm/XPQ== + version "6.1.5" + resolved "https://registry.yarnpkg.com/it-ws/-/it-ws-6.1.5.tgz#317db04256f3d54b891a4d29110df25d72016def" + integrity sha512-uWjMtpy5HqhSd/LlrlP3fhYrr7rUfJFFMABv0F5d6n13Q+0glhZthwUKpEAVhDrXY95Tb1RB5lLqqef+QbVNaw== dependencies: "@types/ws" "^8.2.2" event-iterator "^2.0.0" @@ -9739,26 +9339,26 @@ jmespath@0.16.0: integrity sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw== jose@^4.3.8: - version "4.15.5" - resolved "https://registry.yarnpkg.com/jose/-/jose-4.15.5.tgz#6475d0f467ecd3c630a1b5dadd2735a7288df706" - integrity sha512-jc7BFxgKPKi94uOvEmzlSWFFe2+vASyXaKUpdQKatWAESU2MWjDfFf0fdfc83CDKcA5QecabZeNLyfhe3yKNkg== - -js-base64@^3.7.6: - version "3.7.7" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79" - integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== + version "4.15.9" + resolved "https://registry.yarnpkg.com/jose/-/jose-4.15.9.tgz#9b68eda29e9a0614c042fa29387196c7dd800100" + integrity sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA== js-sha256@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966" integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA== +js-sha256@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.11.0.tgz#256a921d9292f7fe98905face82e367abaca9576" + integrity sha512-6xNlKayMZvds9h1Y1VWc0fQHQ82BxTXizWPEtEeGvmOUYpBRy4gbWroHLpzowe6xiQhHpelCQiE7HEdznyBL9Q== + js-sha3@0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.5.tgz#baf0c0e8c54ad5903447df96ade7a4a1bca79a4a" integrity sha512-yLLwn44IVeunwjpDVTDZmQeVbB0h+dZpY2eO68B/Zik8hu6dH+rKeLxwua79GGIvW6xr8NBAcrtiUbYrTjEFTA== -js-sha3@0.5.7, js-sha3@^0.5.7: +js-sha3@0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== @@ -9773,7 +9373,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.1: +js-yaml@^3.13.1, js-yaml@^3.6.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -9781,6 +9381,13 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + js2xmlparser@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.2.tgz#2a1fdf01e90585ef2ae872a01bc169c6a8d5e60a" @@ -9788,11 +9395,6 @@ js2xmlparser@^4.0.2: dependencies: xmlcreate "^2.0.4" -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - jsdoc-typeof-plugin@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/jsdoc-typeof-plugin/-/jsdoc-typeof-plugin-1.0.0.tgz#d9b621d1c63b607116d53b20d73f87a2f917a51f" @@ -9856,30 +9458,25 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stringify-deterministic@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/json-stringify-deterministic/-/json-stringify-deterministic-1.0.11.tgz#9e53b7431fa5b41d3badedb7bbbe2647ea74f036" - integrity sha512-lsn3NoTZ6dGgJJ7W4i7BUKV4WJ+hqAJ0imqHl314MNUw2U+As++qLDudcHqBqlkCXTTH7kH3v5LUQ3CHoVM0BA== +json-stringify-deterministic@^1.0.11, json-stringify-deterministic@^1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/json-stringify-deterministic/-/json-stringify-deterministic-1.0.12.tgz#aaa3f907466ed01e3afd77b898d0a2b3b132820a" + integrity sha512-q3PN0lbUdv0pmurkBNdJH3pfFvOTL/Zp0lquqpvcjfKzt6Y0j49EPHAmVHCAS4Ceq/Y+PejWTzyiVpoY71+D6g== -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== -json5@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== +json5@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== dependencies: minimist "^1.2.0" @@ -9896,13 +9493,12 @@ jsonfile@^4.0.0: graceful-fs "^4.1.6" jsonld-context-parser@^2.0.0, jsonld-context-parser@^2.0.2, jsonld-context-parser@^2.1.0, jsonld-context-parser@^2.1.1, jsonld-context-parser@^2.1.2, jsonld-context-parser@^2.1.3: - version "2.2.1" - resolved "https://registry.yarnpkg.com/jsonld-context-parser/-/jsonld-context-parser-2.2.1.tgz#f5aae267e806dd2868973b3ec324274a2c42e981" - integrity sha512-MCmJ2Lf1cRtvJ1v7A9X88KkZ+vqC41quhpYSSO4NJFrhodjpJOUeJA3Vy9Gdr06zIDDo/V73SOmKkK44+HSJzA== + version "2.4.0" + resolved "https://registry.yarnpkg.com/jsonld-context-parser/-/jsonld-context-parser-2.4.0.tgz#fae15a56c5ceabd1c4520ab1a9cc12c9a0a8b67d" + integrity sha512-ZYOfvh525SdPd9ReYY58dxB3E2RUEU4DJ6ZibO8AitcowPeBH4L5rCAitE2om5G1P+HMEgYEYEr4EZKbVN4tpA== dependencies: "@types/http-link-header" "^1.0.1" "@types/node" "^18.0.0" - canonicalize "^1.0.1" cross-fetch "^3.0.6" http-link-header "^1.0.2" relative-to-absolute-iri "^1.0.5" @@ -9947,9 +9543,18 @@ jsonld@5.2.0, jsonld@^5.0.0: lru-cache "^6.0.0" rdf-canonize "^3.0.0" +jsonld@digitalcredentials/jsonld.js#v10.1.x: + version "8.3.3-0" + resolved "https://codeload.github.com/digitalcredentials/jsonld.js/tar.gz/da0794d863eeb65faf27673d46d9cffa32e1b65a" + dependencies: + "@digitalbazaar/http-client" "^4.1.1" + canonicalize "^1.0.1" + lru-cache "^6.0.0" + rdf-canonize "^4.0.1" + jsonld@digitalcredentials/jsonld.js#v10.x: version "8.3.3-0" - resolved "https://codeload.github.com/digitalcredentials/jsonld.js/tar.gz/17f2c35f85d176231d9c8620d39144e845c15e91" + resolved "https://codeload.github.com/digitalcredentials/jsonld.js/tar.gz/14357f7a1181ae769ecc50fee9303468f17665ff" dependencies: "@digitalbazaar/http-client" "^4.1.0" canonicalize "^1.0.1" @@ -9966,49 +9571,20 @@ jsonschema@1.4.1: resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.1.tgz#cc4c3f0077fb4542982973d8a083b6b34f482dab" integrity sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ== -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== +key-did-resolver@^1.4.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/key-did-resolver/-/key-did-resolver-1.4.4.tgz#0195ae6993de340ceb3429054c9b0b03b32fbab2" + integrity sha512-aRsFIjMkPeIcWH5jlhff6iG/Gjf+ZaBh02r/6gHbFJp2UqxkjQtaYxchkZ6ZAvrOAk37qE4x70YJj7Qls7WTSA== dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - -just-debounce-it@^3.0.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/just-debounce-it/-/just-debounce-it-3.2.0.tgz#4352265f4af44188624ce9fdbc6bff4d49c63a80" - integrity sha512-WXzwLL0745uNuedrCsCs3rpmfD6DBaf7uuVwaq98/8dafURfgQaBsSpjiPp5+CW6Vjltwy9cOGI6qE71b3T8iQ== + "@stablelib/ed25519" "^1.0.2" + multibase "~4.0.2" + uint8arrays "^2.0.5" + varint "^6.0.0" -jwt-decode@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59" - integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A== - -keccak@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" - integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== - dependencies: - node-addon-api "^2.0.0" - node-gyp-build "^4.2.0" - readable-stream "^3.6.0" - -key-did-resolver@^1.4.0: - version "1.4.4" - resolved "https://registry.yarnpkg.com/key-did-resolver/-/key-did-resolver-1.4.4.tgz#0195ae6993de340ceb3429054c9b0b03b32fbab2" - integrity sha512-aRsFIjMkPeIcWH5jlhff6iG/Gjf+ZaBh02r/6gHbFJp2UqxkjQtaYxchkZ6ZAvrOAk37qE4x70YJj7Qls7WTSA== - dependencies: - "@stablelib/ed25519" "^1.0.2" - multibase "~4.0.2" - uint8arrays "^2.0.5" - varint "^6.0.0" - -keyv@*, keyv@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.0.tgz#dbce9ade79610b6e641a9a65f2f6499ba06b9bc6" - integrity sha512-2YvuMsA+jnFGtBareKqgANOEKe1mk3HKiXu2fRmAfyxG0MJAywNhi5ttWA3PMjl4NmpyjZNbFifR2vNjW1znfA== +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== dependencies: json-buffer "3.0.1" @@ -10048,48 +9624,65 @@ ky@^0.25.1: integrity sha512-PjpCEWlIU7VpiMVrTwssahkYXX1by6NCT0fhTUX34F3DTinARlgMpriuroolugFPcMgpPWrOW4mTb984Qm1RXA== ky@^1.0.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/ky/-/ky-1.2.2.tgz#875b4132012ff7d8c12e5e884f35015676c436d2" - integrity sha512-gYA2QOI3uIaImJPJjaBbLCdvKHzwxsuB03s7PjrXmoO6tcn6k53rwYoSRgqrmVsEV6wFFegOXDVjABxFZ0aRSg== + version "1.6.0" + resolved "https://registry.yarnpkg.com/ky/-/ky-1.6.0.tgz#7602bffb90623dd128831e9b3360b898eb07cbd8" + integrity sha512-MG7hlH26oShC4Lysk5TYzXshHLfEY52IJ0ofOeCsifquqTymbXCSTx+g4rXO30XYxoM6Y1ed5pNnpULe9Rx19A== leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA== - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -libp2p@^1.2.4: - version "1.3.0" - resolved "https://registry.yarnpkg.com/libp2p/-/libp2p-1.3.0.tgz#d785005e8328096abcc0f1d6ac5bc64bfcf8d8ef" - integrity sha512-nmwlV+yWMjOW8uBH/pfFhdTh5tGKRSb3QU8dyk/qqkaikdw+tpj58seAcMtEr1f2/oSi3Mu7GeB1z9Pb1O1wmA== - dependencies: - "@libp2p/crypto" "^4.0.3" - "@libp2p/interface" "^1.1.4" - "@libp2p/interface-internal" "^1.0.9" - "@libp2p/logger" "^4.0.7" - "@libp2p/multistream-select" "^5.1.4" - "@libp2p/peer-collections" "^5.1.7" - "@libp2p/peer-id" "^4.0.7" - "@libp2p/peer-id-factory" "^4.0.7" - "@libp2p/peer-store" "^10.0.11" - "@libp2p/utils" "^5.2.6" - "@multiformats/dns" "^1.0.1" - "@multiformats/multiaddr" "^12.2.0" +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +libp2p@^1.3.0: + version "1.8.3" + resolved "https://registry.yarnpkg.com/libp2p/-/libp2p-1.8.3.tgz#ca2f494467c5921179dc5c17b2f2536620e4386b" + integrity sha512-IpHKhR/gjiRcm3UqaHC3bEFsnBS62hTwXy60L8Uie8NZvvliVL6skmIBAODfma0+C7zvJhNKA8453SOmTeVTwQ== + dependencies: + "@libp2p/crypto" "^4.1.8" + "@libp2p/interface" "^1.6.3" + "@libp2p/interface-internal" "^1.3.3" + "@libp2p/logger" "^4.0.19" + "@libp2p/multistream-select" "^5.1.16" + "@libp2p/peer-collections" "^5.2.8" + "@libp2p/peer-id" "^4.2.3" + "@libp2p/peer-id-factory" "^4.2.3" + "@libp2p/peer-store" "^10.1.4" + "@libp2p/utils" "^5.4.8" + "@multiformats/dns" "^1.0.6" + "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr-matcher" "^1.2.1" any-signal "^4.1.1" - datastore-core "^9.2.8" + datastore-core "^9.2.9" interface-datastore "^8.2.11" - it-merge "^3.0.3" - it-parallel "^3.0.6" + it-merge "^3.0.5" + it-parallel "^3.0.7" merge-options "^3.0.4" multiformats "^13.1.0" - uint8arrays "^5.0.2" + p-defer "^4.0.1" + progress-events "^1.0.0" + race-event "^1.3.0" + race-signal "^1.0.2" + uint8arrays "^5.1.0" + +libsodium-sumo@^0.7.15: + version "0.7.15" + resolved "https://registry.yarnpkg.com/libsodium-sumo/-/libsodium-sumo-0.7.15.tgz#91c1d863fe3fbce6d6b9db1aadaa622733a1d007" + integrity sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw== + +libsodium-wrappers-sumo@^0.7.11: + version "0.7.15" + resolved "https://registry.yarnpkg.com/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.15.tgz#0ef2a99b4b17e8385aa7e6850593660dbaf5fb40" + integrity sha512-aSWY8wKDZh5TC7rMvEdTHoyppVq/1dTSAeAR7H6pzd6QRT3vQWcT5pGwCotLcpPEOLXX6VvqihSPkpEhYAjANA== + dependencies: + libsodium-sumo "^0.7.15" lines-and-columns@^1.1.6: version "1.2.4" @@ -10118,36 +9711,62 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21: +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.startcase@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" + integrity sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg== + +lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -logform@^2.3.2, logform@^2.4.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/logform/-/logform-2.4.2.tgz#a617983ac0334d0c3b942c34945380062795b47c" - integrity sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw== +logform@^2.6.0, logform@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/logform/-/logform-2.6.1.tgz#71403a7d8cae04b2b734147963236205db9b3df0" + integrity sha512-CdaO738xRapbKIMVn2m4F6KTj4j7ooJ8POVnebSgKo3KBz5axNXRAL7ZdRjIV6NOr2Uf4vjtRkxrFETOioCqSA== dependencies: - "@colors/colors" "1.5.0" + "@colors/colors" "1.6.0" + "@types/triple-beam" "^1.3.2" fecha "^4.2.0" ms "^2.1.1" safe-stable-stringify "^2.3.1" triple-beam "^1.3.0" -lowercase-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" - integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== +long@^5.0.0, long@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" + integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== + +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" lru-cache@^5.1.1: version "5.1.1" @@ -10207,9 +9826,9 @@ makeerror@1.0.12: tmpl "1.0.5" markdown-it-anchor@^8.4.1: - version "8.6.5" - resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.6.5.tgz#30c4bc5bbff327f15ce3c429010ec7ba75e7b5f8" - integrity sha512-PI1qEHHkTNWT+X6Ip9w+paonfIQ+QZP9sCeMYi47oqhH+EsW8CrJ8J7CzV19QVOj6il8ATGbK2nTECj22ZHGvQ== + version "8.6.7" + resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz#ee6926daf3ad1ed5e4e3968b1740eef1c6399634" + integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA== markdown-it@^12.3.2: version "12.3.2" @@ -10223,9 +9842,9 @@ markdown-it@^12.3.2: uc.micro "^1.0.5" marked@^4.0.10: - version "4.2.1" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.1.tgz#eaa32594e45b4e58c02e4d118531fd04345de3b4" - integrity sha512-VK1/jNtwqDLvPktNpL0Fdg3qoeUZhmRsuiIjPEy/lHwXW4ouLoZfO4XoWd4ClDt+hupV1VLpkZhEovjU0W/kqA== + version "4.3.0" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" + integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== md5.js@^1.3.4, md5.js@^1.3.5: version "1.3.5" @@ -10241,16 +9860,6 @@ mdurl@^1.0.1: resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g== -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - merge-options@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7" @@ -10268,11 +9877,6 @@ merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - microdata-rdf-streaming-parser@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/microdata-rdf-streaming-parser/-/microdata-rdf-streaming-parser-1.2.0.tgz#130967af0be59ce8ddf5fef4588a0ffa44a17d69" @@ -10283,39 +9887,34 @@ microdata-rdf-streaming-parser@^1.2.0: rdf-data-factory "^1.1.0" relative-to-absolute-iri "^1.0.2" -micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== +micromatch@^4.0.2: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: - braces "^3.0.2" + braces "^3.0.3" picomatch "^2.3.1" -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== +micromatch@^4.0.4: + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" + braces "^3.0.3" + picomatch "^2.3.1" mime-db@1.52.0: version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -10326,23 +9925,11 @@ mimic-fn@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" - integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== - mimic-response@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" - integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ== - dependencies: - dom-walk "^0.1.0" - minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -10353,7 +9940,7 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -10361,66 +9948,27 @@ minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: brace-expansion "^1.1.7" minimatch@^5.0.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.2.tgz#0939d7d6f0898acbd1508abe534d1929368a8fff" - integrity sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg== + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== dependencies: brace-expansion "^2.0.1" -minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: - version "1.2.7" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" - integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== - -minimist@^1.2.3: +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -minipass@^2.6.0, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minizlib@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== -mkdirp-promise@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" - integrity sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w== - dependencies: - mkdirp "*" - -mkdirp@*, mkdirp@^1.0.4: +mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mkdirp@^0.5.1, mkdirp@^0.5.5: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - -mock-fs@^4.1.0: - version "4.14.0" - resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz#ce5124d2c601421255985e6e94da80a7357b1b18" - integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== - mock-socket@^9.3.1: version "9.3.1" resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.3.1.tgz#24fb00c2f573c84812aa4a24181bb025de80cc8e" @@ -10435,6 +9983,11 @@ mortice@^3.0.4: p-queue "^8.0.1" p-timeout "^6.0.0" +mri@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + mrklt@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/mrklt/-/mrklt-0.2.0.tgz#0eecb56eca916adb62dc72a569b13a89d75786de" @@ -10450,34 +10003,23 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multibase@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" +ms@^3.0.0-canary.1: + version "3.0.0-canary.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-3.0.0-canary.1.tgz#c7b34fbce381492fd0b345d1cf56e14d67b77b80" + integrity sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g== -multibase@^4.0.1, multibase@~4.0.2: +multibase@^4.0.6, multibase@~4.0.2: version "4.0.6" resolved "https://registry.yarnpkg.com/multibase/-/multibase-4.0.6.tgz#6e624341483d6123ca1ede956208cb821b440559" integrity sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ== dependencies: "@multiformats/base-x" "^4.0.1" -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - multicast-dns@^7.2.5: version "7.2.5" resolved "https://registry.yarnpkg.com/multicast-dns/-/multicast-dns-7.2.5.tgz#77eb46057f4d7adbd16d9290fa7299f6fa64cced" @@ -10486,55 +10028,27 @@ multicast-dns@^7.2.5: dns-packet "^5.2.2" thunky "^1.0.2" -multicodec@^0.5.5: - version "0.5.7" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-0.5.7.tgz#1fb3f9dd866a10a55d226e194abba2dcc1ee9ffd" - integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== - dependencies: - varint "^5.0.0" - -multicodec@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - multiformats@^13.0.0, multiformats@^13.0.1, multiformats@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.1.0.tgz#5aa9d2175108a448fc3bdb54ba8a3d0b6cab3ac3" - integrity sha512-HzdtdBwxsIkzpeXzhQ5mAhhuxcHbjEHH+JQoxt7hG/2HGFjjwyolLo7hbaexcnhoEuV4e0TNJ8kkpMjiEYY4VQ== + version "13.2.2" + resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.2.2.tgz#16da153ee8b68d8c9da31b52176e90b3cd8b43ef" + integrity sha512-RWI+nyf0q64vyOxL8LbKtjJMki0sogRL/8axvklNtiTM0iFCVtHwME9w6+0P1/v4dQvsIg8A45oT3ka1t/M/+A== -multiformats@^9.4.2, multiformats@^9.5.4: +multiformats@^13.2.2: + version "13.3.0" + resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.3.0.tgz#1f5188bc7c4fe08ff829ae1c18dc33409042fb71" + integrity sha512-CBiqvsufgmpo01VT5ze94O+uc+Pbf6f/sThlvWss0sBZmAOu6GQn5usrYV2sf2mr17FWYc0rO8c/CNe2T90QAA== + +multiformats@^9.4.2, multiformats@^9.5.4, multiformats@^9.6.2: version "9.9.0" resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.9.0.tgz#c68354e7d21037a8f1f8833c8ccd68618e8f1d37" integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg== -multihashes@^0.4.15, multihashes@~0.4.15: - version "0.4.21" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - -multihashes@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-4.0.3.tgz#426610539cd2551edbf533adeac4c06b3b90fb05" - integrity sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA== - dependencies: - multibase "^4.0.1" - uint8arrays "^3.0.0" - varint "^5.0.2" - -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +murmurhash3js-revisited@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" + integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g== -n3@1.16.2, n3@^1.11.1, n3@^1.6.3: +n3@1.16.2: version "1.16.2" resolved "https://registry.yarnpkg.com/n3/-/n3-1.16.2.tgz#ef86b4bf48b556505da1cc3062a3c2ef35f02976" integrity sha512-5vYa2HuNEJ+a26FEs4FGgfFLgaPOODaZpJlc7FS0eUjDumc4uK0cvx216PjKXBkLzmAsSqGgQPwqztcLLvwDsw== @@ -10542,10 +10056,14 @@ n3@1.16.2, n3@^1.11.1, n3@^1.6.3: queue-microtask "^1.1.2" readable-stream "^3.6.0" -nano-json-stream-parser@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" - integrity sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew== +n3@^1.11.1, n3@^1.17.4, n3@^1.6.3: + version "1.20.4" + resolved "https://registry.yarnpkg.com/n3/-/n3-1.20.4.tgz#df003f4e107d941d42100f332199bb74b4384f9e" + integrity sha512-tHeX1Q3/+ET38qYMOfErglmr5F2tzb+WCt82sZhCokzSZHe95CkHzyuzCMqcRB8hTpW+zn7HqamGXCWW/xXCHg== + dependencies: + buffer "^6.0.3" + queue-microtask "^1.1.2" + readable-stream "^4.0.0" nanoassert@^2.0.0: version "2.0.0" @@ -10567,26 +10085,11 @@ negotiate@^1.0.1: resolved "https://registry.yarnpkg.com/negotiate/-/negotiate-1.0.1.tgz#35ac8b5672f7b05faa10bf0261342eb1120370fd" integrity sha512-KBCIM4dAIT9j/pSXLHHQbZG74NmKNXTtxU2zHN0HG6uzzuFE01m1UdGoUmVHmACiBuCAOL7KwfqSW1oUQBj/vg== -negotiator@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - netmask@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - nock@^13.5.0: version "13.5.4" resolved "https://registry.yarnpkg.com/nock/-/nock-13.5.4.tgz#8918f0addc70a63736170fef7106a9721e0dc479" @@ -10597,9 +10100,9 @@ nock@^13.5.0: propagate "^2.0.0" node-abi@^3.3.0: - version "3.56.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.56.0.tgz#ca807d5ff735ac6bbbd684ae3ff2debc1c2a40a7" - integrity sha512-fZjdhDOeRcaS+rcpve7XuwHBmktS1nS1gzgghwKUQQ8nTy2FdSDr6ZT8k6YhvlJeHmmQMYiT/IH9hfco5zeW2Q== + version "3.65.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.65.0.tgz#ca92d559388e1e9cab1680a18c1a18757cdac9d3" + integrity sha512-ThjYBfoDNr08AWx6hGaRbfPwxKV9kVzAzOzlLKbk2CuqXE2xnCh+cbAGnwM3t8Lq4v9rUB7VfondlkBckcJrVA== dependencies: semver "^7.3.5" @@ -10608,18 +10111,23 @@ node-addon-api@^2.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== -node-datachannel@^0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/node-datachannel/-/node-datachannel-0.5.3.tgz#bdf2da7493e22f7960801d65ddd97991d6b2e851" - integrity sha512-aOp+6P2TC6+u36L06yeUAYpBp5FqpDGjIbIJQvC5AY9HX9ZVoqUO3ysLlswnpQRM7wJt8LhBuHxiPkLoM5xEUA== +node-addon-api@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" + integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== + +node-datachannel@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/node-datachannel/-/node-datachannel-0.11.0.tgz#7e1e29c9a82596ebf6550610e7c2547e4a232eca" + integrity sha512-8/vAMms32XxgJ9FIRDXbfmmH1ROm0HBdsa/XteIcUWN4VTQN38UITTkuu6YsfQzN/CQp8YhhnfAEzEadQJ2c6Q== dependencies: node-domexception "^2.0.1" prebuild-install "^7.0.1" node-datachannel@^0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/node-datachannel/-/node-datachannel-0.5.4.tgz#4b4341892c33b2e56c3cda1d944a6439258ab878" - integrity sha512-kMdkt3QRzKEQsaI+CdxFchh0c/KiKMNuttNitHx8YSWDmdd39vJoTcAvVyam9WFOGkc+H8oM6fYRPclYOy5EdA== + version "0.5.5" + resolved "https://registry.yarnpkg.com/node-datachannel/-/node-datachannel-0.5.5.tgz#bba7f15b648bac726761c3232a8b2f138dc2f6e6" + integrity sha512-B0MS/iK0qjCiNY5Go4055zuRCOuiFkOrhNOZuj2PAnaJN7YlnKxKidOLhLXf/lAcsJQXgj8BR31zsqJKKA16jA== dependencies: node-domexception "^2.0.1" prebuild-install "^7.0.1" @@ -10642,13 +10150,6 @@ node-environment-flags@^1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@2.6.7: - version "2.6.7" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" - integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== - dependencies: - whatwg-url "^5.0.0" - node-fetch@3.0.0-beta.9: version "3.0.0-beta.9" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.0.0-beta.9.tgz#0a7554cfb824380dd6812864389923c783c80d9b" @@ -10657,7 +10158,7 @@ node-fetch@3.0.0-beta.9: data-uri-to-buffer "^3.0.1" fetch-blob "^2.1.1" -node-fetch@^2.6.11: +node-fetch@^2.6.11, node-fetch@^2.6.12: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -10673,36 +10174,26 @@ node-fetch@^3.3.2: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" -node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" - integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== +node-gyp-build@^4.2.0: + version "4.8.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5" + integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw== node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-releases@^2.0.13: - version "2.0.13" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d" - integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ== - -node-releases@^2.0.14: - version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" - integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-url@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" - integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== - npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -10725,91 +10216,89 @@ number-to-bn@1.7.0: bn.js "4.11.6" strip-hex-prefix "1.0.0" -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-inspect@^1.12.2, object-inspect@^1.9.0: - version "1.12.2" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" - integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== +object-inspect@^1.13.1: + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== -object-is@^1.1.4: - version "1.1.5" - resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac" - integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw== +object-is@^1.1.4, object-is@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.6.tgz#1a6a53aed2dd8f7e6775ff870bea58545956ab07" + integrity sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" + call-bind "^1.0.7" + define-properties "^1.2.1" object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object.assign@^4.1.2, object.assign@^4.1.4: - version "4.1.4" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" - integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== +object.assign@^4.1.2, object.assign@^4.1.4, object.assign@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" + integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" + call-bind "^1.0.5" + define-properties "^1.2.1" has-symbols "^1.0.3" object-keys "^1.1.1" object.entries@^1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.5.tgz#e1acdd17c4de2cd96d5a08487cfb9db84d881861" - integrity sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g== + version "1.1.8" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.8.tgz#bffe6f282e01f4d17807204a24f8edd823599c41" + integrity sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" -object.getownpropertydescriptors@^2.0.3: - version "2.1.4" - resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.4.tgz#7965e6437a57278b587383831a9b829455a4bc37" - integrity sha512-sccv3L/pMModT6dJAYF3fzGMVcb38ysQ0tEE6ixv2yXJDtEIPph268OlAdJj5/qZMZDq2g/jqvwppt36uS/uQQ== +object.fromentries@^2.0.7: + version "2.0.8" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.8.tgz#f7195d8a9b97bd95cbc1999ea939ecd1a2b00c65" + integrity sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ== dependencies: - array.prototype.reduce "^1.0.4" - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" -object.values@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.5.tgz#959f63e3ce9ef108720333082131e4a459b716ac" - integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== +object.getownpropertydescriptors@^2.0.3: + version "2.1.8" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.8.tgz#2f1fe0606ec1a7658154ccd4f728504f69667923" + integrity sha512-qkHIGe4q0lSYMv0XI4SsBTJz3WaURhLvd0lKSgtVuOsJ2krg4SgMw3PIRQFMp07yi++UR3se2mkcLqsBNpBb/A== + dependencies: + array.prototype.reduce "^1.0.6" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" + gopd "^1.0.1" + safe-array-concat "^1.1.2" + +object.groupby@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.3.tgz#9b125c36238129f6f7b61954a1e7176148d5002e" + integrity sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" -oboe@2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz#5554284c543a2266d7a38f17e073821fbde393cd" - integrity sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA== +object.values@^1.1.7: + version "1.2.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.2.0.tgz#65405a9d92cee68ac2d303002e0b8470a4d9ab1b" + integrity sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ== dependencies: - http-https "^1.0.0" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" observable-webworkers@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/observable-webworkers/-/observable-webworkers-2.0.1.tgz#7d9086ebc567bd318b46ba0506b10cedf3813878" integrity sha512-JI1vB0u3pZjoQKOK1ROWzp0ygxSi7Yb0iR+7UNsw4/Zn4cQ0P3R7XL38zac/Dy2tEA7Lg88/wIJTjF8vYXZ0uw== -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -10824,7 +10313,7 @@ one-time@^1.0.0: dependencies: fn.name "1.x.x" -onetime@^5.1.0, onetime@^5.1.2: +onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -10838,45 +10327,47 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" -optionator@^0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== +optionator@^0.9.3: + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.5" os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== -p-cancelable@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" - integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== - -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== +outdent@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/outdent/-/outdent-0.5.0.tgz#9e10982fdc41492bb473ad13840d22f9655be2ff" + integrity sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q== -p-defer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-4.0.0.tgz#8082770aeeb10eb6b408abe91866738741ddd5d2" - integrity sha512-Vb3QRvQ0Y5XnF40ZUWW7JfLogicVh/EnA5gBIvKDJoYpeI82+1E3AlB9yOcKFS0AhHrWVnAQO39fbR0G99IVEQ== +p-defer@^4.0.0, p-defer@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-4.0.1.tgz#d12c6d41420785ed0d162dbd86b71ba490f7f99e" + integrity sha512-Mr5KC5efvAK5VUptYEIopP1bakB85k2IWXaRC0rsh1uwn1L6M0LVml8OIQ4Gudg4oyZakf7FmeRLkMMtZW1i5A== -p-event@^6.0.0: +p-event@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/p-event/-/p-event-6.0.1.tgz#8f62a1e3616d4bc01fce3abda127e0383ef4715b" integrity sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w== dependencies: p-timeout "^6.1.2" +p-filter@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-filter/-/p-filter-2.1.0.tgz#1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c" + integrity sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw== + dependencies: + p-map "^2.0.0" + p-limit@^2.0.0, p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -10884,7 +10375,7 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.1.0: +p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -10905,6 +10396,18 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-map@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== + p-queue@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-8.0.1.tgz#718b7f83836922ef213ddec263ff4223ce70bef8" @@ -10913,15 +10416,6 @@ p-queue@^8.0.1: eventemitter3 "^5.0.1" p-timeout "^6.1.2" -p-retry@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-6.2.0.tgz#8d6df01af298750009691ce2f9b3ad2d5968f3bd" - integrity sha512-JA6nkq6hKyWLLasXQXUrO4z8BUZGUt/LjlJxx8Gb2+2ntodU/SS63YZ8b0LUTbQ8ZB9iwOfhEPhg4ykKnn2KsA== - dependencies: - "@types/retry" "0.12.2" - is-network-error "^1.0.0" - retry "^0.13.1" - p-timeout@^6.0.0, p-timeout@^6.1.1, p-timeout@^6.1.2: version "6.1.2" resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-6.1.2.tgz#22b8d8a78abf5e103030211c5fc6dee1166a6aa5" @@ -10932,6 +10426,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-manager-detector@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/package-manager-detector/-/package-manager-detector-0.2.1.tgz#c9a0e3d7d2972cf1aa787f7d0c4665b0cf472c84" + integrity sha512-/hVW2fZvAdEas+wyKh0SnlZ2mx0NIa1+j11YaQkogEJkcMErbwchHCuo8z7lEtajZJQZ6rgZNVTWMVVd71Bjng== + pako@^2.0.4, pako@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" @@ -10949,22 +10448,6 @@ parity-scale-codec@^0.5.3: resolved "https://registry.yarnpkg.com/parity-scale-codec/-/parity-scale-codec-0.5.3.tgz#12719281c5b39f7dbdfaa8fcd073c3746dfceac8" integrity sha512-1lBbXrCpfwcwgyOHANUt1KuS7vW8Mf/5jaU08YK7OxlXg2axmXKEaI91LTP7CBEaDp7YDVSX8Xkds9PGzcSCvQ== -parse-asn1@^5.0.0, parse-asn1@^5.1.6: - version "5.1.6" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4" - integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw== - dependencies: - asn1.js "^5.2.0" - browserify-aes "^1.0.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - safe-buffer "^5.1.1" - -parse-headers@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.5.tgz#069793f9356a54008571eb7f9761153e6c770da9" - integrity sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA== - parse-json@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -10987,11 +10470,6 @@ parse-passwd@^1.0.0: resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" integrity sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q== -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -11007,11 +10485,6 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== -path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== - path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -11027,36 +10500,25 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== - path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -pbkdf2@^3.0.17, pbkdf2@^3.0.3: - version "3.1.2" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" - integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" +peek-readable@^5.1.4: + version "5.2.0" + resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-5.2.0.tgz#7458f18126217c154938c32a185f5d05f3df3710" + integrity sha512-U94a+eXHzct7vAd19GH3UQ2dH4Satbng0MyYTMaQatL0pvYYL5CTPR25HBhKtecl+4bfu1/i3vC6k0hydO5Vcw== -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== +picocolors@^1.0.0, picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" @@ -11087,6 +10549,11 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +possible-typed-array-names@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" + integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== + prebuild-install@^7.0.1: version "7.1.2" resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.2.tgz#a5fd9986f5a6251fbc47e1e5c65de71e68c0a056" @@ -11105,10 +10572,15 @@ prebuild-install@^7.0.1: tar-fs "^2.0.0" tunnel-agent "^0.6.0" -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +prettier@^2.7.1: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" @@ -11125,14 +10597,9 @@ process@^0.11.10: integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== progress-events@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/progress-events/-/progress-events-1.0.0.tgz#34f5e8fdb5dae3561837b22672d1e02277bb2109" - integrity sha512-zIB6QDrSbPfRg+33FZalluFIowkbV5Xh1xSuetjG+rlC5he6u2dc6VQJ0TbMdlN3R1RHdpOqxEFMKTnQ+itUwA== - -progress@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + version "1.0.1" + resolved "https://registry.yarnpkg.com/progress-events/-/progress-events-1.0.1.tgz#693b6d4153f08c1418ae3cd5fcad8596c91db7e8" + integrity sha512-MOzLIwhpt64KIVN64h1MwdKWiyKFNc/S6BoYKPIVUHFg0/eIEyBulhWCgn678v/4c0ri3FdGuzXymNCv02MUIw== promise-polyfill@^1.1.6: version "1.1.6" @@ -11160,39 +10627,61 @@ propagate@^2.0.0: resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45" integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== +protobufjs@^6.8.8: + version "6.11.4" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.4.tgz#29a412c38bf70d89e537b6d02d904a6f448173aa" + integrity sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + +protobufjs@^7.3.2: + version "7.4.0" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.4.0.tgz#7efe324ce9b3b61c82aae5de810d287bc08a248a" + integrity sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/node" ">=13.7.0" + long "^5.0.0" + protons-runtime@^5.0.0, protons-runtime@^5.2.1, protons-runtime@^5.4.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-5.4.0.tgz#2751ce22cae6c35eebba89acfd9d783419ae3726" - integrity sha512-XfA++W/WlQOSyjUyuF5lgYBfXZUEMP01Oh1C2dSwZAlF2e/ZrMRPfWonXj6BGM+o8Xciv7w0tsRMKYwYEuQvaw== + version "5.5.0" + resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-5.5.0.tgz#ea06d9ef843aad77ea5de3e1ebafa81b58c24570" + integrity sha512-EsALjF9QsrEk6gbCx3lmfHxVN0ah7nG3cY7GySD4xf4g8cr7g543zB88Foh897Sr1RQJ9yDCUsoT1i1H/cVUFA== dependencies: uint8-varint "^2.0.2" uint8arraylist "^2.4.3" uint8arrays "^5.0.1" -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - -psl@^1.1.28: - version "1.9.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" - integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== -public-encrypt@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" - integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - safe-buffer "^5.1.2" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ== pump@^3.0.0: version "3.0.0" @@ -11207,29 +10696,17 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== -punycode@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" - integrity sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA== - -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== pure-rand@^6.0.0: - version "6.0.4" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.4.tgz#50b737f6a925468679bff00ad20eade53f37d5c7" - integrity sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA== - -pvtsutils@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.2.tgz#9f8570d132cdd3c27ab7d51a2799239bf8d8d5de" - integrity sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ== - dependencies: - tslib "^2.4.0" + version "6.1.0" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== -pvtsutils@^1.3.5: +pvtsutils@^1.3.2, pvtsutils@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.5.tgz#b8705b437b7b134cd7fd858f025a23456f1ce910" integrity sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA== @@ -11241,27 +10718,6 @@ pvutils@^1.1.3: resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== -qs@6.11.0: - version "6.11.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" - -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - querystring@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" @@ -11272,11 +10728,6 @@ queue-microtask@^1.1.2, queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -quick-lru@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" - integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== - r1csfile@0.0.41: version "0.0.41" resolved "https://registry.yarnpkg.com/r1csfile/-/r1csfile-0.0.41.tgz#e3d2709d36923156dd1fc2db9858987b30c92948" @@ -11287,29 +10738,29 @@ r1csfile@0.0.41: fastfile "0.0.20" ffjavascript "0.2.56" -race-event@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/race-event/-/race-event-1.2.0.tgz#6d3a72358db6e9fedabab7380636d1420abb0edb" - integrity sha512-7EvAjTu9uuKa03Jky8yfSy6/SnnMTh6nouNmdeWv9b0dT8eDZC5ylx30cOR9YO9otQorVjjkIuSHQ5Ml/bKwMw== +race-event@^1.2.0, race-event@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/race-event/-/race-event-1.3.0.tgz#854f34118c31addf877898bd9f8e4dcfac9de7a2" + integrity sha512-kaLm7axfOnahIqD3jQ4l1e471FIFcEGebXEnhxyLscuUzV8C94xVHtWEqDDXxll7+yu/6lW0w1Ff4HbtvHvOHg== -race-signal@^1.0.1, race-signal@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/race-signal/-/race-signal-1.0.2.tgz#e42379fba0cec4ee8dab7c9bbbd4aa6e0d14c25f" - integrity sha512-o3xNv0iTcIDQCXFlF6fPAMEBRjFxssgGoRqLbg06m+AdzEXXLUmoNOoUHTVz2NoBI8hHwKFKoC6IqyNtWr2bww== +race-signal@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/race-signal/-/race-signal-1.1.0.tgz#8bfc0740e7dedb9488f90f98858135c7cfe51bd4" + integrity sha512-VqsW1uzCXfKBd2DhA3K3NhQlqQr04+5WQ7+kHpf1HzT01Q+ePSFWZdQHXKZPuLmm2eXTZM1XLO76cq15ZRAaEA== ramda@^0.27.2: version "0.27.2" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.2.tgz#84463226f7f36dc33592f6f4ed6374c48306c3f1" integrity sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA== -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: +randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" -randomfill@^1.0.3, randomfill@^1.0.4: +randomfill@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== @@ -11317,31 +10768,6 @@ randomfill@^1.0.3, randomfill@^1.0.4: randombytes "^2.0.5" safe-buffer "^5.1.0" -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -raw-body@2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" - integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -11353,9 +10779,9 @@ rc@^1.2.7: strip-json-comments "~2.0.1" rdf-canonize@^3.0.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/rdf-canonize/-/rdf-canonize-3.3.0.tgz#366ef1be17e7a396570bdb75be46446b514a0b04" - integrity sha512-gfSNkMua/VWC1eYbSkVaL/9LQhFeOh0QULwv7Or0f+po8pMgQ1blYQFe1r9Mv2GJZXw88Cz/drnAnB9UlNnHfQ== + version "3.4.0" + resolved "https://registry.yarnpkg.com/rdf-canonize/-/rdf-canonize-3.4.0.tgz#87f88342b173cc371d812a07de350f0c1aa9f058" + integrity sha512-fUeWjrkOO0t1rg7B2fdyDTvngj+9RlUyL92vOdiB7c0FPguWVsniIMjEtHH+meLBO9rzkUlUzBVXgWrjI8P9LA== dependencies: setimmediate "^1.0.5" @@ -11366,42 +10792,35 @@ rdf-canonize@^4.0.1: dependencies: setimmediate "^1.0.5" -rdf-data-factory@^1.0.1, rdf-data-factory@^1.0.3, rdf-data-factory@^1.0.4, rdf-data-factory@^1.1.0, rdf-data-factory@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/rdf-data-factory/-/rdf-data-factory-1.1.1.tgz#370142794e2299846896e9c0fafd35e5128c8e5f" - integrity sha512-0HoLx7lbBlNd2YTmNKin0txgiYmAV56eVU823at8cG2+iD0Ia5kcRNDpzZy6I/HCtFTymHvTfdhHTzm3ak3Jpw== +rdf-data-factory@^1.0.1, rdf-data-factory@^1.0.3, rdf-data-factory@^1.0.4, rdf-data-factory@^1.1.0, rdf-data-factory@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/rdf-data-factory/-/rdf-data-factory-1.1.2.tgz#d47550d2649d0d64f8cae3fcc9efae7a8a895d9a" + integrity sha512-TfQD63Lokabd09ES1jAtKK8AA6rkr9rwyUBGo6olOt1CE0Um36CUQIqytyf0am2ouBPR0l7SaHxCiMcPGHkt1A== dependencies: "@rdfjs/types" "*" rdf-isomorphic@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/rdf-isomorphic/-/rdf-isomorphic-1.3.0.tgz#6a1ad38b27c5ebed8a5f752b15f81988f48f8e22" - integrity sha512-3BRwUwCNHHR8//bqmVH+knTFVbVfkp7CWyQk7qPHHA8JriXBYxrab21OomjJx/2KF21w8bWz344mgNYEaQABYQ== + version "1.3.1" + resolved "https://registry.yarnpkg.com/rdf-isomorphic/-/rdf-isomorphic-1.3.1.tgz#cd6d433cd85bf79d903d5f0fdeea42a40eb27265" + integrity sha512-6uIhsXTVp2AtO6f41PdnRV5xZsa0zVZQDTBdn0br+DZuFf5M/YD+T6m8hKDUnALI6nFL/IujTMLgEs20MlNidQ== dependencies: "@rdfjs/types" "*" hash.js "^1.1.7" rdf-string "^1.6.0" rdf-terms "^1.7.0" -rdf-js@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/rdf-js/-/rdf-js-4.0.2.tgz#f01510528bbfc6e004012b71a8a533896c4c4c10" - integrity sha512-ApvlFa/WsQh8LpPK/6hctQwG06Z9ztQQGWVtrcrf9L6+sejHNXLPOqL+w7q3hF+iL0C4sv3AX1PUtGkLNzyZ0Q== - dependencies: - "@rdfjs/types" "*" - rdf-literal@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/rdf-literal/-/rdf-literal-1.3.0.tgz#7524f09e51ae25ca03b1d600260a0f6834fe0baf" - integrity sha512-5u5L4kPYNZANie5AE4gCXqwpNO/p9E/nUcDurk05XAOJT/pt9rQlDk6+BX7j3dNSee3h9GS4xlLoWxQDj7sXtg== + version "1.3.2" + resolved "https://registry.yarnpkg.com/rdf-literal/-/rdf-literal-1.3.2.tgz#6f1bd103bcd0be72a3d969115a6343a53c526eb2" + integrity sha512-79Stlu3sXy0kq9/decHFLf3xNPuY6sfhFPhd/diWErgaFr0Ekyg38Vh9bnVcqDYu48CFRi0t+hrFii49n92Hbw== dependencies: "@rdfjs/types" "*" rdf-data-factory "^1.1.0" rdf-object@^1.11.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/rdf-object/-/rdf-object-1.13.1.tgz#e88a7ebe93397b0e9877e89b855681d523065b1f" - integrity sha512-Sgq+GbsqdPsMYh+d4OZ4C9brXlzqa9MvfVHG4pkuT9p7o+AX39nqjTWE/8HVaXjjOZBIDe8T54WWTMWphu3BpA== + version "1.14.0" + resolved "https://registry.yarnpkg.com/rdf-object/-/rdf-object-1.14.0.tgz#a51a2e575d4f838f88eced1e5096616769d17281" + integrity sha512-/KSUWr7onDtL7d81kOpcUzJ2vHYOYJc2KU9WzBZRYydBhK0Sksh5Hg4VCQNaxUEvYEgdrrTuq9SLpOOCmag0rQ== dependencies: "@rdfjs/types" "*" jsonld-context-parser "^2.0.2" @@ -11444,33 +10863,33 @@ rdf-quad@^1.4.0, rdf-quad@^1.5.0: rdf-string "^1.5.0" rdf-store-stream@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/rdf-store-stream/-/rdf-store-stream-1.3.0.tgz#7afb1c476d451219f51f147061174100c6cbccd4" - integrity sha512-EpvTGWPARsuOm9+MmFfsAzGn2++DWMhmnECdPdg4Sz3NHHHAFU3b9WNBpzjffL7m3yPBJR/dKq+BudIgYUyszg== + version "1.3.1" + resolved "https://registry.yarnpkg.com/rdf-store-stream/-/rdf-store-stream-1.3.1.tgz#41045dd0a403135d767459d64ec3ec449f77e16e" + integrity sha512-+cpnGKJMwFbCa/L0fogSMrNA95P+T2tSoWWXj94IdGN2UdYu+oQpaP7vav5wGenWQ1J9/nQu6Sy0m+stNfAZFw== dependencies: "@rdfjs/types" "*" n3 "^1.11.1" rdf-string-ttl@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/rdf-string-ttl/-/rdf-string-ttl-1.2.0.tgz#642c0a8d81a9eefdd350490cb5525339b3237733" - integrity sha512-y9PQGDu2jM3Pzhb7TbfYa35uO61OWYyxv3dtdSUHVHzvYa7vEB4Koc5FIZ/y5RPpI1IosAo2kaRDN6jV/DgoOg== + version "1.3.2" + resolved "https://registry.yarnpkg.com/rdf-string-ttl/-/rdf-string-ttl-1.3.2.tgz#56060c41680a1ed46cf99d3b42a65754e037dd35" + integrity sha512-yqolaVoUvTaSC5aaQuMcB4BL54G/pCGsV4jQH87f0TvAx8zHZG0koh7XWrjva/IPGcVb1QTtaeEdfda5mcddJg== dependencies: "@rdfjs/types" "*" rdf-data-factory "^1.1.0" rdf-string@^1.5.0, rdf-string@^1.6.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/rdf-string/-/rdf-string-1.6.1.tgz#be576118b07fc59984ee44c3253004f72aed953b" - integrity sha512-EDNVQs9jDgm4hkY8TZLhQI3rYUduecMRxLu3szldAdS2CHEo8aFqlHcZDFgBcaJN2XJWoRJU8YQT85wmb8gPEA== + version "1.6.3" + resolved "https://registry.yarnpkg.com/rdf-string/-/rdf-string-1.6.3.tgz#5c3173fad13e6328698277fb8ff151e3423282ab" + integrity sha512-HIVwQ2gOqf+ObsCLSUAGFZMIl3rh9uGcRf1KbM85UDhKqP+hy6qj7Vz8FKt3GA54RiThqK3mNcr66dm1LP0+6g== dependencies: "@rdfjs/types" "*" rdf-data-factory "^1.1.0" rdf-terms@^1.6.2, rdf-terms@^1.7.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/rdf-terms/-/rdf-terms-1.9.0.tgz#09da2e4f051a77836f3e63f0a49ca11fff254caa" - integrity sha512-FGMPOIpr6vEN8gWd/dVuPpcE/7k+u4Ufqi8FvM5lczjhduT1MN9Shmrw50fWCpHFVE4n0T3lV0qti1PCaHxAfg== + version "1.11.0" + resolved "https://registry.yarnpkg.com/rdf-terms/-/rdf-terms-1.11.0.tgz#0c2e3a2b43f1042959c9263af27dab08dc4b084d" + integrity sha512-iKlVgnMopRKl9pHVNrQrax7PtZKRCT/uJIgYqvuw1VVQb88zDvurtDr1xp0rt7N9JtKtFwUXoIQoEsjyRo20qQ== dependencies: "@rdfjs/types" "*" rdf-data-factory "^1.1.0" @@ -11497,25 +10916,35 @@ rdfxml-streaming-parser@^1.5.0: sax "^1.2.4" react-is@^18.0.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== -react-native-webrtc@^118.0.1: - version "118.0.3" - resolved "https://registry.yarnpkg.com/react-native-webrtc/-/react-native-webrtc-118.0.3.tgz#41fa4cedb25d7b6d5bfb98d64ecf22bce7dc2093" - integrity sha512-qw+aa4rxGJTvltmYwwHonx4Qcgk/tcoojONu/6y5nsXGctkUqo886EIBb29Jv4ssHnudDzvkxyG/xVKK2vJc7Q== +react-native-webrtc@^118.0.7: + version "118.0.7" + resolved "https://registry.yarnpkg.com/react-native-webrtc/-/react-native-webrtc-118.0.7.tgz#8984810f02fff26e2c3784c854e1d4380d092917" + integrity sha512-odgd4CNSGQmI8n/pEbxlUtJBTJ8uqE51B1/NUEAvO1AQbeXsyFNHEG0H2T27eMefo5u0GKcRpNkZpXi6fctTkQ== dependencies: base64-js "1.5.1" debug "4.3.4" event-target-shim "6.0.2" +read-yaml-file@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-yaml-file/-/read-yaml-file-1.1.0.tgz#9362bbcbdc77007cc8ea4519fe1c0b821a7ce0d8" + integrity sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA== + dependencies: + graceful-fs "^4.1.5" + js-yaml "^3.6.1" + pify "^4.0.1" + strip-bom "^3.0.0" + readable-stream-node-to-web@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/readable-stream-node-to-web/-/readable-stream-node-to-web-1.0.1.tgz#8b7614faa1465ebfa0da9b9ca6303fa27073b7cf" integrity sha512-OGzi2VKLa8H259kAx7BIwuRrXHGcxeHj4RdASSgEGBP9Q2wowdPvBc65upF4Q9O05qWgKqBw1+9PiLTtObl7uQ== -readable-stream@^3.1.1, readable-stream@^3.6.2: +readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0, readable-stream@^3.6.2: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== @@ -11524,19 +10953,10 @@ readable-stream@^3.1.1, readable-stream@^3.6.2: string_decoder "^1.1.1" util-deprecate "^1.0.1" -readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - readable-stream@^4.0.0: - version "4.4.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.4.2.tgz#e6aced27ad3b9d726d8308515b9a1b98dc1b9d13" - integrity sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA== + version "4.5.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.5.2.tgz#9e7fc4c45099baeed934bff6eb97ba6cf2729e09" + integrity sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g== dependencies: abort-controller "^3.0.0" buffer "^6.0.3" @@ -11558,10 +10978,15 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +readonly-date@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/readonly-date/-/readonly-date-1.0.0.tgz#5af785464d8c7d7c40b9d738cbde8c646f97dcd9" + integrity sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ== + regenerate-unicode-properties@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c" - integrity sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ== + version "10.1.1" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz#6b0e05489d9076b04c436f318d9b067bba459480" + integrity sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q== dependencies: regenerate "^1.4.2" @@ -11575,15 +11000,10 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.13.10: - version "0.13.10" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz#ed07b19616bcbec5da6274ebc75ae95634bfc2ee" - integrity sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw== - regenerator-runtime@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" - integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== regenerator-transform@^0.15.2: version "0.15.2" @@ -11592,31 +11012,15 @@ regenerator-transform@^0.15.2: dependencies: "@babel/runtime" "^7.8.4" -regexp.prototype.flags@^1.3.0, regexp.prototype.flags@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" - integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA== +regexp.prototype.flags@^1.3.0, regexp.prototype.flags@^1.5.1, regexp.prototype.flags@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" + integrity sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - functions-have-names "^1.2.2" - -regexpp@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" - integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== - -regexpu-core@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.2.1.tgz#a69c26f324c1e962e9ffd0b88b055caba8089139" - integrity sha512-HrnlNtpvqP1Xkb28tMhBUO2EbyUHdQlsnlAhzWcwHy8WJR53UWr7/MAvqrsQKMbV4qdpv03oTMG8iIhfsPFktQ== - dependencies: - regenerate "^1.4.2" - regenerate-unicode-properties "^10.1.0" - regjsgen "^0.7.1" - regjsparser "^0.9.1" - unicode-match-property-ecmascript "^2.0.0" - unicode-match-property-value-ecmascript "^2.0.0" + call-bind "^1.0.6" + define-properties "^1.2.1" + es-errors "^1.3.0" + set-function-name "^2.0.1" regexpu-core@^5.3.1: version "5.3.2" @@ -11630,11 +11034,6 @@ regexpu-core@^5.3.1: unicode-match-property-ecmascript "^2.0.0" unicode-match-property-value-ecmascript "^2.1.0" -regjsgen@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.7.1.tgz#ee5ef30e18d3f09b7c369b76e7c2373ed25546f6" - integrity sha512-RAt+8H2ZEzHeYWxZ3H2z6tF18zyyOnlcdaafLrm21Bguj7uZy6ULibiAFdXEtKQY4Sy7wDTwDiOazasMLc4KPA== - regjsparser@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709" @@ -11643,35 +11042,9 @@ regjsparser@^0.9.1: jsesc "~0.5.0" relative-to-absolute-iri@^1.0.0, relative-to-absolute-iri@^1.0.2, relative-to-absolute-iri@^1.0.5, relative-to-absolute-iri@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/relative-to-absolute-iri/-/relative-to-absolute-iri-1.0.6.tgz#7111dac5730587e3fbca3e0f48585fbc88c147a7" - integrity sha512-Xw5/Zx6iWSCMJUXwXVOjySjH8Xli4hVFL9QQFvkl1qEmFBG94J+QUI9emnoctOCD3285f1jNV+QWV9eDYwIdfQ== - -request@^2.79.0: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" + version "1.0.7" + resolved "https://registry.yarnpkg.com/relative-to-absolute-iri/-/relative-to-absolute-iri-1.0.7.tgz#f2fd6ee60c78d9ffc4926bd20bdf84479b91d765" + integrity sha512-Xjyl4HmIzg2jzK/Un2gELqbcE8Fxy85A/aLSHE6PE/3+OGsFwmKVA1vRyGaz6vLWSqLDMHA+5rjD/xbibSQN1Q== require-directory@^2.1.1: version "2.1.1" @@ -11679,16 +11052,11 @@ require-directory@^2.1.1: integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== requizzle@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.3.tgz#4675c90aacafb2c036bd39ba2daa4a1cb777fded" - integrity sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ== + version "0.2.4" + resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.4.tgz#319eb658b28c370f0c20f968fa8ceab98c13d27c" + integrity sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw== dependencies: - lodash "^4.17.14" - -resolve-alpn@^1.0.0, resolve-alpn@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" - integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== + lodash "^4.17.21" resolve-cwd@^3.0.0: version "3.0.0" @@ -11712,49 +11080,15 @@ resolve.exports@^2.0.0: resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== -resolve@^1.12.0: - version "1.22.4" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.4.tgz#1dc40df46554cdaf8948a486a10f6ba1e2026c34" - integrity sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg== +resolve@^1.12.0, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.22.4: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== dependencies: is-core-module "^2.13.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.0, resolve@^1.22.1: - version "1.22.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" - integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== - dependencies: - is-core-module "^2.9.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -responselike@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" - integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== - dependencies: - lowercase-keys "^2.0.0" - -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== - dependencies: - onetime "^5.1.0" - signal-exit "^3.0.2" - -retimer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/retimer/-/retimer-3.0.0.tgz#98b751b1feaf1af13eb0228f8ea68b8f9da530df" - integrity sha512-WKE0j11Pa0ZJI5YIk0nflGI7SQsfl2ljihVy7ogh7DeQSeYAUi0ubZ/yEueGtDfUPk6GH5LRw1hBdLq4IwUBWA== - -retry@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" - integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== - reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -11765,14 +11099,14 @@ rify@^0.7.1: resolved "https://registry.yarnpkg.com/rify/-/rify-0.7.1.tgz#4d7808c5e991f7046a488681d7c40b6e716e0b26" integrity sha512-kQs3BkgqDipNBvD+35IJeaCsQXcDc/r/5GjOn8WI7W8OFFDiBhhvT+/rd+cs783ghioKwvJ/DPuoOK0oUWkR+Q== -rimraf@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" -ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.2: +ripemd160@^2.0.1, ripemd160@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== @@ -11780,17 +11114,10 @@ ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.2: hash-base "^3.0.0" inherits "^2.0.1" -rlp@^2.2.4: - version "2.2.7" - resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" - integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== - dependencies: - bn.js "^5.2.0" - rollup-plugin-copy@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz#f1228a3ffb66ffad8606e2f3fb7ff23141ed3286" - integrity sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ== + version "3.5.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-copy/-/rollup-plugin-copy-3.5.0.tgz#7ffa2a7a8303e143876fa64fb5eed9022d304eeb" + integrity sha512-wI8D5dvYovRMx/YYKtUNt3Yxaw4ORC9xo6Gt9t22kveWz1enG9QrhVlagzwrxSC455xD1dHMKhIJkbsQ7d48BA== dependencies: "@types/fs-extra" "^8.0.1" colorette "^1.1.0" @@ -11808,13 +11135,11 @@ rollup-plugin-inject@^3.0.0: rollup-pluginutils "^2.8.1" rollup-plugin-multi-input@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-multi-input/-/rollup-plugin-multi-input-1.3.2.tgz#e093c06fe0619db048dee2a1dc5a8e6beff8d832" - integrity sha512-fxIsIluArT6bRwGnVgYyHytA4oq1GQp97s+Uk/OLZ1MpX2MoChEJVOFNA3u+Yrrg1aTya9qxacXSCD7Z5YgKuw== + version "1.5.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-multi-input/-/rollup-plugin-multi-input-1.5.0.tgz#d4c34c128bddf94bfbc04726e53201bc719f9077" + integrity sha512-Tgb/pz1VxzYCk/MPTh0dhLb/zme4tWb72S9KtwVgGVupkdngUPQZqRUld25f8tAb18z1lfvz4Mn7ihDQLr+L9g== dependencies: - core-js "^3.1.3" - fast-glob "^3.0.0" - lodash "^4.17.11" + fast-glob "3.3.2" rollup-plugin-node-polyfills@^0.2.1: version "0.2.1" @@ -11847,11 +11172,6 @@ rollup@2.78.0: optionalDependencies: fsevents "~2.3.2" -run-async@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" - integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -11859,52 +11179,48 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@^6.6.0: - version "6.6.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== - dependencies: - tslib "^1.9.0" - -rxjs@^7.4.0: - version "7.5.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" - integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== - dependencies: - tslib "^2.1.0" - -rxjs@^7.8.1: +rxjs@^7.4.0, rxjs@^7.8.1: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== dependencies: tslib "^2.1.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: +safe-array-concat@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.2.tgz#81d77ee0c4e8b863635227c721278dd524c20edb" + integrity sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q== + dependencies: + call-bind "^1.0.7" + get-intrinsic "^1.2.4" + has-symbols "^1.0.3" + isarray "^2.0.5" + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-regex-test@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" - integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== +safe-regex-test@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377" + integrity sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw== dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.3" + call-bind "^1.0.6" + es-errors "^1.3.0" is-regex "^1.1.4" safe-stable-stringify@^2.3.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz#34694bd8a30575b7f94792aa51527551bd733d61" - integrity sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA== + version "2.4.3" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" + integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== -"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -11930,9 +11246,9 @@ sax@1.2.1: integrity sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA== sax@>=0.6.0, sax@^1.2.4, sax@~1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + version "1.4.1" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.4.1.tgz#44cc8988377f126304d3b3fc1010c733b929ef0f" + integrity sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg== scale-ts@^1.6.0: version "1.6.0" @@ -11944,12 +11260,12 @@ scrypt-js@2.0.4: resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== -scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: +scrypt-js@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== -secp256k1@^4.0.1, secp256k1@^4.0.2: +secp256k1@^4.0.2: version "4.0.3" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== @@ -11958,65 +11274,34 @@ secp256k1@^4.0.1, secp256k1@^4.0.2: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" +secp256k1@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-5.0.0.tgz#be6f0c8c7722e2481e9773336d351de8cddd12f7" + integrity sha512-TKWX8xvoGHrxVdqbYeZM9w+izTF4b9z3NhSaDkdn81btvuh+ivbIMGT/zQvDtTFWhRlThpoz6LEYTr7n8A5GcA== + dependencies: + elliptic "^6.5.4" + node-addon-api "^5.0.0" + node-gyp-build "^4.2.0" + security-context@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/security-context/-/security-context-4.0.0.tgz#e73f5d22bee9c7699a02eaaced359d001dc948e9" integrity sha512-yiDCS7tpKQl6p4NG57BdKLTSNLFfj5HosBIzXBl4jZf/qorJzSzbEUIdLhN+vVYgyLlvjixY8DPPTgqI8zvNCA== -semver@^5.5.0, semver@^5.6.0, semver@^5.7.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -semver@^6.1.2: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^5.6.0, semver@^5.7.0: + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.2, semver@^7.3.5: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== - dependencies: - lru-cache "^6.0.0" - -semver@^7.5.3, semver@^7.6.0: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" - -semver@^7.5.4: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - -send@0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" - integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" +semver@^7.3.2, semver@^7.3.5, semver@^7.3.7, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== serialize-error@^8.0.1: version "8.1.0" @@ -12032,26 +11317,27 @@ serialize-javascript@^4.0.0: dependencies: randombytes "^2.1.0" -serve-static@1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" - integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== +set-function-length@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.18.0" + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" -servify@^0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" - integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== +set-function-name@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.2.tgz#16a705c5a0dc2f5e638ca96d8a8cd4e1c2b90985" + integrity sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ== dependencies: - body-parser "^1.16.0" - cors "^2.8.1" - express "^4.14.0" - request "^2.79.0" - xhr "^2.3.3" + define-data-property "^1.1.4" + es-errors "^1.3.0" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.2" set-immediate-shim@^1.0.1: version "1.0.1" @@ -12068,12 +11354,7 @@ setimmediate@^1.0.5: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8: +sha.js@^2.4.0, sha.js@^2.4.11: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== @@ -12113,13 +11394,14 @@ shebang-regex@^3.0.0: integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== side-channel@^1.0.3, side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + version "1.0.6" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" + integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA== dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" + call-bind "^1.0.7" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + object-inspect "^1.13.1" signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" @@ -12131,15 +11413,6 @@ simple-concat@^1.0.0: resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== -simple-get@^2.7.0: - version "2.8.2" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.2.tgz#5708fb0919d440657326cd5fe7d2599d07705019" - integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== - dependencies: - decompress-response "^3.3.0" - once "^1.3.1" - simple-concat "^1.0.0" - simple-get@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" @@ -12176,15 +11449,6 @@ slash@^4.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== - dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" - smoldot@2.0.22: version "2.0.22" resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-2.0.22.tgz#1e924d2011a31c57416e79a2b97a460f462a31c7" @@ -12256,11 +11520,11 @@ sparqlee@^1.10.0: uuid "^8.0.0" sparqljs@^3.1.2, sparqljs@^3.4.1, sparqljs@^3.4.2: - version "3.6.1" - resolved "https://registry.yarnpkg.com/sparqljs/-/sparqljs-3.6.1.tgz#9aa6d07afbce2b95edfcd83403fac09b3ab51f73" - integrity sha512-4QoI3cMywOio8mtTLa3Rl85XI7UBvQRm1CbzbHEQ7C6AN6ldBFsSS96vkhcKCQKPl0eDTmCXsi+50234+1cOpA== + version "3.7.2" + resolved "https://registry.yarnpkg.com/sparqljs/-/sparqljs-3.7.2.tgz#80dc1c9fc254ffef108394ae3cc44bb58686580d" + integrity sha512-S95lfbQNfcMc6JOEe04mpu4zCsB3troit2UOe0YxmkdvR7EzOVjaSgp/I8esKg2EC6zhi8GHA4iQpmQnzlY73A== dependencies: - rdf-data-factory "^1.1.1" + rdf-data-factory "^1.1.2" sparqljson-parse@^1.6.0, sparqljson-parse@^1.7.0: version "1.7.0" @@ -12290,26 +11554,19 @@ sparqlxml-parse@^1.5.0: rdf-data-factory "^1.1.0" sax-stream "^1.2.3" +spawndamnit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/spawndamnit/-/spawndamnit-2.0.0.tgz#9f762ac5c3476abb994b42ad592b5ad22bb4b0ad" + integrity sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA== + dependencies: + cross-spawn "^5.1.0" + signal-exit "^3.0.2" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5" - integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - stack-trace@0.0.x: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" @@ -12322,27 +11579,29 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== +stop-iteration-iterator@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz#6a60be0b4ee757d1ed5254858ec66b10c49285e4" + integrity sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ== + dependencies: + internal-slot "^1.0.4" str2buf@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/str2buf/-/str2buf-1.3.0.tgz#a4172afff4310e67235178e738a2dbb573abead0" integrity sha512-xIBmHIUHYZDP4HyoXGHYNVmxlXLXDrtFHYT0eV6IOdEj3VO9ccaF1Ejl9Oq8iFjITllpT8FhaXb4KsNmw+3EuA== -stream-to-it@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-0.2.4.tgz#d2fd7bfbd4a899b4c0d6a7e6a533723af5749bd0" - integrity sha512-4vEbkSs83OahpmBybNJXlJd7d6/RxzkkSdT3I0mnGt79Xd2Kk+e1JqbvAvsQfCeKj3aKb0QIWkyK3/n0j506vQ== +stream-to-it@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-1.0.1.tgz#7d5e1b04bab70facd48273279bfa49f0d0165950" + integrity sha512-AqHYAYPHcmvMrcLNgncE/q0Aj/ajP6A4qGhxP6EVn7K3YTNs0bJpJyk57wc2Heb7MUL64jurvmnmui8D9kjZgA== dependencies: - get-iterator "^1.0.2" + it-stream-types "^2.0.1" stream-to-string@^1.1.0, stream-to-string@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/stream-to-string/-/stream-to-string-1.2.0.tgz#3ca506a097ecbf78b0e0aee0b6fa5c4565412a15" - integrity sha512-8drZlFIKBHSMdX9GCWv8V9AAWnQcTqw0iAI6/GC7UJ0H0SwKeFKjOoZfGY1tOU00GGU7FYZQoJ/ZCUEoXhD7yQ== + version "1.2.1" + resolved "https://registry.yarnpkg.com/stream-to-string/-/stream-to-string-1.2.1.tgz#15cb325d88b33cc62accb032c7093f85eb785db2" + integrity sha512-WsvTDNF8UYs369Yko3pcdTducQtYpzEZeOV7cTuReyFvOoA9S/DLJ6sYK+xPafSPHhUMpaxiljKYnT6JSFztIA== dependencies: promise-polyfill "^1.1.6" @@ -12356,11 +11615,6 @@ streamify-string@^1.0.1: resolved "https://registry.yarnpkg.com/streamify-string/-/streamify-string-1.0.1.tgz#9e220de33e1c475dd30e0206f5b1815cc6c9525b" integrity sha512-RXvBglotrvSIuQQ7oC55pdV40wZ/17gTb68ipMC4LA0SqMN4Sqfsf31Dpei7qXpYqZQ8ueVnPglUvtep3tlhqw== -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== - string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -12369,15 +11623,6 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -string-width@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" - string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -12387,23 +11632,33 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string.prototype.trimend@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0" - integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== +string.prototype.trim@^1.2.9: + version "1.2.9" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz#b6fa326d72d2c78b6df02f7759c73f8f6274faa4" + integrity sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.19.5" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.0" + es-object-atoms "^1.0.0" -string.prototype.trimstart@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz#5466d93ba58cfa2134839f81d7f42437e8c01fef" - integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== +string.prototype.trimend@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz#3651b8513719e8a9f48de7f2f77640b26652b229" + integrity sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.19.5" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + +string.prototype.trimstart@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz#7ee834dda8c7c17eff3118472bb35bfedaa34dde" + integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" string_decoder@^1.1.1, string_decoder@^1.3.0: version "1.3.0" @@ -12412,13 +11667,6 @@ string_decoder@^1.1.1, string_decoder@^1.3.0: dependencies: safe-buffer "~5.2.0" -strip-ansi@^5.1.0, strip-ansi@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -12453,7 +11701,7 @@ strip-hex-prefix@1.0.0: dependencies: is-hex-prefixed "1.0.0" -strip-json-comments@^3.0.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -12463,6 +11711,23 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== +strtok3@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-8.1.0.tgz#9234a6f42ee03bf8569c7ae0788d5fd4e67e095b" + integrity sha512-ExzDvHYPj6F6QkSNe/JxSlBxTh3OrI6wrAIz53ulxo1c4hBJ1bT9C/JrAthEKHWG9riVH3Xzg7B03Oxty6S2Lw== + dependencies: + "@tokenizer/token" "^0.3.0" + peek-readable "^5.1.4" + +super-regex@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/super-regex/-/super-regex-0.2.0.tgz#dc1e071e55cdcf56930eb6271f73653a655b2642" + integrity sha512-WZzIx3rC1CvbMDloLsVw0lkZVKJWbrkJ0k1ghKFmcnPrW1+jWbgTkTEWVtD9lMdmI4jZEz40+naBxl1dCUhXXw== + dependencies: + clone-regexp "^3.0.0" + function-timeout "^0.1.0" + time-span "^5.1.0" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -12484,37 +11749,20 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" +supports-color@^9.4.0: + version "9.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954" + integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw== + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -swarm-js@^0.1.40: - version "0.1.42" - resolved "https://registry.yarnpkg.com/swarm-js/-/swarm-js-0.1.42.tgz#497995c62df6696f6e22372f457120e43e727979" - integrity sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ== - dependencies: - bluebird "^3.5.0" - buffer "^5.0.5" - eth-lib "^0.1.26" - fs-extra "^4.0.2" - got "^11.8.5" - mime-types "^2.1.16" - mkdirp-promise "^5.0.1" - mock-fs "^4.1.0" - setimmediate "^1.0.5" - tar "^4.0.2" - xhr-request "^1.0.1" - -table@^5.2.3: - version "5.4.6" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" - integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== - dependencies: - ajv "^6.10.2" - lodash "^4.17.14" - slice-ansi "^2.1.0" - string-width "^3.0.0" +symbol-observable@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" + integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== taffydb@2.6.2: version "2.6.2" @@ -12542,26 +11790,18 @@ tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" -tar@^4.0.2: - version "4.4.19" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" - integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== - dependencies: - chownr "^1.1.4" - fs-minipass "^1.2.7" - minipass "^2.9.0" - minizlib "^1.3.3" - mkdirp "^0.5.5" - safe-buffer "^5.2.1" - yallist "^3.1.1" +term-size@^2.1.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.1.tgz#2a6a54840432c2fb6320fea0f415531e90189f54" + integrity sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg== terser@^5.0.0: - version "5.15.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.15.1.tgz#8561af6e0fd6d839669c73b92bdd5777d870ed6c" - integrity sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw== + version "5.31.6" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.6.tgz#c63858a0f0703988d0266a82fcbf2d7ba76422b1" + integrity sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg== dependencies: - "@jridgewell/source-map" "^0.3.2" - acorn "^8.5.0" + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" commander "^2.20.0" source-map-support "~0.5.20" @@ -12584,7 +11824,7 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -"through@>=2.2.7 <3", through@^2.3.6: +"through@>=2.2.7 <3": version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== @@ -12594,17 +11834,12 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== -timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== - -timeout-abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/timeout-abort-controller/-/timeout-abort-controller-3.0.0.tgz#dd57ffca041652c03769904f8d95afd93fb95595" - integrity sha512-O3e+2B8BKrQxU2YRyEjC/2yFdb33slI22WRdUaDx6rvysfi9anloNZyR2q0l6LnePo5qH7gSM7uZtvvwZbc2yA== +time-span@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/time-span/-/time-span-5.1.0.tgz#80c76cf5a0ca28e0842d3f10a4e99034ce94b90d" + integrity sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA== dependencies: - retimer "^3.0.0" + convert-hrtime "^5.0.0" timestamp-nano@^1.0.0: version "1.0.1" @@ -12635,18 +11870,13 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== +token-types@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/token-types/-/token-types-6.0.0.tgz#1ab26be1ef9c434853500c071acfe5c8dd6544a3" + integrity sha512-lbDrTLVsHhOMljPscd0yitpozq7Ga2M5Cvez5AjGg8GASBjtt6iERCAJ93yommPmz62fb45oFIXHEZ3u9bfJEA== dependencies: - psl "^1.1.28" - punycode "^2.1.1" + "@tokenizer/token" "^0.3.0" + ieee754 "^1.2.1" tr46@~0.0.3: version "0.0.3" @@ -12654,9 +11884,9 @@ tr46@~0.0.3: integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== triple-beam@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9" - integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw== + version "1.4.1" + resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" + integrity sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg== truncate-utf8-bytes@^1.0.0: version "1.0.2" @@ -12665,35 +11895,25 @@ truncate-utf8-bytes@^1.0.0: dependencies: utf8-byte-length "^1.0.1" -tsconfig-paths@^3.14.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a" - integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ== +tsconfig-paths@^3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" + integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== dependencies: "@types/json5" "^0.0.29" - json5 "^1.0.1" + json5 "^1.0.2" minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.4.0, tslib@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" - integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== - -tslib@^2.1.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" - integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== - -tslib@^2.6.1, tslib@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== +tslib@^2.0.0, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.6.1, tslib@^2.6.2: + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== tsutils@^3.21.0: version "3.21.0" @@ -12709,17 +11929,54 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== +turbo-darwin-64@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-2.0.5.tgz#23c711370911d66e4589928243ec086c453709df" + integrity sha512-t/9XpWYIjOhIHUdwiR47SYBGYHkR1zWLxTkTNKZwCSn8BN0cfjPZ1BR6kcwYGxLGBhtl5GBf6A29nq2K7iwAjg== -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg== +turbo-darwin-arm64@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-2.0.5.tgz#a1e47e97cca55ba6e15d52f2ae7af41e74a4d837" + integrity sha512-//5y4RJvnal8CttOLBwlaBqblcQb1qTlIxLN+I8O3E3rPuvHOupNKB9ZJxYIQ8oWf8ns8Ec8cxQ0GSBLTJIMtA== + +turbo-linux-64@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-2.0.5.tgz#ef9da9b8d90ab2d9d0c1c473ee27426e03cdc953" + integrity sha512-LDtEDU2Gm8p3lKu//aHXZFRKUCVu68BNF9LQ+HmiCKFpNyK7khpMTxIAAUhDqt+AzlrbxtrxcCpCJaWg1JDjHg== + +turbo-linux-arm64@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-2.0.5.tgz#a7a0da918effa62ecc55668d4f4dc7266dedd7fa" + integrity sha512-84wdrzntErBNxkHcwHxiTZdaginQAxGPnwLTyZj8lpUYI7okPoxy3jKpUeMHN3adm3iDedl/x0mYSIvVVkmOiA== + +turbo-windows-64@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-2.0.5.tgz#bfdce4337e2518eee9cb656258500effb1974b79" + integrity sha512-SgaFZ0VW6kHCJogLNuLEleAauAJx2Y48wazZGVRmBpgSUS2AylXesaBMhJaEScYqLz7mIRn6KOgwM8D4wTxI9g== + +turbo-windows-arm64@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-2.0.5.tgz#eb9d038e976cd3e7e11c6af5271314db9ef093b0" + integrity sha512-foUxLOZoru0IRNIxm53fkfM4ubas9P0nTFjIcHtd+E8YHeogt8GqTweNre2e6ri1EHDo71emmuQgpuoFCOXZMg== + +turbo@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/turbo/-/turbo-2.0.5.tgz#e33eaae264e8e373a1ca80762b9289a802ab4cbc" + integrity sha512-+6+hcWr4nwuESlKqUc626HMOTd3QT8hUOc9QM45PP1d4nErGkNOgExm4Pcov3in7LTuadMnB0gcd/BuzkEDIPw== + optionalDependencies: + turbo-darwin-64 "2.0.5" + turbo-darwin-arm64 "2.0.5" + turbo-linux-64 "2.0.5" + turbo-linux-arm64 "2.0.5" + turbo-windows-64 "2.0.5" + turbo-windows-arm64 "2.0.5" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: - prelude-ls "~1.1.2" + prelude-ls "^1.2.1" type-detect@4.0.8: version "4.0.8" @@ -12736,35 +11993,49 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== - -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== +typed-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" + integrity sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ== dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" + call-bind "^1.0.7" + es-errors "^1.3.0" + is-typed-array "^1.1.13" -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== +typed-array-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz#d92972d3cff99a3fa2e765a28fcdc0f1d89dec67" + integrity sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw== + dependencies: + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" -type@^2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" - integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== +typed-array-byte-offset@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz#f9ec1acb9259f395093e4567eb3c28a580d02063" + integrity sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA== + dependencies: + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== +typed-array-length@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.6.tgz#57155207c76e64a3457482dfdc1c9d1d3c4c73a3" + integrity sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g== dependencies: - is-typedarray "^1.0.0" + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + possible-typed-array-names "^1.0.0" typescript@5.0.4: version "5.0.4" @@ -12776,7 +12047,7 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== -uint8-varint@^2.0.1, uint8-varint@^2.0.2, uint8-varint@^2.0.4: +uint8-varint@^2.0.1, uint8-varint@^2.0.2, uint8-varint@^2.0.3, uint8-varint@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/uint8-varint/-/uint8-varint-2.0.4.tgz#85be52b3849eb30f2c3640a2df8a14364180affb" integrity sha512-FwpTa7ZGA/f/EssWAb5/YV6pHgVF1fViKdW8cWaEarjB8t7NyofSWBdOTyFPaGuUG4gx3v1O3PQ8etsiOs3lcw== @@ -12784,13 +12055,25 @@ uint8-varint@^2.0.1, uint8-varint@^2.0.2, uint8-varint@^2.0.4: uint8arraylist "^2.0.0" uint8arrays "^5.0.0" -uint8arraylist@^2.0.0, uint8arraylist@^2.4.1, uint8arraylist@^2.4.3, uint8arraylist@^2.4.8: +uint8array-extras@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/uint8array-extras/-/uint8array-extras-1.4.0.tgz#e42a678a6dd335ec2d21661333ed42f44ae7cc74" + integrity sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ== + +uint8arraylist@^2.0.0, uint8arraylist@^2.4.3, uint8arraylist@^2.4.8: version "2.4.8" resolved "https://registry.yarnpkg.com/uint8arraylist/-/uint8arraylist-2.4.8.tgz#5a4d17f4defd77799cb38e93fd5db0f0dceddc12" integrity sha512-vc1PlGOzglLF0eae1M8mLRTBivsvrGsdmJ5RbK3e+QRvRLOZfZhQROTwH/OfyF3+ZVUg9/8hE8bmKP2CvP9quQ== dependencies: uint8arrays "^5.0.1" +uint8arrays@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" + integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== + dependencies: + multiformats "^9.4.2" + uint8arrays@^2.0.5: version "2.1.10" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-2.1.10.tgz#34d023c843a327c676e48576295ca373c56e286a" @@ -12798,25 +12081,13 @@ uint8arrays@^2.0.5: dependencies: multiformats "^9.4.2" -uint8arrays@^3.0.0, uint8arrays@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" - integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== - dependencies: - multiformats "^9.4.2" - -uint8arrays@^5.0.0, uint8arrays@^5.0.1, uint8arrays@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-5.0.2.tgz#f05479bcd521d37c2e7710b24132a460b0ac80e3" - integrity sha512-S0GaeR+orZt7LaqzTRs4ZP8QqzAauJ+0d4xvP2lJTA99jIkKsE2FgDs4tGF/K/z5O9I/2W5Yvrh7IuqNeYH+0Q== +uint8arrays@^5.0.0, uint8arrays@^5.0.1, uint8arrays@^5.0.2, uint8arrays@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-5.1.0.tgz#14047c9bdf825d025b7391299436e5e50e7270f1" + integrity sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww== dependencies: multiformats "^13.0.0" -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -12828,14 +12099,29 @@ unbox-primitive@^1.0.2: which-boxed-primitive "^1.0.2" underscore@~1.13.2: - version "1.13.6" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" - integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== + version "1.13.7" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.7.tgz#970e33963af9a7dda228f17ebe8399e5fbe63a10" + integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +undici-types@~6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.13.0.tgz#e3e79220ab8c81ed1496b5812471afd7cf075ea5" + integrity sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== undici@^6.6.2: - version "6.7.1" - resolved "https://registry.yarnpkg.com/undici/-/undici-6.7.1.tgz#3cb27222fd5d72c1b2058f4e18bf9b53dd933af8" - integrity sha512-+Wtb9bAQw6HYWzCnxrPTMVEV3Q1QjYanI0E4q02ehReMuquQdLTEFEYbfs7hcImVYKcQkWSwT6buEmSVIiDDtQ== + version "6.19.7" + resolved "https://registry.yarnpkg.com/undici/-/undici-6.19.7.tgz#7d4cf26dc689838aa8b6753a3c5c4288fc1e0216" + integrity sha512-HR3W/bMGPSr90i8AAp2C4DM3wChFdJPLrWYpIS++LxS8K+W535qftjt+4MyjNYHeWabMj1nvtmLIi7l++iq91A== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" @@ -12850,11 +12136,6 @@ unicode-match-property-ecmascript@^2.0.0: unicode-canonical-property-names-ecmascript "^2.0.0" unicode-property-aliases-ecmascript "^2.0.0" -unicode-match-property-value-ecmascript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz#1a01aa57247c14c568b89775a54938788189a714" - integrity sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw== - unicode-match-property-value-ecmascript@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz#cb5fffdcd16a05124f5a4b0bf7c3770208acbbe0" @@ -12870,26 +12151,13 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - -update-browserslist-db@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940" - integrity sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== - dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" - -update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== +update-browserslist-db@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" + integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" + escalade "^3.1.2" + picocolors "^1.0.1" uri-js@^4.2.2: version "4.4.1" @@ -12903,11 +12171,6 @@ uritemplate@0.3.4: resolved "https://registry.yarnpkg.com/uritemplate/-/uritemplate-0.3.4.tgz#05d0a853ffbc8b0f49aa3d4d2ad777b0d1ee070c" integrity sha512-enADBvHfhjrwxFMTVWeIIYz51SZ91uC6o2MR/NQTVljJB6HTZ8eQL3Q7JBj3RxNISA14MOwJaU3vpf5R6dyxHA== -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" - integrity sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg== - url@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64" @@ -12916,29 +12179,17 @@ url@0.10.3: punycode "1.3.2" querystring "0.2.0" -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - utf8-byte-length@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61" - integrity sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA== - -utf8@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== + version "1.0.5" + resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz#f9f63910d15536ee2b2d5dd4665389715eac5c1e" + integrity sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA== util-deprecate@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -util@^0.12.0, util@^0.12.4: +util@^0.12.4: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== @@ -12949,45 +12200,38 @@ util@^0.12.0, util@^0.12.4: is-typed-array "^1.1.3" which-typed-array "^1.1.2" -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - uuid@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.1.tgz#c2a30dedb3e535d72ccf82e343941a50ba8533ac" integrity sha512-nWg9+Oa3qD2CQzHIP4qKUqwNfzKn8P0LtFhotaCTFchsV7ZfDhAybeip/HZVeMIpZi9JgY1E3nUlwaCmZT1sEg== -uuid@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== - uuid@8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.0.0.tgz#bc6ccf91b5ff0ac07bbcdbf1c7c4e150db4dbb6c" integrity sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw== -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - -uuid@^8.0.0: +uuid@8.3.2, uuid@^8.0.0: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-compile-cache@^2.0.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" - integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== +uuid@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294" + integrity sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ== + +uuidv4@^6.2.13: + version "6.2.13" + resolved "https://registry.yarnpkg.com/uuidv4/-/uuidv4-6.2.13.tgz#8f95ec5ef22d1f92c8e5d4c70b735d1c89572cb7" + integrity sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ== + dependencies: + "@types/uuid" "8.3.4" + uuid "8.3.2" v8-to-istanbul@^9.0.1: - version "9.2.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" - integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== dependencies: "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" @@ -13000,37 +12244,11 @@ v8flags@^3.1.1: dependencies: homedir-polyfill "^1.0.1" -varint-decoder@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/varint-decoder/-/varint-decoder-1.0.0.tgz#289dab7887ee58d0c7be3a3353abeab4ca60aa77" - integrity sha512-JkOvdztASWGUAsXshCFHrB9f6AgR2Q8W08CEyJ+43b1qtFocmI8Sp1R/M0E/hDOY2FzVIqk63tOYLgDYWuJ7IQ== - dependencies: - varint "^5.0.0" - -varint@^5.0.0, varint@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" - integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== - varint@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0" integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" @@ -13050,6 +12268,21 @@ wasmcurves@0.2.0: dependencies: wasmbuilder "0.0.16" +wasmcurves@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/wasmcurves/-/wasmcurves-0.2.2.tgz#ca444f6a6f6e2a5cbe6629d98ff478a62b4ccb2b" + integrity sha512-JRY908NkmKjFl4ytnTu5ED6AwPD+8VJ9oc94kdq7h5bIwbj0L4TDJ69mG+2aLs2SoCmGfqIesMWTEJjtYsoQXQ== + dependencies: + wasmbuilder "0.0.16" + +weald@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/weald/-/weald-1.0.2.tgz#a51fb3a8dbf5fa2b71ef09f9a267c86a46742238" + integrity sha512-iG5cIuBwsPe1ZcoGGd4X6QYlepU1vLr4l4oWpzQWqeJPSo9B8bxxyE6xlnj3TCmThtha7gyVL+uuZgUFkPyfDg== + dependencies: + ms "^3.0.0-canary.1" + supports-color "^9.4.0" + web-streams-node@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/web-streams-node/-/web-streams-node-0.4.0.tgz#641e42d7a7c4df95785a774e2484ba93d36fd672" @@ -13060,265 +12293,29 @@ web-streams-node@^0.4.0: web-streams-ponyfill "^1.4.1" web-streams-polyfill@^3.0.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== web-streams-ponyfill@^1.4.1: version "1.4.2" resolved "https://registry.yarnpkg.com/web-streams-ponyfill/-/web-streams-ponyfill-1.4.2.tgz#0ae863cc5f7493903679f16b08cbf14d432b62f4" integrity sha512-LCHW+fE2UBJ2vjhqJujqmoxh1ytEDEr0dPO3CabMdMDJPKmsaxzS90V1Ar6LtNE5VHLqxR4YMEj1i4lzMAccIA== -web-worker@^1.2.0: +web-worker@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.2.0.tgz#5d85a04a7fbc1e7db58f66595d7a3ac7c9c180da" integrity sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA== -web3-bzz@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.8.0.tgz#2023676d7c17ea36512bf76eb310755a02a3d464" - integrity sha512-caDtdKeLi7+2Vb+y+cq2yyhkNjnxkFzVW0j1DtemarBg3dycG1iEl75CVQMLNO6Wkg+HH9tZtRnUyFIe5LIUeQ== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - -web3-core-helpers@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.8.0.tgz#5dcfdda1a4ea277041d912003198f1334ca29d7c" - integrity sha512-nMAVwZB3rEp/khHI2BvFy0e/xCryf501p5NGjswmJtEM+Zrd3Biaw52JrB1qAZZIzCA8cmLKaOgdfamoDOpWdw== - dependencies: - web3-eth-iban "1.8.0" - web3-utils "1.8.0" - -web3-core-method@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.8.0.tgz#9c2da8896808917d1679c319f19e2174ba17086c" - integrity sha512-c94RAzo3gpXwf2rf8rL8C77jOzNWF4mXUoUfZYYsiY35cJFd46jQDPI00CB5+ZbICTiA5mlVzMj4e7jAsTqiLA== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.8.0" - web3-core-promievent "1.8.0" - web3-core-subscriptions "1.8.0" - web3-utils "1.8.0" - -web3-core-promievent@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.8.0.tgz#979765fd4d37ab0f158f0ee54037b279b737bd53" - integrity sha512-FGLyjAuOaAQ+ZhV6iuw9tg/9WvIkSZXKHQ4mdTyQ8MxVraOtFivOCbuLLsGgapfHYX+RPxsc1j1YzQjKoupagQ== - dependencies: - eventemitter3 "4.0.4" - -web3-core-requestmanager@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.8.0.tgz#06189df80cf52d24a195a7ef655031afe8192df3" - integrity sha512-2AoYCs3Owl5foWcf4uKPONyqFygSl9T54L8b581U16nsUirjhoTUGK/PBhMDVcLCmW4QQmcY5A8oPFpkQc1TTg== - dependencies: - util "^0.12.0" - web3-core-helpers "1.8.0" - web3-providers-http "1.8.0" - web3-providers-ipc "1.8.0" - web3-providers-ws "1.8.0" - -web3-core-subscriptions@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.8.0.tgz#ff66ae4467c8cb4716367248bcefb1845c0f8b83" - integrity sha512-7lHVRzDdg0+Gcog55lG6Q3D8JV+jN+4Ly6F8cSn9xFUAwOkdbgdWsjknQG7t7CDWy21DQkvdiY2BJF8S68AqOA== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.8.0" - -web3-core@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.8.0.tgz#90afce527ac1b1dff8cbed2acbc0336530b8aacf" - integrity sha512-9sCA+Z02ci6zoY2bAquFiDjujRwmSKHiSGi4B8IstML8okSytnzXk1izHYSynE7ahIkguhjWAuXFvX76F5rAbA== - dependencies: - "@types/bn.js" "^5.1.0" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.8.0" - web3-core-method "1.8.0" - web3-core-requestmanager "1.8.0" - web3-utils "1.8.0" - -web3-eth-abi@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.8.0.tgz#47fdff00bfdfa72064c9c612ff6369986598196d" - integrity sha512-xPeMb2hS9YLQK/Q5YZpkcmzoRGM+/R8bogSrYHhNC3hjZSSU0YRH+1ZKK0f9YF4qDZaPMI8tKWIMSCDIpjG6fg== - dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.8.0" - -web3-eth-accounts@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.8.0.tgz#960d947ee87a49d6c706dc6312334fbfbd6ff812" - integrity sha512-HQ/MDSv4bexwJLvnqsM6xpGE7c2NVOqyhzOZFyMUKXbIwIq85T3TaLnM9pCN7XqMpDcfxqiZ3q43JqQVkzHdmw== - dependencies: - "@ethereumjs/common" "^2.5.0" - "@ethereumjs/tx" "^3.3.2" - crypto-browserify "3.12.0" - eth-lib "0.2.8" - ethereumjs-util "^7.0.10" - scrypt-js "^3.0.1" - uuid "3.3.2" - web3-core "1.8.0" - web3-core-helpers "1.8.0" - web3-core-method "1.8.0" - web3-utils "1.8.0" - -web3-eth-contract@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.8.0.tgz#58f4ce0bde74e5ce87663502e409a92abad7b2c5" - integrity sha512-6xeXhW2YoCrz2Ayf2Vm4srWiMOB6LawkvxWJDnUWJ8SMATg4Pgu42C/j8rz/enXbYWt2IKuj0kk8+QszxQbK+Q== - dependencies: - "@types/bn.js" "^5.1.0" - web3-core "1.8.0" - web3-core-helpers "1.8.0" - web3-core-method "1.8.0" - web3-core-promievent "1.8.0" - web3-core-subscriptions "1.8.0" - web3-eth-abi "1.8.0" - web3-utils "1.8.0" - -web3-eth-ens@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.8.0.tgz#f1937371eac54b087ebe2e871780c2710d39998d" - integrity sha512-/eFbQEwvsMOEiOhw9/iuRXCsPkqAmHHWuFOrThQkozRgcnSTRnvxkkRC/b6koiT5/HaKeUs4yQDg+/ixsIxZxA== - dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.8.0" - web3-core-helpers "1.8.0" - web3-core-promievent "1.8.0" - web3-eth-abi "1.8.0" - web3-eth-contract "1.8.0" - web3-utils "1.8.0" - -web3-eth-iban@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.8.0.tgz#3af8a0c95b5f7b0b81ab0bcd2075c1e5dda31520" - integrity sha512-4RbvUxcMpo/e5811sE3a6inJ2H4+FFqUVmlRYs0RaXaxiHweahSRBNcpO0UWgmlePTolj0rXqPT2oEr0DuC8kg== - dependencies: - bn.js "^5.2.1" - web3-utils "1.8.0" - -web3-eth-personal@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.8.0.tgz#433c35e2e042844402a12d543c4126ea1494b478" - integrity sha512-L7FT4nR3HmsfZyIAhFpEctKkYGOjRC2h6iFKs9gnFCHZga8yLcYcGaYOBIoYtaKom99MuGBoosayWt/Twh7F5A== - dependencies: - "@types/node" "^12.12.6" - web3-core "1.8.0" - web3-core-helpers "1.8.0" - web3-core-method "1.8.0" - web3-net "1.8.0" - web3-utils "1.8.0" - -web3-eth@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.8.0.tgz#006974a5d5e30644d05814111f9e162a72e4a09c" - integrity sha512-hist52os3OT4TQFB/GxPSMxTh3995sz6LPvQpPvj7ktSbpg9RNSFaSsPlCT63wUAHA3PZb1FemkAIeQM5t72Lw== - dependencies: - web3-core "1.8.0" - web3-core-helpers "1.8.0" - web3-core-method "1.8.0" - web3-core-subscriptions "1.8.0" - web3-eth-abi "1.8.0" - web3-eth-accounts "1.8.0" - web3-eth-contract "1.8.0" - web3-eth-ens "1.8.0" - web3-eth-iban "1.8.0" - web3-eth-personal "1.8.0" - web3-net "1.8.0" - web3-utils "1.8.0" - -web3-net@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.8.0.tgz#9acff92d7c647d801bc68df0ff4416f104dbe789" - integrity sha512-kX6EAacK7QrOe7DOh0t5yHS5q2kxZmTCxPVwSz9io9xBeE4n4UhmzGJ/VfhP2eM3OPKYeypcR3LEO6zZ8xn2vw== - dependencies: - web3-core "1.8.0" - web3-core-method "1.8.0" - web3-utils "1.8.0" - -web3-providers-http@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.8.0.tgz#3fd1e569ead2095343fac17d53160a3bae674c23" - integrity sha512-/MqxwRzExohBWW97mqlCSW/+NHydGRyoEDUS1bAIF2YjfKFwyRtHgrEzOojzkC9JvB+8LofMvbXk9CcltpZapw== - dependencies: - abortcontroller-polyfill "^1.7.3" - cross-fetch "^3.1.4" - es6-promise "^4.2.8" - web3-core-helpers "1.8.0" - -web3-providers-ipc@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.8.0.tgz#d339a24c4d764e459e425d3ac868a551ac33e3ea" - integrity sha512-tAXHtVXNUOgehaBU8pzAlB3qhjn/PRpjdzEjzHNFqtRRTwzSEKOJxFeEhaUA4FzHnTlbnrs8ujHWUitcp1elfg== - dependencies: - oboe "2.1.5" - web3-core-helpers "1.8.0" - -web3-providers-ws@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.8.0.tgz#a0a73e0606981ea32bed40d215000a64753899de" - integrity sha512-bcZtSifsqyJxwkfQYamfdIRp4nhj9eJd7cxHg1uUkfLJK125WP96wyJL1xbPt7qt0MpfnTFn8/UuIqIB6nFENg== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.8.0" - websocket "^1.0.32" - -web3-shh@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.8.0.tgz#b4abbf4f59d097ce2f74360e61e2e5c0bd6507c7" - integrity sha512-DNRgSa9Jf9xYFUGKSMylrf+zt3MPjhI2qF+UWX07o0y3+uf8zalDGiJOWvIS4upAsdPiKKVJ7co+Neof47OMmg== - dependencies: - web3-core "1.8.0" - web3-core-method "1.8.0" - web3-core-subscriptions "1.8.0" - web3-net "1.8.0" - -web3-utils@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.8.0.tgz#0a506f8c6af9a2ad6ba79689892662769534fc03" - integrity sha512-7nUIl7UWpLVka2f09CMbKOSEvorvHnaugIabU4mj7zfMvm0tSByLcEu3eyV9qgS11qxxLuOkzBIwCstTflhmpQ== - dependencies: - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereumjs-util "^7.1.0" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" +web-worker@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.3.0.tgz#e5f2df5c7fe356755a5fb8f8410d4312627e6776" + integrity sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA== -web3@^1.7.5: +webcrypto-core@^1.8.0: version "1.8.0" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.8.0.tgz#3ca5f0b32de6a1f626407740411219035b5fde64" - integrity sha512-sldr9stK/SALSJTgI/8qpnDuBJNMGjVR84hJ+AcdQ+MLBGLMGsCDNubCoyO6qgk1/Y9SQ7ignegOI/7BPLoiDA== - dependencies: - web3-bzz "1.8.0" - web3-core "1.8.0" - web3-eth "1.8.0" - web3-eth-personal "1.8.0" - web3-net "1.8.0" - web3-shh "1.8.0" - web3-utils "1.8.0" - -webcrypto-core@^1.7.7: - version "1.7.7" - resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.7.tgz#06f24b3498463e570fed64d7cab149e5437b162c" - integrity sha512-7FjigXNsBfopEj+5DV2nhNpfic2vumtjjgPmeDKk45z+MJwXKKfhPB7118Pfzrmh4jqOMST6Ch37iPAHoImg5g== - dependencies: - "@peculiar/asn1-schema" "^2.3.6" - "@peculiar/json-schema" "^1.1.12" - asn1js "^3.0.1" - pvtsutils "^1.3.2" - tslib "^2.4.0" - -webcrypto-core@^1.7.8: - version "1.7.8" - resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.8.tgz#056918036e846c72cfebbb04052e283f57f1114a" - integrity sha512-eBR98r9nQXTqXt/yDRtInszPMjTaSAMJAFDg2AHsgrnczawT1asx9YNBX6k5p+MekbPF4+s/UJJrr88zsTqkSg== + resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.8.0.tgz#aaea17f3dd9c77c304e3c494eb27ca07cc72ca37" + integrity sha512-kR1UQNH8MD42CYuLzvibfakG5Ew5seG85dMMoAM/1LqvckxaF6pUiidLuraIu4V+YCIFabYecUZAW0TuxAoaqw== dependencies: "@peculiar/asn1-schema" "^2.3.8" "@peculiar/json-schema" "^1.1.12" @@ -13336,18 +12333,6 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -websocket@^1.0.32: - version "1.0.34" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" - integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.50" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -13375,26 +12360,25 @@ which-boxed-primitive@^1.0.1, which-boxed-primitive@^1.0.2: is-symbol "^1.0.3" which-collection@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" - integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.2.tgz#627ef76243920a107e7ce8e96191debe4b16c2a0" + integrity sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw== dependencies: - is-map "^2.0.1" - is-set "^2.0.1" - is-weakmap "^2.0.1" - is-weakset "^2.0.1" + is-map "^2.0.3" + is-set "^2.0.3" + is-weakmap "^2.0.2" + is-weakset "^2.0.3" -which-typed-array@^1.1.2: - version "1.1.8" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.8.tgz#0cfd53401a6f334d90ed1125754a42ed663eb01f" - integrity sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw== +which-typed-array@^1.1.13, which-typed-array@^1.1.14, which-typed-array@^1.1.15, which-typed-array@^1.1.2: + version "1.1.15" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.15.tgz#264859e9b11a649b388bfaaf4f767df1f779b38d" + integrity sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA== dependencies: - available-typed-arrays "^1.0.5" - call-bind "^1.0.2" - es-abstract "^1.20.0" + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" for-each "^0.3.3" - has-tostringtag "^1.0.0" - is-typed-array "^1.1.9" + gopd "^1.0.1" + has-tostringtag "^1.0.2" which@^1.2.9: version "1.3.1" @@ -13410,36 +12394,36 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -winston-transport@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.5.0.tgz#6e7b0dd04d393171ed5e4e4905db265f7ab384fa" - integrity sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q== +winston-transport@^4.7.0: + version "4.7.1" + resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.7.1.tgz#52ff1bcfe452ad89991a0aaff9c3b18e7f392569" + integrity sha512-wQCXXVgfv/wUPOfb2x0ruxzwkcZfxcktz6JIMUaPLmcNhO4bZTwA/WtDWK74xV3F2dKu8YadrFv0qhwYjVEwhA== dependencies: - logform "^2.3.2" - readable-stream "^3.6.0" + logform "^2.6.1" + readable-stream "^3.6.2" triple-beam "^1.3.0" winston@^3.3.3: - version "3.8.2" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.8.2.tgz#56e16b34022eb4cff2638196d9646d7430fdad50" - integrity sha512-MsE1gRx1m5jdTTO9Ld/vND4krP2To+lgDoMEHGGa4HIlAUyXJtfc7CxQcGXVyz2IBpw5hbFkj2b/AtUdQwyRew== + version "3.14.1" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.14.1.tgz#b296f2756e6b46d3b6faac5660d2af878fc3f666" + integrity sha512-CJi4Il/msz8HkdDfXOMu+r5Au/oyEjFiOZzbX2d23hRLY0narGjqfE5lFlrT5hfYJhPtM8b85/GNFsxIML/RVA== dependencies: - "@colors/colors" "1.5.0" + "@colors/colors" "^1.6.0" "@dabh/diagnostics" "^2.0.2" async "^3.2.3" is-stream "^2.0.0" - logform "^2.4.0" + logform "^2.6.0" one-time "^1.0.0" readable-stream "^3.4.0" safe-stable-stringify "^2.3.1" stack-trace "0.0.x" triple-beam "^1.3.0" - winston-transport "^4.5.0" + winston-transport "^4.7.0" -word-wrap@~1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== wrap-ansi@^7.0.0: version "7.0.0" @@ -13463,81 +12447,27 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" -write@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" - ws@7.4.6: version "7.4.6" resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - -ws@^8.15.1, ws@^8.16.0, ws@^8.4.0: - version "8.16.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" - integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== +ws@^7: + version "7.5.10" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" + integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== -ws@^8.8.1: - version "8.10.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.10.0.tgz#00a28c09dfb76eae4eb45c3b565f771d6951aa51" - integrity sha512-+s49uSmZpvtAsd2h37vIPy1RBusaLawVe8of+GyEPsaJTCMpj/2v8NpeK1SHXjBlQ95lQTmQofOJnFiLoaN3yw== - -xhr-request-promise@^0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" - integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== - dependencies: - xhr-request "^1.1.0" - -xhr-request@^1.0.1, xhr-request@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" - integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" +ws@^8.15.1, ws@^8.17.0, ws@^8.4.0, ws@^8.8.1: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== xhr2@0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/xhr2/-/xhr2-0.1.3.tgz#cbfc4759a69b4a888e78cf4f20b051038757bd11" integrity sha512-6RmGK22QwC7yXB1CRwyLWuS2opPcKOlAu0ViAnyZjDlzrEmCKL4kLHkfvB8oMRWeztMsNoDGAjsMZY15w/4tTw== -xhr@^2.0.4, xhr@^2.3.3: - version "2.6.0" - resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d" - integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== - dependencies: - global "~4.4.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" - -xml2js@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7" - integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q== - dependencies: - sax ">=0.6.0" - xmlbuilder "~9.0.1" - -xml2js@^0.6.0, xml2js@^0.6.2: +xml2js@0.6.2, xml2js@^0.6.0, xml2js@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.6.2.tgz#dd0b630083aa09c161e25a4d0901e2b2a929b499" integrity sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA== @@ -13555,11 +12485,6 @@ xmlbuilder@~11.0.0: resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3" integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== -xmlbuilder@~9.0.1: - version "9.0.7" - resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" - integrity sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ== - xmlcreate@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be" @@ -13570,7 +12495,15 @@ xmlhttprequest@1.8.0: resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" integrity sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA== -xtend@^4.0.0, xtend@~4.0.1: +xstream@^11.14.0: + version "11.14.0" + resolved "https://registry.yarnpkg.com/xstream/-/xstream-11.14.0.tgz#2c071d26b18310523b6877e86b4e54df068a9ae5" + integrity sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw== + dependencies: + globalthis "^1.0.1" + symbol-observable "^2.0.3" + +xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== @@ -13580,12 +12513,12 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A== -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== @@ -13595,25 +12528,12 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@^21.0.0, yargs-parser@^21.1.1: +yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^17.1.1: - version "17.6.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.0.tgz#e134900fc1f218bc230192bdec06a0a5f973e46c" - integrity sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.0.0" - -yargs@^17.3.1: +yargs@^17.1.1, yargs@^17.3.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==