diff --git a/.github/actions/build-napi/action.yml b/.github/actions/build-napi/action.yml new file mode 100644 index 0000000000..65175b6e22 --- /dev/null +++ b/.github/actions/build-napi/action.yml @@ -0,0 +1,65 @@ +name: 'build-napi-artifact' +description: | + Builds napi artifact using specified settings' + +inputs: + docker: + required: true + target: + required: true + build: + required: true + node-version: + default: 18 + rust-version: + default: 1.64.0 + +runs: + using: "composite" + steps: + - name: Setup node + uses: actions/setup-node@v3 + if: ${{ !inputs.docker }} + with: + node-version: ${{ inputs.node-version }} + cache: npm + cache-dependency-path: ${{ github.workspace }}/wrappers/vcx-napi-rs/package-lock.json + - name: Install + uses: actions-rs/toolchain@v1 + if: ${{ !inputs.docker }} + with: + toolchain: ${{ inputs.rust-version }} + target: ${{ inputs.target }} + default: true + - name: Cache cargo + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + .cargo-cache + target/ + key: ${{ inputs.target }}-cargo-registry + - name: Install dependencies + run: npm install + working-directory: ${{ github.workspace }}/wrappers/vcx-napi-rs + shell: bash + - name: Build in docker + uses: addnab/docker-run-action@v3 + if: ${{ inputs.docker }} + with: + image: ${{ inputs.docker }} + options: -v /home/runner/.cargo/git/db:/root/.cargo/git/db -v /home/runner/.cargo/registry/cache:/root/.cargo/registry/cache -v /home/runner/.cargo/registry/index:/root/.cargo/registry/index -v ${{ github.workspace }}:/build -w /build + run: ${{ inputs.build }} + - name: Build + run: ${{ inputs.build }} + if: ${{ !inputs.docker }} + working-directory: ${{ github.workspace }}/wrappers/vcx-napi-rs + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bindings-${{ inputs.target }} + path: ${{ github.workspace }}/wrappers/vcx-napi-rs/*.node + if-no-files-found: error diff --git a/.github/actions/detect-skip-info/action.yml b/.github/actions/detect-skip-info/action.yml index 57090321a6..0dd6e3e5fd 100644 --- a/.github/actions/detect-skip-info/action.yml +++ b/.github/actions/detect-skip-info/action.yml @@ -17,17 +17,24 @@ runs: shell: bash run: | if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip-ios') }}" == "true" ]]; then - echo "Detected tag to skip E2E tests" + echo "Detected tag to skip ios" echo "skip-ios=true" >> $GITHUB_OUTPUT else echo "skip-ios=false" >> $GITHUB_OUTPUT fi - + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip-android') }}" == "true" ]]; then - echo "Detected tag to skip E2E tests" + echo "Detected tag to skip android" echo "skip-android=true" >> $GITHUB_OUTPUT - else + else echo "skip-android=false" >> $GITHUB_OUTPUT fi; - + + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip-napi-m1') }}" == "true" ]]; then + echo "Detected tag to skip M1 napi build" + echo "skip-napi-m1=true" >> $GITHUB_OUTPUT + else + echo "skip-napi-m1=false" >> $GITHUB_OUTPUT + fi; + echo "Finished, GITHUB_OUTPUT:\n`cat $GITHUB_OUTPUT`" diff --git a/.github/actions/publish-napi/action.yml b/.github/actions/publish-napi/action.yml new file mode 100644 index 0000000000..66532f9832 --- /dev/null +++ b/.github/actions/publish-napi/action.yml @@ -0,0 +1,52 @@ +name: 'publish-napi' +description: | + Publishes vcx-napi-rs node packages + +inputs: + publish-version: + required: true + npmjs-token: + required: true + node-version: + default: 18 + +runs: + using: "composite" + steps: + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.node-version }} + cache: npm + cache-dependency-path: ${{ github.workspace }}/wrappers/vcx-napi-rs/package-lock.json + - name: Install dependencies + run: npm install + working-directory: ${{ github.workspace }}/wrappers/vcx-napi-rs + shell: bash + - name: Download napi artifacts + uses: actions/download-artifact@v3 + with: + path: ${{ github.workspace }}/wrappers/vcx-napi-rs/artifacts + - name: Move artifacts + run: | + find . -type d -not -path \*\*/artifacts/bindings-\* -path \*\*/artifacts/\*\* -mindepth 2 -maxdepth 2 -exec rm -rf {} \+ + ls -R artifacts + npm run artifacts + working-directory: ${{ github.workspace }}/wrappers/vcx-napi-rs + shell: bash + - name: Publish + run: | + if [[ "$PUBLISH_VERSION" ]] + then + npm set "//registry.npmjs.org/:_authToken" $NPMJS_TOKEN + npm version $PUBLISH_VERSION + npm run prepublish + npm publish + else + echo "New version was not defined, skipping release." + fi + working-directory: ${{ github.workspace }}/wrappers/vcx-napi-rs + shell: bash + env: + NPMJS_TOKEN: ${{ inputs.npmjs-token }} + PUBLISH_VERSION: ${{ inputs.publish-version }} diff --git a/.github/actions/setup-testing-nodejs/action.yml b/.github/actions/setup-testing-nodejs/action.yml index 4d56aa16b8..72fd13640b 100644 --- a/.github/actions/setup-testing-nodejs/action.yml +++ b/.github/actions/setup-testing-nodejs/action.yml @@ -39,6 +39,14 @@ runs: docker run --rm -d --name indypool --network host ${{ env.DOCKER_IMAGE_POOL }} sleep 5 docker-compose -f ./ci/agency/docker-compose.yml up -d + - name: "Build binding module" + shell: bash + run: (cd wrappers/vcx-napi-rs && npm install && npm run build:napi:debug) - name: "Transpile TS wrapper" shell: bash - run: (cd wrappers/node && npm install && npm run tscversion && npm run compile) + run: (cd wrappers/node && npm install && npm run compile) + - name: "Check wrappers" + shell: bash + run: | + ls -lah wrappers/vcx-napi-rs + ls -lah wrappers/node diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e852dcee0e..e78197a422 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,9 @@ env: DOCKER_REPO_LOCAL_LIBVCX: libvcx DOCKER_REPO_LOCAL_ANDROID: android-test + RUST_TOOLCHAIN_VERSON: 1.64.0 + NODE_VERSION: 18 + jobs: verify-code-formatting: runs-on: ubuntu-20.04 @@ -44,6 +47,7 @@ jobs: SKIP_IOS: ${{ steps.skip-info.outputs.skip-ios }} SKIP_ANDROID: ${{ steps.skip-info.outputs.skip-android }} + SKIP_NAPI_M1: ${{ steps.skip-info.outputs.skip-napi-m1 }} DOCKER_IMG_CACHED_ALPINE_CORE: ${{ steps.docker-imgs.outputs.DOCKER_IMG_CACHED_ALPINE_CORE }} DOCKER_IMG_CACHED_LIBVCX: ${{ steps.docker-imgs.outputs.DOCKER_IMG_CACHED_LIBVCX }} @@ -377,7 +381,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node-version: [12.x, 18.x, 19.x] + node-version: [12.x, 18.x] steps: - name: "Git checkout" uses: actions/checkout@v3 @@ -387,14 +391,14 @@ jobs: skip-docker-setup: true node-version: ${{ matrix.node-version }} - name: "Run tests" - run: cd wrappers/node && npm run test + run: cd wrappers/node && RUST_LOG=vcx=trace npm run test test-integration-node-wrapper: needs: workflow-setup runs-on: ubuntu-20.04 strategy: matrix: - node-version: [12.x, 18.x, 19.x] + node-version: [12.x, 18.x] steps: - name: "Git checkout" uses: actions/checkout@v3 @@ -635,10 +639,10 @@ jobs: steps: - name: "Git checkout" uses: actions/checkout@v3 - - name: Use Node.js 12 + - name: Use Node.js 18 uses: actions/setup-node@v3 with: - node-version: 12.x + node-version: 18.x - name: "Run tests" run: | if [[ "$PUBLISH_VERSION" ]] @@ -679,6 +683,85 @@ jobs: echo "New version was not defined, skipping release." fi + build-napi: + needs: + - workflow-setup + strategy: + fail-fast: false + matrix: + settings: + - host: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + build: |- + set -e + sudo apt-get update -y + sudo apt-get install -y libssl-dev libzmq3-dev + npm run build:napi -- --target x86_64-unknown-linux-gnu + strip *.node + - host: ubuntu-20.04 + target: x86_64-unknown-linux-musl + docker: ghcr.io/hyperledger/aries-vcx/napi-rs-alpine + build: |- + set -e + cd wrappers/vcx-napi-rs + npm run build:napi + strip *.node + - host: macos-latest + target: x86_64-apple-darwin + build: | + brew install openssl zmq + npm run build:napi + strip -x *.node + - host: macos-latest + target: aarch64-apple-darwin + skip: ${{ needs.workflow-setup.outputs.SKIP_NAPI_M1 }} + build: | + wget https://github.com/macports/macports-base/releases/download/v2.8.0/MacPorts-2.8.0-12-Monterey.pkg + sudo installer -pkg ./MacPorts-2.8.0-12-Monterey.pkg -target / + export PATH=/opt/local/bin:/opt/local/sbin:$PATH + + sudo port install openssl +universal zmq +universal + export OPENSSL_DIR=/opt/local + export OPENSSL_INCLUDE_DIR=/opt/local/include/ + export OPENSSL_LIB_DIR=/opt/local/lib/ + + export SODIUM_LIB_DIR=/opt/local/lib/ + export SODIUM_INCLUDE_DIR=/opt/local/include + + export LIBZMQ_LIB_DIR=/opt/local/lib/ + export LIBZMQ_INCLUDE_DIR=/opt/local/include + + export PKG_CONFIG_ALLOW_CROSS=1 + export PKG_CONFIG_SYSROOT_DIR=/ + export RUST_BACKTRACE=1 + npm run build:napi -- --target aarch64-apple-darwin + strip -x *.node + name: ${{ matrix.settings.target }} + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/build-napi + if: ${{ matrix.settings.skip != 'true' }} + with: + docker: ${{ matrix.settings.docker }} + target: ${{ matrix.settings.target }} + build: ${{ matrix.settings.build }} + node-version: ${{ env.NODE_VERSION }} + rust-version: ${{ env.RUST_TOOLCHAIN_VERSON }} + + publish-napi: + runs-on: ubuntu-20.04 + needs: + - workflow-setup + - build-napi + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/publish-napi + with: + publish-version: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + npmjs-token: ${{ secrets.NPMJS_TOKEN }} + node-version: ${{ env.NODE_VERSION }} + # ########################################################################################## # ############################## RELEASE ######################################### diff --git a/.gitignore b/.gitignore index f453a11d53..63bbf362f3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ **/target **/.DS_Store **/node_modules +**/*.node wrappers/ios/vcx/vcx.framework/** wrappers/ios/vcx/vcx.framework.dSYM/** wrappers/ios_legacy/vcx/vcx.framework/** diff --git a/Cargo.lock b/Cargo.lock index 9c372249a0..77761ac61c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -192,7 +192,7 @@ dependencies = [ "indy-credx", "indy-vdr", "lazy_static", - "libloading", + "libloading 0.5.2", "libvdrtools", "log", "messages", @@ -673,6 +673,15 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e1f025f441cdfb75831bec89b9d6a6ed02e5e763f78fc5e1ff30d4870fefaec" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -1389,7 +1398,6 @@ dependencies = [ "futures-core", "futures-task", "futures-util", - "num_cpus", ] [[package]] @@ -2080,6 +2088,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if 1.0.0", + "winapi", +] + [[package]] name = "libm" version = "0.2.6" @@ -2143,8 +2161,7 @@ dependencies = [ "bs58 0.4.0", "byteorder", "cfg-if 1.0.0", - "convert_case", - "env_logger 0.9.3", + "convert_case 0.3.2", "etcommon-rlp", "failure", "futures", @@ -2159,7 +2176,6 @@ dependencies = [ "log-panics", "num-derive", "num-traits", - "num_cpus", "rand 0.8.5", "regex", "rmp-serde", @@ -2332,6 +2348,62 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4330eca86d39f2b52d0481aa1e90fe21bfa61f11b0bf9b48ab95595013cefe48" +[[package]] +name = "napi" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fece4c26c5132f8559080145fde9ba88700c0f1aa30a1ab3e057ab105814d" +dependencies = [ + "bitflags", + "ctor", + "napi-sys", + "once_cell", + "thread_local", + "tokio", +] + +[[package]] +name = "napi-build" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a73d9ef23e8dc2ebbffb6a6ae2ef467c0f18ac10711e4cc59c5485d41df0e" + +[[package]] +name = "napi-derive" +version = "2.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4e44e34e70aa61be9036ae652e27c20db5bca80e006be0f482419f6601352a" +dependencies = [ + "convert_case 0.6.0", + "napi-derive-backend", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "napi-derive-backend" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17925fff04b6fa636f8e4b4608cc1a4f1360b64ac8ecbfdb7da1be1dc74f6843" +dependencies = [ + "convert_case 0.6.0", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "napi-sys" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529671ebfae679f2ce9630b62dd53c72c56b3eb8b2c852e7e2fa91704ff93d67" +dependencies = [ + "libloading 0.7.4", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -3689,6 +3761,15 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + [[package]] name = "time" version = "0.1.45" @@ -3995,6 +4076,17 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vcx-napi-rs" +version = "0.51.1" +dependencies = [ + "libvcx", + "log", + "napi", + "napi-build", + "napi-derive", +] + [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 8553f2885d..e83f85f2db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,8 @@ members = [ "messages", "shared_vcx", "diddoc", - "agents/rust/aries-vcx-agent" + "agents/rust/aries-vcx-agent", + "wrappers/vcx-napi-rs", ] [workspace.package] diff --git a/agents/node/vcxagent-core/demo/alice.js b/agents/node/vcxagent-core/demo/alice.js index 5d23f2781d..5e7f3010ff 100644 --- a/agents/node/vcxagent-core/demo/alice.js +++ b/agents/node/vcxagent-core/demo/alice.js @@ -1,6 +1,5 @@ const readlineSync = require('readline-sync') const sleepPromise = require('sleep-promise') -const { initRustapi } = require('../src/index') const { createVcxAgent } = require('../src/index') const { testTailsUrl } = require('../src/common') const logger = require('./logger')('Alice') @@ -12,6 +11,7 @@ const url = require('url') const { extractProofRequestAttachement } = require('../src/utils/proofs') const assert = require('assert') const { getStorageInfoMysql } = require('./wallet-common') +const { initRustLogger } = require('../src') const mapRevRegIdToTailsFile = (_revRegId) => '/tmp/tails' @@ -43,7 +43,7 @@ async function getInvitationString (fetchInviteUrl) { async function runAlice (options) { logger.info('Starting.') - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error,agency_client=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') const agentName = `alice-${uuid.v4()}` const connectionId = 'alice-to-faber' const holderCredentialId = 'alice-credential' diff --git a/agents/node/vcxagent-core/demo/faber.js b/agents/node/vcxagent-core/demo/faber.js index bc107f39b8..0aed280567 100644 --- a/agents/node/vcxagent-core/demo/faber.js +++ b/agents/node/vcxagent-core/demo/faber.js @@ -7,18 +7,19 @@ const uuid = require('uuid') const express = require('express') const bodyParser = require('body-parser') const { getFaberProofDataWithNonRevocation } = require('../test/utils/data') -const { createVcxAgent, initRustapi, getSampleSchemaData } = require('../src/index') +const { createVcxAgent, getSampleSchemaData } = require('../src/index') const { getAliceSchemaAttrs, getFaberCredDefName } = require('../test/utils/data') require('@hyperledger/node-vcx-wrapper') const { getStorageInfoMysql } = require('./wallet-common') const sleep = require('sleep-promise') -const { testTailsUrl } = require('../src') +const { testTailsUrl, initRustLogger } = require('../src') const tailsDir = '/tmp/tails' async function runFaber (options) { logger.info(`Starting. Revocation enabled=${options.revocation}`) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error,agency_client=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') + let faberServer let exitcode = 0 let vcxAgent @@ -111,6 +112,7 @@ async function runFaber (options) { logger.info('#27 Process the proof provided by alice.') const { proofState, proof } = await vcxProof.getProof() + logger.info(`#27 Proof: proofState=${proofState}, proof=${proof}`) assert(proofState) assert(proof) logger.info(`Proof protocol state = ${JSON.stringify(proofProtocolState)}`) diff --git a/agents/node/vcxagent-core/package.json b/agents/node/vcxagent-core/package.json index ac5f92e77f..2d6b1db66b 100644 --- a/agents/node/vcxagent-core/package.json +++ b/agents/node/vcxagent-core/package.json @@ -38,7 +38,7 @@ "test:integration": "npm run test:integration:issue-verify && npm run test:integration:signing && npm run test:integration:messaging && npm run test:integration:tails && npm run test:integration:trustping && npm run test:integration:feature-discovery && npm run test:integration:public-invite && npm run test:integration:out-of-band && npm run test:integration:nonmediation", "test:integration:issue-verify": "jest --forceExit --env=node --runInBand test/issue-verify.spec.js", "test:integration:signing": "jest --forceExit --env=node --runInBand test/sign-verify.spec.js", - "test:integration:messaging": "jest --forceExit --env=node --runInBand test/sign-messaging.spec.js", + "test:integration:messaging": "jest --forceExit --env=node --runInBand test/messaging.spec.js", "test:integration:tails": "jest --forceExit --env=node --runInBand test/distribute-tails.spec.js", "test:integration:trustping": "jest --forceExit --env=node --runInBand test/trustping.spec.js", "test:integration:feature-discovery": "jest --forceExit --env=node --runInBand test/feature-discovery.spec.js", @@ -69,6 +69,6 @@ "winston": "^3.3.3" }, "peerDependencies": { - "@hyperledger/node-vcx-wrapper": "^0.51.1" + "@hyperledger/node-vcx-wrapper": "^0.50.0-featurenapi-rs-separate-crate-4208" } } diff --git a/agents/node/vcxagent-core/src/agent.js b/agents/node/vcxagent-core/src/agent.js index 80283fcd2c..7fe762fecc 100644 --- a/agents/node/vcxagent-core/src/agent.js +++ b/agents/node/vcxagent-core/src/agent.js @@ -10,7 +10,6 @@ const { createServiceOutOfBand } = require('./services/service-out-of-band') const { createServiceLedgerRevocationRegistry } = require('./services/service-revocation-registry') const { provisionAgentInAgency } = require('./utils/vcx-workflows') const { - initThreadpool, createAgencyClientForMainWallet, initIssuerConfig, openMainWallet, @@ -38,8 +37,6 @@ async function createVcxAgent ({ agentName, genesisPath, agencyUrl, seed, wallet async function agentInitVcx () { logger.info(`Initializing ${agentName} vcx session.`) logger.silly(`Using following agent provision to initialize VCX settings ${JSON.stringify(agentProvision, null, 2)}`) - logger.silly('Initializing threadpool') - await initThreadpool({}) logger.silly('Initializing issuer config') await initIssuerConfig(agentProvision.issuerConfig) logger.silly('Opening main wallet') diff --git a/agents/node/vcxagent-core/src/services/service-connections.js b/agents/node/vcxagent-core/src/services/service-connections.js index 4df187cdbb..5e76949fcd 100644 --- a/agents/node/vcxagent-core/src/services/service-connections.js +++ b/agents/node/vcxagent-core/src/services/service-connections.js @@ -10,10 +10,10 @@ module.exports.createServiceConnections = function createServiceConnections ({ l async function inviterConnectionCreate (connectionId, cbInvitation) { logger.info(`InviterConnectionSM creating connection ${connectionId}`) const connection = await Connection.create({ id: connectionId }) - logger.debug(`InviterConnectionSM after created connection:\n${JSON.stringify(await connection.serialize())}`) + logger.debug(`InviterConnectionSM after created connection:\n${JSON.stringify(connection.serialize())}`) await connection.connect('{}') - logger.debug(`InviterConnectionSM after invitation was generated:\n${JSON.stringify(await connection.serialize())}`) - const invite = await connection.inviteDetails() + logger.debug(`InviterConnectionSM after invitation was generated:\n${JSON.stringify(connection.serialize())}`) + const invite = connection.inviteDetails() if (cbInvitation) { cbInvitation(invite) } @@ -126,7 +126,7 @@ module.exports.createServiceConnections = function createServiceConnections ({ l const connection = await loadConnection(connectionId) const data = Buffer.from(dataBase64, 'base64') const signature = Buffer.from(signatureBase64, 'base64') - return connection.verifySignature({ data, signature }) + return await connection.verifySignature({ data, signature }) } async function getConnectionPwDid (connectionId) { diff --git a/agents/node/vcxagent-core/src/services/service-cred-holder.js b/agents/node/vcxagent-core/src/services/service-cred-holder.js index f7a24e3113..9bd3622b67 100644 --- a/agents/node/vcxagent-core/src/services/service-cred-holder.js +++ b/agents/node/vcxagent-core/src/services/service-cred-holder.js @@ -66,7 +66,7 @@ module.exports.createServiceCredHolder = function createServiceCredHolder ({ log async function createCredentialFromOfferAndSendRequest (connectionId, holderCredentialId, credentialOffer) { const connection = await loadConnection(connectionId) - const credential = await Credential.create({ sourceId: 'credential', offer: credentialOffer }) + const credential = Credential.create({ sourceId: 'credential', offer: credentialOffer }) await saveHolderCredential(holderCredentialId, credential) logger.info('Sending credential request') await credential.sendRequest({ connection, payment: 0 }) @@ -76,7 +76,7 @@ module.exports.createServiceCredHolder = function createServiceCredHolder ({ log async function createCredentialFromOfferAndDecline (connectionId, holderCredentialId, credentialOffer, comment) { const connection = await loadConnection(connectionId) - const credential = await Credential.create({ sourceId: 'credential', offer: credentialOffer }) + const credential = Credential.create({ sourceId: 'credential', offer: credentialOffer }) await saveHolderCredential(holderCredentialId, credential) logger.info('Declining credential offer') await credential.declineOffer(connection, comment) diff --git a/agents/node/vcxagent-core/src/services/service-ledger-creddef.js b/agents/node/vcxagent-core/src/services/service-ledger-creddef.js index c2b8737cd3..2e6aeaf29a 100644 --- a/agents/node/vcxagent-core/src/services/service-ledger-creddef.js +++ b/agents/node/vcxagent-core/src/services/service-ledger-creddef.js @@ -23,7 +23,7 @@ module.exports.createServiceLedgerCredDef = function createServiceLedgerCredDef async function printInfo (credDefIds) { for (const id of credDefIds) { const credDef = await loadCredDef(id) - const serCredDef = await credDef.serialize() + const serCredDef = credDef.serialize() logger.info(`Credential definition ${id}: ${JSON.stringify(serCredDef)}`) } } diff --git a/agents/node/vcxagent-core/src/services/service-out-of-band.js b/agents/node/vcxagent-core/src/services/service-out-of-band.js index 85006f4589..95a7a14f9e 100644 --- a/agents/node/vcxagent-core/src/services/service-out-of-band.js +++ b/agents/node/vcxagent-core/src/services/service-out-of-band.js @@ -1,30 +1,27 @@ const { OutOfBandSender, OutOfBandReceiver } = require('@hyperledger/node-vcx-wrapper') module.exports.createServiceOutOfBand = function createServiceOutOfBand ({ logger, saveConnection, loadConnection }) { - async function _createOobSender (message, label) { - logger.info('createOobMsg >>>') - const oob = await OutOfBandSender.create({ label }) + function _createOobSender (message, label) { + const oob = OutOfBandSender.create({ label }) if (message) { const msgParsed = JSON.parse(message) const msgType = msgParsed['@type'] if (!msgType) { throw Error(`Message appended to OOB message must have @type. Invalid message: ${msgParsed}`) } - logger.info(`createOobMsg >>> appending message of type ${msgType}`) - await oob.appendMessage(message) - logger.info('createOobMsg >>> append message') + oob.appendMessage(message) } return oob } async function createOobMessageWithDid (message, label, publicDid) { - const oobSender = await _createOobSender(message, label) - await oobSender.appendServiceDid(publicDid) - return await oobSender.toMessage() + const oobSender = _createOobSender(message, label) + oobSender.appendServiceDid(publicDid) + return oobSender.toMessage() } async function createConnectionFromOobMsg (connectionId, oobMsg) { - const oob = await OutOfBandReceiver.createWithMessage(oobMsg) + const oob = OutOfBandReceiver.createWithMessage(oobMsg) const connection = await oob.buildConnection() await connection.connect('{}') await saveConnection(connectionId, connection) @@ -44,7 +41,7 @@ module.exports.createServiceOutOfBand = function createServiceOutOfBand ({ logge return filtered } catch {} }, []) - const oobReceiver = await OutOfBandReceiver.createWithMessage(oobMsg) + const oobReceiver = OutOfBandReceiver.createWithMessage(oobMsg) if (connections && await oobReceiver.connectionExists(connections)) { return true } diff --git a/agents/node/vcxagent-core/src/services/service-prover.js b/agents/node/vcxagent-core/src/services/service-prover.js index f2b57174cc..412a9c543f 100644 --- a/agents/node/vcxagent-core/src/services/service-prover.js +++ b/agents/node/vcxagent-core/src/services/service-prover.js @@ -21,7 +21,7 @@ module.exports.createServiceProver = function createServiceProver ({ logger, loa const [error] = await pollFunction(progressToAcceptedState, `Progress ProofSM to one of states ${JSON.stringify(targetStates)}`, logger, attemptsThreshold, timeoutMs) if (error) { - throw Error(`Couldn't progress credential to Accepted state. ${error}`) + throw Error(`Couldn't progress proof to Accepted state. ${error}`) } } @@ -45,7 +45,7 @@ module.exports.createServiceProver = function createServiceProver ({ logger, loa async function waitForProofRequests (connectionId, attemptsThreshold = 20, timeoutMs = 500) { const connection = await loadConnection(connectionId) const proofRequests = await _getProofRequests(connection, attemptsThreshold, timeoutMs) - logger.info(`Found ${proofRequests.length} credential offers.`) + logger.info(`Found ${proofRequests.length} proof requests.`) return proofRequests } diff --git a/agents/node/vcxagent-core/src/services/service-revocation-registry.js b/agents/node/vcxagent-core/src/services/service-revocation-registry.js index 855803612f..7385c62716 100644 --- a/agents/node/vcxagent-core/src/services/service-revocation-registry.js +++ b/agents/node/vcxagent-core/src/services/service-revocation-registry.js @@ -11,7 +11,7 @@ module.exports.createServiceLedgerRevocationRegistry = function createServiceLed } const revReg = await RevocationRegistry.create(data) await revReg.publish(tailsUrl) - const revRegId = await revReg.getRevRegId() + const revRegId = revReg.getRevRegId() await saveRevReg(revRegId, revReg) return { revReg, revRegId } } diff --git a/agents/node/vcxagent-core/src/services/service-verifier.js b/agents/node/vcxagent-core/src/services/service-verifier.js index ebfcd590c6..50f7c92f3d 100644 --- a/agents/node/vcxagent-core/src/services/service-verifier.js +++ b/agents/node/vcxagent-core/src/services/service-verifier.js @@ -6,7 +6,7 @@ const assert = require('assert') module.exports.createServiceVerifier = function createServiceVerifier ({ logger, loadConnection, saveProof, loadProof, listProofIds }) { async function createProof (proofId, proofData) { - logger.info(`Verifier creating proof ${proofId}, proofData=${JSON.stringify(proofData)}`) + logger.info(`Verifier creating proof ${proofId}, proofData: ${JSON.stringify(proofData)}`) await sleep(1000) const proof = await Proof.create(proofData) await saveProof(proofId, proof) @@ -16,7 +16,7 @@ module.exports.createServiceVerifier = function createServiceVerifier ({ logger, async function buildProofReqAndMarkAsSent (proofId, proofData) { logger.debug(`Building proof request ${proofId}`) const proof = await Proof.create(proofData) - const presentationRequest = await proof.getProofRequestMessage() + const presentationRequest = proof.getProofRequestMessage() const state1 = await proof.getState() assert.equal(state1, VerifierStateType.PresentationRequestSet) @@ -35,7 +35,7 @@ module.exports.createServiceVerifier = function createServiceVerifier ({ logger, await proof.requestProof(connection) const state = await proof.getState() await saveProof(proofId, proof) - const proofRequestMessage = await proof.getProofRequestMessage() + const proofRequestMessage = proof.getProofRequestMessage() return { state, proofRequestMessage } } diff --git a/agents/node/vcxagent-core/src/utils/vcx-workflows.js b/agents/node/vcxagent-core/src/utils/vcx-workflows.js index 0a1f836635..a22adc1c0b 100644 --- a/agents/node/vcxagent-core/src/utils/vcx-workflows.js +++ b/agents/node/vcxagent-core/src/utils/vcx-workflows.js @@ -1,22 +1,15 @@ const { - initRustAPI, initThreadpool, initVcxWithConfig, provisionCloudAgent, + initVcxWithConfig, provisionCloudAgent, createWallet, openMainWallet, closeMainWallet, - configureIssuerWallet + configureIssuerWallet, defaultLogger } = require('@hyperledger/node-vcx-wrapper') -const axios = require('axios') - -async function initRustApiAndLogger (logLevel) { - const rustApi = initRustAPI() - await rustApi.vcx_set_default_logger(logLevel) -} async function initVcxWithProvisionedAgentConfig (config) { await initVcxWithConfig(JSON.stringify(config)) } -async function initRustapi (logLevel = 'vcx=error', num_threads = 4) { - await initRustApiAndLogger(logLevel) - await initThreadpool({ num_threads }) +function initRustLogger (logPattern) { + defaultLogger(logPattern) } async function provisionAgentInAgency (agentName, agencyConfig, seed, walletExtraConfigs, logger) { @@ -63,7 +56,6 @@ async function provisionAgentInAgency (agentName, agencyConfig, seed, walletExtr return { agencyConfig, issuerConfig, walletConfig } } -module.exports.initRustApiAndLogger = initRustApiAndLogger module.exports.initVcxWithProvisionedAgentConfig = initVcxWithProvisionedAgentConfig module.exports.provisionAgentInAgency = provisionAgentInAgency -module.exports.initRustapi = initRustapi +module.exports.initRustLogger = initRustLogger diff --git a/agents/node/vcxagent-core/test/distribute-tails.spec.js b/agents/node/vcxagent-core/test/distribute-tails.spec.js index 70cfbedd3a..78c2a71d5f 100644 --- a/agents/node/vcxagent-core/test/distribute-tails.spec.js +++ b/agents/node/vcxagent-core/test/distribute-tails.spec.js @@ -2,9 +2,8 @@ require('jest') const express = require('express') const axios = require('axios') -const { buildRevocationDetails } = require('../src') +const { buildRevocationDetails, initRustLogger } = require('../src') const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') const { IssuerStateType, HolderStateType, VerifierStateType, ProverStateType } = require('@hyperledger/node-vcx-wrapper') const uuid = require('uuid') const sleep = require('sleep-promise') @@ -13,7 +12,7 @@ const mkdirp = require('mkdirp') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test tails distribution', () => { diff --git a/agents/node/vcxagent-core/test/feature-discovery.spec.js b/agents/node/vcxagent-core/test/feature-discovery.spec.js index ebb6006f86..9086770b6a 100644 --- a/agents/node/vcxagent-core/test/feature-discovery.spec.js +++ b/agents/node/vcxagent-core/test/feature-discovery.spec.js @@ -1,12 +1,12 @@ /* eslint-env jest */ require('jest') const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') const sleep = require('sleep-promise') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('send ping, get ping', () => { diff --git a/agents/node/vcxagent-core/test/issue-verify.spec.js b/agents/node/vcxagent-core/test/issue-verify.spec.js index f9945922e2..d636aa70b4 100644 --- a/agents/node/vcxagent-core/test/issue-verify.spec.js +++ b/agents/node/vcxagent-core/test/issue-verify.spec.js @@ -1,13 +1,13 @@ /* eslint-env jest */ require('jest') const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') const { IssuerStateType, HolderStateType, ProverStateType, VerifierStateType } = require('@hyperledger/node-vcx-wrapper') const sleep = require('sleep-promise') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=warn') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test update state', () => { @@ -30,8 +30,8 @@ describe('test update state', () => { await faber.updateStateVerifierProof(VerifierStateType.Finished) await alice.updateStateHolderProof(ProverStateType.Finished) } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) await sleep(2000) + console.error(`err = ${err.message} stack = ${err.stack}`) throw Error(err) } }) diff --git a/agents/node/vcxagent-core/test/sign-messaging.spec.js b/agents/node/vcxagent-core/test/messaging.spec.js similarity index 92% rename from agents/node/vcxagent-core/test/sign-messaging.spec.js rename to agents/node/vcxagent-core/test/messaging.spec.js index 0df4b18e6f..f21e2d2994 100644 --- a/agents/node/vcxagent-core/test/sign-messaging.spec.js +++ b/agents/node/vcxagent-core/test/messaging.spec.js @@ -1,17 +1,19 @@ /* eslint-env jest */ require('jest') const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') +const sleep = require('sleep-promise') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test messaging', () => { it('downloadReceivedMessages: Alice should send message and Faber download it', async () => { const { alice, faber } = await createPairedAliceAndFaber() await alice.sendMessage('Hello Faber') + await sleep(100) const msgs = await faber.downloadReceivedMessages() expect(msgs.length).toBe(1) expect(msgs[0].uid).toBeDefined() @@ -23,8 +25,7 @@ describe('test messaging', () => { await faber.updateMessageStatus([msgs[0].uid]) const msgs2 = await faber.downloadReceivedMessages() expect(msgs2.length).toBe(0) - } - ) + }) it('should update all messages with Received status', async () => { const { alice, faber } = await createPairedAliceAndFaber() @@ -38,8 +39,7 @@ describe('test messaging', () => { const msgs2 = await faber.downloadReceivedMessages() expect(msgs2.length).toBe(0) - } - ) + }) it('downloadReceivedMessagesV2: Alice should send message and Faber download it ', async () => { const { alice, faber } = await createPairedAliceAndFaber() diff --git a/agents/node/vcxagent-core/test/nonmediated-endpoint.spec.js b/agents/node/vcxagent-core/test/nonmediated-endpoint.spec.js index 3ec4f7b020..fc44ae184e 100644 --- a/agents/node/vcxagent-core/test/nonmediated-endpoint.spec.js +++ b/agents/node/vcxagent-core/test/nonmediated-endpoint.spec.js @@ -5,11 +5,11 @@ const sleep = require('sleep-promise') const express = require('express') const { ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') const { createAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test connecting via unmediated endpoint', () => { diff --git a/agents/node/vcxagent-core/test/out-of-band.spec.js b/agents/node/vcxagent-core/test/out-of-band.spec.js index c066165d9c..2d6191741d 100644 --- a/agents/node/vcxagent-core/test/out-of-band.spec.js +++ b/agents/node/vcxagent-core/test/out-of-band.spec.js @@ -2,14 +2,14 @@ require('jest') const sleep = require('sleep-promise') -const { initRustapi } = require('../src/index') const { VerifierStateType } = require('@hyperledger/node-vcx-wrapper') const { createPairedAliceAndFaberViaOobMsg, createAliceAndFaber, connectViaOobMessage, createPairedAliceAndFaber } = require('./utils/utils') const { IssuerStateType, HolderStateType, OutOfBandReceiver } = require('@hyperledger/node-vcx-wrapper') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test out of band communication', () => { diff --git a/agents/node/vcxagent-core/test/public-invite.spec.js b/agents/node/vcxagent-core/test/public-invite.spec.js index 6e9d483bbb..43bcf7a759 100644 --- a/agents/node/vcxagent-core/test/public-invite.spec.js +++ b/agents/node/vcxagent-core/test/public-invite.spec.js @@ -1,11 +1,11 @@ /* eslint-env jest */ require('jest') const { createPairedAliceAndFaberViaPublicInvite } = require('./utils/utils') -const { initRustapi } = require('../src/index') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test public invite', () => { diff --git a/agents/node/vcxagent-core/test/sign-verify.spec.js b/agents/node/vcxagent-core/test/sign-verify.spec.js index 0e0a01927a..148ce61927 100644 --- a/agents/node/vcxagent-core/test/sign-verify.spec.js +++ b/agents/node/vcxagent-core/test/sign-verify.spec.js @@ -1,11 +1,11 @@ /* eslint-env jest */ require('jest') const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('test signatures', () => { diff --git a/agents/node/vcxagent-core/test/trustping.spec.js b/agents/node/vcxagent-core/test/trustping.spec.js index 0ea4f85a3f..ffe6c2935d 100644 --- a/agents/node/vcxagent-core/test/trustping.spec.js +++ b/agents/node/vcxagent-core/test/trustping.spec.js @@ -1,12 +1,12 @@ /* eslint-env jest */ require('jest') const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustapi } = require('../src/index') const sleep = require('sleep-promise') +const { initRustLogger } = require('../src') beforeAll(async () => { jest.setTimeout(1000 * 60 * 4) - await initRustapi(process.env.VCX_LOG_LEVEL || 'vcx=error') + initRustLogger(process.env.RUST_LOG || 'vcx=error') }) describe('trustping', () => { diff --git a/agents/node/vcxagent-core/test/utils/faber.js b/agents/node/vcxagent-core/test/utils/faber.js index f571b66560..3ec6e201c1 100644 --- a/agents/node/vcxagent-core/test/utils/faber.js +++ b/agents/node/vcxagent-core/test/utils/faber.js @@ -5,6 +5,7 @@ const { ConnectionStateType, IssuerStateType, VerifierStateType, generatePublicI } = require('@hyperledger/node-vcx-wrapper') const { getAliceSchemaAttrs, getFaberCredDefName, getFaberProofData } = require('./data') const sleep = require('sleep-promise') +const assert = require('assert') module.exports.createFaber = async function createFaber () { const agentName = `faber-${Math.floor(new Date() / 1000)}` @@ -83,11 +84,13 @@ module.exports.createFaber = async function createFaber () { } async function unpackMsg (encryptedMsg) { - logger.info('Faber is going to unpack message') + assert(encryptedMsg) + logger.info(`Faber is going to unpack message of length ${encryptedMsg.length}`) await vcxAgent.agentInitVcx() - const { message, sender_verkey: senderVerkey } = await unpack(encryptedMsg); + const { message, sender_verkey: senderVerkey } = await unpack(encryptedMsg) + logger.info(`Decrypted msg has length ${message.length}, sender verkey: ${senderVerkey}`) await vcxAgent.agentShutdownVcx() return { message, senderVerkey } @@ -250,7 +253,7 @@ module.exports.createFaber = async function createFaber () { } async function verifySignature (dataBase64, signatureBase64) { - logger.debug(`Faber is going to verift signed data. Data=${dataBase64} signature=${signatureBase64}`) + logger.debug(`Faber is going to verify signed data. Data=${dataBase64} signature=${signatureBase64}`) await vcxAgent.agentInitVcx() const isValid = await vcxAgent.serviceConnections.verifySignature(connectionId, dataBase64, signatureBase64) @@ -278,9 +281,9 @@ module.exports.createFaber = async function createFaber () { } async function createConnectionFromReceivedRequestV2 (pwInfo, request) { - logger.info('Faber is going to create a connection from a request') - await vcxAgent.agentInitVcx() + logger.info(`Faber is going to create a connection from a request: ${request}, using pwInfo: ${JSON.stringify(pwInfo)}`) + await vcxAgent.agentInitVcx() await vcxAgent.serviceConnections.inviterConnectionCreateFromRequestV2(connectionId, pwInfo, request) expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(ConnectionStateType.Responded) diff --git a/agents/node/vcxagent-core/test/utils/utils.js b/agents/node/vcxagent-core/test/utils/utils.js index 8e6dae9771..b644690593 100644 --- a/agents/node/vcxagent-core/test/utils/utils.js +++ b/agents/node/vcxagent-core/test/utils/utils.js @@ -4,14 +4,15 @@ const express = require('express') const { createFaber } = require('./faber') const { createAlice } = require('./alice') const { ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') +const assert = require('assert') -module.exports.createAliceAndFaber = async function createAliceAndFaber() { +module.exports.createAliceAndFaber = async function createAliceAndFaber () { const alice = await createAlice() const faber = await createFaber() return { alice, faber } } -module.exports.createPairedAliceAndFaber = async function createPairedAliceAndFaber() { +module.exports.createPairedAliceAndFaber = async function createPairedAliceAndFaber () { const alice = await createAlice() const faber = await createFaber() const invite = await faber.createInvite() @@ -22,7 +23,7 @@ module.exports.createPairedAliceAndFaber = async function createPairedAliceAndFa return { alice, faber } } -async function executeFunctionWithServer(f1, f2) { +async function executeFunctionWithServer (f1, f2) { let server try { const port = 5419 @@ -39,6 +40,8 @@ async function executeFunctionWithServer(f1, f2) { server = app.listen(port) const { alice, faber, pwInfo } = await f1(endpoint) + await sleep(150) + assert(encryptedMsg, "It seems that no message has yet arrived on faber's endpoint, try to increase timeout") const { message } = await faber.unpackMsg(encryptedMsg) return await f2(alice, faber, pwInfo, message) } catch (err) { @@ -53,7 +56,7 @@ async function executeFunctionWithServer(f1, f2) { } } -module.exports.createPairedAliceAndFaberViaPublicInvite = async function createPairedAliceAndFaberViaPublicInvite() { +module.exports.createPairedAliceAndFaberViaPublicInvite = async function createPairedAliceAndFaberViaPublicInvite () { const f1 = async (endpoint) => { const alice = await createAlice() const faber = await createFaber() @@ -71,7 +74,7 @@ module.exports.createPairedAliceAndFaberViaPublicInvite = async function createP return await executeFunctionWithServer(f1, f2) } -module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedAliceAndFaberViaOobMsg() { +module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedAliceAndFaberViaOobMsg () { const f1 = async (endpoint) => { const alice = await createAlice() const faber = await createFaber() @@ -90,7 +93,7 @@ module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedA return await executeFunctionWithServer(f1, f2) } -module.exports.connectViaOobMessage = async function connectViaOobMessage(alice, faber, msg) { +module.exports.connectViaOobMessage = async function connectViaOobMessage (alice, faber, msg) { const f1 = async (endpoint) => { const pwInfo = await faber.publishService(endpoint) await alice.createConnectionUsingOobMessage(msg) diff --git a/ci/alpine_core.dockerfile b/ci/alpine_core.dockerfile index 29d9e82d12..b66a4cb6a5 100644 --- a/ci/alpine_core.dockerfile +++ b/ci/alpine_core.dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.15.4 AS builder +FROM alpine:3.17.1 AS builder ARG UID=1000 ARG GID=1000 diff --git a/ci/libvcx.dockerfile b/ci/libvcx.dockerfile index 1f5766a6f2..17f7492811 100644 --- a/ci/libvcx.dockerfile +++ b/ci/libvcx.dockerfile @@ -11,7 +11,7 @@ USER root RUN mv /home/indy/target/release/libvcx.so . -FROM alpine:3.15.4 +FROM alpine:3.17.1 ARG UID=1000 ARG GID=1000 RUN addgroup -g $GID node && adduser -u $UID -D -G node node @@ -29,7 +29,7 @@ RUN cp /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone ENV TZ=UTC -RUN echo 'https://dl-cdn.alpinelinux.org/alpine/v3.12/main' >> /etc/apk/repositories -RUN apk add --no-cache nodejs=12.22.12-r0 +RUN echo 'https://dl-cdn.alpinelinux.org/alpine/v3.17/main' >> /etc/apk/repositories +RUN apk add --no-cache nodejs=18.12.1-r0 USER node diff --git a/libvcx/Cargo.toml b/libvcx/Cargo.toml index babc85912d..e70f1c77f8 100644 --- a/libvcx/Cargo.toml +++ b/libvcx/Cargo.toml @@ -37,7 +37,7 @@ futures = { version = "0.3", default-features = false } tokio = { version = "1.20.3", features = ["rt-multi-thread"] } aries-vcx = { path = "../aries_vcx" } thiserror = "1.0.37" -uuid = {version = "0.7.1", default-features = false, features = ["v4"]} +uuid = { version = "0.7.4", default-features = false, features = ["v4"] } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.5" diff --git a/libvcx/src/api_c/vcx.rs b/libvcx/src/api_c/vcx.rs index 52a2f19f23..51cc628af9 100644 --- a/libvcx/src/api_c/vcx.rs +++ b/libvcx/src/api_c/vcx.rs @@ -5,6 +5,7 @@ use libc::c_char; use aries_vcx::agency_client::configuration::AgencyClientConfig; +use crate::api_vcx::utils::version_constants; use aries_vcx::indy::ledger::pool::PoolConfig; use aries_vcx::indy::wallet::IssuerConfig; @@ -25,8 +26,6 @@ use crate::api_c::cutils::current_error::{get_current_error_c_json, set_current_ use crate::api_c::cutils::runtime::{execute, execute_async, init_threadpool}; use crate::api_vcx::api_global::VERSION_STRING; -use crate::api_vcx::utils::version_constants; - /// Only for Wrapper testing purposes, sets global library settings. /// /// #Params @@ -483,6 +482,7 @@ pub extern "C" fn vcx_get_current_error(error_json_p: *mut *const c_char) { pub mod test_utils { use aries_vcx::agency_client::testing::mocking::enable_agency_mocks; use aries_vcx::global::settings::{DEFAULT_WALLET_KEY, WALLET_KDF_RAW}; + use uuid; use crate::api_c::cutils::return_types_u32; use crate::api_c::cutils::timeout::TimeoutUtils; diff --git a/libvcx/src/api_vcx/api_handle/disclosed_proof.rs b/libvcx/src/api_vcx/api_handle/disclosed_proof.rs index f3d7cea760..896400c2d4 100644 --- a/libvcx/src/api_vcx/api_handle/disclosed_proof.rs +++ b/libvcx/src/api_vcx/api_handle/disclosed_proof.rs @@ -158,6 +158,10 @@ pub fn generate_reject_proof_msg(_handle: u32) -> LibvcxResult { } pub async fn reject_proof(handle: u32, connection_handle: u32) -> LibvcxResult<()> { + info!( + "reject_proof >> handle: {}, connection_handle: {}", + handle, connection_handle + ); let mut proof = HANDLE_MAP.get_cloned(handle)?; let send_message = mediated_connection::send_message_closure(connection_handle).await?; proof diff --git a/libvcx/src/api_vcx/api_handle/object_cache/mod.rs b/libvcx/src/api_vcx/api_handle/object_cache/mod.rs index b4f25b0c35..f3b01b4be1 100644 --- a/libvcx/src/api_vcx/api_handle/object_cache/mod.rs +++ b/libvcx/src/api_vcx/api_handle/object_cache/mod.rs @@ -185,6 +185,7 @@ where } pub fn add(&self, obj: T) -> LibvcxResult { + trace!("[ObjectCache: {}] add >> Adding object to cache", self.cache_name); let mut store = self._lock_store_write()?; let mut new_handle = rand::thread_rng().gen::(); @@ -196,12 +197,36 @@ where } match store.insert(new_handle, Mutex::new(obj)) { - Some(_) => Ok(new_handle), - None => Ok(new_handle), + Some(_) => { + warn!( + "[ObjectCache: {}] add >> Object already exists for handle: {}", + self.cache_name, new_handle + ); + Err(LibvcxError::from_msg( + LibvcxErrorKind::InvalidHandle, + format!( + "[ObjectCache: {}] add >> generated handle {} conflicts with existing handle, failed to store object", + self.cache_name, new_handle + ), + )) + } + None => { + trace!( + "[ObjectCache: {}] add >> Object added to cache for handle: {}", + self.cache_name, + new_handle + ); + Ok(new_handle) + } } } pub fn insert(&self, handle: u32, obj: T) -> LibvcxResult<()> { + trace!( + "[ObjectCache: {}] insert >> Inserting object with handle: {}", + self.cache_name, + handle + ); let mut store = self._lock_store_write()?; store.insert(handle, Mutex::new(obj)); @@ -209,6 +234,11 @@ where } pub fn release(&self, handle: u32) -> LibvcxResult<()> { + trace!( + "[ObjectCache: {}] release >> Releasing object with handle: {}", + self.cache_name, + handle + ); let mut store = self._lock_store_write()?; match store.remove(&handle) { Some(_) => {} @@ -223,6 +253,7 @@ where } pub fn drain(&self) -> LibvcxResult<()> { + warn!("[ObjectCache: {}] drain >> Draining object cache", self.cache_name); let mut store = self._lock_store_write()?; store.clear(); Ok(()) diff --git a/wrappers/java/ci/android.build.sh b/wrappers/java/ci/android.build.sh index e5de7b3a1f..94869f05c4 100755 --- a/wrappers/java/ci/android.build.sh +++ b/wrappers/java/ci/android.build.sh @@ -4,7 +4,7 @@ set -ex REPO_DIR=$PWD SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )" -LIBVCX_DIR="${REPO_DIR}/" +LIBVCX_DIR="${REPO_DIR}" JAVA_WRAPPER_DIR="${REPO_DIR}/wrappers/java" TARGET_ARCHS="$@" diff --git a/wrappers/java/ci/setup.android.env.sh b/wrappers/java/ci/setup.android.env.sh index 2b534dac0b..8f3a57c2b3 100755 --- a/wrappers/java/ci/setup.android.env.sh +++ b/wrappers/java/ci/setup.android.env.sh @@ -289,7 +289,7 @@ build_libvcx(){ pushd ${LIBVCX_DIR} rm -rf target/${TRIPLET} cargo clean - cargo build --release --target=${TRIPLET} + cargo build -p libvcx --release --target=${TRIPLET} rm -rf target/${TRIPLET}/release/deps rm -rf target/${TRIPLET}/release/build rm -rf target/release/deps @@ -306,5 +306,5 @@ copy_libraries_to_jni(){ echo "Copying dependencies to ${BOLD}${YELLOW}${LIB_PATH}${RESET}" mkdir -p $LIB_PATH cp ${LIBVCX_DIR}/target/${TRIPLET}/release/libvcx.so ${LIB_PATH} - cp ${LIBZMQ_LIB_DIR}/libzmq.so ${LIB_PATH} + cp ${LIBZMQ_LIB_DIR}/libzmq.so ${LIB_PATH} } diff --git a/wrappers/node/package-lock.json b/wrappers/node/package-lock.json index 320996f6db..4e20a96dd5 100644 --- a/wrappers/node/package-lock.json +++ b/wrappers/node/package-lock.json @@ -9,24 +9,18 @@ "version": "0.51.1", "license": "Apache-2.0", "dependencies": { - "ffi-napi": "^4.0.3", "fs-extra": "^4.0.2", "lodash": "^4.17.21", - "ref-napi": "^3.0.3", "uuid": "^8.3.2", "weak-napi": "^2.0.2" }, "devDependencies": { "@types/app-module-path": "^2.2.0", "@types/chai": "^4.2.22", - "@types/ffi-napi": "^4.0.6", "@types/lodash": "^4.14.177", "@types/mocha": "^8.2.3", "@types/node": "^12.20.55", - "@types/ref-napi": "^3.0.5", - "@types/sinon": "^5.0.1", "@types/uuid": "^8.3.3", - "@types/weak": "^1.0.0", "@types/weak-napi": "^1.0.0", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", @@ -35,36 +29,52 @@ "eslint": "^7.32.0", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.4.1", - "jsdoc": "^3.6.7", "mocha": "^9.2.2", "prettier": "^2.5.0", "ts-node": "^10.9.1", + "typescript": "^4.8.4", + "vcx-napi-rs": "../vcx-napi-rs" + }, + "peerDependencies": { + "@hyperledger/vcx-napi-rs": "^0.50.0-featurenapi-rs-separate-crate-4208" + } + }, + "../vcx-napi-rs": { + "name": "@hyperledger/vcx-napi-rs", + "dev": true, + "license": "Apache-2.0", + "devDependencies": { + "@napi-rs/cli": "^2.9.1", + "@types/node": "^18.11.18", "typescript": "^4.8.4" + }, + "optionalDependencies": { + "@hyperledger/vcx-napi-rs-darwin-arm64": "undefined", + "@hyperledger/vcx-napi-rs-darwin-x64": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-gnu": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-musl": "undefined" } }, "node_modules/@babel/code-frame": { "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/highlight": "^7.10.4" } }, "node_modules/@babel/helper-validator-identifier": { "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, + "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", @@ -76,9 +86,8 @@ }, "node_modules/@babel/highlight/node_modules/ansi-styles": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -88,9 +97,8 @@ }, "node_modules/@babel/highlight/node_modules/chalk": { "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -102,42 +110,37 @@ }, "node_modules/@babel/highlight/node_modules/color-convert": { "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "1.1.3" } }, "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.0" } }, "node_modules/@babel/highlight/node_modules/has-flag": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/supports-color": { "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -145,23 +148,10 @@ "node": ">=4" } }, - "node_modules/@babel/parser": { - "version": "7.20.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.3.tgz", - "integrity": "sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -171,9 +161,8 @@ }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.1.1", @@ -191,18 +180,16 @@ }, "node_modules/@eslint/eslintrc/node_modules/ignore": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@humanwhocodes/object-schema": "^1.2.0", "debug": "^4.1.1", @@ -214,30 +201,77 @@ }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@hyperledger/vcx-napi-rs": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs/-/vcx-napi-rs-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-VUpIjTBurvN61diP+xeamSKg7Ug6PG72WSCLGjyVYFGpDTzrJuGW3LL/UsbFjMoQaNA1XUXERenAoya02gJJ9w==", + "peer": true, + "optionalDependencies": { + "@hyperledger/vcx-napi-rs-darwin-arm64": "0.50.0-featurenapi-rs-separate-crate-4208", + "@hyperledger/vcx-napi-rs-darwin-x64": "0.50.0-featurenapi-rs-separate-crate-4208", + "@hyperledger/vcx-napi-rs-linux-x64-gnu": "0.50.0-featurenapi-rs-separate-crate-4208", + "@hyperledger/vcx-napi-rs-linux-x64-musl": "0.50.0-featurenapi-rs-separate-crate-4208" + } + }, + "node_modules/@hyperledger/vcx-napi-rs-darwin-x64": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs-darwin-x64/-/vcx-napi-rs-darwin-x64-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-F38iz0gAo4BkAZVwD3D/VIkBqE849iZM0J3rHjCHzNOZOY3+u7cNtVRPumFoiq8p/ZExNIr+yyqRCCCQ8GDESQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true + }, + "node_modules/@hyperledger/vcx-napi-rs-linux-x64-gnu": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs-linux-x64-gnu/-/vcx-napi-rs-linux-x64-gnu-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-kv0AUEaLQuYJQpHBEyaE7pTRrt7nRlIPuE5jR/6sFxHTZwY0I4kZc0YLv23/uRDlnri9CPdRsLAgbTRzWZcIUg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@hyperledger/vcx-napi-rs-linux-x64-musl": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs-linux-x64-musl/-/vcx-napi-rs-linux-x64-musl-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-UyJW95OUIpswcw7ih8RiYpwGoPWu+4WCTSSbsBx/5f8ZwwP9y7ahnkWancPOuVFvG42WjKtSDbG/YJkw5Q9JPw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -245,9 +279,8 @@ }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -258,18 +291,16 @@ }, "node_modules/@nodelib/fs.stat": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.walk": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -280,150 +311,71 @@ }, "node_modules/@tsconfig/node10": { "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node12": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node14": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node16": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/app-module-path": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@types/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-r47Kt3ApJDzUU2xCNzaBI25Au5Xfdvf0Gyomveqvg46nQ3J4PaDLicObhyX6cMhvMVWJMB/BnkXdv1E4zxP+6w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/chai": { "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "node_modules/@types/ffi-napi": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/ffi-napi/-/ffi-napi-4.0.6.tgz", - "integrity": "sha512-yrBtqeVD1aeVo271jXVEo3iAtbzSGVGRssJv9W9JlUfg5Z5FgHJx2MV88GRwVATu/XWg6zyenW/cb1MNAuOtaQ==", "dev": true, - "dependencies": { - "@types/node": "*", - "@types/ref-napi": "*", - "@types/ref-struct-di": "*" - } + "license": "MIT" }, "node_modules/@types/json-schema": { "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "node_modules/@types/linkify-it": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", - "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/lodash": { "version": "4.14.188", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.188.tgz", - "integrity": "sha512-zmEmF5OIM3rb7SbLCFYoQhO4dGt2FRM9AMkxvA3LaADOF1n8in/zGJlWji9fmafLoNyz+FoL6FE0SLtGIArD7w==", - "dev": true - }, - "node_modules/@types/markdown-it": { - "version": "12.2.3", - "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", - "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", "dev": true, - "dependencies": { - "@types/linkify-it": "*", - "@types/mdurl": "*" - } - }, - "node_modules/@types/mdurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", - "dev": true + "license": "MIT" }, "node_modules/@types/mocha": { "version": "8.2.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", - "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - }, - "node_modules/@types/ref-napi": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@types/ref-napi/-/ref-napi-3.0.5.tgz", - "integrity": "sha512-u+L/RdwTuJes3pDypOVR/MtcqzoULu8Z8yulP6Tw5z7eXV1ba1llizNVFtI/m2iPfDy/dPPt+3ar1QCgonTzsw==", "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/ref-struct-di": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@types/ref-struct-di/-/ref-struct-di-1.1.7.tgz", - "integrity": "sha512-nnHR26qrCnQqxwHTv+rqzu/hGgDZl45TUs4bO6ZjpuC8/M2JoXFxk63xrWmAmqsLe55oxOgAWssyr3YHAMY89g==", - "dev": true, - "dependencies": { - "@types/ref-napi": "*" - } - }, - "node_modules/@types/sinon": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-5.0.7.tgz", - "integrity": "sha512-opwMHufhUwkn/UUDk35LDbKJpA2VBsZT8WLU8NjayvRLGPxQkN+8XmfC2Xl35MAscBE8469koLLBjaI3XLEIww==", - "dev": true + "license": "MIT" }, "node_modules/@types/uuid": { "version": "8.3.4", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", - "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", - "dev": true - }, - "node_modules/@types/weak": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/weak/-/weak-1.0.0.tgz", - "integrity": "sha512-6WXZpeAac3vj5+OfQvlqYEtc88oOgvkcxbrnmBw53Da6gA+MGztL+Hns3BpnyUevgz+4DxsJblgAew1A/tkcng==", "dev": true, - "dependencies": { - "@types/node": "*" - } + "license": "MIT" }, "node_modules/@types/weak-napi": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/weak-napi/-/weak-napi-1.0.1.tgz", - "integrity": "sha512-EqTeT7n+f6uxfLFRDcJEOu12dH0AT2fZlb8MTQKDG8E70T7uP//qG4CMdNKV3Ra/cxG7/Z1i04GT7Ll0QriWvQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz", - "integrity": "sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/experimental-utils": "4.33.0", "@typescript-eslint/scope-manager": "4.33.0", @@ -453,9 +405,8 @@ }, "node_modules/@typescript-eslint/experimental-utils": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz", - "integrity": "sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.7", "@typescript-eslint/scope-manager": "4.33.0", @@ -477,9 +428,8 @@ }, "node_modules/@typescript-eslint/parser": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", - "integrity": "sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/scope-manager": "4.33.0", "@typescript-eslint/types": "4.33.0", @@ -504,9 +454,8 @@ }, "node_modules/@typescript-eslint/scope-manager": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", - "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/types": "4.33.0", "@typescript-eslint/visitor-keys": "4.33.0" @@ -521,9 +470,8 @@ }, "node_modules/@typescript-eslint/types": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", - "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", "dev": true, + "license": "MIT", "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, @@ -534,9 +482,8 @@ }, "node_modules/@typescript-eslint/typescript-estree": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", - "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/types": "4.33.0", "@typescript-eslint/visitor-keys": "4.33.0", @@ -561,9 +508,8 @@ }, "node_modules/@typescript-eslint/visitor-keys": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", - "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/types": "4.33.0", "eslint-visitor-keys": "^2.0.0" @@ -578,15 +524,13 @@ }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/acorn": { "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -596,27 +540,24 @@ }, "node_modules/acorn-jsx": { "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/acorn-walk": { "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } }, "node_modules/ajv": { "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -630,27 +571,24 @@ }, "node_modules/ansi-colors": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/ansi-regex": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -663,9 +601,8 @@ }, "node_modules/anymatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", "dev": true, + "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -676,78 +613,63 @@ }, "node_modules/app-module-path": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/arg": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/argparse": { "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, + "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" } }, "node_modules/array-union": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/assertion-error": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/astral-regex": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/balanced-match": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/binary-extensions": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, "node_modules/brace-expansion": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -755,9 +677,8 @@ }, "node_modules/braces": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, + "license": "MIT", "dependencies": { "fill-range": "^7.0.1" }, @@ -767,24 +688,21 @@ }, "node_modules/browser-stdout": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/callsites": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/camelcase": { "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -792,23 +710,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/catharsis": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", - "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", - "dev": true, - "dependencies": { - "lodash": "^4.17.15" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/chai": { "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", "dev": true, + "license": "MIT", "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.2", @@ -824,9 +729,8 @@ }, "node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -840,17 +744,14 @@ }, "node_modules/check-error": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/chokidar": { "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "funding": [ { @@ -858,6 +759,7 @@ "url": "https://paulmillr.com/funding/" } ], + "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -876,9 +778,8 @@ }, "node_modules/cliui": { "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, + "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -887,9 +788,8 @@ }, "node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -899,27 +799,23 @@ }, "node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/create-require": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -931,8 +827,8 @@ }, "node_modules/debug": { "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "license": "MIT", "dependencies": { "ms": "2.1.2" }, @@ -947,9 +843,8 @@ }, "node_modules/decamelize": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -959,9 +854,8 @@ }, "node_modules/deep-eql": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.2.tgz", - "integrity": "sha512-gT18+YW4CcW/DBNTwAmqTtkJh7f9qqScu2qFVlx7kCoeY9tlBu9cUcr7+I+Z/noG8INehS3xQgLpTtd/QUTn4w==", "dev": true, + "license": "MIT", "dependencies": { "type-detect": "^4.0.0" }, @@ -971,24 +865,21 @@ }, "node_modules/deep-is": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/diff": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, "node_modules/dir-glob": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, + "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -998,9 +889,8 @@ }, "node_modules/doctrine": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, + "license": "Apache-2.0", "dependencies": { "esutils": "^2.0.2" }, @@ -1010,15 +900,13 @@ }, "node_modules/emoji-regex": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/enquirer": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-colors": "^4.1.1" }, @@ -1026,29 +914,18 @@ "node": ">=8.6" } }, - "node_modules/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", - "dev": true, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/escalade": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -1058,9 +935,8 @@ }, "node_modules/eslint": { "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "7.12.11", "@eslint/eslintrc": "^0.4.3", @@ -1115,9 +991,8 @@ }, "node_modules/eslint-config-prettier": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", - "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", "dev": true, + "license": "MIT", "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -1127,9 +1002,8 @@ }, "node_modules/eslint-plugin-prettier": { "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz", - "integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==", "dev": true, + "license": "MIT", "dependencies": { "prettier-linter-helpers": "^1.0.0" }, @@ -1148,9 +1022,8 @@ }, "node_modules/eslint-scope": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -1161,9 +1034,8 @@ }, "node_modules/eslint-utils": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^2.0.0" }, @@ -1179,18 +1051,16 @@ }, "node_modules/eslint-visitor-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10" } }, "node_modules/eslint/node_modules/eslint-utils": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -1203,27 +1073,24 @@ }, "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=4" } }, "node_modules/eslint/node_modules/ignore": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } }, "node_modules/espree": { "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "acorn": "^7.4.0", "acorn-jsx": "^5.3.1", @@ -1235,18 +1102,16 @@ }, "node_modules/espree/node_modules/eslint-visitor-keys": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=4" } }, "node_modules/esprima": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, + "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -1257,9 +1122,8 @@ }, "node_modules/esquery": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" }, @@ -1269,18 +1133,16 @@ }, "node_modules/esquery/node_modules/estraverse": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, "node_modules/esrecurse": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -1290,48 +1152,42 @@ }, "node_modules/esrecurse/node_modules/estraverse": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, "node_modules/estraverse": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, "node_modules/esutils": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } }, "node_modules/fast-deep-equal": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-diff": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/fast-glob": { "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -1345,47 +1201,26 @@ }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fastq": { "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, + "license": "ISC", "dependencies": { "reusify": "^1.0.4" } }, - "node_modules/ffi-napi": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/ffi-napi/-/ffi-napi-4.0.3.tgz", - "integrity": "sha512-PMdLCIvDY9mS32RxZ0XGb95sonPRal8aqRhLbeEtWKZTe2A87qRFG9HjOhvG8EX2UmQw5XNRMIOT+1MYlWmdeg==", - "hasInstallScript": true, - "dependencies": { - "debug": "^4.1.1", - "get-uv-event-loop-napi-h": "^1.0.5", - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1", - "ref-napi": "^2.0.1 || ^3.0.2", - "ref-struct-di": "^1.1.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/file-entry-cache": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, + "license": "MIT", "dependencies": { "flat-cache": "^3.0.4" }, @@ -1395,9 +1230,8 @@ }, "node_modules/fill-range": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -1407,9 +1241,8 @@ }, "node_modules/find-up": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -1423,18 +1256,16 @@ }, "node_modules/flat": { "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, + "license": "BSD-3-Clause", "bin": { "flat": "cli.js" } }, "node_modules/flat-cache": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, + "license": "MIT", "dependencies": { "flatted": "^3.1.0", "rimraf": "^3.0.2" @@ -1445,14 +1276,12 @@ }, "node_modules/flatted": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/fs-extra": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "license": "MIT", "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -1461,16 +1290,13 @@ }, "node_modules/fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/fsevents": { "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, - "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1481,46 +1307,40 @@ }, "node_modules/functional-red-black-tree": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/get-caller-file": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, + "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } }, "node_modules/get-func-name": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/get-symbol-from-current-process-h": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz", - "integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==" + "license": "MIT" }, "node_modules/get-uv-event-loop-napi-h": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz", - "integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==", + "license": "MIT", "dependencies": { "get-symbol-from-current-process-h": "^1.0.1" } }, "node_modules/glob": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1538,9 +1358,8 @@ }, "node_modules/glob-parent": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -1550,9 +1369,8 @@ }, "node_modules/globals": { "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -1565,9 +1383,8 @@ }, "node_modules/globby": { "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, + "license": "MIT", "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -1585,50 +1402,44 @@ }, "node_modules/graceful-fs": { "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + "license": "ISC" }, "node_modules/growl": { "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true, + "license": "MIT", "engines": { "node": ">=4.x" } }, "node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/he": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true, + "license": "MIT", "bin": { "he": "bin/he" } }, "node_modules/ignore": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } }, "node_modules/import-fresh": { "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, + "license": "MIT", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -1642,18 +1453,16 @@ }, "node_modules/imurmurhash": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.19" } }, "node_modules/inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, + "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -1661,15 +1470,13 @@ }, "node_modules/inherits": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/is-binary-path": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, + "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, @@ -1679,27 +1486,24 @@ }, "node_modules/is-extglob": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/is-glob": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -1709,27 +1513,24 @@ }, "node_modules/is-number": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } }, "node_modules/is-plain-obj": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/is-unicode-supported": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -1739,21 +1540,18 @@ }, "node_modules/isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/js-tokens": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-yaml": { "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -1762,87 +1560,27 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/js2xmlparser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", - "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", - "dev": true, - "dependencies": { - "xmlcreate": "^2.0.4" - } - }, - "node_modules/jsdoc": { - "version": "3.6.11", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz", - "integrity": "sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.9.4", - "@types/markdown-it": "^12.2.3", - "bluebird": "^3.7.2", - "catharsis": "^0.9.0", - "escape-string-regexp": "^2.0.0", - "js2xmlparser": "^4.0.2", - "klaw": "^3.0.0", - "markdown-it": "^12.3.2", - "markdown-it-anchor": "^8.4.1", - "marked": "^4.0.10", - "mkdirp": "^1.0.4", - "requizzle": "^0.2.3", - "strip-json-comments": "^3.1.0", - "taffydb": "2.6.2", - "underscore": "~1.13.2" - }, - "bin": { - "jsdoc": "jsdoc.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/jsdoc/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/json-schema-traverse": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jsonfile": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", "optionalDependencies": { "graceful-fs": "^4.1.6" } }, - "node_modules/klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.9" - } - }, "node_modules/levn": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -1851,20 +1589,10 @@ "node": ">= 0.8.0" } }, - "node_modules/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", - "dev": true, - "dependencies": { - "uc.micro": "^1.0.1" - } - }, "node_modules/locate-path": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^5.0.0" }, @@ -1877,26 +1605,22 @@ }, "node_modules/lodash": { "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.truncate": { "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-symbols": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -1910,18 +1634,16 @@ }, "node_modules/loupe": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", "dev": true, + "license": "MIT", "dependencies": { "get-func-name": "^2.0.0" } }, "node_modules/lru-cache": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, + "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -1931,74 +1653,21 @@ }, "node_modules/make-error": { "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, - "node_modules/markdown-it-anchor": { - "version": "8.6.5", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.5.tgz", - "integrity": "sha512-PI1qEHHkTNWT+X6Ip9w+paonfIQ+QZP9sCeMYi47oqhH+EsW8CrJ8J7CzV19QVOj6il8ATGbK2nTECj22ZHGvQ==", - "dev": true, - "peerDependencies": { - "@types/markdown-it": "*", - "markdown-it": "*" - } - }, - "node_modules/markdown-it/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/marked": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.2.tgz", - "integrity": "sha512-JjBTFTAvuTgANXx82a5vzK9JLSMoV6V3LBVn4Uhdso6t7vXrGx7g1Cd2r6NYSsxrYbQGFCMqBDhFHyK5q2UvcQ==", "dev": true, - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 12" - } - }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", - "dev": true + "license": "ISC" }, "node_modules/merge2": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/micromatch": { "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -2009,9 +1678,8 @@ }, "node_modules/minimatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2019,23 +1687,10 @@ "node": "*" } }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/mocha": { "version": "9.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", - "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", "dev": true, + "license": "MIT", "dependencies": { "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", @@ -2076,24 +1731,21 @@ }, "node_modules/mocha/node_modules/ansi-colors": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/mocha/node_modules/argparse": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "dev": true, + "license": "Python-2.0" }, "node_modules/mocha/node_modules/debug": { "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.1.2" }, @@ -2108,15 +1760,13 @@ }, "node_modules/mocha/node_modules/debug/node_modules/ms": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/mocha/node_modules/js-yaml": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -2126,9 +1776,8 @@ }, "node_modules/mocha/node_modules/minimatch": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2138,15 +1787,13 @@ }, "node_modules/mocha/node_modules/ms": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/mocha/node_modules/supports-color": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -2159,14 +1806,13 @@ }, "node_modules/ms": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "dev": true, + "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", - "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true, + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -2176,19 +1822,16 @@ }, "node_modules/natural-compare": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/node-addon-api": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" + "license": "MIT" }, "node_modules/node-gyp-build": { "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "license": "MIT", "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -2197,27 +1840,24 @@ }, "node_modules/normalize-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, + "license": "ISC", "dependencies": { "wrappy": "1" } }, "node_modules/optionator": { "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, + "license": "MIT", "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -2232,9 +1872,8 @@ }, "node_modules/p-limit": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" }, @@ -2247,9 +1886,8 @@ }, "node_modules/p-locate": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^3.0.2" }, @@ -2262,9 +1900,8 @@ }, "node_modules/parent-module": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, + "license": "MIT", "dependencies": { "callsites": "^3.0.0" }, @@ -2274,54 +1911,48 @@ }, "node_modules/path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/path-key": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/path-type": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/pathval": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/picomatch": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.6" }, @@ -2331,18 +1962,16 @@ }, "node_modules/prelude-ls": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } }, "node_modules/prettier": { "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin-prettier.js" }, @@ -2355,9 +1984,8 @@ }, "node_modules/prettier-linter-helpers": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, + "license": "MIT", "dependencies": { "fast-diff": "^1.1.2" }, @@ -2367,26 +1995,22 @@ }, "node_modules/progress": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } }, "node_modules/punycode": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/queue-microtask": { "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ { @@ -2401,22 +2025,21 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/randombytes": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" } }, "node_modules/readdirp": { "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, + "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, @@ -2424,42 +2047,10 @@ "node": ">=8.10.0" } }, - "node_modules/ref-napi": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-3.0.3.tgz", - "integrity": "sha512-LiMq/XDGcgodTYOMppikEtJelWsKQERbLQsYm0IOOnzhwE9xYZC7x8txNnFC9wJNOkPferQI4vD4ZkC0mDyrOA==", - "hasInstallScript": true, - "dependencies": { - "debug": "^4.1.1", - "get-symbol-from-current-process-h": "^1.0.2", - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1" - }, - "engines": { - "node": ">= 10.0" - } - }, - "node_modules/ref-struct-di": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ref-struct-di/-/ref-struct-di-1.1.1.tgz", - "integrity": "sha512-2Xyn/0Qgz89VT+++WP0sTosdm9oeowLP23wRJYhG4BFdMUrLj3jhwHZNEytYNYgtPKLNTP3KJX4HEgBvM1/Y2g==", - "dependencies": { - "debug": "^3.1.0" - } - }, - "node_modules/ref-struct-di/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dependencies": { - "ms": "^2.1.1" - } - }, "node_modules/regexpp": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -2469,45 +2060,32 @@ }, "node_modules/require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/require-from-string": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/requizzle": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz", - "integrity": "sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ==", - "dev": true, - "dependencies": { - "lodash": "^4.17.14" - } - }, "node_modules/resolve-from": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/reusify": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, + "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -2515,9 +2093,8 @@ }, "node_modules/rimraf": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, + "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -2530,8 +2107,6 @@ }, "node_modules/run-parallel": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { @@ -2547,14 +2122,13 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } }, "node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -2569,13 +2143,13 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/semver": { "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -2588,17 +2162,15 @@ }, "node_modules/serialize-javascript": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" } }, "node_modules/setimmediate-napi": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/setimmediate-napi/-/setimmediate-napi-1.0.6.tgz", - "integrity": "sha512-sdNXN15Av1jPXuSal4Mk4tEAKn0+8lfF9Z50/negaQMrAIO9c1qM0eiCh8fT6gctp0RiCObk+6/Xfn5RMGdZoA==", + "license": "MIT", "dependencies": { "get-symbol-from-current-process-h": "^1.0.1", "get-uv-event-loop-napi-h": "^1.0.5" @@ -2606,9 +2178,8 @@ }, "node_modules/shebang-command": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" }, @@ -2618,27 +2189,24 @@ }, "node_modules/shebang-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/slash": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/slice-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -2653,15 +2221,13 @@ }, "node_modules/sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/string-width": { "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -2673,9 +2239,8 @@ }, "node_modules/strip-ansi": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -2685,9 +2250,8 @@ }, "node_modules/strip-json-comments": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -2697,9 +2261,8 @@ }, "node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -2709,9 +2272,8 @@ }, "node_modules/table": { "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -2725,9 +2287,8 @@ }, "node_modules/table/node_modules/ajv": { "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -2741,27 +2302,18 @@ }, "node_modules/table/node_modules/json-schema-traverse": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/text-table": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/to-regex-range": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -2771,9 +2323,8 @@ }, "node_modules/ts-node": { "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -2814,9 +2365,8 @@ }, "node_modules/ts-node/node_modules/acorn": { "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -2826,24 +2376,21 @@ }, "node_modules/ts-node/node_modules/diff": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, "node_modules/tslib": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/tsutils": { "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.8.1" }, @@ -2856,9 +2403,8 @@ }, "node_modules/type-check": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" }, @@ -2868,18 +2414,16 @@ }, "node_modules/type-detect": { "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/type-fest": { "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -2889,9 +2433,8 @@ }, "node_modules/typescript": { "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -2900,60 +2443,46 @@ "node": ">=4.2.0" } }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, - "node_modules/underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", - "dev": true - }, "node_modules/universalify": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "license": "MIT", "engines": { "node": ">= 4.0.0" } }, "node_modules/uri-js": { "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } }, "node_modules/uuid": { "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } }, "node_modules/v8-compile-cache": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/vcx-napi-rs": { + "resolved": "../vcx-napi-rs", + "link": true }, "node_modules/weak-napi": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", - "integrity": "sha512-LcOSVFrghtVXf4QH+DLIy8iPiCktV7lVbqRDYP+bDPpLzC41RCHQPMyQOnPpWO41Ie4CmnDxS+mbL72r5xFMMQ==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "node-addon-api": "^3.0.0", "node-gyp-build": "^4.2.1", @@ -2962,9 +2491,8 @@ }, "node_modules/which": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -2977,24 +2505,21 @@ }, "node_modules/word-wrap": { "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/workerpool": { "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/wrap-ansi": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -3009,36 +2534,26 @@ }, "node_modules/wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/xmlcreate": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", - "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/y18n": { "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10" } }, "node_modules/yallist": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/yargs": { "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, + "license": "MIT", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -3054,18 +2569,16 @@ }, "node_modules/yargs-parser": { "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10" } }, "node_modules/yargs-unparser": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, + "license": "MIT", "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", @@ -3078,18 +2591,16 @@ }, "node_modules/yn": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/yocto-queue": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -3101,8 +2612,6 @@ "dependencies": { "@babel/code-frame": { "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, "requires": { "@babel/highlight": "^7.10.4" @@ -3110,14 +2619,10 @@ }, "@babel/helper-validator-identifier": { "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true }, "@babel/highlight": { "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.18.6", @@ -3127,8 +2632,6 @@ "dependencies": { "ansi-styles": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "^1.9.0" @@ -3136,8 +2639,6 @@ }, "chalk": { "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -3147,8 +2648,6 @@ }, "color-convert": { "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { "color-name": "1.1.3" @@ -3156,26 +2655,18 @@ }, "color-name": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true }, "has-flag": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true }, "supports-color": { "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { "has-flag": "^3.0.0" @@ -3183,16 +2674,8 @@ } } }, - "@babel/parser": { - "version": "7.20.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.3.tgz", - "integrity": "sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg==", - "dev": true - }, "@cspotcode/source-map-support": { "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" @@ -3200,8 +2683,6 @@ }, "@eslint/eslintrc": { "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -3217,16 +2698,12 @@ "dependencies": { "ignore": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true } } }, "@humanwhocodes/config-array": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.0", @@ -3236,26 +2713,51 @@ }, "@humanwhocodes/object-schema": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@hyperledger/vcx-napi-rs": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs/-/vcx-napi-rs-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-VUpIjTBurvN61diP+xeamSKg7Ug6PG72WSCLGjyVYFGpDTzrJuGW3LL/UsbFjMoQaNA1XUXERenAoya02gJJ9w==", + "peer": true, + "requires": { + "@hyperledger/vcx-napi-rs-darwin-arm64": "0.50.0-featurenapi-rs-separate-crate-4208", + "@hyperledger/vcx-napi-rs-darwin-x64": "0.50.0-featurenapi-rs-separate-crate-4208", + "@hyperledger/vcx-napi-rs-linux-x64-gnu": "0.50.0-featurenapi-rs-separate-crate-4208", + "@hyperledger/vcx-napi-rs-linux-x64-musl": "0.50.0-featurenapi-rs-separate-crate-4208" + } + }, + "@hyperledger/vcx-napi-rs-darwin-x64": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs-darwin-x64/-/vcx-napi-rs-darwin-x64-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-F38iz0gAo4BkAZVwD3D/VIkBqE849iZM0J3rHjCHzNOZOY3+u7cNtVRPumFoiq8p/ZExNIr+yyqRCCCQ8GDESQ==", + "optional": true, + "peer": true + }, + "@hyperledger/vcx-napi-rs-linux-x64-gnu": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs-linux-x64-gnu/-/vcx-napi-rs-linux-x64-gnu-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-kv0AUEaLQuYJQpHBEyaE7pTRrt7nRlIPuE5jR/6sFxHTZwY0I4kZc0YLv23/uRDlnri9CPdRsLAgbTRzWZcIUg==", + "optional": true, + "peer": true + }, + "@hyperledger/vcx-napi-rs-linux-x64-musl": { + "version": "0.50.0-featurenapi-rs-separate-crate-4208", + "resolved": "https://registry.npmjs.org/@hyperledger/vcx-napi-rs-linux-x64-musl/-/vcx-napi-rs-linux-x64-musl-0.50.0-featurenapi-rs-separate-crate-4208.tgz", + "integrity": "sha512-UyJW95OUIpswcw7ih8RiYpwGoPWu+4WCTSSbsBx/5f8ZwwP9y7ahnkWancPOuVFvG42WjKtSDbG/YJkw5Q9JPw==", + "optional": true, + "peer": true + }, "@jridgewell/resolve-uri": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", "dev": true }, "@jridgewell/sourcemap-codec": { "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, "@jridgewell/trace-mapping": { "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", @@ -3264,8 +2766,6 @@ }, "@nodelib/fs.scandir": { "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "requires": { "@nodelib/fs.stat": "2.0.5", @@ -3274,14 +2774,10 @@ }, "@nodelib/fs.stat": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true }, "@nodelib/fs.walk": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "requires": { "@nodelib/fs.scandir": "2.1.5", @@ -3290,140 +2786,50 @@ }, "@tsconfig/node10": { "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", "dev": true }, "@tsconfig/node12": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", "dev": true }, "@tsconfig/node14": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", "dev": true }, "@tsconfig/node16": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "dev": true }, "@types/app-module-path": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@types/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-r47Kt3ApJDzUU2xCNzaBI25Au5Xfdvf0Gyomveqvg46nQ3J4PaDLicObhyX6cMhvMVWJMB/BnkXdv1E4zxP+6w==", "dev": true }, "@types/chai": { "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", "dev": true }, - "@types/ffi-napi": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/ffi-napi/-/ffi-napi-4.0.6.tgz", - "integrity": "sha512-yrBtqeVD1aeVo271jXVEo3iAtbzSGVGRssJv9W9JlUfg5Z5FgHJx2MV88GRwVATu/XWg6zyenW/cb1MNAuOtaQ==", - "dev": true, - "requires": { - "@types/node": "*", - "@types/ref-napi": "*", - "@types/ref-struct-di": "*" - } - }, "@types/json-schema": { "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "@types/linkify-it": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", - "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", "dev": true }, "@types/lodash": { "version": "4.14.188", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.188.tgz", - "integrity": "sha512-zmEmF5OIM3rb7SbLCFYoQhO4dGt2FRM9AMkxvA3LaADOF1n8in/zGJlWji9fmafLoNyz+FoL6FE0SLtGIArD7w==", - "dev": true - }, - "@types/markdown-it": { - "version": "12.2.3", - "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", - "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", - "dev": true, - "requires": { - "@types/linkify-it": "*", - "@types/mdurl": "*" - } - }, - "@types/mdurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", "dev": true }, "@types/mocha": { "version": "8.2.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", - "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", "dev": true }, "@types/node": { "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - }, - "@types/ref-napi": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@types/ref-napi/-/ref-napi-3.0.5.tgz", - "integrity": "sha512-u+L/RdwTuJes3pDypOVR/MtcqzoULu8Z8yulP6Tw5z7eXV1ba1llizNVFtI/m2iPfDy/dPPt+3ar1QCgonTzsw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/ref-struct-di": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@types/ref-struct-di/-/ref-struct-di-1.1.7.tgz", - "integrity": "sha512-nnHR26qrCnQqxwHTv+rqzu/hGgDZl45TUs4bO6ZjpuC8/M2JoXFxk63xrWmAmqsLe55oxOgAWssyr3YHAMY89g==", - "dev": true, - "requires": { - "@types/ref-napi": "*" - } - }, - "@types/sinon": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-5.0.7.tgz", - "integrity": "sha512-opwMHufhUwkn/UUDk35LDbKJpA2VBsZT8WLU8NjayvRLGPxQkN+8XmfC2Xl35MAscBE8469koLLBjaI3XLEIww==", "dev": true }, "@types/uuid": { "version": "8.3.4", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", - "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", "dev": true }, - "@types/weak": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/weak/-/weak-1.0.0.tgz", - "integrity": "sha512-6WXZpeAac3vj5+OfQvlqYEtc88oOgvkcxbrnmBw53Da6gA+MGztL+Hns3BpnyUevgz+4DxsJblgAew1A/tkcng==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/weak-napi": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/weak-napi/-/weak-napi-1.0.1.tgz", - "integrity": "sha512-EqTeT7n+f6uxfLFRDcJEOu12dH0AT2fZlb8MTQKDG8E70T7uP//qG4CMdNKV3Ra/cxG7/Z1i04GT7Ll0QriWvQ==", "dev": true, "requires": { "@types/node": "*" @@ -3431,8 +2837,6 @@ }, "@typescript-eslint/eslint-plugin": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz", - "integrity": "sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg==", "dev": true, "requires": { "@typescript-eslint/experimental-utils": "4.33.0", @@ -3447,8 +2851,6 @@ }, "@typescript-eslint/experimental-utils": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz", - "integrity": "sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==", "dev": true, "requires": { "@types/json-schema": "^7.0.7", @@ -3461,8 +2863,6 @@ }, "@typescript-eslint/parser": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", - "integrity": "sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA==", "dev": true, "requires": { "@typescript-eslint/scope-manager": "4.33.0", @@ -3473,8 +2873,6 @@ }, "@typescript-eslint/scope-manager": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", - "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", "dev": true, "requires": { "@typescript-eslint/types": "4.33.0", @@ -3483,14 +2881,10 @@ }, "@typescript-eslint/types": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", - "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", "dev": true }, "@typescript-eslint/typescript-estree": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", - "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", "dev": true, "requires": { "@typescript-eslint/types": "4.33.0", @@ -3504,8 +2898,6 @@ }, "@typescript-eslint/visitor-keys": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", - "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", "dev": true, "requires": { "@typescript-eslint/types": "4.33.0", @@ -3514,33 +2906,23 @@ }, "@ungap/promise-all-settled": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, "acorn": { "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, "acorn-jsx": { "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "requires": {} }, "acorn-walk": { "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, "ajv": { "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -3551,20 +2933,14 @@ }, "ansi-colors": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true }, "ansi-regex": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { "color-convert": "^2.0.1" @@ -3572,8 +2948,6 @@ }, "anymatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -3582,20 +2956,14 @@ }, "app-module-path": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==", "dev": true }, "arg": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "dev": true }, "argparse": { "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" @@ -3603,44 +2971,26 @@ }, "array-union": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, "assertion-error": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, "astral-regex": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, "balanced-match": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "binary-extensions": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", "dev": true }, "brace-expansion": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -3649,8 +2999,6 @@ }, "braces": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "requires": { "fill-range": "^7.0.1" @@ -3658,35 +3006,18 @@ }, "browser-stdout": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, "callsites": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, "camelcase": { "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, - "catharsis": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", - "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", - "dev": true, - "requires": { - "lodash": "^4.17.15" - } - }, "chai": { "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", "dev": true, "requires": { "assertion-error": "^1.1.0", @@ -3700,8 +3031,6 @@ }, "chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -3710,14 +3039,10 @@ }, "check-error": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", "dev": true }, "chokidar": { "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "requires": { "anymatch": "~3.1.2", @@ -3732,8 +3057,6 @@ }, "cliui": { "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "requires": { "string-width": "^4.2.0", @@ -3743,8 +3066,6 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { "color-name": "~1.1.4" @@ -3752,26 +3073,18 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "create-require": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, "cross-spawn": { "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -3781,22 +3094,17 @@ }, "debug": { "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "requires": { "ms": "2.1.2" } }, "decamelize": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true }, "deep-eql": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.2.tgz", - "integrity": "sha512-gT18+YW4CcW/DBNTwAmqTtkJh7f9qqScu2qFVlx7kCoeY9tlBu9cUcr7+I+Z/noG8INehS3xQgLpTtd/QUTn4w==", "dev": true, "requires": { "type-detect": "^4.0.0" @@ -3804,20 +3112,14 @@ }, "deep-is": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "diff": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true }, "dir-glob": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "requires": { "path-type": "^4.0.0" @@ -3825,8 +3127,6 @@ }, "doctrine": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, "requires": { "esutils": "^2.0.2" @@ -3834,41 +3134,25 @@ }, "emoji-regex": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "enquirer": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", "dev": true, "requires": { "ansi-colors": "^4.1.1" } }, - "entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", - "dev": true - }, "escalade": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true }, "escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, "eslint": { "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", @@ -3915,8 +3199,6 @@ "dependencies": { "eslint-utils": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" @@ -3924,31 +3206,23 @@ "dependencies": { "eslint-visitor-keys": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true } } }, "ignore": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true } } }, "eslint-config-prettier": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", - "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", "dev": true, "requires": {} }, "eslint-plugin-prettier": { "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz", - "integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0" @@ -3956,8 +3230,6 @@ }, "eslint-scope": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "requires": { "esrecurse": "^4.3.0", @@ -3966,8 +3238,6 @@ }, "eslint-utils": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "requires": { "eslint-visitor-keys": "^2.0.0" @@ -3975,14 +3245,10 @@ }, "eslint-visitor-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true }, "espree": { "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", "dev": true, "requires": { "acorn": "^7.4.0", @@ -3992,22 +3258,16 @@ "dependencies": { "eslint-visitor-keys": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true } } }, "esprima": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "esquery": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -4015,16 +3275,12 @@ "dependencies": { "estraverse": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } }, "esrecurse": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "requires": { "estraverse": "^5.2.0" @@ -4032,40 +3288,28 @@ "dependencies": { "estraverse": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } }, "estraverse": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, "esutils": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, "fast-deep-equal": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-diff": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, "fast-glob": { "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -4077,42 +3321,21 @@ }, "fast-json-stable-stringify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, "fast-levenshtein": { "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, "fastq": { "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "requires": { "reusify": "^1.0.4" } }, - "ffi-napi": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/ffi-napi/-/ffi-napi-4.0.3.tgz", - "integrity": "sha512-PMdLCIvDY9mS32RxZ0XGb95sonPRal8aqRhLbeEtWKZTe2A87qRFG9HjOhvG8EX2UmQw5XNRMIOT+1MYlWmdeg==", - "requires": { - "debug": "^4.1.1", - "get-uv-event-loop-napi-h": "^1.0.5", - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1", - "ref-napi": "^2.0.1 || ^3.0.2", - "ref-struct-di": "^1.1.0" - } - }, "file-entry-cache": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "requires": { "flat-cache": "^3.0.4" @@ -4120,8 +3343,6 @@ }, "fill-range": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "requires": { "to-regex-range": "^5.0.1" @@ -4129,8 +3350,6 @@ }, "find-up": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { "locate-path": "^6.0.0", @@ -4139,14 +3358,10 @@ }, "flat": { "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, "flat-cache": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, "requires": { "flatted": "^3.1.0", @@ -4155,14 +3370,10 @@ }, "flatted": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, "fs-extra": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -4171,52 +3382,36 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "fsevents": { "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "optional": true }, "functional-red-black-tree": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", "dev": true }, "get-caller-file": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, "get-func-name": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", "dev": true }, "get-symbol-from-current-process-h": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz", - "integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==" + "version": "1.0.2" }, "get-uv-event-loop-napi-h": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz", - "integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==", "requires": { "get-symbol-from-current-process-h": "^1.0.1" } }, "glob": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -4229,8 +3424,6 @@ }, "glob-parent": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -4238,8 +3431,6 @@ }, "globals": { "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -4247,8 +3438,6 @@ }, "globby": { "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -4260,38 +3449,26 @@ } }, "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + "version": "4.2.10" }, "growl": { "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, "has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "he": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "ignore": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "import-fresh": { "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -4300,14 +3477,10 @@ }, "imurmurhash": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "requires": { "once": "^1.3.0", @@ -4316,14 +3489,10 @@ }, "inherits": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "is-binary-path": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "requires": { "binary-extensions": "^2.0.0" @@ -4331,20 +3500,14 @@ }, "is-extglob": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true }, "is-fullwidth-code-point": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "is-glob": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { "is-extglob": "^2.1.1" @@ -4352,162 +3515,74 @@ }, "is-number": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, "is-plain-obj": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true }, "is-unicode-supported": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, "isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, "js-tokens": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, "js-yaml": { "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, - "js2xmlparser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", - "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", - "dev": true, - "requires": { - "xmlcreate": "^2.0.4" - } - }, - "jsdoc": { - "version": "3.6.11", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz", - "integrity": "sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==", - "dev": true, - "requires": { - "@babel/parser": "^7.9.4", - "@types/markdown-it": "^12.2.3", - "bluebird": "^3.7.2", - "catharsis": "^0.9.0", - "escape-string-regexp": "^2.0.0", - "js2xmlparser": "^4.0.2", - "klaw": "^3.0.0", - "markdown-it": "^12.3.2", - "markdown-it-anchor": "^8.4.1", - "marked": "^4.0.10", - "mkdirp": "^1.0.4", - "requizzle": "^0.2.3", - "strip-json-comments": "^3.1.0", - "taffydb": "2.6.2", - "underscore": "~1.13.2" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true - } - } - }, "json-schema-traverse": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, "jsonfile": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", "requires": { "graceful-fs": "^4.1.6" } }, - "klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, "levn": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "requires": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, - "linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", - "dev": true, - "requires": { - "uc.micro": "^1.0.1" - } - }, "locate-path": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "requires": { "p-locate": "^5.0.0" } }, "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "version": "4.17.21" }, "lodash.merge": { "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, "lodash.truncate": { "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dev": true }, "log-symbols": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -4516,8 +3591,6 @@ }, "loupe": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", "dev": true, "requires": { "get-func-name": "^2.0.0" @@ -4525,8 +3598,6 @@ }, "lru-cache": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "requires": { "yallist": "^4.0.0" @@ -4534,60 +3605,14 @@ }, "make-error": { "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", - "dev": true, - "requires": { - "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - } - } - }, - "markdown-it-anchor": { - "version": "8.6.5", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.5.tgz", - "integrity": "sha512-PI1qEHHkTNWT+X6Ip9w+paonfIQ+QZP9sCeMYi47oqhH+EsW8CrJ8J7CzV19QVOj6il8ATGbK2nTECj22ZHGvQ==", - "dev": true, - "requires": {} - }, - "marked": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.2.tgz", - "integrity": "sha512-JjBTFTAvuTgANXx82a5vzK9JLSMoV6V3LBVn4Uhdso6t7vXrGx7g1Cd2r6NYSsxrYbQGFCMqBDhFHyK5q2UvcQ==", - "dev": true - }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, "merge2": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, "micromatch": { "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { "braces": "^3.0.2", @@ -4596,23 +3621,13 @@ }, "minimatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true - }, "mocha": { "version": "9.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", - "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", @@ -4643,20 +3658,14 @@ "dependencies": { "ansi-colors": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "dev": true }, "argparse": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, "debug": { "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, "requires": { "ms": "2.1.2" @@ -4664,16 +3673,12 @@ "dependencies": { "ms": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true } } }, "js-yaml": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "requires": { "argparse": "^2.0.1" @@ -4681,8 +3686,6 @@ }, "minimatch": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -4690,14 +3693,10 @@ }, "ms": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "supports-color": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -4707,41 +3706,28 @@ }, "ms": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "dev": true }, "nanoid": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", - "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true }, "natural-compare": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, "node-addon-api": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" + "version": "3.2.1" }, "node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" + "version": "4.5.0" }, "normalize-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "requires": { "wrappy": "1" @@ -4749,8 +3735,6 @@ }, "optionator": { "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, "requires": { "deep-is": "^0.1.3", @@ -4763,8 +3747,6 @@ }, "p-limit": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "requires": { "yocto-queue": "^0.1.0" @@ -4772,8 +3754,6 @@ }, "p-locate": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { "p-limit": "^3.0.2" @@ -4781,8 +3761,6 @@ }, "parent-module": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "requires": { "callsites": "^3.0.0" @@ -4790,56 +3768,38 @@ }, "path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true }, "path-key": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, "path-type": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, "pathval": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, "picomatch": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "prelude-ls": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, "prettier": { "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "dev": true }, "prettier-linter-helpers": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, "requires": { "fast-diff": "^1.1.2" @@ -4847,26 +3807,18 @@ }, "progress": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, "punycode": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, "queue-microtask": { "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, "randombytes": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, "requires": { "safe-buffer": "^5.1.0" @@ -4874,85 +3826,33 @@ }, "readdirp": { "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "requires": { "picomatch": "^2.2.1" } }, - "ref-napi": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-3.0.3.tgz", - "integrity": "sha512-LiMq/XDGcgodTYOMppikEtJelWsKQERbLQsYm0IOOnzhwE9xYZC7x8txNnFC9wJNOkPferQI4vD4ZkC0mDyrOA==", - "requires": { - "debug": "^4.1.1", - "get-symbol-from-current-process-h": "^1.0.2", - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1" - } - }, - "ref-struct-di": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ref-struct-di/-/ref-struct-di-1.1.1.tgz", - "integrity": "sha512-2Xyn/0Qgz89VT+++WP0sTosdm9oeowLP23wRJYhG4BFdMUrLj3jhwHZNEytYNYgtPKLNTP3KJX4HEgBvM1/Y2g==", - "requires": { - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "requires": { - "ms": "^2.1.1" - } - } - } - }, "regexpp": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, "require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true }, "require-from-string": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, - "requizzle": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz", - "integrity": "sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, "resolve-from": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, "reusify": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, "rimraf": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { "glob": "^7.1.3" @@ -4960,8 +3860,6 @@ }, "run-parallel": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "requires": { "queue-microtask": "^1.2.2" @@ -4969,14 +3867,10 @@ }, "safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true }, "semver": { "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -4984,8 +3878,6 @@ }, "serialize-javascript": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", "dev": true, "requires": { "randombytes": "^2.1.0" @@ -4993,8 +3885,6 @@ }, "setimmediate-napi": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/setimmediate-napi/-/setimmediate-napi-1.0.6.tgz", - "integrity": "sha512-sdNXN15Av1jPXuSal4Mk4tEAKn0+8lfF9Z50/negaQMrAIO9c1qM0eiCh8fT6gctp0RiCObk+6/Xfn5RMGdZoA==", "requires": { "get-symbol-from-current-process-h": "^1.0.1", "get-uv-event-loop-napi-h": "^1.0.5" @@ -5002,8 +3892,6 @@ }, "shebang-command": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "requires": { "shebang-regex": "^3.0.0" @@ -5011,20 +3899,14 @@ }, "shebang-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, "slash": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, "slice-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, "requires": { "ansi-styles": "^4.0.0", @@ -5034,14 +3916,10 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, "string-width": { "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { "emoji-regex": "^8.0.0", @@ -5051,8 +3929,6 @@ }, "strip-ansi": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { "ansi-regex": "^5.0.1" @@ -5060,14 +3936,10 @@ }, "strip-json-comments": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, "supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -5075,8 +3947,6 @@ }, "table": { "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", "dev": true, "requires": { "ajv": "^8.0.1", @@ -5088,8 +3958,6 @@ "dependencies": { "ajv": { "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -5100,28 +3968,16 @@ }, "json-schema-traverse": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true } } }, - "taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", - "dev": true - }, "text-table": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, "to-regex-range": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "requires": { "is-number": "^7.0.0" @@ -5129,8 +3985,6 @@ }, "ts-node": { "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", @@ -5150,28 +4004,20 @@ "dependencies": { "acorn": { "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true }, "diff": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true } } }, "tslib": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "tsutils": { "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -5179,8 +4025,6 @@ }, "type-check": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "requires": { "prelude-ls": "^1.2.1" @@ -5188,69 +4032,51 @@ }, "type-detect": { "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, "type-fest": { "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, "typescript": { "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", - "dev": true - }, - "uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, - "underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", "dev": true }, "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + "version": "0.1.2" }, "uri-js": { "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "requires": { "punycode": "^2.1.0" } }, "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + "version": "8.3.2" }, "v8-compile-cache": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, "v8-compile-cache-lib": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "vcx-napi-rs": { + "version": "file:../vcx-napi-rs", + "requires": { + "@hyperledger/vcx-napi-rs-darwin-arm64": "undefined", + "@hyperledger/vcx-napi-rs-darwin-x64": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-gnu": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-musl": "undefined", + "@napi-rs/cli": "^2.9.1", + "@types/node": "^18.11.18", + "typescript": "^4.8.4" + } + }, "weak-napi": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", - "integrity": "sha512-LcOSVFrghtVXf4QH+DLIy8iPiCktV7lVbqRDYP+bDPpLzC41RCHQPMyQOnPpWO41Ie4CmnDxS+mbL72r5xFMMQ==", "requires": { "node-addon-api": "^3.0.0", "node-gyp-build": "^4.2.1", @@ -5259,8 +4085,6 @@ }, "which": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -5268,20 +4092,14 @@ }, "word-wrap": { "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, "workerpool": { "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", "dev": true }, "wrap-ansi": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "requires": { "ansi-styles": "^4.0.0", @@ -5291,32 +4109,18 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "xmlcreate": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", - "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", "dev": true }, "y18n": { "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, "yallist": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, "yargs": { "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "requires": { "cliui": "^7.0.2", @@ -5330,14 +4134,10 @@ }, "yargs-parser": { "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", "dev": true }, "yargs-unparser": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, "requires": { "camelcase": "^6.0.0", @@ -5348,14 +4148,10 @@ }, "yn": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true }, "yocto-queue": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true } } diff --git a/wrappers/node/package.json b/wrappers/node/package.json index 16c91f1c97..383848bcc1 100644 --- a/wrappers/node/package.json +++ b/wrappers/node/package.json @@ -31,24 +31,18 @@ "access": "public" }, "dependencies": { - "ffi-napi": "^4.0.3", "fs-extra": "^4.0.2", "lodash": "^4.17.21", - "ref-napi": "^3.0.3", "uuid": "^8.3.2", "weak-napi": "^2.0.2" }, "devDependencies": { "@types/app-module-path": "^2.2.0", "@types/chai": "^4.2.22", - "@types/ffi-napi": "^4.0.6", "@types/lodash": "^4.14.177", "@types/mocha": "^8.2.3", "@types/node": "^12.20.55", - "@types/ref-napi": "^3.0.5", - "@types/sinon": "^5.0.1", "@types/uuid": "^8.3.3", - "@types/weak": "^1.0.0", "@types/weak-napi": "^1.0.0", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", @@ -57,11 +51,14 @@ "eslint": "^7.32.0", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.4.1", - "jsdoc": "^3.6.7", "mocha": "^9.2.2", "prettier": "^2.5.0", "ts-node": "^10.9.1", - "typescript": "^4.8.4" + "typescript": "^4.8.4", + "@hyperledger/vcx-napi-rs": "../vcx-napi-rs" + }, + "peerDependencies": { + "@hyperledger/vcx-napi-rs": "^0.50.0-featurenapi-rs-separate-crate-4208" }, "scripts": { "tscversion": "tsc --version", @@ -70,18 +67,17 @@ "lint": "eslint '*/**/*.{js,ts,tsx}'", "lint-fix": "npm run lint -- --fix", "jslint:fix": "standard --fix", - "test": "npm run test:connection && npm run test:credentialDef && npm run test:credential && npm run test:disclosedProof && npm run test:issuerCredential && npm run test:proof && npm run test:oob && npm run test:schema && npm run test:utils && npm run test:wallet && npm run test:ffi", - "test:connection": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-connection.test.ts", - "test:credentialDef": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-credential-def.test.ts", - "test:credential": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-credential.test.ts", - "test:disclosedProof": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-disclosed-proof.test.ts", - "test:issuerCredential": "TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-issuer-credential.test.ts", - "test:proof": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-proof.test.ts", - "test:schema": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-schema.test.ts", - "test:utils": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-utils.test.ts", - "test:oob": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-oob.test.ts", - "test:wallet": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite1/ariesvcx-wallet.test.ts", - "test:ffi": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full ./node_modules/.bin/mocha --timeout 60000 --v8-expose-gc --v8-use-strict --exit --recursive --require ts-node/register ./test/suite2/ffi.test.ts" + "test": "npm run test:connection && npm run test:credentialDef && npm run test:credential && npm run test:disclosedProof && npm run test:issuerCredential && npm run test:proof && npm run test:oob && npm run test:schema && npm run test:utils && npm run test:wallet", + "test:connection": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register test/suite1/ariesvcx-mediated-connection.test.ts", + "test:credentialDef": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-credential-def.test.ts", + "test:credential": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-credential.test.ts", + "test:disclosedProof": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-disclosed-proof.test.ts", + "test:issuerCredential": "TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-issuer-credential.test.ts", + "test:proof": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-proof.test.ts", + "test:schema": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-schema.test.ts", + "test:utils": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-utils.test.ts", + "test:oob": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-oob.test.ts", + "test:wallet": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-wallet.test.ts" }, "main": "dist/index.js", "typings": "dist/index.d.ts" diff --git a/wrappers/node/src/api/credential-def.ts b/wrappers/node/src/api/credential-def.ts index 6bf33057c4..c3ed838fb6 100644 --- a/wrappers/node/src/api/credential-def.ts +++ b/wrappers/node/src/api/credential-def.ts @@ -1,28 +1,7 @@ -import * as ffi from 'ffi-napi'; -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { ISerializedData } from './common'; -import { VCXBase } from './vcx-base'; - -/** - * @interface Interface that represents the parameters for `CredentialDef.create` function. - * @description - * SourceId: Enterprise's personal identification for the user. - * name: Name of credential definition - * schemaId: The schema id given during the creation of the schema - * revocation: type-specific configuration of credential definition revocation - * TODO: Currently supports ISSUANCE BY DEFAULT, support for ISSUANCE ON DEMAND will be added as part of ticket: IS-1074 - * support_revocation: true|false - Optional, by default its false - * tails_file: path to tails file - Optional if support_revocation is false - * max_creds: size of tails file - Optional if support_revocation is false - */ -export interface ICredentialDefCreateData { - sourceId: string; - schemaId: string; - revocationDetails: IRevocationDetails; - tailsUrl?: string; -} +import { VcxBase } from './vcx-base'; +import { VCXInternalError } from '../errors'; export interface ICredentialDefCreateDataV2 { sourceId: string; @@ -63,39 +42,26 @@ export enum CredentialDefState { Published = 1, } -/** - * @class Class representing a credential Definition - */ -export class CredentialDef extends VCXBase { +export class CredentialDef extends VcxBase { public static async create({ supportRevocation, schemaId, sourceId, - tag + tag, }: ICredentialDefCreateDataV2): Promise { - const credentialDef = new CredentialDef(sourceId, { schemaId }); - const commandHandle = 0; try { - await credentialDef._create((cb) => - rustAPI().vcx_credentialdef_create_v2( - commandHandle, - sourceId, - schemaId, - tag, - supportRevocation, - cb, - ), - ); + const credentialDef = new CredentialDef(sourceId, { schemaId }); + const handle = await ffi.credentialdefCreateV2(sourceId, schemaId, tag, supportRevocation); + credentialDef._setHandle(handle); return credentialDef; } catch (err: any) { throw new VCXInternalError(err); } } - public static async deserialize( + public static deserialize( credentialDef: ISerializedData, - ): Promise { - // Todo: update the ICredentialDefObj + ): CredentialDef { const { data: { name }, } = credentialDef; @@ -106,16 +72,13 @@ export class CredentialDef extends VCXBase { return super._deserialize(CredentialDef, credentialDef, credentialDefParams); } - protected _releaseFn = rustAPI().vcx_credentialdef_release; - protected _serializeFn = rustAPI().vcx_credentialdef_serialize; - protected _deserializeFn = rustAPI().vcx_credentialdef_deserialize; + protected _serializeFn = ffi.credentialdefSerialize; + protected _deserializeFn = ffi.credentialdefDeserialize; + protected _releaseFn = ffi.credentialdefRelease; private _name: string | undefined; private _schemaId: string | undefined; private _credDefId: string | undefined; private _tailsDir: string | undefined; - private _credDefTransaction: string | null; - private _revocRegDefTransaction: string | null; - private _revocRegEntryTransaction: string | null; constructor(sourceId: string, { name, schemaId, credDefId, tailsDir }: ICredentialDefParams) { super(sourceId); @@ -123,149 +86,43 @@ export class CredentialDef extends VCXBase { this._schemaId = schemaId; this._credDefId = credDefId; this._tailsDir = tailsDir; - this._credDefTransaction = null; - this._revocRegDefTransaction = null; - this._revocRegEntryTransaction = null; } - public async publish(tailsUrl?: string): Promise { + public releaseRustData(): void { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credentialdef_publish(0, this.handle, tailsUrl || null, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32'], - (handle: number, err: number) => { - if (err) { - reject(err); - } - resolve(); - }, - ), - ); + this._releaseFn(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } + public async publish(): Promise { + try { + await ffi.credentialdefPublish(this.handle); + } catch (err: any) { + throw new VCXInternalError(err); + } + } - /** - * Retrieves the credential definition id associated with the created cred def. - * Example: - * ``` - * data = { - * name: 'testCredentialDefName', - * revocation: false, - * schemaId: 'testCredentialDefSchemaId', - * sourceId: 'testCredentialDefSourceId' - * } - * credentialDef = await CredentialDef.create(data) - * id = await credentialDef.getCredDefId() - * ``` - */ - public async getCredDefId(): Promise { + public getCredDefId(): string { try { - const credDefId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credentialdef_get_cred_def_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, credDefIdVal: string) => { - if (err) { - reject(err); - return; - } - this._credDefId = credDefIdVal; - resolve(credDefIdVal); - }, - ), - ); - return credDefId; + return ffi.credentialdefGetCredDefId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * - * Checks if credential definition is published on the Ledger and updates the state - * - * Example: - * ``` - * await credentialDef.updateState() - * ``` - * @returns {Promise} - */ public async updateState(): Promise { try { - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credentialdef_update_state(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: CredentialDefState) => { - if (err) { - reject(err); - } - resolve(_state); - }, - ), - ); - return state; + return await ffi.credentialdefUpdateState(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Get the current state of the credential definition object - * - * Example: - * ``` - * state = await credentialdef.getState() - * ``` - * @returns {Promise} - */ - public async getState(): Promise { + public getState(): CredentialDefState { try { - const stateRes = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credentialdef_get_state(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, state: CredentialDefState) => { - if (err) { - reject(err); - } - resolve(state); - }, - ), - ); - return stateRes; + return ffi.credentialdefGetState(this.handle); } catch (err: any) { throw new VCXInternalError(err); } @@ -290,16 +147,4 @@ export class CredentialDef extends VCXBase { protected _setHandle(handle: number): void { super._setHandle(handle); } - - get credentialDefTransaction(): string | null { - return this._credDefTransaction; - } - - get revocRegDefTransaction(): string | null { - return this._revocRegDefTransaction; - } - - get revocRegEntryTransaction(): string | null { - return this._revocRegEntryTransaction; - } } diff --git a/wrappers/node/src/api/credential.ts b/wrappers/node/src/api/credential.ts index 82cb33344a..d21f3d74ea 100644 --- a/wrappers/node/src/api/credential.ts +++ b/wrappers/node/src/api/credential.ts @@ -1,47 +1,8 @@ -import { Callback } from 'ffi-napi'; - -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { ISerializedData, HolderStateType } from './common'; import { Connection } from './mediated-connection'; -import { VCXBaseWithState } from './vcx-base-with-state'; - -/** - * The object of the VCX API representing a Holder side in the credential issuance process. - * Assumes that pairwise connection between Issuer and Holder is already established. - * - * # State - * - * The set of object states and transitions depends on communication method is used. - * The communication method can be specified as config option on one of *_init function. - * - * VcxStateType::VcxStateRequestReceived - once `vcx_credential_create_with_offer` (create Credential object) is called. - * - * VcxStateType::VcxStateOfferSent - once `vcx_credential_send_request` (send `CredentialRequest` message) is called. - * - * VcxStateType::VcxStateAccepted - once `Credential` messages is received. - * VcxStateType::None - once `ProblemReport` messages is received. - * use `vcx_credential_update_state` or `vcx_credential_update_state_with_message` functions for state updates. - * - * # Transitions - * - * aries: RFC - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential - * VcxStateType::None - `vcx_credential_create_with_offer` - VcxStateType::VcxStateRequestReceived - * - * VcxStateType::VcxStateRequestReceived - `vcx_issuer_send_credential_offer` - VcxStateType::VcxStateOfferSent - * - * VcxStateType::VcxStateOfferSent - received `Credential` - VcxStateType::VcxStateAccepted - * VcxStateType::VcxStateOfferSent - received `ProblemReport` - VcxStateType::None - * - * # Messages - * CredentialProposal - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#propose-credential - * CredentialOffer - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#offer-credential - * CredentialRequest - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#request-credential - * Credential - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#issue-credential - * ProblemReport - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0035-report-problem#the-problem-report-message-type - * Ack - https://github.com/hyperledger/aries-rfcs/tree/master/features/0015-acks#explicit-acks - */ +import { VcxBaseWithState } from './vcx-base-with-state'; +import { VCXInternalError } from '../errors'; export interface ICredentialStructData { source_id: string; @@ -50,195 +11,44 @@ export interface ICredentialStructData { // eslint-disable-next-line @typescript-eslint/ban-types export type ICredentialOffer = [object, object]; -/** - * @description Interface that represents the parameters for `Credential.create` function. - * @interface - */ export interface ICredentialCreateWithOffer { - // Institution's personal identification for the credential, should be unique. sourceId: string; - // Credential offer received via "getOffers" offer: string; - // We're going to need it in the future connection: Connection; } -/** - * @description Interface that represents the parameters for `Credential.createWithMsgId` function. - * @interface - */ -export interface ICredentialCreateWithMsgId { - // Institution's personal identification for the credential, should be unique. - sourceId: string; - // Id of the message that contains the credential offer - msgId: string; - // Connection to query for credential offer - connection: Connection; -} - -/** - * @description Interface that represents the parameters for `Credential.sendRequest` function. - * @interface - */ export interface ICredentialSendData { - // Connection to send credential request connection: Connection; } -export interface ICredentialGetRequestMessageData { - // Use Connection api (vcx_connection_get_pw_did) with specified connection_handle to retrieve your pw_did - myPwDid: string; - // Use Connection api (vcx_connection_get_their_pw_did) with specified connection_handle to retrieve their pw_did - theirPwDid?: string; -} - -/** - * A Credential Object, which is issued by the issuing party to the prover and stored in the prover's wallet. - */ -export class Credential extends VCXBaseWithState { - /** - * Creates a credential with an offer. - * - * * Requires a credential offer to be submitted to prover. - * - * ``` - * credentialOffer = [ - * { - * claim_id: 'defaultCredentialId', - * claim_name: 'Credential', - * cred_def_id: 'id', - * credential_attrs: { - * address1: ['101 Tela Lane'], - * address2: ['101 Wilson Lane'], - * city: ['SLC'], - * state: ['UT'], - * zip: ['87121'] - * }, - * from_did: '8XFh8yBzrpJQmNyZzgoTqB', - * libindy_offer: '{}', - * msg_ref_id: '123', - * msg_type: 'CLAIM_OFFER', - * schema_seq_no: 1487, - * to_did: '8XFh8yBzrpJQmNyZzgoTqB', - * version: '0.1' - * }] - * - * { - * JSON.stringify(credentialOffer), - * 'testCredentialSourceId' - * } - * credential = Credential.create(data) - * ``` - * - */ - public static async create({ sourceId, offer }: ICredentialCreateWithOffer): Promise { - const credential = new Credential(sourceId); +export class Credential extends VcxBaseWithState { + public static create({ sourceId, offer }: ICredentialCreateWithOffer): Credential { try { - await credential._create((cb) => - rustAPI().vcx_credential_create_with_offer(0, sourceId, offer, cb), - ); + const credential = new Credential(sourceId); + const handle = ffi.credentialCreateWithOffer(sourceId, offer); + credential._setHandle(handle); return credential; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Create a Credential object based off of a known message id for a given connection. - * - * ``` - * credential = Credential.createWithMsgId({ - * connection, - * msgId: 'testCredentialMsgId', - * sourceId: 'testCredentialSourceId' - * }) - * ``` - */ - public static async createWithMsgId({ - connection, - sourceId, - msgId, - }: ICredentialCreateWithMsgId): Promise { - try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_create_with_msgid( - 0, - sourceId, - connection.handle, - msgId, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'uint32', 'string'], - (xHandle: number, err: number, handleNum: number, credOffer: string) => { - if (err) { - reject(err); - return; - } - const newObj = new Credential(sourceId); - newObj._setHandle(handleNum); - newObj._credOffer = credOffer; - resolve(newObj); - }, - ), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Create an object from a JSON Structured data produced from the objects serialize method - * - * ``` - * data = credential.deserialize() - * ``` - */ - public static async deserialize( + public static deserialize( credentialData: ISerializedData, - ): Promise { - const credential = await super._deserialize(Credential, credentialData); + ): Credential { + const credential = super._deserialize(Credential, credentialData); return credential; } - /** - * Retrieves all pending credential offers. - * - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * offers = await Credential.getOffers(connection) - * ``` - */ + protected _releaseFn = ffi.credentialRelease; + protected _updateStFnV2 = ffi.v2CredentialUpdateState; + protected _getStFn = ffi.credentialGetState; + protected _serializeFn = ffi.credentialSerialize; + protected _deserializeFn = ffi.credentialDeserialize; + public static async getOffers(connection: Connection): Promise { try { - const offersStr = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_offers(0, connection.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, messages: string) => { - if (err) { - reject(err); - return; - } - resolve(messages); - }, - ), - ); + const offersStr = await ffi.credentialGetOffers(connection.handle); const offers: ICredentialOffer[] = JSON.parse(offersStr); return offers; } catch (err: any) { @@ -246,306 +56,70 @@ export class Credential extends VCXBaseWithState { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_send_request( - 0, - this.handle, - connection.handle, - 0, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - /** - * Gets the credential request message for sending to the specified connection. - * - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * credential = Credential.create(data) - * await credential.getRequestMessage({ '44x8p4HubxzUK1dwxcc5FU', 1000 }) - * ``` - * - */ - public async getRequestMessage({ - myPwDid, - theirPwDid, - }: ICredentialGetRequestMessageData): Promise { - try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_request_msg( - 0, - this.handle, - myPwDid, - theirPwDid, - 0, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, message: string) => { - if (err) { - reject(err); - return; - } - if (!message) { - reject(`Credential ${this.sourceId} returned empty string`); - return; - } - resolve(message); - }, - ), - ); + return await ffi.credentialSendRequest(this.handle, connection.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getAttributes(): Promise { + public getAttributes(): string { try { - const attrs = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_attributes(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, _attrs: string) => { - if (err) { - reject(err); - return; - } - resolve(_attrs); - }, - ), - ); - return attrs; + return ffi.credentialGetAttributes(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getAttachment(): Promise { + public getAttachment(): string { try { - const attach = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_attachment(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, _attach: string) => { - if (err) { - reject(err); - return; - } - resolve(_attach); - }, - ), - ); - return attach; + return ffi.credentialGetAttachment(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getTailsLocation(): Promise { + public getTailsLocation(): string { try { - const location = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_tails_location(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, _location: string) => { - if (err) { - reject(err); - return; - } - resolve(_location); - }, - ), - ); - return location; + return ffi.credentialGetTailsLocation(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getTailsHash(): Promise { + public getTailsHash(): string { try { - const hash = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_tails_hash(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, _hash: string) => { - if (err) { - reject(err); - return; - } - resolve(_hash); - }, - ), - ); - return hash; + return ffi.credentialGetTailsHash(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getRevRegId(): Promise { + public getRevRegId(): string { try { - const revRegId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_rev_reg_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, _revRegId: string) => { - if (err) { - reject(err); - return; - } - resolve(_revRegId); - }, - ), - ); - return revRegId; + return ffi.credentialGetRevRegId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getThreadId(): string { try { - const threadId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_get_thread_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, threadId: string) => { - if (err) { - reject(err); - return; - } - resolve(threadId); - }, - ), - ); - return threadId; + return ffi.credentialGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async declineOffer(connection: Connection, comment: string): Promise { + public async declineOffer(connection: Connection, comment: string) { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_credential_decline_offer( - 0, - this.handle, - connection.handle, - comment, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + await ffi.credentialDeclineOffer(this.handle, connection.handle, comment); } catch (err: any) { throw new VCXInternalError(err); } } - get credOffer(): string { - return this._credOffer; - } - protected _setHandle(handle: number): void { super._setHandle(handle); } diff --git a/wrappers/node/src/api/disclosed-proof.ts b/wrappers/node/src/api/disclosed-proof.ts index c91db00562..14db459c17 100644 --- a/wrappers/node/src/api/disclosed-proof.ts +++ b/wrappers/node/src/api/disclosed-proof.ts @@ -1,51 +1,8 @@ -import { Callback } from 'ffi-napi'; - -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; import { ISerializedData, ProverStateType } from './common'; import { Connection } from './mediated-connection'; -import { VCXBaseWithState } from './vcx-base-with-state'; - -/** - * The API represents an Prover side in the credential presentation process. - * Assumes that pairwise connection between Verifier and Prover is already established. - * - * # State - * - * The set of object states and transitions depends on communication method is used. - * The communication method can be specified as config option on one of *_init function. - * - * VcxStateType::VcxStateRequestReceived - once `vcx_disclosed_proof_create_with_request` (create DisclosedProof object) is called. - * - * VcxStateType::VcxStateRequestReceived - once `vcx_disclosed_proof_generate_proof` is called. - * - * VcxStateType::VcxStateOfferSent - once `vcx_disclosed_proof_send_proof` (send `Presentation` message) is called. - * VcxStateType::None - once `vcx_disclosed_proof_decline_presentation_request` (send `PresentationReject` or `PresentationProposal` message) is called. - * - * VcxStateType::VcxStateAccepted - once `Ack` messages is received. - * VcxStateType::None - once `ProblemReport` messages is received. - * - * # Transitions - * - * aries: RFC - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#propose-presentation - * VcxStateType::None - `vcx_disclosed_proof_create_with_request` - VcxStateType::VcxStateRequestReceived - * - * VcxStateType::VcxStateRequestReceived - `vcx_disclosed_proof_generate_proof` - VcxStateType::VcxStateRequestReceived - * - * VcxStateType::VcxStateRequestReceived - `vcx_disclosed_proof_send_proof` - VcxStateType::VcxStateAccepted - * VcxStateType::VcxStateRequestReceived - `vcx_disclosed_proof_decline_presentation_request` - VcxStateType::None - * - * VcxStateType::VcxStateOfferSent - received `Ack` - VcxStateType::VcxStateAccepted - * VcxStateType::VcxStateOfferSent - received `ProblemReport` - VcxStateType::None - * - * # Messages - * - * PresentationRequest - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#request-presentation - * Presentation - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#presentation - * PresentationProposal - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#propose-presentation - * Ack - https://github.com/hyperledger/aries-rfcs/tree/master/features/0015-acks#explicit-acks - */ +import { VcxBaseWithState } from './vcx-base-with-state'; +import * as ffi from '@hyperledger/vcx-napi-rs'; +import { VCXInternalError } from '../errors'; export interface IDisclosedProofData { source_id: string; @@ -54,37 +11,18 @@ export interface IDisclosedProofData { // eslint-disable-next-line @typescript-eslint/no-explicit-any export type IDisclosedProofRequest = Record; -/** - * @description Interface that represents the parameters for `DisclosedProof.create` function. - * @interface - */ export interface IDisclosedProofCreateData { - // We're going to need it in the future connection: Connection; - // Institution's identification for the proof, should be unique. sourceId: string; - // Proof request received via "getRequests" request: string; } -/** - * @description Interface that represents the parameters for `DisclosedProof.createWithMsgId` function. - * @interface - */ export interface IDisclosedProofCreateWithMsgIdData { - // Connection to query for proof request connection: Connection; - // Id of the message that contains the proof request msgId: string; - // Institution's personal identification for the proof, should be unique. sourceId: string; } -/** - * @description Interface that represents the result of `DisclosedProof.getCredentials` function. - * @interface - * example: {'attrs': {'attribute_0': [{'cred_info': {'schema_id': 'id', 'cred_def_id': 'id', 'attrs': {'attr_name': 'attr_value', ...}, 'referent': '914c7e11'}}]}} - */ export interface IRetrievedCreds { attrs: { [index: string]: ICredData[]; @@ -99,11 +37,6 @@ export interface ICredData { interval: any; // eslint-disable-line @typescript-eslint/no-explicit-any } -/** - * @description Interface that represents the parameters for `DisclosedProof.generateProof` function. - * @interface - * example: {'attrs': {'attribute_0': {'credential': {'cred_info': {'cred_def_id': 'od', 'schema_id': 'id', 'referent': '0c212108-9433-4199-a21f-336a44164f38', 'attrs': {'attr_name': 'attr_value', ...}}}}}} - */ export interface IGenerateProofData { selectedCreds: { [index: string]: ICredData; @@ -113,552 +46,124 @@ export interface IGenerateProofData { }; } -/** - * @description Interface that represents the parameters for `DisclosedProof.declinePresentationRequest` function. - * @interface - */ export interface IDeclinePresentationRequestData { - // Connection to decline presentation request connection: Connection; - // Human-readable string that explain the reason of decline reason?: string; - // The proposed format of presentation request proposal?: any; // eslint-disable-line @typescript-eslint/no-explicit-any } -export class DisclosedProof extends VCXBaseWithState { - /** - * Create a proof for fulfilling a corresponding proof request - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProofRequest = { - * '@topic': { - * mid: 9, - * tid: 1 - * }, - * '@type': { - * name: 'PROOF_REQUEST', - * version: '1.0' - * }, - * 'msg_ref_id': 'abcd', - * 'proof_request_data': { - * name: 'Account Certificate', - * nonce: '838186471541979035208225', - * requested_attributes: { - * business_2: { - * name: 'business' - * }, - * email_1: { - * name: 'email' - * }, - * name_0: { - * name: 'name' - * } - * }, - * requested_predicates: {}, - * version: '0.1' - * } - * sourceId = 'testDisclosedProofSourceId' - * disclosedProof = await DisclosedProof.create({ connection, request: disclosedProofRequest, sourceId: sourceId }) - * ``` - */ - public static async create({ - sourceId, - request, - }: IDisclosedProofCreateData): Promise { - const newObj = new DisclosedProof(sourceId); +export class DisclosedProof extends VcxBaseWithState { + public static create({ sourceId, request }: IDisclosedProofCreateData): DisclosedProof { try { - await newObj._create((cb) => - rustAPI().vcx_disclosed_proof_create_with_request(0, sourceId, request, cb), - ); - return newObj; + const disclosedProof = new DisclosedProof(sourceId); + disclosedProof._setHandle(ffi.disclosedProofCreateWithRequest(sourceId, request)); + return disclosedProof; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Create a proof based off of a known message id for a given connection. - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * ``` - */ - public static async createWithMsgId({ - connection, - sourceId, - msgId, - }: IDisclosedProofCreateWithMsgIdData): Promise { + public static deserialize(data: ISerializedData): DisclosedProof { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_create_with_msgid( - 0, - sourceId, - connection.handle, - msgId, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'uint32', 'string'], - (xHandle: number, err: number, handle: number, proofReq: string) => { - if (err) { - reject(err); - return; - } - const newObj = new DisclosedProof(sourceId); - newObj._setHandle(handle); - newObj._proofReq = proofReq; - resolve(newObj); - }, - ), - ); + return super._deserialize(DisclosedProof, data); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Builds a proof object with defined attributes. - * Attributes are provided by a previous call to the serialize function. - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * data = await disclosedProof.serialize() - * ``` - */ - public static async deserialize( - data: ISerializedData, - ): Promise { - try { - const newObj = await super._deserialize(DisclosedProof, data); - return newObj; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Queries agency for all pending proof requests from the given connection. - * - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * requests = disclosedProof.getRequests(connection) - * ``` - */ - public static async getRequests(connection: Connection): Promise { - const requestsStr = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_get_requests(0, connection.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, messages: string) => { - if (err) { - reject(err); - return; - } - resolve(messages); - }, - ), - ); - const requests = JSON.parse(requestsStr); - return requests; - } - protected _releaseFn = rustAPI().vcx_disclosed_proof_release; - protected _updateStFnV2 = rustAPI().vcx_v2_disclosed_proof_update_state; - protected _getStFn = rustAPI().vcx_disclosed_proof_get_state; - protected _serializeFn = rustAPI().vcx_disclosed_proof_serialize; - protected _deserializeFn = rustAPI().vcx_disclosed_proof_deserialize; - private _proofReq = ''; + protected _releaseFn = ffi.disclosedProofRelease; + protected _updateStFnV2 = ffi.v2DisclosedProofUpdateState; + protected _getStFn = ffi.disclosedProofGetState; + protected _serializeFn = ffi.disclosedProofSerialize; + protected _deserializeFn = ffi.disclosedProofDeserialize; - /** - * Get credentials from wallet matching to the proof request associated with proof object - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * creds = await disclosedProof.getCredentials() - * ``` - */ - public async getCredentials(): Promise { + public static async getRequests(connection: Connection): Promise { try { - const credsStr = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_retrieve_credentials(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, credsRet: string) => { - if (err) { - reject(err); - return; - } - resolve(credsRet); - }, - ), - ); - const creds: IRetrievedCreds = JSON.parse(credsStr); - return creds; + const string_msgs = await ffi.disclosedProofGetRequests(connection.handle); + return JSON.parse(string_msgs); } catch (err: any) { throw new VCXInternalError(err); } } - public async getProofRequestAttachment(): Promise { + public async getCredentials(): Promise { try { - const attrs = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_get_proof_request_attachment(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, _attrs: string) => { - if (err) { - reject(err); - return; - } - resolve(_attrs); - }, - ), - ); - return attrs; + const credentials = await ffi.disclosedProofRetrieveCredentials(this.handle); + return JSON.parse(credentials); } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getProofRequestAttachment(): string { try { - const threadId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_get_thread_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, threadId: string) => { - if (err) { - reject(err); - return; - } - resolve(threadId); - }, - ), - ); - return threadId; + return ffi.disclosedProofGetProofRequestAttachment(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Sends the proof to the Connection - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * { attrs } = await disclosedProof.getCredentials() - * valSelfAttested = 'testSelfAttestedVal' - * await disclosedProof.generateProof({ - * {}, - * mapValues(attrs, () => valSelfAttested) - * }) - * await disclosedProof.sendProof(connection) - * ``` - */ - public async sendProof(connection?: Connection): Promise { + public getThreadId(): string { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const connectionHandle = connection ? connection.handle : 0; - const rc = rustAPI().vcx_disclosed_proof_send_proof(0, this.handle, connectionHandle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return ffi.disclosedProofGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Sends the proof reject to the Connection - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * await disclosedProof.rejectProof(connection) - * ``` - */ - public async rejectProof(connection: Connection): Promise { + public async sendProof(connection: Connection): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_reject_proof( - 0, - this.handle, - connection.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffi.disclosedProofSendProof(this.handle, connection.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Generates the proof message for sending. - * - * Example: - * ``` - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * { attrs } = await disclosedProof.getCredentials() - * valSelfAttested = 'testSelfAttestedVal' - * await disclosedProof.generateProof({ - * {}, - * mapValues(attrs, () => valSelfAttested) - * }) - * await disclosedProof.getProofMessage(connection) - * ``` - */ - public async getProofMessage(): Promise { + public async rejectProof(connection: Connection): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_get_proof_msg(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, message: string) => { - if (err) { - reject(err); - return; - } - if (!message) { - reject(`proof ${this.sourceId} returned empty string`); - return; - } - resolve(message); - }, - ), - ); + return await ffi.disclosedProofRejectProof(this.handle, connection.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Generates the proof reject message for sending. - * - * Example: - * ``` - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * await disclosedProof.getRejectMessage(connection) - * ``` - */ - public async getRejectMessage(): Promise { + public getProofMessage(): string { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_get_reject_msg(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, message: string) => { - if (err) { - reject(err); - return; - } - if (!message) { - reject(`proof ${this.sourceId} returned empty string`); - return; - } - resolve(message); - }, - ), - ); + return ffi.disclosedProofGetProofMsg(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Accept proof request associated with proof object and - * generates a proof from the selected credentials and self attested attributes - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * { attrs } = await disclosedProof.getCredentials() - * valSelfAttested = 'testSelfAttestedVal' - * await disclosedProof.generateProof({ - * {}, - * mapValues(attrs, () => valSelfAttested) - * }) - * ``` - */ public async generateProof({ selectedCreds, selfAttestedAttrs, }: IGenerateProofData): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_generate_proof( - 0, - this.handle, - JSON.stringify(selectedCreds), - JSON.stringify(selfAttestedAttrs), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), + return await ffi.disclosedProofGenerateProof( + this.handle, + JSON.stringify(selectedCreds), + JSON.stringify(selfAttestedAttrs), ); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Declines presentation request. - * There are two ways of following interaction: - * - Prover wants to propose using a different presentation - pass `proposal` parameter. - * - Prover doesn't want to continue interaction - pass `reason` parameter. - * Note that only one of these parameters can be passed. - * - * Note that proposing of different presentation is supported for `aries` protocol only. - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * disclosedProof = await DisclosedProof.createWithMsgId(connection, 'testDisclousedProofMsgId', 'sourceId') - * await disclosedProof.declinePresentationRequest({connection, reason: 'some reason', proposal: null}) - * ``` - */ public async declinePresentationRequest({ connection, reason, proposal, }: IDeclinePresentationRequestData): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_disclosed_proof_decline_presentation_request( - 0, - this.handle, - connection.handle, - reason, - proposal ? JSON.stringify(proposal) : null, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), + return await ffi.disclosedProofDeclinePresentationRequest( + this.handle, + connection.handle, + reason, + JSON.stringify(proposal), ); } catch (err: any) { throw new VCXInternalError(err); } } - - get proofRequest(): string { - return this._proofReq; - } } diff --git a/wrappers/node/src/api/init.ts b/wrappers/node/src/api/init.ts index ecf343c565..8b26891b23 100644 --- a/wrappers/node/src/api/init.ts +++ b/wrappers/node/src/api/init.ts @@ -1,91 +1,30 @@ -import { Callback } from 'ffi-napi'; - +import * as ffiNapi from '@hyperledger/vcx-napi-rs'; import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; - -export function initThreadpool (config: object) { - const rc = rustAPI().vcx_init_threadpool(JSON.stringify(config)) - if (rc !== 0) { - throw new VCXInternalError(rc) - } -} -export async function createAgencyClientForMainWallet (config: object): Promise { +export function createAgencyClientForMainWallet(config: object): void { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_create_agency_client_for_main_wallet(0, JSON.stringify(config), cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32', 'uint32'], - (xhandle: number, err: number) => { - if (err) { - reject(err) - return - } - resolve() - }) - ) + ffiNapi.createAgencyClientForMainWallet(JSON.stringify(config)); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -export async function initIssuerConfig (config: object): Promise { +export async function initIssuerConfig(config: object): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_init_issuer_config(0, JSON.stringify(config), cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32', 'uint32'], - (xhandle: number, err: number) => { - if (err) { - reject(err) - return - } - resolve() - }) - ) + return await ffiNapi.vcxInitIssuerConfig(JSON.stringify(config)); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -export async function openMainPool (config: object): Promise { +export async function openMainPool(config: object): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_open_main_pool(0, JSON.stringify(config), cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32', 'uint32'], - (xhandle: number, err: number) => { - if (err) { - reject(err) - return - } - resolve() - }) - ) + return await ffiNapi.openMainPool(JSON.stringify(config)); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } export function enableMocks(): void { - return rustAPI().vcx_enable_mocks(); + return ffiNapi.enableMocks(); } diff --git a/wrappers/node/src/api/issuer-credential.ts b/wrappers/node/src/api/issuer-credential.ts index 9ca42a5938..126154266e 100644 --- a/wrappers/node/src/api/issuer-credential.ts +++ b/wrappers/node/src/api/issuer-credential.ts @@ -1,109 +1,18 @@ -import * as ffi from 'ffi-napi'; -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { ISerializedData, IssuerStateType } from './common'; import { Connection } from './mediated-connection'; import { CredentialDef } from './credential-def'; import { RevocationRegistry } from './revocation-registry'; -import { VCXBaseWithState } from './vcx-base-with-state'; - -/** - * The object of the VCX API representing an Issuer side in the credential issuance process. - * Assumes that pairwise connection between Issuer and Holder is already established. - * - * # State - * - * The set of object states and transitions depends on communication method is used. - * The communication method can be specified as config option on one of *_init function. - * - * VcxStateType::VcxStateInitialized - once `vcx_issuer_create_credential` (create IssuerCredential object) is called. - * - * VcxStateType::VcxStateOfferSent - once `vcx_issuer_send_credential_offer` (send `CredentialOffer` message) is called. - * - * VcxStateType::VcxStateRequestReceived - once `CredentialRequest` messages is received. - * VcxStateType::None - once `ProblemReport` messages is received. - * use `vcx_issuer_credential_update_state` or `vcx_issuer_credential_update_state_with_message` functions for state updates. - * - * VcxStateType::VcxStateAccepted - once `vcx_issuer_send_credential` (send `Credential` message) is called. - * - * # Transitions - * - * aries: RFC - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential - * VcxStateType::None - `vcx_issuer_create_credential` - VcxStateType::VcxStateInitialized - * - * VcxStateType::VcxStateInitialized - `vcx_issuer_send_credential_offer` - VcxStateType::VcxStateOfferSent - * - * VcxStateType::VcxStateOfferSent - received `CredentialRequest` - VcxStateType::VcxStateRequestReceived - * VcxStateType::VcxStateOfferSent - received `ProblemReport` - VcxStateType::None - * - * VcxStateType::VcxStateRequestReceived - vcx_issuer_send_credential` - VcxStateType::VcxStateAccepted - * - * VcxStateType::VcxStateAccepted - received `Ack` - VcxStateType::VcxStateAccepted - * - * # Messages - * CredentialProposal - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#propose-credential - * CredentialOffer - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#offer-credential - * CredentialRequest - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#request-credential - * Credential - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential#issue-credential - * ProblemReport - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0035-report-problem#the-problem-report-message-type - * Ack - https://github.com/hyperledger/aries-rfcs/tree/master/features/0015-acks#explicit-acks - */ - -/** - * @description Interface that represents the parameters for `IssuerCredential.create` function. - * @interface - */ -export interface IIssuerCredentialCreateData { - // Enterprise's personal identification for the user. - sourceId: string; - // Handle of the correspondent credential definition object - credDefHandle: number; - // Data attributes offered to person in the credential ('{"state":"UT"}') - attr: { - [index: string]: string; - }; - // Name of the credential - ex. Drivers Licence - credentialName: string; - // price of credential - price: string; - issuerDid: string; -} +import { VcxBaseWithState } from './vcx-base-with-state'; +import { VCXInternalError } from '../errors'; -export interface IIssuerCredentialOfferSendData { - connection: Connection; +export interface IIssuerCredentialBuildOfferDataV2 { credDef: CredentialDef; + revReg?: RevocationRegistry; attr: { [index: string]: string; }; -} - -export interface IIssuerCredentialBuildOfferData { - credDef: CredentialDef; - attr: { - [index: string]: string; - }; - comment: string -} - -export interface IIssuerCredentialBuildOfferDataV2 { - credDef: CredentialDef; - revReg?: RevocationRegistry; - attr: { - [index: string]: string; - }; - comment?: string -} - -export interface IIssuerCredentialVCXAttributes { - [index: string]: string; -} - -export interface IIssuerCredentialParams { - credDefHandle: number; - credentialName: string; - attr: IIssuerCredentialVCXAttributes; - price: string; + comment?: string; } /** @@ -119,71 +28,32 @@ export interface IIssuerCredentialData { /** * A Credential created by the issuing party (institution) */ -export class IssuerCredential extends VCXBaseWithState { - /** - * Create a Issuer Credential object that provides a credential for an enterprise's user - * Assumes a credential definition has been already written to the ledger. - * ``` - * issuerCredential = await IssuerCredential.create({sourceId: "12", - * credDefId: "credDefId", attr: {key: "value"}, credentialName: "name", price: "0"}) - * ``` - * @returns {Promise} An Issuer credential Object - */ +export class IssuerCredential extends VcxBaseWithState { public static async create(sourceId: string): Promise { try { - const credential = new IssuerCredential(sourceId); - const commandHandle = 0; - await credential._create((cb) => - rustAPI().vcx_issuer_create_credential(commandHandle, sourceId, cb), - ); - return credential; + const connection = new IssuerCredential(sourceId); + connection._setHandle(await ffi.issuerCredentialCreate(sourceId)); + return connection; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Builds an Issuer credential object with defined attributes. - * - * Attributes are provided by a previous call to the serialize function. - * ``` - * issuerCredential = await IssuerCredential.create({sourceId: "12", - * credDefId: "credDefId", attr: {key: "value"}, credentialName: "name", price: 0}) - * data1 = await issuerCredential.serialize() - * issuerCredential2 = await IssuerCredential.deserialize(data1) - * ``` - */ - public static async deserialize( - credentialData: ISerializedData, - ): Promise { + public static deserialize( + serializedData: ISerializedData, + ): IssuerCredential { try { - const params: IIssuerCredentialParams = (() => { - switch (credentialData.version) { - case '2.0': - return { attr: {}, credDefHandle: -1, credentialName: '', price: '0' }; - default: - throw Error( - `Unsupported version provided in serialized credential data: ${JSON.stringify( - credentialData.version, - )}`, - ); - } - })(); - return await super._deserialize( - IssuerCredential, - credentialData, - params, - ); + return super._deserialize(IssuerCredential, serializedData); } catch (err: any) { throw new VCXInternalError(err); } } - protected _releaseFn = rustAPI().vcx_issuer_credential_release; - protected _updateStFnV2 = rustAPI().vcx_v2_issuer_credential_update_state; - protected _getStFn = rustAPI().vcx_issuer_credential_get_state; - protected _serializeFn = rustAPI().vcx_issuer_credential_serialize; - protected _deserializeFn = rustAPI().vcx_issuer_credential_deserialize; + protected _releaseFn = ffi.issuerCredentialRelease; + protected _updateStFnV2 = ffi.issuerCredentialUpdateStateV2; + protected _getStFn = ffi.issuerCredentialGetState; + protected _serializeFn = ffi.issuerCredentialSerialize; + protected _deserializeFn = ffi.issuerCredentialDeserialize; constructor(sourceId: string) { super(sourceId); @@ -191,354 +61,94 @@ export class IssuerCredential extends VCXBaseWithState { try { - const commandHandle = 0; - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_v2_issuer_credential_update_state_with_message( - commandHandle, - this.handle, - connection.handle, - message, - cb, - ); - if (rc) { - resolve(0); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: number) => { - if (err) { - reject(err); - } - resolve(_state); - }, - ), + return await ffi.issuerCredentialUpdateStateWithMessageV2( + this.handle, + connection.handle, + message, ); - return state; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Sends a credential Offer to the end user. - * - * A Credential Offer is made up of the data provided in the creation of this object - * - * Example: - * ``` - * connection = await Connection.create({id: 'foobar'}) - * inviteDetails = await connection.connect() - * issuerCredential = await IssuerCredential.create({sourceId: "12")} - * issuerCredential.buildCredentialOfferMsg({ - * credDefId: "credDefId", - * attr: {k ey: "value"}, - * credentialName: "name" - * }) - * await issuerCredential.sendOfferV2(connection) - * ``` - */ - public async sendOfferV2(connection: Connection): Promise { - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_send_credential_offer_v2( - 0, - this.handle, - connection.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Flags the protocol object as the credential offer has been sent and incoming credential request message should - * be expected. - */ - public async markCredentialOfferMsgSent(): Promise { - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_mark_credential_offer_msg_sent( - 0, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } + public async sendOfferV2(connection: Connection): Promise { + try { + return await ffi.issuerCredentialSendOfferV2(this.handle, connection.handle); + } catch (err: any) { + throw new VCXInternalError(err); } + } - public async buildCredentialOfferMsgV2({ credDef, attr, revReg, comment }: IIssuerCredentialBuildOfferDataV2): Promise { - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_build_credential_offer_msg_v2( - 0, - this.handle, - credDef.handle, - revReg?.handle || 0, - JSON.stringify(attr), - comment || '', - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } + public async markCredentialOfferMsgSent(): Promise { + try { + return await ffi.issuerCredentialMarkOfferMsgSent(this.handle); + } catch (err: any) { + throw new VCXInternalError(err); } + } - /** - * Gets the credential offer message for sending to connection. - * - * ``` - * connection = await connectionCreateConnect() - * issuerCredential = await issuerCredentialCreate() - * await issuerCredential.getCredentialOfferMsg() - * ``` - * - */ - public async getCredentialOfferMsg(): Promise { + public async buildCredentialOfferMsgV2({ + credDef, + attr, + revReg, + comment, + }: IIssuerCredentialBuildOfferDataV2): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_get_credential_offer_msg(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, message: string) => { - if (err) { - reject(err); - return; - } - if (!message) { - reject(`Credential ${this.sourceId} returned empty string`); - return; - } - resolve(message); - }, - ), + return await ffi.issuerCredentialBuildOfferMsgV2( + this.handle, + credDef.handle, + revReg?.handle || 0, + JSON.stringify(attr), + comment || '', ); } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getCredentialOfferMsg(): string { try { - const threadId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_credential_get_thread_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, threadId: string) => { - if (err) { - reject(err); - return; - } - resolve(threadId); - }, - ), - ); - return threadId; + return ffi.issuerCredentialGetOfferMsg(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - - /** - * Sends the credential to the end user. - * - * Credential is made up of the data sent during Credential Offer - */ - public async sendCredential(connection: Connection): Promise { + public getThreadId(): string { try { - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_send_credential(0, this.handle, connection.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32', 'uint32'], (xcommandHandle: number, err: number, _state: number) => { - if (err) { - reject(err); - return; - } - resolve(_state); - }), - ); - return state; + return ffi.issuerCredentialGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Gets the credential message for sending to connection. - * - * Credential is made up of the data sent during Credential Offer - */ - public async getCredentialMsg(myPwDid: string): Promise { + public async sendCredential(connection: Connection): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_get_credential_msg(0, this.handle, myPwDid, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, message: string) => { - if (err) { - reject(err); - return; - } - if (!message) { - reject(`Credential ${this.sourceId} returned empty string`); - return; - } - resolve(message); - }, - ), - ); + return await ffi.issuerCredentialSendCredential(this.handle, connection.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async revokeCredentialLocal(): Promise { + public async revokeCredentialLocal() { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_revoke_credential_local(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffi.issuerCredentialRevokeLocal(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async isRevokable(): Promise { + public isRevokable(): boolean { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_credential_is_revokable(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'bool'], - (xcommandHandle: number, err: number, revokable: boolean) => { - if (err) { - reject(err); - return; - } - resolve(revokable); - }, - ), - ); + return ffi.issuerCredentialIsRevokable(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getRevRegId(): Promise { + public getRevRegId(): string { try { - const revRegId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_issuer_credential_get_rev_reg_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, _revRegId: string) => { - if (err) { - reject(err); - return; - } - resolve(_revRegId); - }, - ), - ); - return revRegId; + return ffi.issuerCredentialGetRevRegId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/logging.ts b/wrappers/node/src/api/logging.ts index d5980ac11c..a4b58ccdf1 100644 --- a/wrappers/node/src/api/logging.ts +++ b/wrappers/node/src/api/logging.ts @@ -1,55 +1,10 @@ -import * as ffi from 'ffi-napi'; -import * as ref from 'ref-napi'; -import * as buildStructType from 'ref-struct-di'; +import * as ffiNapi from '@hyperledger/vcx-napi-rs'; -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { PtrBuffer } from './utils'; - -export type LogFunction = ( - level: number, - target: string, - message: string, - modulePath: string, - file: string, - line: number, -) => void; - -const Struct = buildStructType(ref); - -export const Logger = Struct({ - flushFn: ffi.Function('void', []), - logFn: ffi.Function('void', ['int', 'string', 'string', 'string', 'string', 'int']), -}); - -type LoggerType = typeof Logger; - -type LoggerPtr = PtrBuffer; - -const Ilogger = { - context: ref.refType(ref.refType('void')), - file: 'string', - level: 'uint32', - line: 'uint32', - message: 'string', - module_path: 'string', - target: 'string', -}; - -/** - * Sets the Logger to Default - * - * Accepts a string indicating what level to log at. - * Example: - * ``` - * defaultLogger('info') - * ``` - * - */ +import {VCXInternalError} from "../errors"; export function defaultLogger(level: string): void { try { - rustAPI().vcx_set_default_logger(level); + ffiNapi.initDefaultLogger(level) } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/mediated-connection.ts b/wrappers/node/src/api/mediated-connection.ts index 75d568fc25..745257249c 100644 --- a/wrappers/node/src/api/mediated-connection.ts +++ b/wrappers/node/src/api/mediated-connection.ts @@ -1,100 +1,9 @@ -import * as ffi from 'ffi-napi'; -import * as ref from 'ref-napi'; +import * as ffiNapi from '@hyperledger/vcx-napi-rs'; import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise, ICbRef } from '../utils/ffi-helpers'; import { ISerializedData, ConnectionStateType } from './common'; -import { VCXBaseWithState } from './vcx-base-with-state'; -import { PtrBuffer, IPwInfo } from './utils'; +import { VcxBaseWithState } from './vcx-base-with-state'; +import { IPwInfo } from './utils'; -/** - * The object of the VCX API representing a pairwise relationship with another identity owner. - * Once the relationship, or connection, is established communication can happen securely and privately. - * Credentials and Proofs are exchanged using this object. - * - * # States - * - * The set of object states and transitions depends on communication method is used. - * The communication method can be specified as config option on one of *_init function. - * - * Inviter: - * VcxStateType::VcxStateInitialized - once `vcx_connection_create` (create Connection object) is called. - * - * VcxStateType::VcxStateOfferSent - once `vcx_connection_connect` (prepared Connection invite) is called. - * - * VcxStateType::VcxStateRequestReceived - once `ConnectionRequest` messages is received. - * accept `ConnectionRequest` and send `ConnectionResponse` message. - * use `vcx_connection_update_state` or `vcx_connection_update_state_with_message` functions for state updates. - * - * VcxStateType::VcxStateAccepted - once `Ack` messages is received. - * use `vcx_connection_update_state` or `vcx_connection_update_state_with_message` functions for state updates. - * - * VcxStateType::VcxStateNone - once `vcx_connection_delete_connection` (delete Connection object) is called - * OR - * `ConnectionProblemReport` messages is received on state updates. - * - * Invitee: - * VcxStateType::VcxStateOfferSent - once `vcx_connection_create_with_invite` (create Connection object with invite) is called. - * - * VcxStateType::VcxStateRequestReceived - once `vcx_connection_connect` (accept `ConnectionInvite` and send `ConnectionRequest` message) is called. - * - * VcxStateType::VcxStateAccepted - once `ConnectionResponse` messages is received. - * send `Ack` message if requested. - * use `vcx_connection_update_state` or `vcx_connection_update_state_with_message` functions for state updates. - * - * VcxStateType::VcxStateNone - once `vcx_connection_delete_connection` (delete Connection object) is called - * OR - * `ConnectionProblemReport` messages is received on state updates. - * - * # Transitions - * - * aries - RFC: https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0036-issue-credential - * Inviter: - * VcxStateType::None - `vcx_connection_create` - VcxStateType::VcxStateInitialized - * - * VcxStateType::VcxStateInitialized - `vcx_connection_connect` - VcxStateType::VcxStateOfferSent - * - * VcxStateType::VcxStateOfferSent - received `ConnectionRequest` - VcxStateType::VcxStateRequestReceived - * VcxStateType::VcxStateOfferSent - received `ConnectionProblemReport` - VcxStateType::VcxStateNone - * - * VcxStateType::VcxStateRequestReceived - received `Ack` - VcxStateType::VcxStateAccepted - * VcxStateType::VcxStateRequestReceived - received `ConnectionProblemReport` - VcxStateType::VcxStateNone - * - * VcxStateType::VcxStateAccepted - received `Ping`, `PingResponse`, `Query`, `Disclose` - VcxStateType::VcxStateAccepted - * - * any state - `vcx_connection_delete_connection` - VcxStateType::VcxStateNone - * - * Invitee: - * VcxStateType::None - `vcx_connection_create_with_invite` - VcxStateType::VcxStateOfferSent - * - * VcxStateType::VcxStateOfferSent - `vcx_connection_connect` - VcxStateType::VcxStateRequestReceived - * VcxStateType::VcxStateOfferSent - received `ConnectionProblemReport` - VcxStateType::VcxStateNone - * - * VcxStateType::VcxStateRequestReceived - received `ConnectionResponse` - VcxStateType::VcxStateAccepted - * VcxStateType::VcxStateRequestReceived - received `ConnectionProblemReport` - VcxStateType::VcxStateNone - * - * VcxStateType::VcxStateAccepted - received `Ping`, `PingResponse`, `Query`, `Disclose` - VcxStateType::VcxStateAccepted - * - * any state - `vcx_connection_delete_connection` - VcxStateType::VcxStateNone - * - * # Messages - * - * Invitation - https://github.com/hyperledger/aries-rfcs/tree/master/features/0160-connection-protocol#0-invitation-to-connect - * ConnectionRequest - https://github.com/hyperledger/aries-rfcs/tree/master/features/0160-connection-protocol#1-connection-request - * ConnectionResponse - https://github.com/hyperledger/aries-rfcs/tree/master/features/0160-connection-protocol#2-connection-response - * ConnectionProblemReport - https://github.com/hyperledger/aries-rfcs/tree/master/features/0160-connection-protocol#error-message-example - * Ack - https://github.com/hyperledger/aries-rfcs/tree/master/features/0015-acks#explicit-acks - * Ping - https://github.com/hyperledger/aries-rfcs/tree/master/features/0048-trust-ping#messages - * PingResponse - https://github.com/hyperledger/aries-rfcs/tree/master/features/0048-trust-ping#messages - * Query - https://github.com/hyperledger/aries-rfcs/tree/master/features/0031-discover-features#query-message-type - * Disclose - https://github.com/hyperledger/aries-rfcs/tree/master/features/0031-discover-features#disclose-message-type - */ - -/** - * @description Interface that represents the attributes of a Connection object. - * This data is expected as the type for deserialize's parameter and serialize's return value - * @interface - */ export interface IConnectionData { source_id: string; invite_detail: string; @@ -190,14 +99,6 @@ export interface ISignatureData { */ export type IConnectionInfo = string; -export function voidPtrToUint8Array(origPtr: Buffer, length: number): Buffer { - /** - * Read the contents of the pointer and copy it into a new Buffer - */ - const ptrType = ref.refType('uint8 *'); - return ref.reinterpret(origPtr, length * ptrType.size) -} - export interface IDownloadMessagesConfigsV2 { connections: [Connection]; status: string; @@ -219,143 +120,45 @@ export async function downloadMessagesV2({ uids, }: IDownloadMessagesConfigsV2): Promise { try { - const handles = connections.map((connection) => connection.handle).join(','); - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_v2_messages_download(0, handles, status, uids, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xhandle: number, err: number, messages: string) => { - if (err) { - reject(err); - return; - } - resolve(messages); - }, - ), - ); + const handles = connections.map((connection) => connection.handle); + return await ffiNapi.mediatedConnectionMessagesDownload(handles, status, uids); } catch (err: any) { throw new VCXInternalError(err); } } -export async function generatePublicInvite(public_did: string, label: string): Promise { +export function generatePublicInvite(public_did: string, label: string): string { try { - const data = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_generate_public_invite( - commandHandle, - public_did, - label, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, invite: string) => { - if (err) { - reject(err); - return; - } - if (!invite) { - reject('no public invite returned'); - return; - } - resolve(invite); - }, - ), - ); - return data; + return ffiNapi.mediatedConnectionGeneratePublicInvite(public_did, label); } catch (err: any) { throw new VCXInternalError(err); } } -/** - * @class Class representing a Connection - */ -export class Connection extends VCXBaseWithState { - /** - * Create a connection object, represents a single endpoint and can be used for sending and receiving - * credentials and proofs - * - * Example: - * ``` - * source_id = 'foobar123' - * connection = await Connection.create(source_id) - * ``` - */ +export class Connection extends VcxBaseWithState { public static async create({ id }: IConnectionCreateData): Promise { try { const connection = new Connection(id); - const commandHandle = 0; - await connection._create((cb) => rustAPI().vcx_connection_create(commandHandle, id, cb)); + connection._setHandle(await ffiNapi.mediatedConnectionCreate(id)); return connection; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Create a connection object with a provided invite, represents a single endpoint and can be used for - * sending and receiving credentials and proofs. - * Invite details are provided by the entity offering a connection and generally pulled from a provided QRCode. - * - * Example: - * ``` - * sourceId = 'foobar123' - * connection_handle = await Connection.createWithInvite({sourceId, inviteDetails}) - * ``` - */ public static async createWithInvite({ id, invite }: IRecipientInviteInfo): Promise { - const connection = new Connection(id); - const commandHandle = 0; try { - await connection._create((cb) => - rustAPI().vcx_connection_create_with_invite(commandHandle, id, invite, cb), - ); - + const connection = new Connection(id); + connection._setHandle(await ffiNapi.mediatedConnectionCreateWithInvite(id, invite)); return connection; } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getThreadId(): string { try { - const threadId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_get_thread_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, threadId: string) => { - if (err) { - reject(err); - return; - } - resolve(threadId); - }, - ), - ); - return threadId; + return ffiNapi.mediatedConnectionGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } @@ -364,13 +167,15 @@ export class Connection extends VCXBaseWithState { - const connection = new Connection(id); - const commandHandle = 0; try { - await connection._create((cb) => - rustAPI().vcx_connection_create_with_connection_request_v2(commandHandle, id, JSON.stringify(pwInfo), request, cb), + const connection = new Connection(id); + connection._setHandle( + await ffiNapi.mediatedConnectionCreateWithConnectionRequestV2( + request, + JSON.stringify(pwInfo), + ), ); return connection; } catch (err: any) { @@ -378,275 +183,70 @@ export class Connection extends VCXBaseWithState, - ): Promise { - const connection = await super._deserialize(Connection, connectionData); - return connection; + public static deserialize(connectionData: ISerializedData): Connection { + try { + return super._deserialize(Connection, connectionData); + } catch (err: any) { + throw new VCXInternalError(err); + } } - protected _releaseFn = rustAPI().vcx_connection_release; - protected _updateStFn = rustAPI().vcx_connection_update_state; - protected _updateStFnV2 = ( - _commandHandle: number, - _handle: number, - _connHandle: number, - _cb: ICbRef, - ): number => { + protected _releaseFn = ffiNapi.mediatedConnectionRelease; + protected _updateStFn = ffiNapi.mediatedConnectionUpdateState; + protected _updateStFnV2 = async (_handle: number, _connHandle: number): Promise => { throw new Error('_updateStFnV2 cannot be called for a Connection object'); }; - protected _getStFn = rustAPI().vcx_connection_get_state; - protected _serializeFn = rustAPI().vcx_connection_serialize; - protected _deserializeFn = rustAPI().vcx_connection_deserialize; - protected _inviteDetailFn = rustAPI().vcx_connection_invite_details; - protected _infoFn = rustAPI().vcx_connection_info; + protected _getStFn = ffiNapi.mediatedConnectionGetState; + protected _serializeFn = ffiNapi.mediatedConnectionSerialize; + protected _deserializeFn = ffiNapi.mediatedConnectionDeserialize; + protected _inviteDetailFn = ffiNapi.mediatedConnectionInviteDetails; + protected _infoFn = ffiNapi.mediatedConnectionInfo; - /** - * - * Updates the state of the connection from the given message. - * - * Example: - * ``` - * await object.updateStateWithMessage(message) - * ``` - * @returns {Promise} - */ public async updateStateWithMessage(message: string): Promise { try { - const commandHandle = 0; - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_update_state_with_message( - commandHandle, - this.handle, - message, - cb, - ); - if (rc) { - resolve(0); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: number) => { - if (err) { - reject(err); - } - resolve(_state); - }, - ), - ); - return state; + return await ffiNapi.mediatedConnectionUpdateStateWithMessage(this.handle, message); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * - * Answers message if it there's "easy" way to do so (ping, disclose query, handshake-reuse) - * - * Example: - * ``` - * await object.handleMessage(message) - * ``` - * @returns {Promise} - */ - public async handleMessage(message: string) { + public async handleMessage(message: string): Promise { try { - const commandHandle = 0; - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_handle_message( - commandHandle, - this.handle, - message, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32'], - (handle: number, err: number) => { - if (err) { - reject(err); - } - resolve(); - }, - ), - ); + return await ffiNapi.mediatedConnectionHandleMessage(this.handle, message); } catch (err: any) { throw new VCXInternalError(err); } } - - /** - * - * Communicates with the agent service for polling and setting the state of the entity. - * - * Example: - * ``` - * await object.updateState() - * ``` - * @returns {Promise} - */ public async updateState(): Promise { try { - const commandHandle = 0; - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._updateStFn(commandHandle, this.handle, cb); - if (rc) { - resolve(0); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: number) => { - if (err) { - reject(err); - } - resolve(_state); - }, - ), - ); - return state; + return await ffiNapi.mediatedConnectionUpdateState(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Delete the object from the agency and release any memory associated with it - * NOTE: This eliminates the connection and any ability to use it for any communication. - * - * Example: - * ``` - * def connection = await Connection.create(source_id) - * await connection.delete() - * ``` - */ public async delete(): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_delete_connection(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + await ffiNapi.mediatedConnectionDeleteConnection(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Creates a connection between enterprise and end user. - * - * Example: - * ``` - * connection = await Connection.create('foobar123') - * inviteDetails = await connection.connect( - * {data: '{"connection_type":"SMS","phone":"5555555555"}',"use_public_did":true}) - * ``` - * @returns {Promise { + + public async connect(): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_connect(0, this.handle, connectionData.data, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, details: string) => { - if (err) { - reject(err); - return; - } - if (!details) { - reject(`Connection ${this.sourceId} connect returned empty string`); - return; - } - resolve(details); - }, - ), - ); + return await ffiNapi.mediatedConnectionConnect(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Sends a message to the connection. - * - * Example: - * ``` - * msg_id = await connection.send_message( - * {msg:"are you there?",type:"question","title":"Sending you a question"}) - * ``` - * @returns {Promise} Promise of String representing UID of created message in 1.0 VCX protocol. When using - * 2.0 / 3.0 / Aries protocol, return empty string. - */ - public async sendMessage(msgData: IMessageData): Promise { - const sendMsgOptions = { - msg_title: msgData.title, - msg_type: msgData.type, - ref_msg_id: msgData.refMsgId, - }; + + public async sendMessage(msgData: IMessageData): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_send_message( - 0, - this.handle, - msgData.msg, - JSON.stringify(sendMsgOptions), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, details: string) => { - if (err) { - reject(err); - return; - } - resolve(details); - }, - ), + return await ffiNapi.mediatedConnectionSendMessage( + this.handle, + msgData.msg, ); } catch (err: any) { throw new VCXInternalError(err); @@ -655,342 +255,78 @@ export class Connection extends VCXBaseWithState { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_send_handshake_reuse( - 0, - this.handle, - oobMsg, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32'], - (xHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }, - ), - ); + return await ffiNapi.mediatedConnectionSendHandshakeReuse(this.handle, oobMsg); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Sign data using connection pairwise key. - * - * Example: - * ``` - * signature = await connection.signData(bufferOfBits) - * ``` - * @returns {Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_sign_data( - 0, - this.handle, - ref.address(data), - data.length, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'pointer', 'uint32'], - (xHandle: number, err: number, detailsPtr: PtrBuffer, length: number) => { - if (err) { - reject(err); - return; - } - if (!detailsPtr) { - reject(`Connection ${this.sourceId} returned empty buffer`); - return; - } - const newBuffer = voidPtrToUint8Array(detailsPtr, length); - resolve(newBuffer); - }, - ), - ); + return await ffiNapi.mediatedConnectionSignData(this.handle, data); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Verify the signature of the data using connection pairwise key. - * - * Example: - * ``` - * valid = await connection.verifySignature({data: bufferOfBits, signature: signatureBits}) - * ``` - * @returns {Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_verify_signature( - 0, - this.handle, - ref.address(signatureData.data), - signatureData.data.length, - ref.address(signatureData.signature), - signatureData.signature.length, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'bool'], - (xHandle: number, err: number, valid: boolean) => { - if (err) { - reject(err); - return; - } - resolve(valid); - }, - ), + return await ffiNapi.mediatedConnectionVerifySignature( + this.handle, + signatureData.data, + signatureData.signature, ); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Get the invite details that were sent or can be sent to the remote side. - * - * Example: - * ``` - * phoneNumber = '8019119191' - * connection = await Connection.create('foobar123') - * inviteDetails = await connection.connect({phone: phoneNumber}) - * inviteDetailsAgain = await connection.inviteDetails() - * ``` - */ - public async inviteDetails(abbr = false): Promise { + public inviteDetails(): IConnectionInvite { try { - const data = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._inviteDetailFn(0, this.handle, abbr, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, details: string) => { - if (err) { - reject(err); - return; - } - if (!details) { - reject('no details returned'); - return; - } - resolve(details); - }, - ), - ); - return data; + return ffiNapi.mediatedConnectionInviteDetails(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Send trust ping message to the specified connection to prove that two agents have a functional pairwise channel. - * - * Note that this function is useful in case `aries` communication method is used. - * In other cases it returns ActionNotSupported error. - * - */ public async sendPing(comment: string | null | undefined): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_send_ping(0, this.handle, comment, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffiNapi.mediatedConnectionSendPing(this.handle, comment); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Send discovery features message to the specified connection to discover which features it supports, and to what extent. - * - * Note that this function is useful in case `aries` communication method is used. - * In other cases it returns ActionNotSupported error. - * - */ public async sendDiscoveryFeatures( query: string | null | undefined, comment: string | null | undefined, ): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_send_discovery_features( - 0, - this.handle, - query, - comment, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffiNapi.mediatedConnectionSendDiscoveryFeatures(this.handle, query, comment); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Retrieves pw_did from Connection object - * - */ - public async getPwDid(): Promise { + public getPwDid(): string { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_get_pw_did(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, details: string) => { - if (err) { - reject(err); - return; - } - if (!details) { - reject(`Connection ${this.sourceId} connect returned empty string`); - return; - } - resolve(details); - }, - ), - ); + return ffiNapi.mediatedConnectionGetPwDid(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Retrieves their_pw_did from Connection object - * - */ - public async getTheirDid(): Promise { + public getTheirDid(): string { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_get_their_pw_did(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, details: string) => { - if (err) { - reject(err); - return; - } - if (!details) { - reject(`Connection ${this.sourceId} connect returned empty string`); - return; - } - resolve(details); - }, - ), - ); + return ffiNapi.mediatedConnectionGetTheirPwDid(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Get the information about the connection state. - * - * Note: This method can be used for `aries` communication method only. - * For other communication method it returns ActionNotSupported error. - * - */ public async info(): Promise { try { - const data = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._infoFn(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, info: string) => { - if (err) { - reject(err); - return; - } - if (!info) { - reject('no info returned'); - return; - } - resolve(info); - }, - ), - ); - return data; + return await ffiNapi.mediatedConnectionInfo(this.handle); } catch (err: any) { throw new VCXInternalError(err); } @@ -998,26 +334,7 @@ export class Connection extends VCXBaseWithState { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_connection_messages_download(0, this.handle, status, uids, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xhandle: number, err: number, messages: string) => { - if (err) { - reject(err); - return; - } - resolve(messages); - }, - ), - ); + return await ffiNapi.mediatedConnectionMessagesDownload([this.handle], status, uids); } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/out-of-band-receiver.ts b/wrappers/node/src/api/out-of-band-receiver.ts index faff4f4030..96791621d1 100644 --- a/wrappers/node/src/api/out-of-band-receiver.ts +++ b/wrappers/node/src/api/out-of-band-receiver.ts @@ -1,61 +1,33 @@ -import * as ffi from 'ffi-napi'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; import { IOOBSerializedData } from './out-of-band-sender'; import { Connection } from './mediated-connection'; -import { VCXBase } from './vcx-base'; +import { VcxBase } from './vcx-base'; import { ISerializedData } from './common'; -export class OutOfBandReceiver extends VCXBase { - public static async createWithMessage(msg: string): Promise { - const oob = new OutOfBandReceiver(""); - const commandHandle = 0; +export class OutOfBandReceiver extends VcxBase { + public static createWithMessage(msg: string): OutOfBandReceiver { + const oob = new OutOfBandReceiver(''); try { - await oob._create((cb) => - rustAPI().vcx_out_of_band_receiver_create(commandHandle, msg, cb), - ); + oob._setHandle(ffi.outOfBandReceiverCreate(msg)); return oob; } catch (err: any) { throw new VCXInternalError(err); } } - public static async deserialize( - data: ISerializedData, - ): Promise { + public static deserialize(data: ISerializedData): OutOfBandReceiver { const newObj = { ...data, source_id: 'foo' }; - return super._deserialize(OutOfBandReceiver, newObj); + try { + return super._deserialize(OutOfBandReceiver, newObj); + } catch (err: any) { + throw new VCXInternalError(err); + } } - public async extractMessage(): Promise { + public extractMessage(): string { try { - const msg = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_receiver_extract_message( - commandHandle, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, msg: string) => { - if (err) { - reject(err); - return; - } - resolve(msg); - }, - ), - ); - return msg + return ffi.outOfBandReceiverExtractMessage(this.handle); } catch (err: any) { throw new VCXInternalError(err); } @@ -64,42 +36,8 @@ export class OutOfBandReceiver extends VCXBase { public async connectionExists(connections: [Connection]): Promise { try { const connHandles = connections.map((conn) => conn.handle); - const res = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_receiver_connection_exists( - commandHandle, - this.handle, - JSON.stringify(connHandles), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32', 'bool'], - (handle: number, err: number, conn_handle: number, found_one: boolean) => { - if (err) { - reject(err); - return; - } - if (!found_one) { - resolve(); - } else { - const conn = connections.find((conn) => conn.handle === conn_handle); - if (conn) { - resolve(conn); - return; - } - reject(Error('Unexpected state: should have found connection')); - } - }, - ), - ); - return res + const connHandle = await ffi.outOfBandReceiverConnectionExists(this.handle, connHandles); + return connections.find((conn) => conn.handle === connHandle); } catch (err: any) { throw new VCXInternalError(err); } @@ -107,71 +45,22 @@ export class OutOfBandReceiver extends VCXBase { public async buildConnection(): Promise { try { - const connection = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_receiver_build_connection( - commandHandle, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, connection: string) => { - if (err) { - reject(err); - return; - } - resolve(connection); - }, - ), - ); - return await Connection.deserialize(JSON.parse(connection)); + const connection = await ffi.outOfBandReceiverBuildConnection(this.handle); + return Connection.deserialize(JSON.parse(connection)); } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getThreadId(): string { try { - const thid = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_receiver_get_thread_id( - commandHandle, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, thid: string) => { - if (err) { - reject(err); - return; - } - resolve(thid); - }, - ), - ); - return thid; + return ffi.outOfBandReceiverGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - protected _serializeFn = rustAPI().vcx_out_of_band_receiver_serialize; - protected _deserializeFn = rustAPI().vcx_out_of_band_receiver_deserialize; - protected _releaseFn = rustAPI().vcx_out_of_band_receiver_release; + protected _serializeFn = ffi.outOfBandReceiverSerialize; + protected _deserializeFn = ffi.outOfBandReceiverDeserialize; + protected _releaseFn = ffi.outOfBandReceiverRelease; } diff --git a/wrappers/node/src/api/out-of-band-sender.ts b/wrappers/node/src/api/out-of-band-sender.ts index 41c5b058a7..bed61e4b12 100644 --- a/wrappers/node/src/api/out-of-band-sender.ts +++ b/wrappers/node/src/api/out-of-band-sender.ts @@ -1,8 +1,6 @@ -import * as ffi from 'ffi-napi'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; -import { VCXBase } from './vcx-base'; +import { VcxBase } from './vcx-base'; import { ISerializedData } from './common'; export interface IOOBSerializedData { @@ -32,197 +30,67 @@ export enum GoalCode { } export enum HandshakeProtocol { - ConnectionV1 = "ConnectionV1", - DidExchangeV1 = "DidExchangeV1", + ConnectionV1 = 'ConnectionV1', + DidExchangeV1 = 'DidExchangeV1', } -export class OutOfBandSender extends VCXBase { - public static async create(config: IOOBCreateData): Promise { +export class OutOfBandSender extends VcxBase { + public static create(config: IOOBCreateData): OutOfBandSender { const oob = new OutOfBandSender(config.source_id); - const commandHandle = 0; try { - await oob._create((cb) => - rustAPI().vcx_out_of_band_sender_create(commandHandle, JSON.stringify(config), cb), - ); + oob._setHandle(ffi.outOfBandSenderCreate(JSON.stringify(config))); return oob; } catch (err: any) { throw new VCXInternalError(err); } } - public static async deserialize( - data: ISerializedData, - ): Promise { + public static deserialize(data: ISerializedData): OutOfBandSender { const newObj = { ...data, source_id: 'foo' }; return super._deserialize(OutOfBandSender, newObj); } - public async appendMessage(message: string): Promise { + public appendMessage(message: string): void { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_sender_append_message( - commandHandle, - this.handle, - message, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32'], - (handle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }, - ), - ); + ffi.outOfBandSenderAppendMessage(this.handle, message); } catch (err: any) { throw new VCXInternalError(err); } } - public async appendServiceDid(did: string): Promise { - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_sender_append_service_did( - commandHandle, - this.handle, - did, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32'], - (handle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }, - ), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } + public appendServiceDid(did: string): void { + try { + ffi.outOfBandSenderAppendServiceDid(this.handle, did); + } catch (err: any) { + throw new VCXInternalError(err); + } } - public async appendService(service: string): Promise { + public appendService(service: string): void { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_sender_append_service( - commandHandle, - this.handle, - service, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32'], - (handle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }, - ), - ); + ffi.outOfBandSenderAppendService(this.handle, service); } catch (err: any) { throw new VCXInternalError(err); } } - public async toMessage(): Promise { + public toMessage(): string { try { - const msg = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_to_message( - commandHandle, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, msg: string) => { - if (err) { - reject(err); - return; - } - resolve(msg); - }, - ), - ); - return msg + return ffi.outOfBandSenderToMessage(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getThreadId(): string { try { - const thid = await createFFICallbackPromise( - (resolve, reject, cb) => { - const commandHandle = 0; - const rc = rustAPI().vcx_out_of_band_sender_get_thread_id( - commandHandle, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, thid: string) => { - if (err) { - reject(err); - return; - } - resolve(thid); - }, - ), - ); - return thid; + return ffi.outOfBandSenderGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - protected _serializeFn = rustAPI().vcx_out_of_band_sender_serialize; - protected _deserializeFn = rustAPI().vcx_out_of_band_sender_deserialize; - protected _releaseFn = rustAPI().vcx_out_of_band_sender_release; + protected _serializeFn = ffi.outOfBandSenderSerialize; + protected _deserializeFn = ffi.outOfBandSenderDeserialize; + protected _releaseFn = ffi.outOfBandSenderRelease; } diff --git a/wrappers/node/src/api/proof.ts b/wrappers/node/src/api/proof.ts index 0ea0b7d63e..7c1a91e4dc 100644 --- a/wrappers/node/src/api/proof.ts +++ b/wrappers/node/src/api/proof.ts @@ -1,77 +1,23 @@ -import * as ffi from 'ffi-napi'; -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { ISerializedData, VerifierStateType } from './common'; import { Connection } from './mediated-connection'; -import { VCXBaseWithState } from './vcx-base-with-state'; - -/** - * The object of the VCX API representing a Verifier side in the credential presentation process. - * Assumes that pairwise connection between Verifier and Prover is already established. - * - * # State - * - * VcxStateType::VcxStateInitialized - once `vcx_proof_create` (create Proof object) is called. - * - * VcxStateType::VcxStateOfferSent - once `vcx_credential_send_request` (send `PresentationRequest` message) is called. - * - * VcxStateType::VcxStateAccepted - once `Presentation` messages is received. - * VcxStateType::None - once `ProblemReport` messages is received. - * VcxStateType::None - once `PresentationProposal` messages is received. - * VcxStateType::None - on `Presentation` validation failed. - * use `vcx_proof_update_state` or `vcx_proof_update_state_with_message` functions for state updates. - * - * # Transitions - * - * aries: RFC - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#propose-presentation - * VcxStateType::None - `vcx_proof_create` - VcxStateType::VcxStateInitialized - * - * VcxStateType::VcxStateInitialized - `vcx_credential_send_request` - VcxStateType::VcxStateOfferSent - * - * VcxStateType::VcxStateOfferSent - received `Presentation` - VcxStateType::VcxStateAccepted - * VcxStateType::VcxStateOfferSent - received `PresentationProposal` - VcxStateType::None - * VcxStateType::VcxStateOfferSent - received `ProblemReport` - VcxStateType::None - * - * # Messages - * - * PresentationRequest - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#request-presentation - * Presentation - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#presentation - * PresentationProposal - https://github.com/hyperledger/aries-rfcs/tree/7b6b93acbaf9611d3c892c4bada142fe2613de6e/features/0037-present-proof#propose-presentation - * Ack - https://github.com/hyperledger/aries-rfcs/tree/master/features/0015-acks#explicit-acks - */ +import { VcxBaseWithState } from './vcx-base-with-state'; +import { VCXInternalError } from '../errors'; -/** - * @description Interface that represents the parameters for `Proof.create` function. - * @interface - */ export interface IProofCreateData { - // Enterprise's personal identification for the user. sourceId: string; - // Describes requested attribute attrs: IProofAttr[]; - // Describres requested predicates preds: IProofPredicate[]; - // Name of the proof request name: string; - // Revocation interval revocationInterval: IRevocationInterval; } export interface IProofConstructorData { - // Describes requested attributes attrs: IProofAttr[]; - // Describes requested predicates preds: IProofPredicate[]; - // Name of the proof request name: string; } -/** - * @description Interface that represents the attributes of a Proof object. - * This interface is expected as the type for deserialize's parameter and serialize's return value - * @interface - */ export interface IProofData { source_id: string; handle: number; @@ -85,9 +31,7 @@ export interface IProofData { } export interface IProofResponses { - // Proof json proof?: string; - // Proof status proofState: ProofState; } @@ -104,13 +48,7 @@ export enum PredicateTypes { EQ = 'EQ', } -/** - * @description This represents one attribute expected for user to prove. - * A list of these attributes will be composed of all requirements for user to prove. - * @interface - */ export interface IProofAttr { - // Requested attribute restrictions restrictions?: IFilter[] | IFilter; // Requested attribute name name?: string; @@ -119,23 +57,6 @@ export interface IProofAttr { names?: string[]; } -/** - * @description This represents the set of restrictions applying to credentials. - * The list of allowed fields: - * "schema_id": , - * "schema_issuer_did": , - * "schema_name": , - * "schema_version": , - * "issuer_did": , - * "cred_def_id": , - * "rev_reg_id": , // "None" as string if not present - * // the following tags can be used for every attribute in credential. - * "attr::::marker": "1", - to filter based on existence of a specific attribute - * "attr::::value": , - to filter based on value of a specific attribute - * Furthermore they can be combine into complex queries using Indy wql: indy-sdk/docs/design/011-wallet-query-language/README.md - * - * @interface - */ export interface IFilter { schema_id?: string; schema_issuer_did?: string; @@ -163,113 +84,38 @@ export interface IRevocationInterval { to?: number; } -/** - * Class representing a Proof - */ -export class Proof extends VCXBaseWithState { - /** - * Get the state of the proof - */ - get proofState(): ProofState | null { - return this._proofState; - } - /** - * Get the attributes of the proof - */ - get requestedAttributes(): IProofAttr[] { - return this._requestedAttributes; - } - - get requestedPredicates(): IProofPredicate[] { - return this._requestedPredicates; - } - - /** - * Get the name of the proof - */ - get name(): string { - return this._name; - } - /** - * Builds a generic proof object - * - * Example: - * ``` - * data = { - * attrs: [ - * { name: 'attr1', restrictions: [{ 'issuer_did': 'NcYxiDXkpYi6ov5FcYDi1i' }] }, - * { name: 'attr2', restrictions: { 'schema_id': 'id' } }, - * { names: ['attr3', 'attr4'] }], - * name: 'Proof', - * sourceId: 'testProofSourceId', - * revocationInterval: {from: 1, to: 2} - * } - * proof1 = await Proof.create(data) - * ``` - */ - +export class Proof extends VcxBaseWithState { public static async create({ sourceId, ...createDataRest }: IProofCreateData): Promise { try { - const proof = new Proof(sourceId, createDataRest); - const commandHandle = 0; - await proof._create((cb) => - rustAPI().vcx_proof_create( - commandHandle, - proof.sourceId, - JSON.stringify(createDataRest.attrs), - JSON.stringify(createDataRest.preds || []), - JSON.stringify(createDataRest.revocationInterval), - createDataRest.name, - cb, - ), + const proof = new Proof(sourceId); + const handle = await ffi.proofCreate( + proof.sourceId, + JSON.stringify(createDataRest.attrs), + JSON.stringify(createDataRest.preds || []), + JSON.stringify(createDataRest.revocationInterval), + createDataRest.name, ); + proof._setHandle(handle); return proof; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Builds a Proof object with defined attributes. - * - * Attributes are provided by a previous call to the serialize function. - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof1 = await Proof.create(data) - * data1 = await Proof.serialize() - * await Proof.deserialize(data1) - * ``` - */ - public static async deserialize(proofData: ISerializedData): Promise { + public static deserialize(proofData: ISerializedData): Proof { try { - const params: IProofConstructorData = (() => { - switch (proofData.version) { - case '1.0': - return Proof.getParams(proofData); - case '2.0': - return { attrs: [{ name: '' }], preds: [], name: '' }; - case '3.0': - return Proof.getParams(proofData); - default: - throw Error( - `Unsupported version provided in serialized proof data: ${JSON.stringify( - proofData.version, - )}`, - ); - } - })(); - return await super._deserialize(Proof, proofData, params); + return super._deserialize(Proof, proofData); } catch (err: any) { throw new VCXInternalError(err); } } + protected _releaseFn = ffi.proofRelease; + protected _updateStFnV2 = ffi.v2ProofUpdateState; + protected _getStFn = ffi.proofGetState; + protected _serializeFn = ffi.proofSerialize; + protected _deserializeFn = ffi.proofDeserialize; + private static getParams(proofData: ISerializedData): IProofConstructorData { const { data: { requested_attrs, requested_predicates, name }, @@ -279,246 +125,58 @@ export class Proof extends VCXBaseWithState { return { attrs, name, preds }; } - protected _releaseFn = rustAPI().vcx_proof_release; - protected _updateStFnV2 = rustAPI().vcx_v2_proof_update_state; - protected _getStFn = rustAPI().vcx_proof_get_state; - protected _serializeFn = rustAPI().vcx_proof_serialize; - protected _deserializeFn = rustAPI().vcx_proof_deserialize; - private _requestedAttributes: IProofAttr[]; - private _requestedPredicates: IProofPredicate[]; - private _name: string; - private _proofState: ProofState | null = null; - - constructor(sourceId: string, { attrs, preds, name }: IProofConstructorData) { - super(sourceId); - this._requestedAttributes = attrs; - this._requestedPredicates = preds; - this._name = name; - } - public async updateStateWithMessage(connection: Connection, message: string): Promise { try { - const commandHandle = 0; - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_v2_proof_update_state_with_message( - commandHandle, - this.handle, - connection.handle, - message, - cb, - ); - if (rc) { - resolve(0); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: number) => { - if (err) { - reject(err); - } - resolve(_state); - }, - ), + return await ffi.v2ProofUpdateStateWithMessage( + this.handle, + message, + connection.handle, ); - return state; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Sends a proof request to pairwise connection. - * - * Example - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof = await Proof.create(data) - * await proof.requestProof(connection) - * ``` - */ public async requestProof(connection: Connection): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_proof_send_request(0, this.handle, connection.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffi.proofSendRequest(this.handle, connection.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Generates the proof request message for sending. - * - * Example: - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof = await Proof.create(data) - * await proof.getProofRequestMessage() - * ``` - */ - public async getProofRequestMessage(): Promise { + + public getProofRequestMessage(): string { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_proof_get_request_msg(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xHandle: number, err: number, message: string) => { - if (err) { - reject(err); - return; - } - if (!message) { - reject(`proof ${this.sourceId} returned empty string`); - return; - } - resolve(message); - }, - ), - ); + return ffi.proofGetRequestMsg(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Flags the protocol object as the credential offer has been sent and incoming credential request message should - * be expected. - */ - public async markPresentationRequestMsgSent(): Promise { + public markPresentationRequestMsgSent(): void { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_mark_presentation_request_msg_sent( - 0, - this.handle, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback('void', ['uint32', 'uint32'], (xcommandHandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return ffi.markPresentationRequestMsgSent(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getThreadId(): Promise { + public getThreadId(): string { try { - const threadId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_proof_get_thread_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, threadId: string) => { - if (err) { - reject(err); - return; - } - resolve(threadId); - }, - ), - ); - return threadId; + return ffi.proofGetThreadId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Returns the requested proof if available - * - * Example - * ``` - * data = { - * attrs: [ - * { name: 'attr1' }, - * { name: 'attr2' }], - * name: 'Proof', - * sourceId: 'testProofSourceId' - * } - * proof = await Proof.create(data) - * await proof.requestProof(connection) - * proofData = await proof.getProof(connection) - * assert.equal(proofData.proofState, ProofState.Verified) - * ``` - */ - public async getProof(): Promise { + public getProof(): IProofResponses { try { - const proofRes = await createFFICallbackPromise<{ - proofState: ProofState; - proofData: string; - }>( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_get_proof_msg(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, proofState: ProofState, proofData: string) => { - if (err) { - reject(err); - return; - } - resolve({ proofState, proofData }); - }, - ), - ); - this._proofState = proofRes.proofState; - return { proof: proofRes.proofData, proofState: proofRes.proofState }; + const proof = ffi.proofGetProofMsg(this.handle); + const proofState = ffi.proofGetProofState(this.handle); + return { + proof, + proofState, + }; } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/public-agent.ts b/wrappers/node/src/api/public-agent.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/wrappers/node/src/api/revocation-registry.ts b/wrappers/node/src/api/revocation-registry.ts index ef58ca35cd..50f50bc7d0 100644 --- a/wrappers/node/src/api/revocation-registry.ts +++ b/wrappers/node/src/api/revocation-registry.ts @@ -1,24 +1,20 @@ -import * as ffi from 'ffi-napi'; +import * as ffi from '@hyperledger/vcx-napi-rs'; +import { ISerializedData } from './common'; +import { VcxBase } from './vcx-base'; import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; -import { ISerializedData, IssuerStateType } from './common'; -import { Connection } from './mediated-connection'; -import { CredentialDef } from './credential-def'; -import { VCXBase } from './vcx-base'; export interface IRevocationRegistryData { source_id: string; - cred_def_id: string, - issuer_did: string, - rev_reg_id: string, - rev_reg_def: string, - rev_reg_entry: string, - tails_dir: string, - max_creds: number, - tag: number, - rev_reg_def_state: string, - rev_reg_delta_state: string, + cred_def_id: string; + issuer_did: string; + rev_reg_id: string; + rev_reg_def: string; + rev_reg_entry: string; + tails_dir: string; + max_creds: number; + tag: number; + rev_reg_def_state: string; + rev_reg_delta_state: string; } export interface IRevocationRegistryConfig { @@ -29,49 +25,39 @@ export interface IRevocationRegistryConfig { maxCreds: number; } -export class RevocationRegistry extends VCXBase { +export class RevocationRegistry extends VcxBase { public static async create(config: IRevocationRegistryConfig): Promise { try { const revReg = new RevocationRegistry(''); - const commandHandle = 0; const _config = { issuer_did: config.issuerDid, cred_def_id: config.credDefId, tag: config.tag, tails_dir: config.tailsDir, - max_creds: config.maxCreds - } - await revReg._create((cb) => - rustAPI().vcx_revocation_registry_create(commandHandle, JSON.stringify(_config), cb), - ); + max_creds: config.maxCreds, + }; + const handle = await ffi.revocationRegistryCreate(JSON.stringify(_config)); + revReg._setHandle(handle); return revReg; } catch (err: any) { throw new VCXInternalError(err); } } + public static deserialize( + data: ISerializedData, + ): RevocationRegistry { + const newObj = { ...data, source_id: 'foo' }; + return super._deserialize(RevocationRegistry, newObj); + } + + protected _serializeFn = ffi.revocationRegistrySerialize; + protected _deserializeFn = ffi.revocationRegistryDeserialize; + protected _releaseFn = ffi.revocationRegistryRelease; + public async publish(tailsUrl: string): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_revocation_registry_publish(0, this.handle, tailsUrl, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (xcommandHandle: number, err: number, handle: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }, - ), - ); + await ffi.revocationRegistryPublish(this.handle, tailsUrl); } catch (err: any) { throw new VCXInternalError(err); } @@ -79,95 +65,25 @@ export class RevocationRegistry extends VCXBase { public async publishRevocations(): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_revocation_registry_publish_revocations(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number) => { - if (err) { - reject(err); - } - resolve(); - }, - ), - ); + await ffi.revocationRegistryPublishRevocations(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - - public async getRevRegId(): Promise { + public getRevRegId(): string { try { - const revRegId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_revocation_registry_get_rev_reg_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, _revRegId: string) => { - if (err) { - reject(err); - return; - } - resolve(_revRegId); - }, - ), - ); - return revRegId; + return ffi.revocationRegistryGetRevRegId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - public async getTailsHash(): Promise { + public getTailsHash(): string { try { - const tailsHash = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_revocation_registry_get_tails_hash(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, tailsHash: string) => { - if (err) { - reject(err); - return; - } - resolve(tailsHash); - }, - ), - ); - return tailsHash; + return ffi.revocationRegistryGetTailsHash(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - - public static async deserialize( - data: ISerializedData, - ): Promise { - const newObj = { ...data, source_id: 'foo' }; - return super._deserialize(RevocationRegistry, newObj); - } - - protected _releaseFn = rustAPI().vcx_revocation_registry_release; - protected _serializeFn = rustAPI().vcx_revocation_registry_serialize; - protected _deserializeFn = rustAPI().vcx_revocation_registry_deserialize; } diff --git a/wrappers/node/src/api/schema.ts b/wrappers/node/src/api/schema.ts index 54f2024e64..05afd776f2 100644 --- a/wrappers/node/src/api/schema.ts +++ b/wrappers/node/src/api/schema.ts @@ -1,20 +1,15 @@ -import * as ffi from 'ffi-napi'; -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; +import * as ffi from '@hyperledger/vcx-napi-rs'; import { ISerializedData } from './common'; -import { VCXBase } from './vcx-base'; +import { VcxBase } from './vcx-base'; +import { VCXInternalError } from '../errors'; /** * @interface Interface that represents the parameters for `Schema.create` function. * @description */ export interface ISchemaCreateData { - // Enterprise's personal identification for the user. sourceId: string; - // list of attributes that will make up the schema (the number of attributes should be less or equal than 125) data: ISchemaAttrs; - // future use (currently uses any address in the wallet) } /** @@ -22,9 +17,7 @@ export interface ISchemaCreateData { * @description */ export interface ISchemaPrepareForEndorserData { - // Enterprise's personal identification for the user. sourceId: string; - // list of attributes that will make up the schema (the number of attributes should be less or equal than 125) data: ISchemaAttrs; // DID of the Endorser that will submit the transaction. endorser: string; @@ -53,18 +46,6 @@ export interface ISchemaSerializedData { schema_id: string; } -export interface ISchemaTxn { - sequence_num?: number; - sponsor?: string; - txn_timestamp?: number; - txn_type?: string; - data?: { - name: string; - version: string; - attr_names: string[]; - }; -} - export interface ISchemaParams { schemaId: string; name: string; @@ -81,7 +62,7 @@ export enum SchemaState { Published = 1, } -export class Schema extends VCXBase { +export class Schema extends VcxBase { get schemaAttrs(): ISchemaAttrs { return this._schemaAttrs; } @@ -94,228 +75,41 @@ export class Schema extends VCXBase { return this._name; } - get schemaTransaction(): string { - return this._transaction; - } - /** - * Creates a new Schema object that is written to the ledger - * - * Example: - * ``` - * data: { - * attrNames: [ - * 'attr1', - * 'attr2' - * ], - * name: 'Schema', - * version: '1.0.0' - * }, - * sourceId: 'testSchemaSourceId' - * } - * schema1 = await Schema.create(data) - * ``` - */ - public static async create({ - data, - sourceId, - }: ISchemaCreateData): Promise { + public static async create({ data, sourceId }: ISchemaCreateData): Promise { try { const schema = new Schema(sourceId, { name: data.name, schemaId: '', schemaAttrs: data }); - const commandHandle = 0; - await schema._create((cb) => - rustAPI().vcx_schema_create( - commandHandle, - schema.sourceId, - schema._name, - data.version, - JSON.stringify(data.attrNames), - 0, - cb, - ), + const handle = await ffi.schemaCreate( + schema.sourceId, + schema._name, + data.version, + JSON.stringify(data.attrNames), ); - await schema.getSchemaId(); + schema._setHandle(handle); + schema._schemaId = ffi.schemaGetSchemaId(handle); return schema; } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Builds a new Schema object that will be published by Endorser later. - * - * Example: - * ``` - * data: { - * attrNames: [ - * 'attr1', - * 'attr2' - * ], - * name: 'Schema', - * version: '1.0.0' - * }, - * endorser: 'V4SGRU86Z58d6TV7PBUe6f', - * sourceId: 'testSchemaSourceId' - * } - * schema1 = await Schema.prepareForEndorser(data) - * ``` - */ - public static async prepareForEndorser({ - endorser, - data, - sourceId, - }: ISchemaPrepareForEndorserData): Promise { - try { - const schema = new Schema(sourceId, { name: data.name, schemaId: '', schemaAttrs: data }); - - const schemaForEndorser = await createFFICallbackPromise<{ - transaction: string; - handle: number; - }>( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_schema_prepare_for_endorser( - 0, - sourceId, - schema._name, - data.version, - JSON.stringify(data.attrNames), - endorser, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32', 'string'], - (handle: number, err: number, _schemaHandle: number, _transaction: string) => { - if (err) { - reject(err); - return; - } - if (!_transaction) { - reject('no schema transaction'); - return; - } - resolve({ transaction: _transaction, handle: _schemaHandle }); - }, - ), - ); - schema._setHandle(schemaForEndorser.handle); - schema._transaction = schemaForEndorser.transaction; - await schema.getSchemaId(); - return schema; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Builds Schema object with defined attributes. - * Attributes are provided by a previous call to the serialize function. - * - * Example: - * ``` - * sourceId = 'lookupTest' - * data: { - * attrNames: [ - * 'attr1', - * 'attr2' - * ], - * name: 'Schema', - * version: '1.0.0' - * }, - * sourceId: sourceId - * } - * schema1 = await Schema.create(data) - * data1 = await schema1.serialize() - * schema2 = Schema.deserialize(data1) - */ - public static async deserialize(schema: ISerializedData): Promise { + public static deserialize(schema: ISerializedData): Schema { const { data: { name, schema_id, version, data }, } = schema; - const schemaParams = { + const jsConstructorParams = { name, schemaAttrs: { name, version, attrNames: data }, schemaId: schema_id, }; - return super._deserialize(Schema, schema, schemaParams); - } - - /** - * Looks up the attributes of an already created Schema. - * - * Example: - * ``` - * sourceId = 'lookupTest' - * data: { - * attrNames: [ - * 'attr1', - * 'attr2' - * ], - * name: 'Schema', - * version: '1.0.0' - * }, - * sourceId: sourceId - * } - * schema1 = await Schema.create(data) - * schemaId1 = await schema1.getSchemaId() - * data = await Schema.lookup(sourceId, schemaId1) - * ``` - */ - public static async lookup({ sourceId, schemaId }: ISchemaLookupData): Promise { - try { - const schemaLookupData = await createFFICallbackPromise<{ data: string; handle: number }>( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_schema_get_attributes(0, sourceId, schemaId, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32', 'string'], - (handle: number, err: number, _schemaHandle: number, _schemaData: string) => { - if (err) { - reject(err); - return; - } - if (!_schemaData) { - reject('no schema attrs'); - return; - } - resolve({ data: _schemaData, handle: _schemaHandle }); - }, - ), - ); - const { name, version, data }: ISchemaSerializedData = JSON.parse(schemaLookupData.data); - const schemaParams = { - name, - schemaAttrs: { - attrNames: data, - name, - version, - }, - schemaId, - }; - const newSchema = new Schema(sourceId, schemaParams); - newSchema._setHandle(schemaLookupData.handle); - return newSchema; - } catch (err: any) { - throw new VCXInternalError(err); - } + return super._deserialize(Schema, schema, jsConstructorParams); } - protected _releaseFn = rustAPI().vcx_schema_release; - protected _serializeFn = rustAPI().vcx_schema_serialize; - protected _deserializeFn = rustAPI().vcx_schema_deserialize; + protected _serializeFn = ffi.schemaSerialize; + protected _deserializeFn = ffi.schemaDeserialize; + protected _releaseFn = ffi.schemaRelease; protected _name: string; protected _schemaId: string; protected _schemaAttrs: ISchemaAttrs; - private _transaction = ''; constructor(sourceId: string, { name, schemaId, schemaAttrs }: ISchemaParams) { super(sourceId); @@ -324,121 +118,25 @@ export class Schema extends VCXBase { this._schemaAttrs = schemaAttrs; } - /** - * - * Checks if schema is published on the Ledger and updates the state - * - * Example: - * ``` - * await schema.updateState() - * ``` - * @returns {Promise} - */ public async updateState(): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_schema_update_state(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, state: SchemaState) => { - if (err) { - reject(err); - } - resolve(state); - }, - ), - ); + await ffi.schemaUpdateState(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Get the current state of the schema object - * - * Example: - * ``` - * state = await schema.getState() - * ``` - * @returns {Promise} - */ - public async getState(): Promise { + public getState(): SchemaState { try { - const stateRes = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_schema_get_state(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, state: SchemaState) => { - if (err) { - reject(err); - } - resolve(state); - }, - ), - ); - return stateRes; + return ffi.schemaGetState(this.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Get the ledger ID of the object - * - * Example: - * ``` - * data: { - * attrNames: [ - * 'attr1', - * 'attr2' - * ], - * name: 'Schema', - * version: '1.0.0' - * }, - * sourceId: 'testSchemaSourceId' - * } - * schema1 = await Schema.create(data) - * id1 = await schema1.getSchemaId() - * ``` - */ - protected async getSchemaId(): Promise { + protected getSchemaId(): string { try { - const schemaId = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_schema_get_schema_id(0, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xcommandHandle: number, err: number, schemaIdVal: string) => { - if (err) { - reject(err); - return; - } - this._schemaId = schemaIdVal; - resolve(schemaIdVal); - }, - ), - ); - return schemaId; + return ffi.schemaGetSchemaId(this.handle); } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/utils.ts b/wrappers/node/src/api/utils.ts index e5d36c4ee9..4869f6866d 100644 --- a/wrappers/node/src/api/utils.ts +++ b/wrappers/node/src/api/utils.ts @@ -1,10 +1,5 @@ -import { Callback } from 'ffi-napi'; - -import { VCXInternalError } from '../errors' -import { rustAPI } from '../rustlib' -import { IConnectionDownloadAllMessages } from './mediated-connection' -import { createFFICallbackPromise } from '../utils/ffi-helpers' -import * as ref from 'ref-napi'; +import { VCXInternalError } from '../errors'; +import * as ffi from '@hyperledger/vcx-napi-rs'; export interface IPwInfo { pw_did: string; @@ -25,67 +20,25 @@ export interface IAriesService { serviceEndpoint: string; } -export async function provisionCloudAgent (configAgent: object): Promise { +export async function provisionCloudAgent(configAgent: object): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_provision_cloud_agent(0, JSON.stringify(configAgent), cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32','uint32','string'], - (xhandle: number, err: number, config: string) => { - if (err) { - reject(err) - return - } - resolve(config) - }) - ) + return await ffi.provisionCloudAgent(JSON.stringify(configAgent)); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -export interface PtrBuffer extends Buffer { - // Buffer.deref typing provided by @types/ref-napi is wrong, so we overwrite the typing/ - // An issue is currently dealing with fixing it https://github.com/DefinitelyTyped/DefinitelyTyped/pull/44004#issuecomment-744497037 - deref: () => PtrBuffer; -} - export function getVersion(): string { - return rustAPI().vcx_version(); + try { + return ffi.getVersion(); + } catch (err: any) { + throw new VCXInternalError(err); + } } export async function getLedgerAuthorAgreement(): Promise { - /** - * Retrieve author agreement set on the sovrin network - */ try { - const agreement = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_get_ledger_author_agreement(0, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xhandle: number, err: number, agreement: string) => { - if (err) { - reject(err); - return; - } - resolve(agreement); - }, - ), - ); - return agreement; + return await ffi.getLedgerAuthorAgreement(); } catch (err: any) { throw new VCXInternalError(err); } @@ -95,24 +48,28 @@ export function setActiveTxnAuthorAgreementMeta( text: string | null | undefined, version: string | null | undefined, hash: string | null | undefined, - acc_mech_type: string, - time_of_acceptance: number, -): number { - /** - * Set some accepted agreement as active. - * As result of successful call of this function appropriate metadata will be appended to each write request. - */ - return rustAPI().vcx_set_active_txn_author_agreement_meta( - text, - version, - hash, - acc_mech_type, - time_of_acceptance, - ); + acceptanceMechanismType: string, + timeOfAcceptance: number, +): void { + try { + ffi.setActiveTxnAuthorAgreementMeta( + text, + version, + hash, + acceptanceMechanismType, + timeOfAcceptance, + ); + } catch (err: any) { + throw new VCXInternalError(err); + } } -export function shutdownVcx(deleteWallet: boolean): number { - return rustAPI().vcx_shutdown(deleteWallet); +export function shutdownVcx(deleteWallet: boolean): void { + try { + ffi.shutdown(deleteWallet); + } catch (err: any) { + throw new VCXInternalError(err); + } } export interface IUpdateWebhookUrl { @@ -121,22 +78,7 @@ export interface IUpdateWebhookUrl { export async function vcxUpdateWebhookUrl({ webhookUrl }: IUpdateWebhookUrl): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_update_webhook_url(0, webhookUrl, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + await ffi.updateWebhookUrl(webhookUrl); } catch (err: any) { throw new VCXInternalError(err); } @@ -146,57 +88,9 @@ export interface IUpdateMessagesConfigs { msgJson: string; } -export async function updateMessages({ msgJson }: IUpdateMessagesConfigs): Promise { - /** - * Update the status of messages from the specified connection - */ +export async function updateMessages(updateConfig: IUpdateMessagesConfigs): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_messages_update_status(0, 'MS-106', msgJson, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(err); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } -} - -export function setPoolHandle(handle: number): void { - rustAPI().vcx_pool_set_handle(handle); -} - -export async function endorseTransaction(transaction: string): Promise { - /** - * Endorse transaction to the ledger preserving an original author - */ - try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_endorse_transaction(0, transaction, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + await ffi.messagesUpdateStatus('MS-106', updateConfig.msgJson); } catch (err: any) { throw new VCXInternalError(err); } @@ -204,22 +98,7 @@ export async function endorseTransaction(transaction: string): Promise { export async function rotateVerkey(did: string): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_rotate_verkey(0, did, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + await ffi.rotateVerkey(did); } catch (err: any) { throw new VCXInternalError(err); } @@ -227,22 +106,7 @@ export async function rotateVerkey(did: string): Promise { export async function rotateVerkeyStart(did: string): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_rotate_verkey_start(0, did, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('string', ['uint32', 'uint32', 'string'], (xhandle: number, err: number, tempVk: string) => { - if (err) { - reject(err); - return; - } - resolve(tempVk); - }), - ); + return await ffi.rotateVerkeyStart(did); } catch (err: any) { throw new VCXInternalError(err); } @@ -250,22 +114,7 @@ export async function rotateVerkeyStart(did: string): Promise { export async function rotateVerkeyApply(did: string, tempVk: string): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_rotate_verkey_apply(0, did, tempVk, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('string', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + await ffi.rotateVerkeyApply(did, tempVk); } catch (err: any) { throw new VCXInternalError(err); } @@ -273,22 +122,7 @@ export async function rotateVerkeyApply(did: string, tempVk: string): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_get_verkey_from_wallet(0, did, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (xhandle: number, err: number, vk: string) => { - if (err) { - reject(err); - return; - } - resolve(vk); - }), - ); + return await ffi.getVerkeyFromWallet(did); } catch (err: any) { throw new VCXInternalError(err); } @@ -296,22 +130,7 @@ export async function getVerkeyFromWallet(did: string): Promise { export async function getVerkeyFromLedger(did: string): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_get_verkey_from_ledger(0, did, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (xhandle: number, err: number, vk: string) => { - if (err) { - reject(err); - return; - } - resolve(vk); - }), - ); + return await ffi.getVerkeyFromLedger(did); } catch (err: any) { throw new VCXInternalError(err); } @@ -319,22 +138,7 @@ export async function getVerkeyFromLedger(did: string): Promise { export async function getLedgerTxn(did: string, seqNo: number): Promise { try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_get_ledger_txn(0, did, seqNo, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (xhandle: number, err: number, txn: string) => { - if (err) { - reject(err); - return; - } - resolve(txn); - }), - ); + return await ffi.getLedgerTxn(seqNo, did); } catch (err: any) { throw new VCXInternalError(err); } @@ -342,96 +146,36 @@ export async function getLedgerTxn(did: string, seqNo: number): Promise export async function createPwInfo(): Promise { try { - return await createFFICallbackPromise( - (_resolve, reject, cb) => { - const rc = rustAPI().vcx_create_pairwise_info(0, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (_xhandle: number, err: number, pwInfo: string) => { - if (err) { - reject(err); - return; - } - resolve(JSON.parse(pwInfo)); - }), - ); + return JSON.parse(await ffi.createPairwiseInfo()); } catch (err: any) { throw new VCXInternalError(err); } } export async function createService( - did: string, endpoint: string, recipientKeys: string[], routingKeys: string[] + target_did: string, + endpoint: string, + recipientKeys: string[], + routingKeys: string[], ): Promise { try { - return await createFFICallbackPromise( - (_resolve, reject, cb) => { - const rc = rustAPI() - .vcx_create_service(0, did, endpoint, JSON.stringify(recipientKeys), JSON.stringify(routingKeys), cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (_xhandle: number, err: number, service: string) => { - if (err) { - reject(err); - return; - } - resolve(JSON.parse(service)); - }), - ); + return JSON.parse(await ffi.createService(target_did, recipientKeys, routingKeys, endpoint)); } catch (err: any) { throw new VCXInternalError(err); } } -export async function getServiceFromLedger (did: string): Promise { +export async function getServiceFromLedger(did: string): Promise { try { - return await createFFICallbackPromise( - (_resolve, reject, cb) => { - const rc = rustAPI() - .vcx_get_service_from_ledger(0, did, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (_xhandle: number, err: number, service: string) => { - if (err) { - reject(err); - return; - } - resolve(JSON.parse(service)); - }), - ); + return JSON.parse(await ffi.getServiceFromLedger(did)); } catch (err: any) { throw new VCXInternalError(err); } } -export async function unpack(payload: Buffer): Promise { +export async function unpack(data: Buffer): Promise { try { - return await createFFICallbackPromise( - (_resolve, reject, cb) => { - const rc = rustAPI() - .vcx_unpack(0, ref.address(payload), payload.length, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32', 'string'], (_xhandle: number, err: number, decryptedPayload: string) => { - if (err) { - reject(err); - return; - } - resolve(JSON.parse(decryptedPayload)); - }), - ); + return JSON.parse(await ffi.unpack(data)); } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/vcx-base-with-state.ts b/wrappers/node/src/api/vcx-base-with-state.ts index b921a55836..8b0fc363c9 100644 --- a/wrappers/node/src/api/vcx-base-with-state.ts +++ b/wrappers/node/src/api/vcx-base-with-state.ts @@ -1,78 +1,22 @@ -import * as ffi from 'ffi-napi'; -import { VCXInternalError } from '../errors'; -import { createFFICallbackPromise, ICbRef } from '../utils/ffi-helpers'; import { Connection } from './mediated-connection'; -import { VCXBase } from './vcx-base'; +import { VcxBase } from './vcx-base'; +import { VCXInternalError } from '../errors'; -export abstract class VCXBaseWithState extends VCXBase { - protected abstract _updateStFnV2: ( - commandHandle: number, - handle: number, - connHandle: number, - cb: ICbRef, - ) => number; - protected abstract _getStFn: (commandHandle: number, handle: number, cb: ICbRef) => number; +export abstract class VcxBaseWithState extends VcxBase { + protected abstract _updateStFnV2: (handle: number, connHandle: number) => Promise; + protected abstract _getStFn: (handle: number) => StateType; public async updateStateV2(connection: Connection): Promise { try { - const commandHandle = 0; - const state = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._updateStFnV2(commandHandle, this.handle, connection.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, _state: StateType) => { - if (err) { - reject(err); - } - resolve(_state); - }, - ), - ); - return state; + return await this._updateStFnV2(this.handle, connection.handle); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Gets the state of the entity. - * - * Example: - * ``` - * state = await object.getState() - * ``` - * @returns {Promise} - */ - public async getState(): Promise { + public getState(): StateType { try { - const commandHandle = 0; - const stateRes = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._getStFn(commandHandle, this.handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (handle: number, err: number, state: StateType) => { - if (err) { - reject(err); - } - resolve(state); - }, - ), - ); - return stateRes; + return this._getStFn(this.handle); } catch (err: any) { throw new VCXInternalError(err); } diff --git a/wrappers/node/src/api/vcx-base.ts b/wrappers/node/src/api/vcx-base.ts index b8b4b7dda0..c5ac696bb7 100644 --- a/wrappers/node/src/api/vcx-base.ts +++ b/wrappers/node/src/api/vcx-base.ts @@ -1,29 +1,26 @@ -import * as ffi from 'ffi-napi'; import { VCXInternalError } from '../errors'; -import { createFFICallbackPromise, ICbRef } from '../utils/ffi-helpers'; -import { GCWatcher } from '../utils/memory-management-helpers'; import { ISerializedData } from './common'; +import {GCWatcher} from "../utils/gc-watcher"; -export type IVCXBaseCreateFn = (cb: ICbRef) => number; +export abstract class VcxBase extends GCWatcher { -export abstract class VCXBase extends GCWatcher { - protected static async _deserialize, P = unknown>( + protected static _deserialize, P = unknown> ( // eslint-disable-next-line @typescript-eslint/no-explicit-any VCXClass: new (sourceId: string, args?: any) => T, objData: ISerializedData<{ source_id: string }>, constructorParams?: P, - ): Promise { + ): T { try { const obj = new VCXClass(objData.source_id || objData.data.source_id, constructorParams); - await obj._initFromData(objData); + obj._initFromData(objData); return obj; } catch (err: any) { throw new VCXInternalError(err); } } - protected abstract _serializeFn: (commandHandle: number, handle: number, cb: ICbRef) => number; - protected abstract _deserializeFn: (commandHandle: number, handle: string, cb: ICbRef) => number; + protected abstract _serializeFn: (handle: number) => string; + protected abstract _deserializeFn: (data: string) => number; protected _sourceId: string; constructor(sourceId: string) { @@ -31,101 +28,20 @@ export abstract class VCXBase extends GCWatcher { this._sourceId = sourceId; } - /** - * - * Data returned can be used to recreate an entity by passing it to the deserialize function. - * - * Same json object structure that is passed to the deserialize function. - * - * Example: - * - * ``` - * data = await object.serialize() - * ``` - */ - public async serialize(): Promise> { + public serialize(): ISerializedData { try { - const dataStr = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._serializeFn(0, this.handle, cb); - if (rc) { - reject(rc); - return; - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: string, err: number, serializedData?: string) => { - if (err) { - reject(err); - return; - } - if (!serializedData) { - reject('no data to serialize'); - return; - } - resolve(serializedData); - }, - ), - ); - const data: ISerializedData = JSON.parse(dataStr); - return data; + return JSON.parse(this._serializeFn(this.handle)); } catch (err: any) { throw new VCXInternalError(err); } } - /** The source Id assigned by the user for this object */ + get sourceId(): string { return this._sourceId; } - protected async _create(createFn: IVCXBaseCreateFn): Promise { - const handleRes = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = createFn(cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (xHandle: number, err: number, handle: number) => { - if (err) { - reject(err); - return; - } - resolve(handle); - }, - ), - ); - this._setHandle(handleRes); - } - - private async _initFromData(objData: ISerializedData<{ source_id: string }>): Promise { - const commandHandle = 0; - const objHandle = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = this._deserializeFn(commandHandle, JSON.stringify(objData), cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (xHandle: number, err: number, handle: number) => { - if (err) { - reject(err); - } - resolve(handle); - }, - ), - ); + private _initFromData(objData: ISerializedData<{ source_id: string }>): void { + const objHandle = this._deserializeFn(JSON.stringify(objData)) this._setHandle(objHandle); } } diff --git a/wrappers/node/src/api/vcx-mock.ts b/wrappers/node/src/api/vcx-mock.ts index 76820c4b1c..0f3d2e217b 100644 --- a/wrappers/node/src/api/vcx-mock.ts +++ b/wrappers/node/src/api/vcx-mock.ts @@ -1,15 +1,3 @@ -import { rustAPI } from '../rustlib'; - -export enum VCXMockMessage { - GetMessages = 3, // get_message response for connection acceptance - UpdateIssuerCredential = 4, // get_message response for claim offer - UpdateProof = 5, // get_message response for updating proof state - IssuerCredentialReq = 6, // get_message response with claim req - Proof = 7, // get_message response with proof, - CredentialResponse = 8, // reply to credential request with an actual credential - AcceptInvite = 9, // connection invite was accepted -} - export const ARIES_PROOF_REQUEST: string = JSON.stringify({ '@id': '4e62363d-6348-4b59-9d98-a86497f9301b', '@type': 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/request-presentation', @@ -69,9 +57,3 @@ export const ARIES_CREDENTIAL_OFFER: string = JSON.stringify({ }, ], }); - -export class VCXMock { - public static setVcxMock(message: VCXMockMessage): void { - rustAPI().vcx_set_next_agency_response(message); - } -} diff --git a/wrappers/node/src/api/wallet.ts b/wrappers/node/src/api/wallet.ts index 5b4d0dcad5..2f2e3aeaef 100644 --- a/wrappers/node/src/api/wallet.ts +++ b/wrappers/node/src/api/wallet.ts @@ -1,722 +1,52 @@ -import { Callback } from 'ffi-napi'; -import * as ref from 'ref-napi'; - import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; -import { createFFICallbackPromise } from '../utils/ffi-helpers'; - -/** - * @interface An interface representing a record that can be added to the wallet - */ -export interface IRecord { - type_: string; - id: string; - value: any; // eslint-disable-line @typescript-eslint/no-explicit-any - tags_json: any; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export interface IRecordUpdate { - type_: string; - id: string; - value: any; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export interface IDeleteRecordTagsOptions { - tagList: string[]; -} - -export interface IDeleteRecordData { - type: string; - id: string; -} - -export interface IGetRecordOptions { - retrieveType: boolean; - retrieveValue: boolean; - retrieveTags: boolean; -} - -export interface IGerRecordData { - type: string; - id: string; - optionsJson: IGetRecordOptions; -} - -export interface IOpenSearchData { - type: string; - queryJson: string; - optionsJson: string; -} +import * as ffi from '@hyperledger/vcx-napi-rs'; -export interface ISearchNextRecordsOptions { - count: number; -} - -export async function createWallet (config: object): Promise { +export async function createWallet(config: object): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_create_wallet(0, JSON.stringify(config), cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32','uint32'], - (xhandle: number, err: number) => { - if (err) { - reject(err) - return - } - resolve() - }) - ) + return await ffi.walletCreateMain(JSON.stringify(config)); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -export async function configureIssuerWallet (seed: string): Promise { +export async function configureIssuerWallet(seed: string): Promise { try { - const issuerConfig = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_configure_issuer_wallet(0, seed, cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32','uint32','string'], - (xhandle: number, err: number, config: string) => { - if (err) { - reject(err) - return - } - resolve(config) - }) - ) - return issuerConfig + return await ffi.configureIssuerWallet(seed); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -export async function openMainWallet (config: object): Promise { +export async function openMainWallet(config: object): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_open_main_wallet(0, JSON.stringify(config), cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32','uint32'], - (xhandle: number, err: number) => { - if (err) { - reject(err) - return - } - resolve() - }) - ) + await ffi.walletOpenAsMain(JSON.stringify(config)); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -export async function closeMainWallet (): Promise { +export async function closeMainWallet(): Promise { try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_close_main_wallet(0, cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32','uint32'], - (xhandle: number, err: number) => { - if (err) { - reject(err) - return - } - resolve() - }) - ) + await ffi.walletCloseMain(); } catch (err: any) { - throw new VCXInternalError(err) + throw new VCXInternalError(err); } } -/** - * @class Class representing a Wallet - */ export class Wallet { - /** - * Adds a record to the wallet for storage - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: {}, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * ``` - * @async - * @param {Record} record - * @returns {Promise} - */ - public static async addRecord(record: IRecord): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_add_record( - commandHandle, - record.type_, - record.id, - record.value, - JSON.stringify(record.tags_json), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Updates a record already in the wallet - * - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: {}, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * await Wallet.updateRecordValue({ - * id: 'RecordId', - * type_: 'TestType', - * value: 'RecordValueNew' - * }) - * ``` - */ - public static async updateRecordValue(record: IRecordUpdate): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_update_record_value( - commandHandle, - record.type_, - record.id, - record.value, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Updates a record's tags already in the wallet - * - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: {}, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * - * updateRecordTags({ - * id: 'RecordId', - * tags: {}, - * type_: 'TestType', - * value: '' - * }) - * ``` - */ - public static async updateRecordTags(record: IRecord): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_update_record_tags( - commandHandle, - record.type_, - record.id, - JSON.stringify(record.tags_json), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Adds tags to a record already in the wallet - * - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: {}, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * - * addRecordTags({ id: 'RecordId', - * tags: { - * "tagName1": "tag value 1", - * "~tagName2": "tag value 2 unencrypted", - * "tagName3", 1 - * }, - * type_: 'TestType', - * value: '' - * }) - * ``` - */ - public static async addRecordTags(record: IRecord): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_add_record_tags( - commandHandle, - record.type_, - record.id, - JSON.stringify(record.tags_json), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Tags to delete from a record already in the wallet - * - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: { - * "foo": "bar", - * "~fizz": "buzz", - * "unencyrptedStringTag": "tag value 1", - * "~encryptedStringTag": "tag value 2 unencrypted", - * "unencyrptedIntTag": 1 - * }, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * - * deleteRecordTags({ - * id: 'RecordId', - * tags: { tagList: [ "foo", "buzz", "~encryptedStringTag" ] } - * type_: 'TestType', - * value: '' - * }) - * ``` - */ - public static async deleteRecordTags( - record: IRecord, - { tagList }: IDeleteRecordTagsOptions, - ): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_delete_record_tags( - commandHandle, - record.type_, - record.id, - JSON.stringify(tagList), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Delete a record already in the wallet - * - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: { - * "foo": "bar", - * "~fizz": "buzz", - * "unencyrptedStringTag": "tag value 1", - * "~encryptedStringTag": "tag value 2 unencrypted", - * "unencyrptedIntTag": 1 - * }, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * - * await Wallet.deleteRecord({ - * id: 'RecordId', - * type_: 'TestType' - * }) - * ``` - */ - public static async deleteRecord({ type, id }: IDeleteRecordData): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_delete_record(commandHandle, type, id, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Retrieve a record already in the wallet - * - * Example: - * ``` - * await Wallet.addRecord({ - * id: 'RecordId', - * tags: { - * "foo": "bar", - * "~fizz": "buzz", - * "unencyrptedStringTag": "tag value 1", - * "~encryptedStringTag": "tag value 2 unencrypted", - * "unencyrptedIntTag": 1 - * }, - * type_: 'TestType', - * value: 'RecordValue' - * }) - * - * record = await Wallet.getReocrd({ type: 'TestType', id: 'RecordId'}) - * ``` - */ - public static async getRecord({ type, id, optionsJson }: IGerRecordData): Promise { - const commandHandle = 0; - try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_get_record( - commandHandle, - type, - id, - JSON.stringify(optionsJson), - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xhandle: number, err: number, info: string) => { - if (err) { - reject(err); - return; - } - resolve(info); - }, - ), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Open a search handle - * - * Example: - * ``` - * searchHandle = await openSearch({type: 'TestType'}) - * ``` - */ - public static async openSearch({ - type, - queryJson, - optionsJson, - }: IOpenSearchData): Promise { - const commandHandle = 0; - try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_open_search( - commandHandle, - type, - queryJson, - optionsJson, - cb, - ); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (xhandle: number, err: number, handle: number) => { - if (err) { - reject(err); - return; - } - resolve(handle); - }, - ), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Close a search handle - * - * Example: - * ``` - * searchHandle = await Wallet.openSearch({type: 'TestType'}) - * await Wallet.closeSearch(searchHandle) - * ``` - */ - public static async closeSearch(handle: number): Promise { - const commandHandle = 0; - try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_close_search(commandHandle, handle, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(handle); - }), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Initiate or continue a search - * - * Example: - * ``` - * searchHandle = await Wallet.openSearch({type: 'TestType'}) - * records = await Wallet.searchNextRecords(searchHandle, {count:5}) - * await Wallet.closeSearch(searchHandle) - * ``` - */ - public static async searchNextRecords( - handle: number, - { count }: ISearchNextRecordsOptions, - ): Promise { - const commandHandle = 0; - try { - return await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_search_next_records(commandHandle, handle, count, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback( - 'void', - ['uint32', 'uint32', 'string'], - (xhandle: number, err: number, info: string) => { - if (err) { - reject(err); - return; - } - resolve(info); - }, - ), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - /** - * Imports wallet from file with given key. - * Cannot be used if wallet is already opened. - * - * Example: - * ``` - * config = { - * "wallet_name":"", - * "wallet_key":"", - * "exported_wallet_path":"", - * "backup_key":"" - * } - * await Wallet.import(JSON.stringify(config)) - * ``` - */ public static async import(config: string): Promise { - const commandHandle = 0; try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_import(commandHandle, config, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffi.walletImport(config); } catch (err: any) { throw new VCXInternalError(err); } } - /** - * Export a file to a wallet, backup key used for decrypting the file. - * - * Example: - * ``` - * await Wallet.export('/tmp/foobar.wallet', 'key_for_wallet') - * ``` - */ public static async export(path: string, backupKey: string): Promise { - const commandHandle = 0; try { - await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_wallet_export(commandHandle, path, backupKey, cb); - if (rc) { - reject(rc); - } - }, - (resolve, reject) => - Callback('void', ['uint32', 'uint32'], (xhandle: number, err: number) => { - if (err) { - reject(err); - return; - } - resolve(); - }), - ); + return await ffi.walletExport(path, backupKey); } catch (err: any) { throw new VCXInternalError(err); } } - - /** - * Set the wallet handle for libvcx to use, called before vcxInitPostIndy - * - * Example: - * ``` - * Wallet.setHandle(1) - * setPoolHandle(1) - * vcxInitPostIndy(config) - */ - public static setHandle(handle: number): void { - rustAPI().vcx_wallet_set_handle(handle); - } } diff --git a/wrappers/node/src/errors.ts b/wrappers/node/src/errors.ts index f31fa96a30..0b60aa970d 100644 --- a/wrappers/node/src/errors.ts +++ b/wrappers/node/src/errors.ts @@ -1,26 +1,46 @@ -import { VCXCode } from './api/common'; -import { errorMessage } from './utils/error-message'; +export interface VcxErrorInfo { + vcxErrKind: string; + vcxErrCode: number; + vcxErrMessage: string; +} + +const VCX_ERR_PREFIX = 'vcx_err_json:'; +const VCX_ERR_PREFIX_LENGTH = VCX_ERR_PREFIX.length; + -export class ConnectionTimeoutError extends Error {} export class VCXInternalError extends Error { - public readonly vcxCode: number; + public readonly vcxError: VcxErrorInfo | undefined; + public readonly vcxCode: number | undefined; + public readonly napiCode: string; public readonly inheritedStackTraces: string[] = []; - constructor(code: number | Error) { - super(errorMessage(code)); - if (code instanceof Error) { - if (code.stack) { - this.inheritedStackTraces.push(code.stack); - } - if (code instanceof VCXInternalError) { - this.vcxCode = code.vcxCode; - this.inheritedStackTraces.unshift(...code.inheritedStackTraces); - return this; - } - this.vcxCode = VCXCode.UNKNOWN_ERROR; + constructor(err: any) { + const message = err.message || JSON.stringify(err); + super(message); + + if (err instanceof VCXInternalError) { + this.vcxError = err.vcxError; + this.vcxCode = err.vcxCode; + this.napiCode = err.napiCode; + this.inheritedStackTraces.unshift(...err.inheritedStackTraces); return this; } - this.vcxCode = code; + if (err.stack) { + this.inheritedStackTraces.push(err.stack); + } + + if (err.message.startsWith(VCX_ERR_PREFIX)) { + const vcxErrJson = err.message.slice(VCX_ERR_PREFIX_LENGTH); + this.vcxError = JSON.parse(vcxErrJson); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + this.vcxCode = this.vcxError.vcxErrCode; + } else { + this.vcxError = undefined; + this.vcxCode = undefined; + } + this.napiCode = err.code; + return this; } } diff --git a/wrappers/node/src/index.ts b/wrappers/node/src/index.ts index bb8216c58e..8f854063f9 100644 --- a/wrappers/node/src/index.ts +++ b/wrappers/node/src/index.ts @@ -13,7 +13,5 @@ export * from './api/utils'; export * from './api/wallet'; export * from './api/out-of-band-sender'; export * from './api/out-of-band-receiver'; -export * from './vcx'; -export * from './rustlib'; export * from './errors'; export * from './api/logging'; diff --git a/wrappers/node/src/rustlib.ts b/wrappers/node/src/rustlib.ts index e556163ba1..e69de29bb2 100644 --- a/wrappers/node/src/rustlib.ts +++ b/wrappers/node/src/rustlib.ts @@ -1,1259 +0,0 @@ -import * as ref from 'ref-napi'; -import { ICbRef } from './utils/ffi-helpers'; - -import { VCXRuntime } from './vcx'; - -interface IUintTypes { - [key: string]: string; -} -const UINTS_TYPES: IUintTypes = { x86: 'uint32', x64: 'uint64' }; -const ARCHITECTURE: string = process.env.LIBVCX_FFI_ARCHITECTURE || 'x64'; -const FFI_UINT: string = UINTS_TYPES[ARCHITECTURE]; - -// FFI Type Strings -export const FFI_ERROR_CODE = 'int'; -export const FFI_BOOL = 'bool'; -export const FFI_CONNECTION_HANDLE = 'uint32'; -export const FFI_UNSIGNED_INT = 'uint32'; -export const FFI_UNSIGNED_LONG = 'uint64'; -export const FFI_UNSIGNED_INT_PTR = FFI_UINT; -export const FFI_STRING = 'string'; -export const FFI_STRING_DATA = 'string'; -export const FFI_SOURCE_ID = 'string'; -export const FFI_CONNECTION_DATA = 'string'; -export const FFI_VOID = ref.types.void; -export const FFI_CONNECTION_HANDLE_PTR = ref.refType(FFI_CONNECTION_HANDLE); -export const FFI_CALLBACK_PTR = 'pointer'; -export const FFI_COMMAND_HANDLE = 'uint32'; -export const FFI_CREDENTIAL_HANDLE = 'uint32'; -export const FFI_PROOF_HANDLE = 'uint32'; -export const FFI_CREDENTIALDEF_HANDLE = 'uint32'; -export const FFI_SCHEMA_HANDLE = 'uint32'; -export const FFI_OOB_HANDLE = 'uint32'; -export const FFI_REV_REG_HANDLE = 'uint32'; -export const FFI_AGENT_HANDLE = 'uint32'; -export const FFI_PAYMENT_HANDLE = 'uint32'; -export const FFI_POINTER = 'pointer'; -export const FFI_VOID_POINTER = 'void *'; - -// Evernym extensions -export const FFI_INDY_NUMBER = 'int32'; - -export interface IFFIEntryPoint { - vcx_open_main_pool: (commandId: number, config: string, cb: any) => number, - - vcx_create_agency_client_for_main_wallet: (commandId: number, config: string, cb: any) => number, - vcx_provision_cloud_agent: (commandId: number, config: string, cb: any) => number, - vcx_init_threadpool: (config: string) => number, - vcx_init_issuer_config: (commandId: number, config: string, cb: any) => number, - - vcx_shutdown: (deleteIndyInfo: boolean) => number; - vcx_error_c_message: (errorCode: number) => string; - vcx_version: () => string; - vcx_enable_mocks: () => void; - vcx_v2_messages_download: ( - commandId: number, - status: string, - uids: string, - pairwiseDids: string, - cb: ICbRef, - ) => number; - vcx_messages_update_status: ( - commandId: number, - status: string, - msgIds: string, - cb: ICbRef, - ) => number; - vcx_get_ledger_author_agreement: (commandId: number, cb: ICbRef) => number; - vcx_set_active_txn_author_agreement_meta: ( - text: string | undefined | null, - version: string | undefined | null, - hash: string | undefined | null, - accMechType: string, - timeOfAcceptance: number, - ) => number; - - // wallet - vcx_create_wallet: (commandId: number, config: string, cb: ICbRef) => number, - vcx_configure_issuer_wallet: (commandId: number, seed: string, cb: ICbRef) => number, - vcx_open_main_wallet: (commandId: number, config: string, cb: ICbRef) => number, - vcx_close_main_wallet: (commandId: number, cb: ICbRef) => number, - - vcx_wallet_add_record: ( - commandId: number, - type: string, - id: string, - value: string, - tags: string, - cb: ICbRef, - ) => number; - vcx_wallet_update_record_value: ( - commandId: number, - type: string, - id: string, - value: string, - cb: ICbRef, - ) => number; - vcx_wallet_update_record_tags: ( - commandId: number, - type: string, - id: string, - tags: string, - cb: ICbRef, - ) => number; - vcx_wallet_add_record_tags: ( - commandId: number, - type: string, - id: string, - tags: string, - cb: ICbRef, - ) => number; - vcx_wallet_delete_record_tags: ( - commandId: number, - type: string, - id: string, - tagsList: string, - cb: ICbRef, - ) => number; - vcx_wallet_delete_record: (commandId: number, type: string, id: string, cb: ICbRef) => number; - vcx_wallet_get_record: ( - commandId: number, - type: string, - id: string, - options: string, - cb: ICbRef, - ) => number; - vcx_wallet_open_search: ( - commandId: number, - type: string, - query: string, - options: string, - cb: ICbRef, - ) => number; - vcx_wallet_close_search: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_wallet_search_next_records: ( - commandId: number, - handle: number, - count: number, - cb: ICbRef, - ) => number; - vcx_wallet_set_handle: (handle: number) => void; - vcx_wallet_import: (commandId: number, config: string, cb: ICbRef) => number; - vcx_wallet_export: ( - commandId: number, - importPath: string, - backupKey: string, - cb: ICbRef, - ) => number; - vcx_update_webhook_url: (commandId: number, webhookUrl: string, cb: ICbRef) => number; - vcx_pool_set_handle: (handle: number) => void; - vcx_endorse_transaction: (commandId: number, transaction: string, cb: ICbRef) => number; - vcx_rotate_verkey: (commandId: number, did: string, cb: ICbRef) => number; - vcx_rotate_verkey_start: (commandId: number, did: string, cb: ICbRef) => number; - vcx_rotate_verkey_apply: (commandId: number, did: string, tempVk: string, cb: ICbRef) => number; - vcx_get_verkey_from_wallet: (commandId: number, did: string, cb: ICbRef) => number; - vcx_get_verkey_from_ledger: (commandId: number, did: string, cb: ICbRef) => number; - vcx_get_ledger_txn: (commandId: number, did: string, seq_no: number, cb: ICbRef) => number; - - // connection - vcx_connection_delete_connection: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_connect: (commandId: number, handle: number, data: string, cb: ICbRef) => number; - vcx_connection_create: (commandId: number, data: string, cb: ICbRef) => number; - vcx_connection_create_with_invite: ( - commandId: number, - data: string, - invite: string, - cb: ICbRef, - ) => number; - vcx_connection_create_with_connection_request_v2: ( - commandId: number, - sourceId: string, - pwVk: string, - request: string, - cb: ICbRef, - ) => number; - vcx_connection_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_connection_release: (handle: number) => number; - vcx_connection_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_update_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_update_state_with_message: ( - commandId: number, - handle: number, - message: string, - cb: ICbRef, - ) => number; - vcx_connection_handle_message: ( - commandId: number, - handle: number, - message: string, - cb: ICbRef, - ) => number; - vcx_connection_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_invite_details: ( - commandId: number, - handle: number, - abbreviated: boolean, - cb: ICbRef, - ) => number; - vcx_connection_send_message: ( - commandId: number, - handle: number, - msg: string, - sendMsgOptions: string, - cb: ICbRef, - ) => number; - vcx_connection_send_handshake_reuse: ( - commandId: number, - handle: number, - oob_id: string, - cb: ICbRef, - ) => number; - vcx_connection_sign_data: ( - commandId: number, - handle: number, - data: number, - dataLength: number, - cb: ICbRef, - ) => number; - vcx_connection_verify_signature: ( - commandId: number, - handle: number, - data: number, - dataLength: number, - signature: number, - signatureLength: number, - cb: ICbRef, - ) => number; - vcx_connection_send_ping: ( - commandId: number, - handle: number, - comment: string | null | undefined, - cb: ICbRef, - ) => number; - vcx_connection_send_discovery_features: ( - commandId: number, - handle: number, - query: string | null | undefined, - comment: string | null | undefined, - cb: ICbRef, - ) => number; - vcx_connection_get_pw_did: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_get_their_pw_did: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_info: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_connection_messages_download: ( - commandId: number, - handle: number, - status: string, - uids: string, - cb: ICbRef, - ) => number; - - // issuer - vcx_issuer_credential_release: (handle: number) => number; - vcx_issuer_credential_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_issuer_credential_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_issuer_credential_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_v2_issuer_credential_update_state: ( - commandId: number, - handle: number, - connHandle: number, - cb: ICbRef, - ) => number; - vcx_v2_issuer_credential_update_state_with_message: ( - commandId: number, - handle: number, - connHandle: number, - msg: string, - cb: ICbRef, - ) => number; - vcx_issuer_credential_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_issuer_credential_get_rev_reg_id: ( - commandId: number, - credentialHandle: number, - cb: ICbRef, - ) => number; - vcx_issuer_create_credential: ( - commandId: number, - sourceId: string, - cb: ICbRef, - ) => number; - vcx_issuer_revoke_credential_local: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_issuer_credential_is_revokable: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_issuer_send_credential: ( - commandId: number, - credentialHandle: number, - connectionHandle: number, - cb: ICbRef, - ) => number; - vcx_issuer_get_credential_msg: ( - commandId: number, - credentialHandle: number, - myPwDid: string, - cb: ICbRef, - ) => number; - vcx_issuer_send_credential_offer_v2: ( - commandId: number, - credentialHandle: number, - connectionHandle: number, - cb: ICbRef, - ) => number; - vcx_mark_credential_offer_msg_sent: ( - commandId: number, - credentialHandle: number, - cb: ICbRef, - ) => number; - vcx_issuer_build_credential_offer_msg_v2: ( - commandId: number, - credentialHandle: number, - credentialDefHandle: number, - revRegHandle: number, - credentialData: string, - comment: string, - cb: ICbRef, - ) => number; - vcx_issuer_get_credential_offer_msg: ( - commandId: number, - credentialHandle: number, - cb: ICbRef, - ) => number; - - // proof - vcx_proof_create: ( - commandId: number, - sourceId: string, - attrs: string, - predicates: string, - revocationInterval: string, - name: string, - cb: ICbRef, - ) => number; - vcx_proof_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_get_proof_msg: ( - commandId: number, - proofHandle: number, - cb: ICbRef, - ) => number; - vcx_proof_release: (handle: number) => number; - vcx_proof_send_request: ( - commandId: number, - proofHandle: number, - connectionHandle: number, - cb: ICbRef, - ) => number; - vcx_proof_get_request_msg: (commandId: number, proofHandle: number, cb: ICbRef) => number; - vcx_proof_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_v2_proof_update_state: ( - commandId: number, - handle: number, - connHandle: number, - cb: ICbRef, - ) => number; - vcx_v2_proof_update_state_with_message: ( - commandId: number, - handle: number, - connHandle: number, - msg: string, - cb: ICbRef, - ) => number; - vcx_proof_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_proof_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_mark_presentation_request_msg_sent: ( - commandId: number, - proofHandle: number, - cb: ICbRef, - ) => number; - - - // disclosed proof - vcx_disclosed_proof_create_with_request: ( - commandId: number, - sourceId: string, - req: string, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_create_with_msgid: ( - commandId: number, - sourceId: string, - connectionHandle: number, - msgId: string, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_release: (handle: number) => number; - vcx_disclosed_proof_send_proof: ( - commandId: number, - proofHandle: number, - connectionHandle: number, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_reject_proof: ( - commandId: number, - proofHandle: number, - connectionHandle: number, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_get_proof_msg: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_disclosed_proof_get_reject_msg: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_disclosed_proof_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_disclosed_proof_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_v2_disclosed_proof_update_state: ( - commandId: number, - handle: number, - connHandle: number, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_disclosed_proof_get_requests: ( - commandId: number, - connectionHandle: number, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_retrieve_credentials: ( - commandId: number, - handle: number, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_get_proof_request_attachment: ( - commandId: number, - handle: number, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_generate_proof: ( - commandId: number, - handle: number, - selectedCreds: string, - selfAttestedAttrs: string, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_decline_presentation_request: ( - commandId: number, - handle: number, - connectionHandle: number, - reason: string | undefined | null, - proposal: string | undefined | null, - cb: ICbRef, - ) => number; - vcx_disclosed_proof_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - - // credential - vcx_credential_create_with_offer: ( - commandId: number, - sourceId: string, - offer: string, - cb: ICbRef, - ) => number; - vcx_credential_create_with_msgid: ( - commandId: number, - sourceId: string, - connectionHandle: number, - msgId: string, - cb: ICbRef, - ) => number; - vcx_credential_release: (handle: number) => number; - vcx_credential_send_request: ( - commandId: number, - handle: number, - connectionHandle: number, - payment: number, - cb: ICbRef, - ) => number; - vcx_credential_get_request_msg: ( - commandId: number, - handle: number, - myPwDid: string, - theirPwDid: string | undefined | null, - payment: number, - cb: ICbRef, - ) => number; - vcx_credential_decline_offer: ( - commandId: number, - handle: number, - connectionHandle: number, - comment: string, - cb: ICbRef, - ) => number; - vcx_credential_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_v2_credential_update_state: ( - commandId: number, - handle: number, - connHandle: number, - cb: ICbRef, - ) => number; - vcx_credential_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_get_offers: (commandId: number, connectionHandle: number, cb: ICbRef) => number; - vcx_credential_get_attributes: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_get_attachment: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_get_tails_location: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_get_tails_hash: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_get_rev_reg_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credential_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - - // logger - vcx_set_default_logger: (level: string) => number; - vcx_set_logger: (context: Buffer, enabled: ICbRef, logFn: ICbRef, flush: ICbRef) => number; - - // mock - vcx_set_next_agency_response: (messageIndex: number) => void; - - // credentialdef - vcx_credentialdef_create_v2: ( - commandId: number, - sourceId: string, - schemaId: string, - tag: string, - support_revocation: boolean, - cb: ICbRef, - ) => number; - vcx_credentialdef_publish: (commandId: number, handle: number, tailsUrl: string | null, cb: ICbRef) => number; - vcx_credentialdef_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_credentialdef_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credentialdef_release: (handle: number) => number; - vcx_credentialdef_get_cred_def_id: (commandId: number, handle: number, cb: ICbRef) => string; - vcx_credentialdef_update_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_credentialdef_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - - // schema - vcx_schema_get_attributes: ( - commandId: number, - sourceId: string, - schemaId: string, - cb: ICbRef, - ) => number; - vcx_schema_create: ( - commandId: number, - sourceId: string, - schemaName: string, - version: string, - schemaData: string, - paymentHandle: number, - cb: ICbRef, - ) => number; - vcx_schema_prepare_for_endorser: ( - commandId: number, - sourceId: string, - schemaName: string, - version: string, - schemaData: string, - endorser: string, - cb: ICbRef, - ) => number; - vcx_schema_get_schema_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_schema_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_schema_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_schema_release: (handle: number) => number; - vcx_schema_update_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_schema_get_state: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_generate_public_invite: (commandId: number, public_did: string, label: string, cb: ICbRef) => number; - vcx_out_of_band_sender_create: (commandId: number, config: string, cb: ICbRef) => number; - vcx_out_of_band_receiver_create: (commandId: number, msg: string, cb: ICbRef) => number; - vcx_out_of_band_sender_append_message: (commandId: number, handle: number, message: string, cb: ICbRef) => number; - vcx_out_of_band_sender_append_service: (commandId: number, handle: number, service: string, cb: ICbRef) => number; - vcx_out_of_band_sender_append_service_did: (commandId: number, handle: number, did: string, cb: ICbRef) => number; - vcx_out_of_band_sender_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_out_of_band_receiver_get_thread_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_out_of_band_receiver_extract_message: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_out_of_band_to_message: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_out_of_band_sender_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_out_of_band_sender_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_out_of_band_receiver_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_out_of_band_receiver_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_out_of_band_sender_release: (handle: number) => number; - vcx_out_of_band_receiver_release: (handle: number) => number; - vcx_out_of_band_receiver_connection_exists: (commandId: number, handle: number, handles: string, cb: ICbRef) => number; - vcx_out_of_band_receiver_build_connection: (commandId: number, handle: number, cb: ICbRef) => number; - - vcx_revocation_registry_create: (commandId: number, config: string, cb: ICbRef) => number; - vcx_revocation_registry_publish: (commandId: number, handle: number, tailsUrl: string, cb: ICbRef) => number; - vcx_revocation_registry_publish_revocations: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_revocation_registry_get_rev_reg_id: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_revocation_registry_get_tails_hash: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_revocation_registry_deserialize: (commandId: number, data: string, cb: ICbRef) => number; - vcx_revocation_registry_serialize: (commandId: number, handle: number, cb: ICbRef) => number; - vcx_revocation_registry_release: (handle: number) => number; - vcx_unpack: (commandId: number, payload: number, payloadLen: number, cb: ICbRef) => number; - vcx_create_pairwise_info: (commandId: number, cb: ICbRef) => number; - vcx_create_service: ( - commandId: number, - did: string, - endpoint: string, - recipientKeys: string, - routingKeys: string, - cb: ICbRef) => number; - vcx_get_service_from_ledger: ( - commandId: number, - did: string, - cb: ICbRef) => number; -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const FFIConfiguration: { [Key in keyof IFFIEntryPoint]: any } = { - vcx_init_threadpool: [FFI_ERROR_CODE, [FFI_STRING_DATA]], - vcx_enable_mocks: [FFI_ERROR_CODE, []], - vcx_init_issuer_config: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_create_agency_client_for_main_wallet: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_provision_cloud_agent: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - - vcx_open_main_pool: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - - vcx_create_wallet: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_open_main_wallet: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_close_main_wallet: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CALLBACK_PTR]], - vcx_configure_issuer_wallet: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_shutdown: [FFI_ERROR_CODE, [FFI_BOOL]], - vcx_error_c_message: [FFI_STRING, [FFI_ERROR_CODE]], - vcx_version: [FFI_STRING, []], - vcx_update_webhook_url: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_v2_messages_download: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_messages_update_status: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_get_ledger_author_agreement: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CALLBACK_PTR]], - vcx_set_active_txn_author_agreement_meta: [ - FFI_ERROR_CODE, - [FFI_STRING_DATA, FFI_STRING_DATA, FFI_STRING_DATA, FFI_STRING_DATA, FFI_UNSIGNED_LONG], - ], - vcx_endorse_transaction: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_rotate_verkey: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_rotate_verkey_start: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_rotate_verkey_apply: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_get_verkey_from_wallet: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_get_verkey_from_ledger: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_get_ledger_txn: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_INDY_NUMBER, FFI_CALLBACK_PTR], - ], - - // wallet - vcx_wallet_set_handle: [FFI_INDY_NUMBER, [FFI_INDY_NUMBER]], - vcx_pool_set_handle: [FFI_INDY_NUMBER, [FFI_INDY_NUMBER]], - vcx_wallet_add_record: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_update_record_value: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_update_record_tags: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_add_record_tags: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_delete_record_tags: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_delete_record: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_get_record: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_open_search: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - vcx_wallet_close_search: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_COMMAND_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_wallet_search_next_records: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_COMMAND_HANDLE, FFI_COMMAND_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_wallet_import: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING, FFI_CALLBACK_PTR]], - vcx_wallet_export: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING, FFI_STRING, FFI_CALLBACK_PTR], - ], - - // connection - vcx_connection_delete_connection: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_connect: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CONNECTION_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_create: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_connection_create_with_invite: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_create_with_connection_request_v2: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_deserialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_release: [FFI_ERROR_CODE, [FFI_CONNECTION_HANDLE]], - vcx_connection_serialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_update_state_with_message: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_handle_message: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_get_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_invite_details: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_BOOL, FFI_CALLBACK_PTR], - ], - vcx_connection_send_message: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_send_handshake_reuse: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_sign_data: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_UNSIGNED_INT_PTR, - FFI_UNSIGNED_INT, - FFI_CALLBACK_PTR, - ], - ], - vcx_connection_verify_signature: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_UNSIGNED_INT_PTR, - FFI_UNSIGNED_INT, - FFI_UNSIGNED_INT_PTR, - FFI_UNSIGNED_INT, - FFI_CALLBACK_PTR, - ], - ], - vcx_connection_send_ping: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_send_discovery_features: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_get_pw_did: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_get_their_pw_did: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_info: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_connection_messages_download: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_connection_get_thread_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - - // issuer - vcx_issuer_credential_deserialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_issuer_credential_serialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_v2_issuer_credential_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_v2_issuer_credential_update_state_with_message: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CREDENTIAL_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_STRING_DATA, - FFI_CALLBACK_PTR - ], - ], - vcx_issuer_credential_get_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_credential_get_rev_reg_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_create_credential: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_SOURCE_ID, - FFI_CALLBACK_PTR, - ], - ], - vcx_issuer_revoke_credential_local: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_credential_is_revokable: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_send_credential: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_get_credential_msg: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_issuer_send_credential_offer_v2: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_mark_credential_offer_msg_sent: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_build_credential_offer_msg_v2: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CREDENTIALDEF_HANDLE, FFI_REV_REG_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_issuer_get_credential_offer_msg: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_issuer_credential_release: [FFI_ERROR_CODE, [FFI_CREDENTIAL_HANDLE]], - vcx_issuer_credential_get_thread_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - - // proof - vcx_proof_create: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_SOURCE_ID, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_CALLBACK_PTR, - ], - ], - vcx_proof_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_get_proof_msg: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_proof_release: [FFI_ERROR_CODE, [FFI_PROOF_HANDLE]], - vcx_proof_send_request: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_proof_get_request_msg: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_proof_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR]], - vcx_v2_proof_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_v2_proof_update_state_with_message: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_PROOF_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_STRING_DATA, - FFI_CALLBACK_PTR, - ], - ], - vcx_proof_get_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR]], - vcx_proof_get_thread_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_mark_presentation_request_msg_sent: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - - // disclosed proof - vcx_disclosed_proof_create_with_request: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_SOURCE_ID, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_create_with_msgid: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_SOURCE_ID, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_release: [FFI_ERROR_CODE, [FFI_PROOF_HANDLE]], - vcx_disclosed_proof_send_proof: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_reject_proof: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_get_proof_msg: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_get_reject_msg: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_serialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_deserialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_v2_disclosed_proof_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_get_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_get_requests: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_retrieve_credentials: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_get_proof_request_attachment: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_generate_proof: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_disclosed_proof_decline_presentation_request: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_PROOF_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_CALLBACK_PTR, - ], - ], - vcx_disclosed_proof_get_thread_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - - // credential - vcx_credential_create_with_offer: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_SOURCE_ID, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_credential_create_with_msgid: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_SOURCE_ID, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_credential_release: [FFI_ERROR_CODE, [FFI_CREDENTIAL_HANDLE]], - vcx_credential_send_request: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CREDENTIAL_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_PAYMENT_HANDLE, - FFI_CALLBACK_PTR, - ], - ], - vcx_credential_decline_offer: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CREDENTIAL_HANDLE, - FFI_CONNECTION_HANDLE, - FFI_STRING_DATA, - FFI_CALLBACK_PTR, - ], - ], - vcx_credential_get_request_msg: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CREDENTIAL_HANDLE, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_PAYMENT_HANDLE, - FFI_CALLBACK_PTR, - ], - ], - vcx_credential_serialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_deserialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_v2_credential_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_offers: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_attributes: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_attachment: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_tails_location: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_tails_hash: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_rev_reg_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credential_get_thread_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - - // credentialDef - vcx_credentialdef_create_v2: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_SOURCE_ID, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_BOOL, - FFI_CALLBACK_PTR, - ], - ], - vcx_credentialdef_publish: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_CREDENTIALDEF_HANDLE, - FFI_STRING_DATA, - FFI_CALLBACK_PTR, - ], - ], - vcx_credentialdef_deserialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_credentialdef_release: [FFI_ERROR_CODE, [FFI_CREDENTIALDEF_HANDLE]], - vcx_credentialdef_serialize: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIALDEF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credentialdef_get_cred_def_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIALDEF_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credentialdef_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_credentialdef_get_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - - // logger - vcx_set_default_logger: [FFI_ERROR_CODE, [FFI_STRING]], - vcx_set_logger: [ - FFI_ERROR_CODE, - [FFI_VOID_POINTER, FFI_CALLBACK_PTR, FFI_CALLBACK_PTR, FFI_CALLBACK_PTR], - ], - - // mock - vcx_set_next_agency_response: [FFI_VOID, [FFI_UNSIGNED_INT]], - - // schema - vcx_schema_get_attributes: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_SOURCE_ID, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_schema_create: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_SOURCE_ID, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_PAYMENT_HANDLE, - FFI_CALLBACK_PTR, - ], - ], - vcx_schema_prepare_for_endorser: [ - FFI_ERROR_CODE, - [ - FFI_COMMAND_HANDLE, - FFI_SOURCE_ID, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_STRING_DATA, - FFI_CALLBACK_PTR, - ], - ], - vcx_schema_get_schema_id: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_SCHEMA_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_schema_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_schema_release: [FFI_ERROR_CODE, [FFI_SCHEMA_HANDLE]], - vcx_schema_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_SCHEMA_HANDLE, FFI_CALLBACK_PTR]], - vcx_schema_update_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_schema_get_state: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_generate_public_invite: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_out_of_band_sender_create: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_receiver_create: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_append_message: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_append_service: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_append_service_did: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_get_thread_id: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_out_of_band_receiver_get_thread_id: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_out_of_band_receiver_extract_message: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_out_of_band_to_message: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_receiver_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_out_of_band_receiver_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_sender_release: [FFI_ERROR_CODE, [FFI_OOB_HANDLE]], - vcx_out_of_band_receiver_release: [FFI_ERROR_CODE, [FFI_OOB_HANDLE]], - vcx_out_of_band_receiver_connection_exists: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_out_of_band_receiver_build_connection: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_OOB_HANDLE, FFI_CALLBACK_PTR]], - vcx_revocation_registry_create: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_revocation_registry_publish: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_REV_REG_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR], - ], - vcx_revocation_registry_publish_revocations: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_REV_REG_HANDLE, FFI_CALLBACK_PTR], - ], - vcx_revocation_registry_get_rev_reg_id: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_REV_REG_HANDLE, FFI_CALLBACK_PTR]], - vcx_revocation_registry_get_tails_hash: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_REV_REG_HANDLE, FFI_CALLBACK_PTR]], - vcx_revocation_registry_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_REV_REG_HANDLE, FFI_CALLBACK_PTR]], - vcx_revocation_registry_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], - vcx_revocation_registry_release: [FFI_ERROR_CODE, [FFI_REV_REG_HANDLE]], - vcx_unpack: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_UNSIGNED_INT_PTR, FFI_UNSIGNED_INT, FFI_CALLBACK_PTR]], - vcx_create_pairwise_info: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CALLBACK_PTR]], - vcx_create_service: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR] - ], - vcx_get_service_from_ledger: [ - FFI_ERROR_CODE, - [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR] - ], -}; - -let _rustAPI: IFFIEntryPoint; -let wasInitialized = false; -export const initRustAPI = (path?: string): IFFIEntryPoint => { - if (wasInitialized) { - throw new Error( - 'initRustAPI was already initialized. Make sure you only call it once in the lifetime of the process.', - ); - } - _rustAPI = new VCXRuntime({ basepath: path }).ffi; - wasInitialized = true; - return _rustAPI; -}; -export const rustAPI = (): IFFIEntryPoint => { - if (!_rustAPI) { - throw new Error('RustAPI not loaded. Make sure you are calling initRustAPI(...)'); - } - return _rustAPI; -}; - -export const isRustApiInitialized = (): boolean => Boolean(_rustAPI); diff --git a/wrappers/node/src/utils/error-message.ts b/wrappers/node/src/utils/error-message.ts deleted file mode 100644 index 66e0e19dd6..0000000000 --- a/wrappers/node/src/utils/error-message.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { VCXCode } from '../api/common'; -import { VCXInternalError } from '../errors'; -import { rustAPI } from '../rustlib'; - -export const errorMessage = (errorCode: number | Error): string => { - if (errorCode instanceof VCXInternalError) { - return errorCode.message; - } - if (errorCode instanceof Error) { - const message = rustAPI().vcx_error_c_message(VCXCode.UNKNOWN_ERROR); - return `${message}: ${errorCode.message}`; - } - return rustAPI().vcx_error_c_message(errorCode); -}; diff --git a/wrappers/node/src/utils/ffi-helpers.ts b/wrappers/node/src/utils/ffi-helpers.ts deleted file mode 100644 index 9c0874f9d2..0000000000 --- a/wrappers/node/src/utils/ffi-helpers.ts +++ /dev/null @@ -1,36 +0,0 @@ -const maxTimeout = 2147483647; - -export type ICbRef = Buffer; - -// LibVCX function which accepts a callback and rejects with a return code if needed -export type ICreateFFICallbackPromiseFn = ( - resolve: (value: T | PromiseLike) => void, - reject: (reason?: number | string | Error) => void, - cbRef: ICbRef, -) => void; - -export type ICreateFFICallbackPromiseCb = ( - resolve: (value: T | PromiseLike) => void, - reject: (reason?: number | string | Error) => void, -) => ICbRef; - -export const createFFICallbackPromise = ( - fn: ICreateFFICallbackPromiseFn, - cb: ICreateFFICallbackPromiseCb, -): Promise => { - let cbRef = null; - // TODO: Research why registering a callback doesn't keep parent thread alive https://github.com/node-ffi/node-ffi - const processKeepAliveTimer = setTimeout(() => undefined, maxTimeout); - return new Promise((resolve, reject) => fn(resolve, reject, (cbRef = cb(resolve, reject)))) - .then((res) => { - cbRef = null; - clearTimeout(processKeepAliveTimer); - return res; - }) - .catch((err) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - cbRef = null; - clearTimeout(processKeepAliveTimer); - throw err; - }); -}; diff --git a/wrappers/node/src/utils/memory-management-helpers.ts b/wrappers/node/src/utils/gc-watcher.ts similarity index 100% rename from wrappers/node/src/utils/memory-management-helpers.ts rename to wrappers/node/src/utils/gc-watcher.ts index 8682007f84..94d8847214 100644 --- a/wrappers/node/src/utils/memory-management-helpers.ts +++ b/wrappers/node/src/utils/gc-watcher.ts @@ -11,12 +11,6 @@ export abstract class GCWatcher { this._releaseFn(this._handleRef); } - // Can not use setter because of https://github.com/Microsoft/TypeScript/issues/2521 - protected _setHandle(handle: number): void { - this._handleRef = handle; - this._clearOnExit(); - } - // _clearOnExit creates a callback that will release the Rust Object // when the node Connection object is Garbage collected protected _clearOnExit(): void { @@ -28,6 +22,12 @@ export abstract class GCWatcher { }); } + // Can not use setter because of https://github.com/Microsoft/TypeScript/issues/2521 + protected _setHandle(handle: number): void { + this._handleRef = handle; + this._clearOnExit(); + } + get handle(): number { return this._handleRef; } diff --git a/wrappers/node/src/vcx.ts b/wrappers/node/src/vcx.ts deleted file mode 100644 index 6378dc2763..0000000000 --- a/wrappers/node/src/vcx.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as ffi from 'ffi-napi'; -import * as os from 'os'; - -import { FFIConfiguration } from './rustlib'; - -export interface IVCXRuntimeConfig { - basepath?: string; -} - -// VCXRuntime is the object that interfaces with the vcx sdk functions -// FFIConfiguration will contain all the sdk api functions -// VCXRuntimeConfg is a class that currently only contains a chosen basepath for the .so file -// I made it a class just in case we think of more needed configs - -const extension = { darwin: '.dylib', linux: '.so', win32: '.dll' }; -const libPath = { darwin: '/usr/local/lib/', linux: '/usr/lib/', win32: 'c:\\windows\\system32\\' }; - -export class VCXRuntime { - public readonly ffi: any; - private _config: IVCXRuntimeConfig; - - constructor(config: IVCXRuntimeConfig = {}) { - this._config = config; - // initialize FFI - const libraryPath = this._initializeBasepath(); - this.ffi = ffi.Library(libraryPath, FFIConfiguration); - } - - private _initializeBasepath = (): string => { - const platform = os.platform(); - const postfix = extension[platform.toLowerCase() as keyof typeof extension] || extension.linux; - const libDir = libPath[platform.toLowerCase() as keyof typeof libPath] || libPath.linux; - const library = `libvcx${postfix}`; - const customPath = process.env.LIBVCX_PATH ? process.env.LIBVCX_PATH + library : undefined; - return customPath || this._config.basepath || `${libDir}${library}`; - }; -} diff --git a/wrappers/node/test/helpers/entities.ts b/wrappers/node/test/helpers/entities.ts index 92c5227b58..40aca5022f 100644 --- a/wrappers/node/test/helpers/entities.ts +++ b/wrappers/node/test/helpers/entities.ts @@ -9,23 +9,19 @@ import { CredentialDef, DisclosedProof, IConnectionCreateData, - ICredentialCreateWithMsgId, ICredentialCreateWithOffer, ICredentialDefCreateDataV2, IDisclosedProofCreateData, - IDisclosedProofCreateWithMsgIdData, IIssuerCredentialBuildOfferDataV2, - IIssuerCredentialCreateData, - IIssuerCredentialOfferSendData, - IProofCreateData, IRevocationRegistryConfig, + IIssuerCredentialBuildOfferDataV2, + IProofCreateData, ISchemaCreateData, - ISchemaLookupData, - ISchemaPrepareForEndorserData, IssuerCredential, - Proof, RevocationRegistry, + Proof, + RevocationRegistry, Schema, -} from 'src' +} from 'src'; import * as uuid from 'uuid'; -import {ARIES_CONNECTION_ACK, ARIES_CONNECTION_REQUEST} from './mockdata' +import { ARIES_CONNECTION_ACK, ARIES_CONNECTION_REQUEST } from './mockdata'; export const dataConnectionCreate = (): IConnectionCreateData => ({ id: `testConnectionId-${uuid.v4()}`, @@ -44,8 +40,7 @@ export const createConnectionInviterInvited = async ( data = dataConnectionCreate(), ): Promise => { const connection = await connectionCreateInviterNull(data); - const inviteDetails = await connection.connect({ data: '{}' }); - assert.ok(inviteDetails); + await connection.connect(); return connection; }; @@ -58,9 +53,9 @@ export const createConnectionInviterRequested = async ( }; export const createConnectionInviterFinished = async ( - data = dataConnectionCreate(), + data = dataConnectionCreate(), ): Promise => { - const connection = await createConnectionInviterRequested() + const connection = await createConnectionInviterRequested(); await connection.updateStateWithMessage(JSON.stringify(ARIES_CONNECTION_ACK)); return connection; }; @@ -69,7 +64,7 @@ export const dataCredentialDefCreate = (): ICredentialDefCreateDataV2 => ({ schemaId: 'testCredentialDefSchemaId', sourceId: 'testCredentialDefSourceId', supportRevocation: true, - tag: '1' + tag: '1', }); export const credentialDefCreate = async ( @@ -85,14 +80,14 @@ export const credentialDefCreate = async ( export const revRegCreate = async (): Promise => { const rev_reg_config = { - issuerDid: "1234", - credDefId: "1234", + issuerDid: '1234', + credDefId: '1234', tag: 1, - tailsDir: "/foo/bar", - maxCreds: 5 - } - return await RevocationRegistry.create(rev_reg_config) -} + tailsDir: '/foo/bar', + maxCreds: 5, + }; + return await RevocationRegistry.create(rev_reg_config); +}; export const dataCredentialCreateWithOffer = async (): Promise => { const connection = await createConnectionInviterRequested(); @@ -115,28 +110,6 @@ export const credentialCreateWithOffer = async ( return credential; }; -export const dataCredentialCreateWithMsgId = async (): Promise => { - const connection = await createConnectionInviterRequested(); - return { - connection, - msgId: 'testCredentialMsgId', - sourceId: 'testCredentialSourceId', - }; -}; - -export const credentialCreateWithMsgId = async ( - data?: ICredentialCreateWithMsgId, -): Promise => { - if (!data) { - data = await dataCredentialCreateWithMsgId(); - } - const credential = await Credential.createWithMsgId(data); - assert.notEqual(credential.handle, undefined); - assert.equal(credential.sourceId, data.sourceId); - assert.ok(credential.credOffer); - return credential; -}; - export const dataDisclosedProofCreateWithRequest = async (): Promise => { const connection = await createConnectionInviterRequested(); return { @@ -152,35 +125,15 @@ export const disclosedProofCreateWithRequest = async ( if (!data) { data = await dataDisclosedProofCreateWithRequest(); } - const disclousedProof = await DisclosedProof.create(data); - assert.notEqual(disclousedProof.handle, undefined); - assert.equal(disclousedProof.sourceId, data.sourceId); - return disclousedProof; -}; - -export const dataDisclosedProofCreateWithMsgId = async (): Promise => { - const connection = await createConnectionInviterRequested(); - return { - connection, - msgId: 'testDisclousedProofMsgId', - sourceId: 'testDisclousedProofSourceId', - }; + const disclosedProof = DisclosedProof.create(data); + assert.notEqual(disclosedProof.handle, undefined); + assert.equal(disclosedProof.sourceId, data.sourceId); + return disclosedProof; }; -export const disclosedProofCreateWithMsgId = async ( - data?: IDisclosedProofCreateWithMsgIdData, -): Promise => { - if (!data) { - data = await dataDisclosedProofCreateWithMsgId(); - } - const disclousedProof = await DisclosedProof.createWithMsgId(data); - assert.notEqual(disclousedProof.handle, undefined); - assert.equal(disclousedProof.sourceId, data.sourceId); - assert.ok(disclousedProof.proofRequest); - return disclousedProof; -}; - -export const issuerCredentialCreate = async (): Promise<[IssuerCredential, IIssuerCredentialBuildOfferDataV2]> => { +export const issuerCredentialCreate = async (): Promise< + [IssuerCredential, IIssuerCredentialBuildOfferDataV2] +> => { const credDef = await credentialDefCreate(); const revReg = await revRegCreate(); const issuerCredential = await IssuerCredential.create('testCredentialSourceId'); @@ -193,7 +146,7 @@ export const issuerCredentialCreate = async (): Promise<[IssuerCredential, IIssu }, credDef, revReg, - comment: "foo" + comment: 'foo', }; return [issuerCredential, buildOfferData]; }; @@ -213,10 +166,6 @@ export const proofCreate = async (data = dataProofCreate()): Promise => { const proof = await Proof.create(data); assert.notEqual(proof.handle, undefined); assert.equal(proof.sourceId, data.sourceId); - assert.equal(proof.name, data.name); - assert.equal(proof.proofState, null); - assert.deepEqual(proof.requestedAttributes, data.attrs); - assert.deepEqual(proof.requestedPredicates, data.preds); return proof; }; @@ -229,16 +178,6 @@ export const dataSchemaCreate = (): ISchemaCreateData => ({ sourceId: 'testSchemaSourceId', }); -export const dataSchemaPrepareForEndorser = (): ISchemaPrepareForEndorserData => ({ - data: { - attrNames: ['attr1', 'attr2'], - name: 'Schema', - version: '1.0.0', - }, - endorser: 'V4SGRU86Z58d6TV7PBUe6f', - sourceId: 'testSchemaSourceId', -}); - export const schemaCreate = async (data = dataSchemaCreate()): Promise => { const schema = await Schema.create(data); assert.notEqual(schema.handle, undefined); @@ -248,29 +187,3 @@ export const schemaCreate = async (data = dataSchemaCreate()): Promise = assert.ok(schema.schemaId); return schema; }; - -export const schemaPrepareForEndorser = async ( - data = dataSchemaPrepareForEndorser(), -): Promise => { - const schema = await Schema.prepareForEndorser(data); - assert.notEqual(schema.handle, undefined); - assert.equal(schema.sourceId, data.sourceId); - assert.equal(schema.name, data.data.name); - assert.deepEqual(schema.schemaAttrs, data.data); - assert.ok(schema.schemaId); - assert.ok(schema.schemaTransaction); - return schema; -}; - -export const dataSchemaLookup = (): ISchemaLookupData => ({ - schemaId: 'testSchemaSchemaId', - sourceId: 'testSchemaSourceId', -}); - -export const schemaLookup = async (data = dataSchemaLookup()): Promise => { - const schema = await Schema.lookup(data); - assert.notEqual(schema.handle, undefined); - assert.equal(schema.sourceId, data.sourceId); - assert.ok(schema.schemaId); - return schema; -}; diff --git a/wrappers/node/test/helpers/mockdata.ts b/wrappers/node/test/helpers/mockdata.ts index 6eff828343..81c786f6a3 100644 --- a/wrappers/node/test/helpers/mockdata.ts +++ b/wrappers/node/test/helpers/mockdata.ts @@ -1,77 +1,77 @@ export const ARIES_PING = { - "@type": "https://didcomm.org/trust_ping/1.0/ping", - "@id": "518be002-de8e-456e-b3d5-8fe472477a86", - "~timing": { - "out_time": "2018-12-15 04:29:23Z", - "expires_time": "2018-12-15 05:29:23Z", - "delay_milli": 0 - }, - "comment": "Hi. Are you listening?", - "response_requested": true -} + '@type': 'https://didcomm.org/trust_ping/1.0/ping', + '@id': '518be002-de8e-456e-b3d5-8fe472477a86', + '~timing': { + out_time: '2018-12-15 04:29:23Z', + expires_time: '2018-12-15 05:29:23Z', + delay_milli: 0, + }, + comment: 'Hi. Are you listening?', + response_requested: true, +}; export const ARIES_PING_RESPONSE = { - "@type": "https://didcomm.org/trust_ping/1.0/ping_response", - "@id": "e002518b-456e-b3d5-de8e-7a86fe472847", - "~thread": { "thid": "518be002-de8e-456e-b3d5-8fe472477a86" }, - "~timing": { "in_time": "2018-12-15 04:29:28Z", "out_time": "2018-12-15 04:31:00Z"}, - "comment": "Hi yourself. I'm here." -} + '@type': 'https://didcomm.org/trust_ping/1.0/ping_response', + '@id': 'e002518b-456e-b3d5-de8e-7a86fe472847', + '~thread': { thid: '518be002-de8e-456e-b3d5-8fe472477a86' }, + '~timing': { in_time: '2018-12-15 04:29:28Z', out_time: '2018-12-15 04:31:00Z' }, + comment: "Hi yourself. I'm here.", +}; export const ARIES_UNKNOWN_TYPE = { - "@type": "https://didcomm.org/foo/5.0/bar", - "@id": "e002518b-456e-b3d5-de8e-7a86fe472847", - "~thread": { "thid": "518be002-de8e-456e-b3d5-8fe472477a86" }, - "~timing": { "in_time": "2018-12-15 04:29:28Z", "out_time": "2018-12-15 04:31:00Z"}, -} + '@type': 'https://didcomm.org/foo/5.0/bar', + '@id': 'e002518b-456e-b3d5-de8e-7a86fe472847', + '~thread': { thid: '518be002-de8e-456e-b3d5-8fe472477a86' }, + '~timing': { in_time: '2018-12-15 04:29:28Z', out_time: '2018-12-15 04:31:00Z' }, +}; export const ARIES_CONNECTION_ACK = { - "@id": "680e90b0-4a01-4dc7-8a1d-e54b43ebcc28", - "@type": "https://didcomm.org/notification/1.0/ack", - "status": "OK", - "~thread": { - "received_orders": {}, - "sender_order": 0, - "thid": "b5517062-303f-4267-9a29-09bc89497c06" - } -} + '@id': '680e90b0-4a01-4dc7-8a1d-e54b43ebcc28', + '@type': 'https://didcomm.org/notification/1.0/ack', + status: 'OK', + '~thread': { + received_orders: {}, + sender_order: 0, + thid: 'b5517062-303f-4267-9a29-09bc89497c06', + }, +}; export const ARIES_CONNECTION_REQUEST = { - '@id': 'b5517062-303f-4267-9a29-09bc89497c06', - '@type': 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/request', - connection: { - DID: '2RjtVytftf9Psbh3E8jqyq', - DIDDoc: { - '@context': 'https://w3id.org/did/v1', - authentication: [ - { - publicKey: '2RjtVytftf9Psbh3E8jqyq#1', - type: 'Ed25519SignatureAuthentication2018', - }, - ], - id: '2RjtVytftf9Psbh3E8jqyq', - publicKey: [ - { - controller: '2RjtVytftf9Psbh3E8jqyq', - id: '1', - publicKeyBase58: 'n6ZJrPGhbkLxQBxH11BvQHSKch58sx3MAqDTkUG4GmK', - type: 'Ed25519VerificationKey2018', - }, - ], - service: [ - { - id: 'did:example:123456789abcdefghi;indy', - priority: 0, - recipientKeys: ['2RjtVytftf9Psbh3E8jqyq#1'], - routingKeys: [ - 'AKnC8qR9xsZZEBY7mdV6fzjmmtKxeegrNatpz4jSJhrH', - 'Hezce2UWMZ3wUhVkh2LfKSs8nDzWwzs2Win7EzNN3YaR', - ], - serviceEndpoint: 'http://localhost:8080/agency/msg', - type: 'IndyAgent', - }, - ], + '@id': 'b5517062-303f-4267-9a29-09bc89497c06', + '@type': 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/request', + connection: { + DID: '2RjtVytftf9Psbh3E8jqyq', + DIDDoc: { + '@context': 'https://w3id.org/did/v1', + authentication: [ + { + publicKey: '2RjtVytftf9Psbh3E8jqyq#1', + type: 'Ed25519SignatureAuthentication2018', + }, + ], + id: '2RjtVytftf9Psbh3E8jqyq', + publicKey: [ + { + controller: '2RjtVytftf9Psbh3E8jqyq', + id: '1', + publicKeyBase58: 'n6ZJrPGhbkLxQBxH11BvQHSKch58sx3MAqDTkUG4GmK', + type: 'Ed25519VerificationKey2018', + }, + ], + service: [ + { + id: 'did:example:123456789abcdefghi;indy', + priority: 0, + recipientKeys: ['2RjtVytftf9Psbh3E8jqyq#1'], + routingKeys: [ + 'AKnC8qR9xsZZEBY7mdV6fzjmmtKxeegrNatpz4jSJhrH', + 'Hezce2UWMZ3wUhVkh2LfKSs8nDzWwzs2Win7EzNN3YaR', + ], + serviceEndpoint: 'http://localhost:8080/agency/msg', + type: 'IndyAgent', }, + ], }, - label: 'alice-157ea14b-4b7c-48a5-b536-d4ed6e027b84', + }, + label: 'alice-157ea14b-4b7c-48a5-b536-d4ed6e027b84', }; diff --git a/wrappers/node/test/helpers/utils.ts b/wrappers/node/test/helpers/utils.ts index 948d6c895d..f82958b637 100644 --- a/wrappers/node/test/helpers/utils.ts +++ b/wrappers/node/test/helpers/utils.ts @@ -1,17 +1,7 @@ -import { assert } from 'chai'; -import { initRustAPI, isRustApiInitialized } from 'src'; import * as vcx from 'src'; import * as uuid from 'uuid'; import '../module-resolver-helper'; -const oldConfig = { - // link_secret_alias: 'main', -}; - -const configThreadpool = { - threadpool_size: '4', -} - const configWalletSample = { use_latest_protocols: 'false', enable_test_mode: 'true', @@ -21,12 +11,7 @@ const configWalletSample = { wallet_name: 'LIBVCX_SDK_WALLET', backup_key: 'backup_wallet_key', exported_wallet_path: '/var/folders/libvcx_nodetest/sample.wallet', -} - -const configPool = { - pool_name: 'pool1', - protocol_version: '2', -} +}; const configAgency = { agency_endpoint: 'http://127.0.0.1:8080', @@ -36,45 +21,35 @@ const configAgency = { sdk_to_remote_did: '2hoqvcwupRTUNkXn6ArYzs', remote_to_sdk_did: '2hoqvcwupRTUNkXn6ArYzs', sdk_to_remote_verkey: 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB', -} - -const issuerConfig = { - - institution_did: '2hoqvcwupRTUNkXn6ArYzs', -} +}; -const issuerSeed = "000000000000000000000000Trustee1" +const issuerSeed = '000000000000000000000000Trustee1'; function generateWalletConfig() { const walletId = uuid.v4(); return { ...configWalletSample, wallet_name: `testnodejs_${walletId}`, - exported_wallet_path: `/var/folders/libvcx_nodetest/wallet_${walletId}.wallet` + exported_wallet_path: `/var/folders/libvcx_nodetest/wallet_${walletId}.wallet`, }; } export async function initVcxTestMode(): Promise { - scheduleGarbageCollectionBeforeExit(); - if (!isRustApiInitialized()) { - initRustAPI(); - } const rustLogPattern = process.env.RUST_LOG || 'vcx=error'; vcx.defaultLogger(rustLogPattern); - vcx.initThreadpool(configThreadpool) const configWallet = generateWalletConfig(); - await vcx.createWallet(configWallet) - await vcx.openMainWallet(configWallet) - const { institution_did, institution_verkey } = JSON.parse(await vcx.configureIssuerWallet(issuerSeed)) + await vcx.createWallet(configWallet); + await vcx.openMainWallet(configWallet); + const { institution_did } = JSON.parse(await vcx.configureIssuerWallet(issuerSeed)); const issuerConfig = { institution_did, - } - await vcx.initIssuerConfig(issuerConfig) - await vcx.createAgencyClientForMainWallet(configAgency) - vcx.enableMocks() + }; + await vcx.initIssuerConfig(issuerConfig); + vcx.createAgencyClientForMainWallet(configAgency); + vcx.enableMocks(); } -export const shouldThrow = (fn: () => any): Promise => +export const shouldThrow = (fn: () => any): Promise => new Promise(async (resolve, reject) => { try { await fn(); @@ -83,26 +58,3 @@ export const shouldThrow = (fn: () => any): Promise => resolve(e); } }); - -export const sleep = (timeout: number): Promise => - new Promise((resolve, _reject) => { - setTimeout(resolve, timeout); - }); - -let garbageCollectionBeforeExitIsScheduled = false; - -// For some (yet unknown) reason, The Rust library segfaults on exit if global.gc() is not called explicitly. -// To solve this issue, we call global.gc() on `beforeExit` event. -// NB: This solution only works with Mocha. -// With Jest the 'beforeExit' event doesn't seem fired, so we are instead still using --forceExit before it segfaults. -// TODO: Avoid using --exit -const scheduleGarbageCollectionBeforeExit = () => { - if (!garbageCollectionBeforeExitIsScheduled) { - process.on('beforeExit', () => { - if (typeof global.gc != 'undefined') { - global.gc(); - }; - }); - } - garbageCollectionBeforeExitIsScheduled = true; -}; diff --git a/wrappers/node/test/suite1/ariesvcx-credential-def.test.ts b/wrappers/node/test/suite1/ariesvcx-credential-def.test.ts index a719792775..dc485d71ac 100644 --- a/wrappers/node/test/suite1/ariesvcx-credential-def.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-credential-def.test.ts @@ -3,7 +3,7 @@ import '../module-resolver-helper'; import { assert } from 'chai'; import { credentialDefCreate } from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; -import { CredentialDef, CredentialDefState, VCXCode } from 'src'; +import { CredentialDef, VCXCode } from 'src'; describe('CredentialDef:', () => { before(() => initVcxTestMode()); @@ -30,7 +30,7 @@ describe('CredentialDef:', () => { it('throws: not initialized', async () => { const credentialDef = new CredentialDef(null as any, {} as any); const error = await shouldThrow(() => credentialDef.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_CREDENTIAL_DEF_HANDLE); + assert.equal(error.napiCode, 'NumberExpected'); }); }); @@ -48,6 +48,7 @@ describe('CredentialDef:', () => { const error = await shouldThrow(async () => CredentialDef.deserialize({ data: { source_id: 'Invalid' } } as any), ); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.CREATE_CREDENTIAL_DEF_ERR); }); }); @@ -58,10 +59,12 @@ describe('CredentialDef:', () => { assert.equal(await credentialDef.getCredDefId(), '2hoqvcwupRTUNkXn6ArYzs:3:CL:2471'); }); - it('throws: not initialized', async () => { - const credentialDef = new CredentialDef(null as any, {} as any); + it('throws: invalid handle', async () => { + const credentialDef = await credentialDefCreate(); + credentialDef.releaseRustData() const error = await shouldThrow(() => credentialDef.getCredDefId()); - assert.equal(error.vcxCode, VCXCode.INVALID_CREDENTIAL_DEF_HANDLE); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); }); }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-credential.test.ts b/wrappers/node/test/suite1/ariesvcx-credential.test.ts index 00b3276e04..b2b9709491 100644 --- a/wrappers/node/test/suite1/ariesvcx-credential.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-credential.test.ts @@ -3,19 +3,11 @@ import '../module-resolver-helper'; import { assert } from 'chai'; import { createConnectionInviterRequested, - credentialCreateWithMsgId, credentialCreateWithOffer, - dataCredentialCreateWithMsgId, dataCredentialCreateWithOffer, -} from 'helpers/entities' +} from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; -import { - Credential, - HolderStateType, - VCXCode, - VCXMock, - VCXMockMessage, -} from 'src'; +import { Credential, HolderStateType, VCXCode } from 'src'; describe('Credential:', () => { before(() => initVcxTestMode()); @@ -28,20 +20,13 @@ describe('Credential:', () => { it('throws: missing sourceId', async () => { const { sourceId, ...data } = await dataCredentialCreateWithOffer(); const error = await shouldThrow(() => Credential.create(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing offer', async () => { const { offer, ...data } = await dataCredentialCreateWithOffer(); const error = await shouldThrow(() => Credential.create(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - // Enable when we start utilizing connection prop - it.skip('throws: missing connection', async () => { - const { connection, ...data } = await dataCredentialCreateWithOffer(); - const error = await shouldThrow(() => Credential.create({ connection: {} as any, ...data })); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: invalid offer', async () => { @@ -63,7 +48,7 @@ describe('Credential:', () => { it('throws: not initialized', async () => { const credential = new Credential(null as any); const error = await shouldThrow(() => credential.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); + assert.equal(error.napiCode, 'NumberExpected'); }); }); @@ -82,6 +67,7 @@ describe('Credential:', () => { data: { source_id: 'Invalid' }, } as any), ); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); }); @@ -104,13 +90,6 @@ describe('Credential:', () => { await credential.sendRequest({ connection: data.connection }); assert.equal(await credential.getState(), HolderStateType.RequestSent); }); - - it('success: with message id', async () => { - const data = await dataCredentialCreateWithMsgId(); - const credential = await credentialCreateWithMsgId(data); - await credential.sendRequest({ connection: data.connection }); - assert.equal(await credential.getState(), HolderStateType.RequestSent); - }); }); describe('getOffers:', () => { @@ -140,10 +119,15 @@ describe('Credential:', () => { offer: JSON.stringify(offer), sourceId: 'credentialGetAttributesTestSourceId', }); - const attrs = JSON.parse(await credential.getAttributes()); - const expectedAttrs = JSON.parse( - '{"last_name":"clark","sex":"female","degree":"maths","date":"05-2018","age":"25","name":"alice"}', - ); + const attrs = JSON.parse(credential.getAttributes()); + const expectedAttrs = { + last_name: 'clark', + sex: 'female', + degree: 'maths', + date: '05-2018', + age: '25', + name: 'alice', + }; assert.deepEqual(attrs, expectedAttrs); }); }); @@ -160,45 +144,8 @@ describe('Credential:', () => { offer: JSON.stringify(offer), sourceId: 'credentialGetAttributesTestSourceId', }); - const attach = JSON.parse(await credential.getAttachment()); + const attach = JSON.parse(credential.getAttachment()); assert.deepEqual(attach.schema_id, 'V4SGRU86Z58d6TV7PBUe6f:2:FaberVcx:83.23.62'); }); }); - - describe('createWithMsgId', () => { - // TODO: to enable this test, credential offer must be mocked in aries code of get_credential_offer_msg - it.skip('createWithMsgIdsuccess', async () => { - await credentialCreateWithMsgId(); - }); - - it('throws: missing sourceId', async () => { - const { connection, msgId } = await dataCredentialCreateWithMsgId(); - const error = await shouldThrow(() => - Credential.createWithMsgId({ connection, msgId } as any), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - it('throws: missing offer', async () => { - const { connection, sourceId } = await dataCredentialCreateWithMsgId(); - const error = await shouldThrow(() => - Credential.createWithMsgId({ connection, sourceId } as any), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - it('throws: missing connection', async () => { - const { connection, ...data } = await dataCredentialCreateWithMsgId(); - const error = await shouldThrow(() => Credential.createWithMsgId(data as any)); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); - }); - - it('throws: missing connection handle', async () => { - const { connection, ...data } = await dataCredentialCreateWithMsgId(); - const error = await shouldThrow(() => - Credential.createWithMsgId({ connection: {} as any, ...data }), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); - }); - }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts b/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts index f934e03716..b28b045494 100644 --- a/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts @@ -2,13 +2,11 @@ import '../module-resolver-helper'; import { assert } from 'chai'; import { - connectionCreateInviterNull, + createConnectionInviterFinished, createConnectionInviterRequested, - dataDisclosedProofCreateWithMsgId, dataDisclosedProofCreateWithRequest, - disclosedProofCreateWithMsgId, disclosedProofCreateWithRequest, -} from 'helpers/entities' +} from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { mapValues } from 'lodash'; import { DisclosedProof, ProverStateType, VCXCode } from 'src'; @@ -24,20 +22,13 @@ describe('DisclosedProof', () => { it('throws: missing sourceId', async () => { const { connection, request } = await dataDisclosedProofCreateWithRequest(); const error = await shouldThrow(() => DisclosedProof.create({ connection, request } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing request', async () => { const { connection, sourceId } = await dataDisclosedProofCreateWithRequest(); const error = await shouldThrow(() => DisclosedProof.create({ connection, sourceId } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - // Enable when we start utilizing connection prop - it.skip('throws: missing connection', async () => { - const { request, sourceId } = await dataDisclosedProofCreateWithRequest(); - const error = await shouldThrow(() => DisclosedProof.create({ request, sourceId } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: invalid request', async () => { @@ -45,47 +36,11 @@ describe('DisclosedProof', () => { const error = await shouldThrow(() => DisclosedProof.create({ connection, request: 'invalid', sourceId }), ); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); }); - describe('createWithMsgId:', () => { - // todo: migrate to aries - it.skip('success', async () => { - await disclosedProofCreateWithMsgId(); - }); - - it('throws: missing sourceId', async () => { - const { connection, msgId } = await dataDisclosedProofCreateWithMsgId(); - const error = await shouldThrow(() => - DisclosedProof.createWithMsgId({ connection, msgId } as any), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - it('throws: missing request', async () => { - const { connection, sourceId } = await dataDisclosedProofCreateWithMsgId(); - const error = await shouldThrow(() => - DisclosedProof.createWithMsgId({ connection, sourceId } as any), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - it('throws: missing connection', async () => { - const { connection, ...data } = await dataDisclosedProofCreateWithMsgId(); - const error = await shouldThrow(() => DisclosedProof.createWithMsgId({ data } as any)); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); - }); - - it.skip('throws: missing connection handle', async () => { - const { connection, ...data } = await dataDisclosedProofCreateWithMsgId(); - const error = await shouldThrow(() => - DisclosedProof.createWithMsgId({ connection: {} as any, ...data }), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); - }); - }); - describe('serialize:', () => { it('success', async () => { const disclosedProof = await disclosedProofCreateWithRequest(); @@ -94,12 +49,6 @@ describe('DisclosedProof', () => { assert.property(serialized, 'version'); assert.property(serialized, 'data'); }); - - it('throws: not initialized', async () => { - const disclosedProof = new (DisclosedProof as any)(); - const error = await shouldThrow(() => disclosedProof.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); - }); }); describe('deserialize:', () => { @@ -115,6 +64,7 @@ describe('DisclosedProof', () => { const error = await shouldThrow(async () => DisclosedProof.deserialize({ data: { source_id: 'Invalid' } } as any), ); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); }); @@ -149,45 +99,36 @@ describe('DisclosedProof', () => { }); }); - describe('getRequests:', async () => { - it.skip('success', async () => { - const connection = await createConnectionInviterRequested(); - const requests = await DisclosedProof.getRequests(connection); - assert.ok(requests); - assert.ok(requests.length); - const request = requests[0]; - const disclosedProof = await disclosedProofCreateWithRequest({ - connection, - request: JSON.stringify(request), - sourceId: 'disclosedProofTestSourceId', - }); - await disclosedProof.updateStateV2(connection); - assert.equal(await disclosedProof.getState(), ProverStateType.Finished); - }); - }); - - describe('generateProof:', async () => { - it.skip('success', async () => { - const data = await dataDisclosedProofCreateWithRequest(); - const disclosedProof = await disclosedProofCreateWithRequest(data); - const { attrs } = await disclosedProof.getCredentials(); - const valSelfAttested = 'testSelfAttestedVal'; - await disclosedProof.generateProof({ - selectedCreds: {}, - selfAttestedAttrs: mapValues(attrs, () => valSelfAttested), - }); - await disclosedProof.sendProof(data.connection); - }); - }); - describe('getProofRequestAttachment:', async () => { it('success', async () => { const data = await dataDisclosedProofCreateWithRequest(); const disclosedProof = await disclosedProofCreateWithRequest(data); const attrs = await disclosedProof.getProofRequestAttachment(); - const expectedAttrs = - '{"name":"proofForAlice","non_revoked":{"from":null,"to":1599834712270},"nonce":"1137618739380422483900458","requested_attributes":{"attribute_0":{"names":["name","last_name","sex"],"restrictions":{"$or":[{"issuer_did":"V4SGRU86Z58d6TV7PBUe6f"}]}},"attribute_1":{"name":"date","restrictions":{"issuer_did":"V4SGRU86Z58d6TV7PBUe6f"}},"attribute_2":{"name":"degree","restrictions":{"attr::degree::value":"maths"}},"attribute_3":{"name":"nickname"}},"requested_predicates":{"predicate_0":{"name":"age","p_type":">=","p_value":20,"restrictions":{"$or":[{"issuer_did":"V4SGRU86Z58d6TV7PBUe6f"}]}}},"ver":"1.0","version":"1.0"}'; - assert.equal(attrs, expectedAttrs); + const expectedAttrs = { + name: 'proofForAlice', + non_revoked: { from: null, to: 1599834712270 }, + nonce: '1137618739380422483900458', + requested_attributes: { + attribute_0: { + names: ['name', 'last_name', 'sex'], + restrictions: { $or: [{ issuer_did: 'V4SGRU86Z58d6TV7PBUe6f' }] }, + }, + attribute_1: { name: 'date', restrictions: { issuer_did: 'V4SGRU86Z58d6TV7PBUe6f' } }, + attribute_2: { name: 'degree', restrictions: { 'attr::degree::value': 'maths' } }, + attribute_3: { name: 'nickname' }, + }, + requested_predicates: { + predicate_0: { + name: 'age', + p_type: '>=', + p_value: 20, + restrictions: { $or: [{ issuer_did: 'V4SGRU86Z58d6TV7PBUe6f' }] }, + }, + }, + ver: '1.0', + version: '1.0', + }; + assert.equal(attrs, JSON.stringify(expectedAttrs)); }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts b/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts index ff993df97c..fa6270ca83 100644 --- a/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-issuer-credential.test.ts @@ -2,11 +2,13 @@ import '../module-resolver-helper'; import { assert } from 'chai'; import { - createConnectionInviterRequested, credentialDefCreate, + createConnectionInviterRequested, + credentialDefCreate, + dataCredentialCreateWithOffer, issuerCredentialCreate, -} from 'helpers/entities' +} from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; -import { Connection, IssuerCredential, IssuerStateType, VCXCode } from 'src'; +import { Connection, Credential, IssuerCredential, IssuerStateType, VCXCode } from 'src'; describe('IssuerCredential:', () => { before(() => initVcxTestMode()); @@ -15,11 +17,6 @@ describe('IssuerCredential:', () => { it('success', async () => { await issuerCredentialCreate(); }); - - it('throws: missing sourceId', async () => { - const error = await shouldThrow(() => IssuerCredential.create('')); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); }); describe('serialize:', () => { @@ -35,9 +32,9 @@ describe('IssuerCredential:', () => { }); it('throws: not initialized', async () => { - const issuerCredential = new IssuerCredential(''); + const issuerCredential = new IssuerCredential('foo'); const error = await shouldThrow(() => issuerCredential.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); + assert.equal(error.napiCode, 'NumberExpected'); }); }); @@ -54,7 +51,8 @@ describe('IssuerCredential:', () => { const error = await shouldThrow(async () => IssuerCredential.deserialize({ source_id: 'Invalid' } as any), ); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); it('throws: incomplete data', async () => { @@ -71,6 +69,7 @@ describe('IssuerCredential:', () => { }, } as any), ); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); }); @@ -78,7 +77,7 @@ describe('IssuerCredential:', () => { describe('updateState:', () => { it(`returns state offer sent`, async () => { const [issuerCredential, data] = await issuerCredentialCreate(); - await issuerCredential.buildCredentialOfferMsgV2(data) + await issuerCredential.buildCredentialOfferMsgV2(data); assert.equal(await issuerCredential.getState(), IssuerStateType.OfferSet); const connection = await createConnectionInviterRequested(); await issuerCredential.sendOfferV2(connection); @@ -87,65 +86,56 @@ describe('IssuerCredential:', () => { it('build offer and mark as sent', async () => { const [issuerCredential, data] = await issuerCredentialCreate(); - await issuerCredential.buildCredentialOfferMsgV2(data) - const offer = JSON.parse(await issuerCredential.getCredentialOfferMsg()) + await issuerCredential.buildCredentialOfferMsgV2(data); + const offer = JSON.parse(await issuerCredential.getCredentialOfferMsg()); assert.equal(await issuerCredential.getState(), IssuerStateType.OfferSet); - // @ts-ignore assert.isDefined(offer['@id']); assert.equal(offer.comment, 'foo'); assert.isDefined(offer.credential_preview); - assert.equal(offer.credential_preview['@type'], 'https://didcomm.org/issue-credential/1.0/credential-preview'); + assert.equal( + offer.credential_preview['@type'], + 'https://didcomm.org/issue-credential/1.0/credential-preview', + ); await issuerCredential.markCredentialOfferMsgSent(); assert.equal(await issuerCredential.getState(), IssuerStateType.OfferSent); }); it('throws: not initialized', async () => { - const [_issuerCredential, data] = await issuerCredentialCreate(); + const [, data] = await issuerCredentialCreate(); const issuerCredential = new IssuerCredential(''); const error = await shouldThrow(() => issuerCredential.buildCredentialOfferMsgV2(data)); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); + assert.equal(error.napiCode, 'NumberExpected'); }); it('throws: connection not initialized', async () => { const [issuerCredential, data] = await issuerCredentialCreate(); - await issuerCredential.buildCredentialOfferMsgV2(data) + await issuerCredential.buildCredentialOfferMsgV2(data); assert.equal(await issuerCredential.getState(), IssuerStateType.OfferSet); - const connection = new (Connection as any)(); + const connection = { handle: 123 } as Connection; const error = await shouldThrow(() => issuerCredential.sendOfferV2(connection)); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); }); - it('throws: missing attr', async () => { - const [issuerCredential, _data] = await issuerCredentialCreate(); - const { attr, ...data } = _data; - const error = await shouldThrow(() => issuerCredential.buildCredentialOfferMsgV2(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + // todo: _build_credential_preview should throw if attr is not JSON Array or Object + it.skip('throws: missing attr', async () => { + const [issuerCredential, buildOfferData] = await issuerCredentialCreate(); + buildOfferData.attr = '{{{' as any; + const error = await shouldThrow(() => + issuerCredential.buildCredentialOfferMsgV2(buildOfferData), + ); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); it('throws: invalid credDefHandle', async () => { - const [issuerCredential, _data] = await issuerCredentialCreate(); - const { credDef, ...data } = _data; - const error = await shouldThrow(() => issuerCredential.buildCredentialOfferMsgV2(data as any)); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); + const [issuerCredential, buildOfferData] = await issuerCredentialCreate(); + buildOfferData.credDef = {} as any + const error = await shouldThrow(() => + issuerCredential.buildCredentialOfferMsgV2(buildOfferData), + ); + assert.equal(error.napiCode, 'NumberExpected'); }); }); - - // describe('revoke:', () => { - // it('throws: invalid revocation details', async () => { - // const issuerCredential = await issuerCredentialCreate() - // const error = await shouldThrow(() => issuerCredential.revokeCredential()) - // assert.equal(error.vcxCode, VCXCode.INVALID_REVOCATION_DETAILS) - // }) - // - // it('success', async () => { - // const issuerCredential1 = await issuerCredentialCreate() - // const data = await issuerCredential1[0].serialize() - // data.data.cred_rev_id = '123' - // data.data.rev_reg_id = '456' - // data.data.tails_file = 'file' - // const issuerCredential2 = await IssuerCredential.deserialize(data) - // await issuerCredential2.revokeCredential() - // }) - // }) }); diff --git a/wrappers/node/test/suite1/ariesvcx-connection.test.ts b/wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts similarity index 76% rename from wrappers/node/test/suite1/ariesvcx-connection.test.ts rename to wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts index 3cebafd28e..5ea219d1e7 100644 --- a/wrappers/node/test/suite1/ariesvcx-connection.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts @@ -2,18 +2,15 @@ import '../module-resolver-helper'; import { assert } from 'chai'; import { - connectionCreateInviterNull, createConnectionInviterFinished, + connectionCreateInviterNull, + createConnectionInviterFinished, createConnectionInviterInvited, createConnectionInviterRequested, dataConnectionCreate, -} from 'helpers/entities' +} from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { Connection, ConnectionStateType, VCXCode } from 'src'; -import { - ARIES_PING, - ARIES_PING_RESPONSE, - ARIES_UNKNOWN_TYPE -} from '../helpers/mockdata' +import { ARIES_PING, ARIES_PING_RESPONSE, ARIES_UNKNOWN_TYPE } from '../helpers/mockdata'; describe('Connection:', () => { before(() => initVcxTestMode()); @@ -35,22 +32,21 @@ describe('Connection:', () => { describe('connect:', () => { it('success', async () => { const connection = await connectionCreateInviterNull(); - const inviteDetails = await connection.connect({ data: '{}' }); - assert.notEqual(inviteDetails, ''); + await connection.connect(); }); it('throws: not initialized', async () => { const connection = new (Connection as any)(); const err = await shouldThrow(async () => connection.connect({ data: '{}' })); - assert.equal(err.vcxCode, VCXCode.INVALID_OBJ_HANDLE); + // NAPI throws error - connection handle is undefined instead of a number + assert.equal(err.message, `Failed to convert napi value Undefined into rust type \`u32\``); }); }); - // todo : restore for aries describe('sendMessage:', () => { - it.skip('success: sends message', async () => { + it('success: sends message', async () => { const connection = await connectionCreateInviterNull(); - await connection.connect({ data: '{"connection_type":"QR"}' }); + await connection.connect(); const error = await shouldThrow(() => connection.sendMessage({ msg: 'msg', type: 'msg', title: 'title' }), ); @@ -61,7 +57,7 @@ describe('Connection:', () => { describe('signData:', () => { it('success: signs data', async () => { const connection = await connectionCreateInviterNull(); - await connection.connect({ data: '{}' }); + await connection.connect(); const signature = await connection.signData(Buffer.from('random string')); assert(signature); }); @@ -81,7 +77,7 @@ describe('Connection:', () => { describe('serialize:', () => { it('success', async () => { const connection = await connectionCreateInviterNull(); - const serialized = await connection.serialize(); + const serialized = connection.serialize(); assert.ok(serialized); assert.property(serialized, 'version'); assert.property(serialized, 'data'); @@ -97,36 +93,20 @@ describe('Connection:', () => { assert.ok(source_id); assert.equal(source_id, connection.sourceId); }); - - // TODO: restore for aries - it.skip('throws: not initialized', async () => { - const connection = new (Connection as any)(); - const error = await shouldThrow(() => connection.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_CONNECTION_HANDLE); - }); - - // TODO: Is this op supported in 3.0? - it.skip('throws: connection deleted', async () => { - const connection = await connectionCreateInviterNull(); - await connection.connect({ data: '{"connection_type":"QR"}' }); - await connection.delete(); - const error = await shouldThrow(() => connection.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_CONNECTION_HANDLE); - }); }); describe('deserialize:', () => { it('success', async () => { const connection1 = await connectionCreateInviterNull(); - const data1 = await connection1.serialize(); - const connection2 = await Connection.deserialize(data1); + const data1 = connection1.serialize(); + const connection2 = Connection.deserialize(data1); assert.equal(connection2.sourceId, connection1.sourceId); - const data2 = await connection2.serialize(); + const data2 = connection2.serialize(); assert.deepEqual(data1, data2); }); it('throws: incorrect data', async () => { - const error = await shouldThrow(async () => + const error = await shouldThrow(() => Connection.deserialize({ data: { source_id: 'Invalid' } } as any), ); assert.equal(error.vcxCode, VCXCode.INVALID_JSON); @@ -156,7 +136,7 @@ describe('Connection:', () => { assert.equal(await connection.getState(), ConnectionStateType.Finished); }); - it('should not fail on attempt to handle unknown message type',async () => { + it('should not fail on attempt to handle unknown message type', async () => { const connection = await createConnectionInviterFinished(); await connection.handleMessage(JSON.stringify(ARIES_UNKNOWN_TYPE)); }); @@ -165,13 +145,10 @@ describe('Connection:', () => { describe('inviteDetails:', () => { it('success', async () => { const connection = await createConnectionInviterInvited(); - const details = await connection.inviteDetails(true); + const details = connection.inviteDetails(); const parsedInvitation = JSON.parse(details); assert.isString(parsedInvitation['@id']); - assert.equal( - parsedInvitation['@type'], - 'https://didcomm.org/connections/1.0/invitation', - ); + assert.equal(parsedInvitation['@type'], 'https://didcomm.org/connections/1.0/invitation'); assert.isString(parsedInvitation.label); assert.isArray(parsedInvitation.recipientKeys); assert.equal(parsedInvitation.recipientKeys.length, 1); diff --git a/wrappers/node/test/suite1/ariesvcx-oob.test.ts b/wrappers/node/test/suite1/ariesvcx-oob.test.ts index af9906c6ae..6b6a5cc0bd 100644 --- a/wrappers/node/test/suite1/ariesvcx-oob.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-oob.test.ts @@ -1,72 +1,78 @@ import '../module-resolver-helper'; -import { initVcxTestMode } from 'helpers/utils' -import { GoalCode, OutOfBandSender, OutOfBandReceiver, HandshakeProtocol } from 'src' +import { initVcxTestMode } from 'helpers/utils'; +import { GoalCode, OutOfBandSender, OutOfBandReceiver, HandshakeProtocol } from 'src'; import { assert } from 'chai'; const credentialOffer = { - "@id": "57b3f85d-7673-4e6f-bb09-cc27cf2653c0", - "@type": "https://didcomm.org/issue-credential/1.0/offer-credential", - "credential_preview": { - "@type": "https://didcomm.org/issue-credential/1.0/credential-preview", - "attributes": [ + '@id': '57b3f85d-7673-4e6f-bb09-cc27cf2653c0', + '@type': 'https://didcomm.org/issue-credential/1.0/offer-credential', + credential_preview: { + '@type': 'https://didcomm.org/issue-credential/1.0/credential-preview', + attributes: [ { - "name": "age", - "value": "25" + name: 'age', + value: '25', }, - ] + ], }, - "offers~attach": [ + 'offers~attach': [ { - "@id": "libindy-cred-offer-0", - "data": { - "base64": "eyJzY2hlzU0NzA3NTkwOTc1MTUyNTk4MTgwNyJ9" + '@id': 'libindy-cred-offer-0', + data: { + base64: 'eyJzY2hlzU0NzA3NTkwOTc1MTUyNTk4MTgwNyJ9', }, - "mime-type": "application/json" - } - ] -} + 'mime-type': 'application/json', + }, + ], +}; describe('Out of Band:', () => { - before(() => initVcxTestMode()) + before(() => initVcxTestMode()); describe('create:', () => { it('success', async () => { - const oobSender = await OutOfBandSender.create({source_id: "abcd", label: "foo", goalCode: GoalCode.P2PMessaging, goal: "bar", handshake_protocols: [HandshakeProtocol.ConnectionV1]}) - await oobSender.appendServiceDid("VsKV7grR1BUE29mG2Fm2kX") + const oobSender = await OutOfBandSender.create({ + source_id: 'abcd', + label: 'foo', + goalCode: GoalCode.P2PMessaging, + goal: 'bar', + handshake_protocols: [HandshakeProtocol.ConnectionV1], + }); + oobSender.appendServiceDid('VsKV7grR1BUE29mG2Fm2kX'); const service = { - "id": "did:example:123456789abcdefghi;indy", - "priority": 0, - "recipientKeys": ["abcde"], - "routingKeys": ["12345"], - "serviceEndpoint": "http://example.org/agent", - "type": "IndyAgent" - } - await oobSender.appendService(JSON.stringify(service)) - await oobSender.appendMessage(JSON.stringify(credentialOffer)) - const msg = JSON.parse(await oobSender.toMessage()) - assert.equal(msg["@type"], "https://didcomm.org/out-of-band/1.1/invitation") - assert.equal(msg["goal"], "bar") - assert.equal(msg["label"], "foo") - assert.equal(msg["handshake_protocols"][0], "https://didcomm.org/connections/1.0") - }) - }) + id: 'did:example:123456789abcdefghi;indy', + priority: 0, + recipientKeys: ['abcde'], + routingKeys: ['12345'], + serviceEndpoint: 'http://example.org/agent', + type: 'IndyAgent', + }; + oobSender.appendService(JSON.stringify(service)); + oobSender.appendMessage(JSON.stringify(credentialOffer)); + const msg = JSON.parse(oobSender.toMessage()); + assert.equal(msg['@type'], 'https://didcomm.org/out-of-band/1.1/invitation'); + assert.equal(msg['goal'], 'bar'); + assert.equal(msg['label'], 'foo'); + assert.equal(msg['handshake_protocols'][0], 'https://didcomm.org/connections/1.0'); + }); + }); describe('sender serde:', () => { it('success', async () => { - const oobSender = await OutOfBandSender.create({ source_id: "abcd" }) - await oobSender.appendServiceDid("VsKV7grR1BUE29mG2Fm2kX") - const serialized = await oobSender.serialize() - await OutOfBandSender.deserialize(serialized) - }) - }) + const oobSender = await OutOfBandSender.create({ source_id: 'abcd' }); + oobSender.appendServiceDid('VsKV7grR1BUE29mG2Fm2kX'); + const serialized = oobSender.serialize(); + OutOfBandSender.deserialize(serialized); + }); + }); describe('receiver serde:', () => { it('success', async () => { - const oobSender = await OutOfBandSender.create({ source_id: "abcd" }) - const oobReceiver = await OutOfBandReceiver.createWithMessage(await oobSender.toMessage()) - const serialized = await oobReceiver.serialize() - await OutOfBandReceiver.deserialize(serialized) - }) - }) -}) + const oobSender = await OutOfBandSender.create({ source_id: 'abcd' }); + const oobReceiver = OutOfBandReceiver.createWithMessage(oobSender.toMessage()); + const serialized = oobReceiver.serialize(); + OutOfBandReceiver.deserialize(serialized); + }); + }); +}); diff --git a/wrappers/node/test/suite1/ariesvcx-proof.test.ts b/wrappers/node/test/suite1/ariesvcx-proof.test.ts index 97d8b57e37..865a916ab5 100644 --- a/wrappers/node/test/suite1/ariesvcx-proof.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-proof.test.ts @@ -1,18 +1,14 @@ import '../module-resolver-helper'; import { assert } from 'chai'; -import {createConnectionInviterRequested, credentialDefCreate, dataProofCreate, proofCreate} from 'helpers/entities' -import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { - Connection, - DisclosedProof, - Proof, - ProofState, - VerifierStateType, - VCXCode, - VCXMock, - VCXMockMessage, IssuerCredential, IssuerStateType, -} from 'src' + createConnectionInviterInvited, + createConnectionInviterRequested, + dataProofCreate, + proofCreate, +} from 'helpers/entities'; +import { initVcxTestMode, shouldThrow } from 'helpers/utils'; +import { Proof, VerifierStateType, VCXCode } from 'src'; describe('Proof:', () => { before(() => initVcxTestMode()); @@ -25,35 +21,19 @@ describe('Proof:', () => { it('throws: missing sourceId', async () => { const { sourceId, ...data } = dataProofCreate(); const error = await shouldThrow(() => Proof.create(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing attrs', async () => { const { attrs, ...data } = dataProofCreate(); const error = await shouldThrow(() => Proof.create({ ...data } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - // TODO: Enable once https://evernym.atlassian.net/browse/EN-666 is resolved - it.skip('throws: empty attrs', async () => { - const { attrs, ...data } = dataProofCreate(); - const error = await shouldThrow(() => Proof.create({ attrs: [], ...data })); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing name', async () => { const { name, ...data } = dataProofCreate(); const error = await shouldThrow(() => Proof.create(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - // TODO: Enable once https://evernym.atlassian.net/browse/EN-666 is resolved - it.skip('throws: invalid attrs', async () => { - const { attrs, ...data } = dataProofCreate(); - const error = await shouldThrow(() => - Proof.create({ attrs: [{ invalid: 'invalid' }] as any, ...data }), - ); - assert.equal(error.vcxCode, VCXCode.INVALID_JSON); + assert.equal(error.napiCode, 'StringExpected'); }); }); @@ -62,15 +42,8 @@ describe('Proof:', () => { const proof = await proofCreate(); const { data } = await proof.serialize(); assert.ok(data); - // todo: IProofData is reflecting legacy structure, not vcxaries assert.equal((data as any).verifier_sm.source_id, proof.sourceId); }); - - it('throws: not initialized', async () => { - const proof = new Proof(null as any, {} as any); - const error = await shouldThrow(() => proof.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); - }); }); describe('deserialize:', () => { @@ -78,22 +51,16 @@ describe('Proof:', () => { const proof1 = await proofCreate(); const data1 = await proof1.serialize(); const proof2 = await Proof.deserialize(data1); - // todo: Does not hold in aries, the TS/JS representation after serialize->deserialize in incorrect because - // IProofData structure is matching legacy structure - // perhaps we could make JS layer thinner and instead of trying to keeping attributes like _requestedAttributes - // in javascript representations, we could rather add method on libvcx proof vcx_proof_get_requested_attributes - // which could encompass the logic of how to retrieve this data from internal proof representation. - // The downside is some overhead associated with FFI. - // assert.equal(proof2.verifier_sm.sourceId, proof1.verifier_sm.sourceId) const data2 = await proof2.serialize(); assert.deepEqual(data1, data2); }); it('throws: incorrect data', async () => { - const error = await shouldThrow(async () => - Proof.deserialize({ source_id: 'Invalid' } as any), + const error = await shouldThrow(() => + Proof.deserialize({ source_id: 'xyz', foo: 'bar' } as any), ); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); it('throws: incomplete data', async () => { @@ -104,14 +71,15 @@ describe('Proof:', () => { source_id: 'Invalid', } as any), ); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); }); describe('updateState:', () => { it(`throws error when not initialized`, async () => { let caught_error; - const proof = new Proof(null as any, {} as any); + const proof = new Proof(null as any); const connection = await createConnectionInviterRequested(); try { await proof.updateStateV2(connection); @@ -124,7 +92,7 @@ describe('Proof:', () => { it('build presentation request and mark as sent', async () => { const proof = await proofCreate(); assert.equal(await proof.getState(), VerifierStateType.PresentationRequestSet); - await proof.markPresentationRequestMsgSent() + await proof.markPresentationRequestMsgSent(); assert.equal(await proof.getState(), VerifierStateType.PresentationRequestSent); }); }); @@ -145,16 +113,17 @@ describe('Proof:', () => { it('throws: not initialized', async () => { const connection = await createConnectionInviterRequested(); - const proof = new Proof(null as any, {} as any); + const proof = new Proof(null as any); const error = await shouldThrow(() => proof.requestProof(connection)); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); + assert.equal(error.napiCode, 'NumberExpected'); }); it('throws: connection not initialized', async () => { - const connection = new (Connection as any)(); + const connection = await createConnectionInviterInvited(); const proof = await proofCreate(); const error = await shouldThrow(() => proof.requestProof(connection)); - assert.equal(error.vcxCode, VCXCode.INVALID_OBJ_HANDLE); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.NOT_READY); }); }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-schema.test.ts b/wrappers/node/test/suite1/ariesvcx-schema.test.ts index 6a22cce49a..ba14906427 100644 --- a/wrappers/node/test/suite1/ariesvcx-schema.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-schema.test.ts @@ -1,13 +1,7 @@ import '../module-resolver-helper'; import { assert } from 'chai'; -import { - dataSchemaCreate, - dataSchemaLookup, - schemaCreate, - schemaLookup, - schemaPrepareForEndorser, -} from 'helpers/entities'; +import { dataSchemaCreate, schemaCreate } from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { Schema, SchemaState, VCXCode } from 'src'; @@ -16,25 +10,20 @@ describe('Schema:', () => { describe('create:', () => { it('success', async () => { - await schemaCreate(); + const schema = await schemaCreate(); + assert.equal(await schema.getState(), SchemaState.Published); }); it('throws: missing sourceId', async () => { const { sourceId, ...data } = dataSchemaCreate(); const error = await shouldThrow(() => Schema.create(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - it('throws: missing data', async () => { - const { data, ...rest } = dataSchemaCreate(); - const error = await shouldThrow(() => Schema.create(rest as any)); - assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR); + assert.equal(error.napiCode, 'StringExpected'); }); - it('throws: imcpmplete data', async () => { + it('throws: incomplete data', async () => { const { data, ...rest } = dataSchemaCreate(); const error = await shouldThrow(() => Schema.create({ data: {} as any, ...rest })); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing data.name', async () => { @@ -43,7 +32,7 @@ describe('Schema:', () => { ...rest } = dataSchemaCreate(); const error = await shouldThrow(() => Schema.create({ data: dataRest, ...rest } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing data.version', async () => { @@ -52,7 +41,7 @@ describe('Schema:', () => { ...rest } = dataSchemaCreate(); const error = await shouldThrow(() => Schema.create({ data: dataRest, ...rest } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: missing data.attrNames', async () => { @@ -61,36 +50,23 @@ describe('Schema:', () => { ...rest } = dataSchemaCreate(); const error = await shouldThrow(() => Schema.create({ data: dataRest, ...rest } as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'StringExpected'); }); it('throws: invalid data', async () => { const { data, ...rest } = dataSchemaCreate(); const error = await shouldThrow(() => Schema.create({ - data: 'invalid' as any, + data: { + attrNames: 'foobar', + name: 'Schema', + version: '1.0.0', + } as any, ...rest, }), ); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - }); - - describe('lookup:', () => { - it('success', async () => { - await schemaLookup(); - }); - - it('throws: missing sourceId', async () => { - const { sourceId, ...data } = dataSchemaLookup(); - const error = await shouldThrow(() => Schema.lookup(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); - }); - - it('throws: missing schemaId', async () => { - const { schemaId, ...data } = dataSchemaLookup(); - const error = await shouldThrow(() => Schema.lookup(data as any)); - assert.equal(error.vcxCode, VCXCode.INVALID_OPTION); + assert.equal(error.napiCode, 'GenericFailure'); + assert.equal(error.vcxCode, VCXCode.SERIALIZATION_ERROR); }); }); @@ -110,7 +86,7 @@ describe('Schema:', () => { it('throws: not initialized', async () => { const schema = new Schema(null as any, {} as any); const error = await shouldThrow(() => schema.serialize()); - assert.equal(error.vcxCode, VCXCode.INVALID_SCHEMA_HANDLE); + assert.equal(error.napiCode, 'NumberExpected'); }); }); @@ -131,19 +107,4 @@ describe('Schema:', () => { assert.equal(error.vcxCode, VCXCode.INVALID_JSON); }); }); - - describe('prepareForEndorser:', () => { - it('success', async () => { - await schemaPrepareForEndorser(); - }); - }); - - describe('updateState:', () => { - it(`success`, async () => { - const schema = await schemaPrepareForEndorser(); - assert.equal(await schema.getState(), SchemaState.Built); - await schema.updateState(); - assert.equal(await schema.getState(), SchemaState.Published); - }); - }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-utils.test.ts b/wrappers/node/test/suite1/ariesvcx-utils.test.ts index 26d4bede97..b0ba408aa8 100644 --- a/wrappers/node/test/suite1/ariesvcx-utils.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-utils.test.ts @@ -3,29 +3,16 @@ import '../module-resolver-helper'; import { assert } from 'chai'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { - downloadMessagesV2, - endorseTransaction, getLedgerAuthorAgreement, getVersion, provisionCloudAgent, setActiveTxnAuthorAgreementMeta, - updateMessages, VCXCode, } from 'src'; -import { errorMessage } from '../../src/utils/error-message'; describe('utils:', () => { before(() => initVcxTestMode()); - const downloadMessagesData = { - pairwiseDids: 'asdf', - status: 'MS-104', - uids: 'asdf', - }; - const updateMessagesData = { - msgJson: '[{"pairwiseDID":"QSrw8hebcvQxiwBETmAaRs","uids":["mgrmngq"]}]', - }; - describe('provisionAgent:', () => { it('success', async () => { const provisionConfig = { @@ -51,18 +38,6 @@ describe('utils:', () => { }); }); - describe('VCXCode:', () => { - it('should have a one-to-one mapping for each code', async () => { - let max = 0; - for (const ec in VCXCode) { - if (Number(VCXCode[ec]) > max) { - max = Number(VCXCode[ec]); - } - } - assert.equal(errorMessage(max + 1), errorMessage(1001)); - }); - }); - describe('setActiveTxnAuthorAgreementMeta:', () => { it('success', async () => { setActiveTxnAuthorAgreementMeta( @@ -84,12 +59,4 @@ describe('utils:', () => { ); }); }); - - describe('endorseTransaction:', () => { - it('success', async () => { - const transaction = - '{"req_id":1, "identifier": "EbP4aYNeTHL6q385GuVpRV", "signature": "gkVDhwe2", "endorser": "NcYxiDXkpYi6ov5FcYDi1e"}'; - await endorseTransaction(transaction); - }); - }); }); diff --git a/wrappers/node/test/suite1/ariesvcx-wallet.test.ts b/wrappers/node/test/suite1/ariesvcx-wallet.test.ts index f73116e917..e04874c717 100644 --- a/wrappers/node/test/suite1/ariesvcx-wallet.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-wallet.test.ts @@ -3,60 +3,9 @@ import { assert } from 'chai'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; import { shutdownVcx, VCXCode, Wallet } from 'src'; -const WALLET_RECORD = { - id: 'RecordId', - tags_json: {}, - type_: 'TestType', - value: 'RecordValue', -}; - -const OPTIONS = { - retrieveTags: false, - retrieveType: true, - retrieveValue: true, -}; -const QUERY_JSON = { tagName1: 'str1' }; - -const UPDATE_WALLET_RECORD = { - id: 'RecordId', - type_: 'TestType', - value: 'RecordValueNew', -}; - -const UPDATE_WALLET_TAGS = { - id: 'RecordId', - tags_json: {}, - type_: 'TestType', - value: '', -}; - describe('Wallet:', () => { before(() => initVcxTestMode()); - describe('records:', () => { - it('success', async () => { - await Wallet.addRecord(WALLET_RECORD); - await Wallet.getRecord({ - type: WALLET_RECORD.type_, - id: WALLET_RECORD.id, - optionsJson: OPTIONS, - }); - await Wallet.updateRecordValue(UPDATE_WALLET_RECORD); - await Wallet.updateRecordTags(UPDATE_WALLET_TAGS); - await Wallet.addRecordTags(UPDATE_WALLET_TAGS); - await Wallet.deleteRecordTags(WALLET_RECORD, { tagList: ['one', 'two'] }); - await Wallet.deleteRecord({ type: WALLET_RECORD.type_, id: WALLET_RECORD.id }); - const searchHandle = await Wallet.openSearch({ - optionsJson: '{}', - queryJson: JSON.stringify(QUERY_JSON), - type: WALLET_RECORD.type_, - }); - assert(searchHandle === 1); - JSON.parse(await Wallet.searchNextRecords(searchHandle, { count: 1 })); - await Wallet.closeSearch(searchHandle); - }); - }); - describe('import:', () => { it('throws: libindy error', async () => { let config = @@ -91,6 +40,7 @@ describe('Wallet:', () => { const error = await shouldThrow(async () => Wallet.export('/tmp/foobar.wallet', 'key_for_wallet'), ); + assert.equal(error.napiCode, 'GenericFailure'); assert.equal(error.vcxCode, VCXCode.INVALID_WALLET_HANDLE); }); }); diff --git a/wrappers/node/test/suite2/ffi.test.ts b/wrappers/node/test/suite2/ffi.test.ts deleted file mode 100644 index b956d3d9fe..0000000000 --- a/wrappers/node/test/suite2/ffi.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import '../module-resolver-helper'; - -import { assert } from 'chai'; -import * as ffi from 'ffi-napi'; -import { initVcxTestMode } from 'helpers/utils'; -import * as os from 'os'; -import { VCXCode, VCXRuntime } from 'src'; - -// these tests were created to only test that the ffi could be called with each function - -describe('Using the vcx ffi directly', () => { - const extension = { darwin: '.dylib', linux: '.so', win32: '.dll' }; - const libPath = { - darwin: '/usr/local/lib/', - linux: '/usr/lib/', - win32: 'c:\\windows\\system32\\', - }; - - const platform = os.platform(); - const postfix = extension[platform.toLowerCase() as keyof typeof extension] || extension.linux; - const libDir = libPath[platform.toLowerCase() as keyof typeof libPath] || libPath.linux; - const run = new VCXRuntime({ basepath: `${libDir}libvcx${postfix}` }); - - before(() => initVcxTestMode()); - - it('a call to vcx_connection_create should return 0', () => { - const result = run.ffi.vcx_connection_create( - 0, - '1', - ffi.Callback( - 'void', - ['uint32', 'uint32', 'uint32'], - (_xhandle: number, _err: number, _connectionHandle: number) => null, - ), - ); - assert.equal(result, 0); - }); -}); diff --git a/wrappers/vcx-napi-rs/Cargo.toml b/wrappers/vcx-napi-rs/Cargo.toml new file mode 100644 index 0000000000..38b4575473 --- /dev/null +++ b/wrappers/vcx-napi-rs/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "vcx-napi-rs" +version.workspace = true +authors.workspace = true +license.workspace = true +edition.workspace = true + +[lib] +name = "vcx_napi_rs" +path = "src/lib.rs" +crate-type = ["cdylib"] +doctest = false + +[features] +test_utils = [ "libvcx/test_utils" ] + +[dependencies] +libvcx = { path = "../../libvcx", default-features = false } +log = "0.4.16" +napi = { version = "=2.9.1", default-features = false, features = [ "async" ] } +napi-derive = { version = "=2.9.3" } + +[build-dependencies] +napi-build = "2.0.1" diff --git a/wrappers/vcx-napi-rs/alpine.Dockerfile b/wrappers/vcx-napi-rs/alpine.Dockerfile new file mode 100644 index 0000000000..b1eb1a92d8 --- /dev/null +++ b/wrappers/vcx-napi-rs/alpine.Dockerfile @@ -0,0 +1,2 @@ +FROM ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine +RUN apk update && apk upgrade && apk add openssl-dev zeromq-dev diff --git a/wrappers/vcx-napi-rs/build.rs b/wrappers/vcx-napi-rs/build.rs new file mode 100644 index 0000000000..9fc2367889 --- /dev/null +++ b/wrappers/vcx-napi-rs/build.rs @@ -0,0 +1,5 @@ +extern crate napi_build; + +fn main() { + napi_build::setup(); +} diff --git a/wrappers/vcx-napi-rs/debian.Dockerfile b/wrappers/vcx-napi-rs/debian.Dockerfile new file mode 100644 index 0000000000..98e2ca1c58 --- /dev/null +++ b/wrappers/vcx-napi-rs/debian.Dockerfile @@ -0,0 +1,3 @@ +FROM ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian +USER root +RUN apt update && apt -y install libsodium-dev libssl-dev libzmq3-dev diff --git a/wrappers/vcx-napi-rs/index.d.ts b/wrappers/vcx-napi-rs/index.d.ts new file mode 100644 index 0000000000..8498b307e6 --- /dev/null +++ b/wrappers/vcx-napi-rs/index.d.ts @@ -0,0 +1,164 @@ +/* tslint:disable */ +/* eslint-disable */ + +/* auto-generated by NAPI-RS */ + +export function updateWebhookUrl(webhookUrl: string): Promise +export function createAgencyClientForMainWallet(config: string): void +export function provisionCloudAgent(config: string): Promise +export function messagesUpdateStatus(statusCode: string, uidsByConns: string): Promise +export function generatePublicInvitation(publicDid: string, label: string): string +export function credentialCreateWithOffer(sourceId: string, offer: string): number +export function credentialRelease(handle: number): void +export function credentialSendRequest(handle: number, handleConnection: number): Promise +export function credentialDeclineOffer(handle: number, handleConnection: number, comment?: string | undefined | null): Promise +export function credentialSerialize(handle: number): string +export function credentialDeserialize(data: string): number +export function v2CredentialUpdateStateWithMessage(handleCredential: number, message: string | undefined | null, connectionHandle: number): Promise +export function v2CredentialUpdateState(handleCredential: number, connectionHandle: number): Promise +export function credentialGetState(handle: number): number +export function credentialGetOffers(handleConnection: number): Promise +export function credentialGetAttributes(handle: number): string +export function credentialGetAttachment(handle: number): string +export function credentialGetTailsLocation(handle: number): string +export function credentialGetTailsHash(handle: number): string +export function credentialGetRevRegId(handle: number): string +export function credentialGetThreadId(handle: number): string +export function credentialdefCreateV2(sourceId: string, schemaId: string, tag: string, supportRevocation: boolean): Promise +export function credentialdefPublish(handle: number): Promise +export function credentialdefDeserialize(serialized: string): number +export function credentialdefRelease(handle: number): void +export function credentialdefSerialize(handle: number): string +export function credentialdefGetCredDefId(handle: number): string +export function credentialdefUpdateState(handle: number): Promise +export function credentialdefGetState(handle: number): number +export function disclosedProofCreateWithRequest(sourceId: string, proofReq: string): number +export function disclosedProofRelease(handle: number): void +export function disclosedProofSendProof(handle: number, handleConnection: number): Promise +export function disclosedProofRejectProof(handle: number, handleConnection: number): Promise +export function disclosedProofGetProofMsg(handle: number): string +export function disclosedProofSerialize(handle: number): string +export function disclosedProofDeserialize(data: string): number +export function v2DisclosedProofUpdateState(handle: number, connectionHandle: number): Promise +export function v2DisclosedProofUpdateStateWithMessage(handle: number, message: string, connectionHandle: number): Promise +export function disclosedProofGetState(handle: number): number +export function disclosedProofGetRequests(handleConnection: number): Promise +export function disclosedProofRetrieveCredentials(handle: number): Promise +export function disclosedProofGetProofRequestAttachment(handle: number): string +export function disclosedProofGenerateProof(handle: number, credentials: string, selfAttestedAttrs: string): Promise +export function disclosedProofDeclinePresentationRequest(handle: number, connectionHandle: number, reason?: string | undefined | null, proposal?: string | undefined | null): Promise +export function disclosedProofGetThreadId(handle: number): string +export function issuerCredentialDeserialize(credentialData: string): number +export function issuerCredentialSerialize(handleCredential: number): string +export function issuerCredentialUpdateStateV2(handleCredential: number, connectionHandle: number): Promise +export function issuerCredentialUpdateStateWithMessageV2(handleCredential: number, connectionHandle: number, message: string): Promise +export function issuerCredentialGetState(handleCredential: number): number +export function issuerCredentialGetRevRegId(handleCredential: number): string +export function issuerCredentialCreate(sourceId: string): number +export function issuerCredentialRevokeLocal(handleCredential: number): Promise +export function issuerCredentialIsRevokable(handleCredential: number): boolean +export function issuerCredentialSendCredential(handleCredential: number, handleConnection: number): Promise +export function issuerCredentialSendOfferV2(handleCredential: number, handleConnection: number): Promise +export function issuerCredentialMarkOfferMsgSent(handleCredential: number): void +export function issuerCredentialBuildOfferMsgV2(credentialHandle: number, credDefHandle: number, revRegHandle: number, credentialJson: string, comment?: string | undefined | null): Promise +export function issuerCredentialGetOfferMsg(credentialHandle: number): string +export function issuerCredentialRelease(credentialHandle: number): void +export function issuerCredentialGetThreadId(credentialHandle: number): string +export function getLedgerAuthorAgreement(): Promise +export function setActiveTxnAuthorAgreementMeta(text: string | undefined | null, version: string | undefined | null, hash: string | undefined | null, accMechType: string, timeOfAcceptance: number): void +export function createService(targetDid: string, recipientKeys: Array, routingKeys: Array, endpoint: string): Promise +export function getServiceFromLedger(targetDid: string): Promise +export function getVerkeyFromLedger(did: string): Promise +export function getLedgerTxn(seqNo: number, submitterDid?: string | undefined | null): Promise +export function initDefaultLogger(pattern?: string | undefined | null): void +export function mediatedConnectionGeneratePublicInvite(publicDid: string, label: string): string +export function mediatedConnectionGetPwDid(handle: number): string +export function mediatedConnectionGetTheirPwDid(handle: number): string +export function mediatedConnectionGetThreadId(handle: number): string +export function mediatedConnectionGetState(handle: number): number +export function mediatedConnectionGetSourceId(handle: number): string +export function mediatedConnectionCreate(sourceId: string): Promise +export function mediatedConnectionCreateWithInvite(sourceId: string, details: string): Promise +export function mediatedConnectionSendMessage(handle: number, msg: string): Promise +export function mediatedConnectionCreateWithConnectionRequestV2(request: string, pwInfo: string): Promise +export function mediatedConnectionSendHandshakeReuse(handle: number, oobMsg: string): Promise +export function mediatedConnectionUpdateStateWithMessage(handle: number, message: string): Promise +export function mediatedConnectionHandleMessage(handle: number, message: string): Promise +export function mediatedConnectionUpdateState(handle: number): Promise +export function mediatedConnectionDeleteConnection(handle: number): Promise +export function mediatedConnectionConnect(handle: number): Promise +export function mediatedConnectionSerialize(handle: number): string +export function mediatedConnectionDeserialize(connectionData: string): number +export function mediatedConnectionRelease(handle: number): void +export function mediatedConnectionInviteDetails(handle: number): string +export function mediatedConnectionSendPing(handle: number, comment?: string | undefined | null): Promise +export function mediatedConnectionSendDiscoveryFeatures(handle: number, query?: string | undefined | null, comment?: string | undefined | null): Promise +export function mediatedConnectionInfo(handle: number): Promise +export function mediatedConnectionMessagesDownload(connHandles: Array, statusCodes?: string | undefined | null, uids?: string | undefined | null): Promise +export function mediatedConnectionSignData(handle: number, data: Buffer): Promise +export function mediatedConnectionVerifySignature(handle: number, data: Buffer, signature: Buffer): Promise +export function outOfBandReceiverCreate(msg: string): number +export function outOfBandReceiverExtractMessage(handle: number): string +export function outOfBandReceiverConnectionExists(handle: number, connHandles: Array): Promise +export function outOfBandReceiverBuildConnection(handle: number): Promise +export function outOfBandReceiverGetThreadId(handle: number): string +export function outOfBandReceiverSerialize(handle: number): string +export function outOfBandReceiverDeserialize(oobData: string): number +export function outOfBandReceiverRelease(handle: number): void +export function outOfBandSenderCreate(config: string): number +export function outOfBandSenderAppendMessage(handle: number, msg: string): void +export function outOfBandSenderAppendService(handle: number, service: string): void +export function outOfBandSenderAppendServiceDid(handle: number, did: string): void +export function outOfBandSenderToMessage(handle: number): string +export function outOfBandSenderGetThreadId(handle: number): string +export function outOfBandSenderSerialize(handle: number): string +export function outOfBandSenderDeserialize(oobData: string): number +export function outOfBandSenderRelease(handle: number): void +export function openMainPool(poolConfig: string): Promise +export function closeMainPool(): Promise +export function proofCreate(sourceId: string, requestedAttrs: string, requestedPredicates: string, revocationDetails: string, name: string): Promise +export function proofGetProofMsg(handle: number): string +export function proofRelease(handle: number): void +export function proofSendRequest(handleProof: number, handleConnection: number): Promise +export function proofGetRequestMsg(handle: number): string +export function proofSerialize(handle: number): string +export function proofDeserialize(data: string): number +export function v2ProofUpdateState(handleProof: number, connectionHandle: number): Promise +export function v2ProofUpdateStateWithMessage(handleProof: number, message: string, connectionHandle: number): Promise +export function proofGetState(handle: number): number +export function proofGetProofState(handle: number): number +export function proofGetThreadId(handle: number): string +export function markPresentationRequestMsgSent(handle: number): void +export function revocationRegistryCreate(config: string): Promise +export function revocationRegistryPublish(handle: number, tailsUrl: string): Promise +export function revocationRegistryPublishRevocations(handle: number): Promise +export function revocationRegistryGetRevRegId(handle: number): string +export function revocationRegistryGetTailsHash(handle: number): string +export function revocationRegistrySerialize(handle: number): string +export function revocationRegistryDeserialize(data: string): number +export function revocationRegistryRelease(handle: number): void +export function schemaGetAttributes(sourceId: string, schemaId: string): void +export function schemaPrepareForEndorser(): void +export function schemaCreate(sourceId: string, name: string, version: string, data: string): Promise +export function schemaGetSchemaId(handleSchema: number): string +export function schemaDeserialize(serialized: string): number +export function schemaSerialize(handleSchema: number): string +export function schemaRelease(handleSchema: number): void +export function schemaUpdateState(handleSchema: number): Promise +export function schemaGetState(handleSchema: number): number +export function enableMocks(): void +export function shutdown(deleteAll?: boolean | undefined | null): void +export function getVersion(): string +export function walletOpenAsMain(walletConfig: string): Promise +export function walletCreateMain(walletConfig: string): Promise +export function walletCloseMain(): Promise +export function vcxInitIssuerConfig(config: string): Promise +export function configureIssuerWallet(enterpriseSeed: string): Promise +export function unpack(data: Buffer): Promise +export function createPairwiseInfo(): Promise +export function walletImport(config: string): Promise +export function walletExport(path: string, backupKey: string): Promise +export function getVerkeyFromWallet(did: string): Promise +export function rotateVerkey(did: string): Promise +export function rotateVerkeyStart(did: string): Promise +export function rotateVerkeyApply(did: string, tempVk: string): Promise diff --git a/wrappers/vcx-napi-rs/index.js b/wrappers/vcx-napi-rs/index.js new file mode 100644 index 0000000000..6aefa19850 --- /dev/null +++ b/wrappers/vcx-napi-rs/index.js @@ -0,0 +1,399 @@ +const { existsSync, readFileSync } = require('fs') +const { join } = require('path') + +const { platform, arch } = process + +let nativeBinding = null +let localFileExisted = false +let loadError = null + +function isMusl() { + // For Node 10 + if (!process.report || typeof process.report.getReport !== 'function') { + try { + return readFileSync('/usr/bin/ldd', 'utf8').includes('musl') + } catch (e) { + return true + } + } else { + const { glibcVersionRuntime } = process.report.getReport().header + return !glibcVersionRuntime + } +} + +switch (platform) { + case 'android': + switch (arch) { + case 'arm64': + localFileExisted = existsSync(join(__dirname, 'vcx-napi-rs.android-arm64.node')) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.android-arm64.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-android-arm64') + } + } catch (e) { + loadError = e + } + break + case 'arm': + localFileExisted = existsSync(join(__dirname, 'vcx-napi-rs.android-arm-eabi.node')) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.android-arm-eabi.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-android-arm-eabi') + } + } catch (e) { + loadError = e + } + break + default: + throw new Error(`Unsupported architecture on Android ${arch}`) + } + break + case 'win32': + switch (arch) { + case 'x64': + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.win32-x64-msvc.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.win32-x64-msvc.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-win32-x64-msvc') + } + } catch (e) { + loadError = e + } + break + case 'ia32': + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.win32-ia32-msvc.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.win32-ia32-msvc.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-win32-ia32-msvc') + } + } catch (e) { + loadError = e + } + break + case 'arm64': + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.win32-arm64-msvc.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.win32-arm64-msvc.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-win32-arm64-msvc') + } + } catch (e) { + loadError = e + } + break + default: + throw new Error(`Unsupported architecture on Windows: ${arch}`) + } + break + case 'darwin': + switch (arch) { + case 'x64': + localFileExisted = existsSync(join(__dirname, 'vcx-napi-rs.darwin-x64.node')) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.darwin-x64.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-darwin-x64') + } + } catch (e) { + loadError = e + } + break + case 'arm64': + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.darwin-arm64.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.darwin-arm64.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-darwin-arm64') + } + } catch (e) { + loadError = e + } + break + default: + throw new Error(`Unsupported architecture on macOS: ${arch}`) + } + break + case 'freebsd': + if (arch !== 'x64') { + throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) + } + localFileExisted = existsSync(join(__dirname, 'vcx-napi-rs.freebsd-x64.node')) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.freebsd-x64.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-freebsd-x64') + } + } catch (e) { + loadError = e + } + break + case 'linux': + switch (arch) { + case 'x64': + if (isMusl()) { + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.linux-x64-musl.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.linux-x64-musl.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-linux-x64-musl') + } + } catch (e) { + loadError = e + } + } else { + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.linux-x64-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.linux-x64-gnu.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-linux-x64-gnu') + } + } catch (e) { + loadError = e + } + } + break + case 'arm64': + if (isMusl()) { + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.linux-arm64-musl.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.linux-arm64-musl.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-linux-arm64-musl') + } + } catch (e) { + loadError = e + } + } else { + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.linux-arm64-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.linux-arm64-gnu.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-linux-arm64-gnu') + } + } catch (e) { + loadError = e + } + } + break + case 'arm': + localFileExisted = existsSync( + join(__dirname, 'vcx-napi-rs.linux-arm-gnueabihf.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./vcx-napi-rs.linux-arm-gnueabihf.node') + } else { + nativeBinding = require('@hyperledger/vcx-napi-rs-linux-arm-gnueabihf') + } + } catch (e) { + loadError = e + } + break + default: + throw new Error(`Unsupported architecture on Linux: ${arch}`) + } + break + default: + throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`) +} + +if (!nativeBinding) { + if (loadError) { + throw loadError + } + throw new Error(`Failed to load native binding`) +} + +const { updateWebhookUrl, createAgencyClientForMainWallet, provisionCloudAgent, messagesUpdateStatus, generatePublicInvitation, credentialCreateWithOffer, credentialRelease, credentialSendRequest, credentialDeclineOffer, credentialSerialize, credentialDeserialize, v2CredentialUpdateStateWithMessage, v2CredentialUpdateState, credentialGetState, credentialGetOffers, credentialGetAttributes, credentialGetAttachment, credentialGetTailsLocation, credentialGetTailsHash, credentialGetRevRegId, credentialGetThreadId, credentialdefCreateV2, credentialdefPublish, credentialdefDeserialize, credentialdefRelease, credentialdefSerialize, credentialdefGetCredDefId, credentialdefUpdateState, credentialdefGetState, disclosedProofCreateWithRequest, disclosedProofRelease, disclosedProofSendProof, disclosedProofRejectProof, disclosedProofGetProofMsg, disclosedProofSerialize, disclosedProofDeserialize, v2DisclosedProofUpdateState, v2DisclosedProofUpdateStateWithMessage, disclosedProofGetState, disclosedProofGetRequests, disclosedProofRetrieveCredentials, disclosedProofGetProofRequestAttachment, disclosedProofGenerateProof, disclosedProofDeclinePresentationRequest, disclosedProofGetThreadId, issuerCredentialDeserialize, issuerCredentialSerialize, issuerCredentialUpdateStateV2, issuerCredentialUpdateStateWithMessageV2, issuerCredentialGetState, issuerCredentialGetRevRegId, issuerCredentialCreate, issuerCredentialRevokeLocal, issuerCredentialIsRevokable, issuerCredentialSendCredential, issuerCredentialSendOfferV2, issuerCredentialMarkOfferMsgSent, issuerCredentialBuildOfferMsgV2, issuerCredentialGetOfferMsg, issuerCredentialRelease, issuerCredentialGetThreadId, getLedgerAuthorAgreement, setActiveTxnAuthorAgreementMeta, createService, getServiceFromLedger, getVerkeyFromLedger, getLedgerTxn, initDefaultLogger, mediatedConnectionGeneratePublicInvite, mediatedConnectionGetPwDid, mediatedConnectionGetTheirPwDid, mediatedConnectionGetThreadId, mediatedConnectionGetState, mediatedConnectionGetSourceId, mediatedConnectionCreate, mediatedConnectionCreateWithInvite, mediatedConnectionSendMessage, mediatedConnectionCreateWithConnectionRequestV2, mediatedConnectionSendHandshakeReuse, mediatedConnectionUpdateStateWithMessage, mediatedConnectionHandleMessage, mediatedConnectionUpdateState, mediatedConnectionDeleteConnection, mediatedConnectionConnect, mediatedConnectionSerialize, mediatedConnectionDeserialize, mediatedConnectionRelease, mediatedConnectionInviteDetails, mediatedConnectionSendPing, mediatedConnectionSendDiscoveryFeatures, mediatedConnectionInfo, mediatedConnectionMessagesDownload, mediatedConnectionSignData, mediatedConnectionVerifySignature, outOfBandReceiverCreate, outOfBandReceiverExtractMessage, outOfBandReceiverConnectionExists, outOfBandReceiverBuildConnection, outOfBandReceiverGetThreadId, outOfBandReceiverSerialize, outOfBandReceiverDeserialize, outOfBandReceiverRelease, outOfBandSenderCreate, outOfBandSenderAppendMessage, outOfBandSenderAppendService, outOfBandSenderAppendServiceDid, outOfBandSenderToMessage, outOfBandSenderGetThreadId, outOfBandSenderSerialize, outOfBandSenderDeserialize, outOfBandSenderRelease, openMainPool, closeMainPool, proofCreate, proofGetProofMsg, proofRelease, proofSendRequest, proofGetRequestMsg, proofSerialize, proofDeserialize, v2ProofUpdateState, v2ProofUpdateStateWithMessage, proofGetState, proofGetProofState, proofGetThreadId, markPresentationRequestMsgSent, revocationRegistryCreate, revocationRegistryPublish, revocationRegistryPublishRevocations, revocationRegistryGetRevRegId, revocationRegistryGetTailsHash, revocationRegistrySerialize, revocationRegistryDeserialize, revocationRegistryRelease, schemaGetAttributes, schemaPrepareForEndorser, schemaCreate, schemaGetSchemaId, schemaDeserialize, schemaSerialize, schemaRelease, schemaUpdateState, schemaGetState, enableMocks, shutdown, getVersion, walletOpenAsMain, walletCreateMain, walletCloseMain, vcxInitIssuerConfig, configureIssuerWallet, unpack, createPairwiseInfo, walletImport, walletExport, getVerkeyFromWallet, rotateVerkey, rotateVerkeyStart, rotateVerkeyApply } = nativeBinding + +module.exports.updateWebhookUrl = updateWebhookUrl +module.exports.createAgencyClientForMainWallet = createAgencyClientForMainWallet +module.exports.provisionCloudAgent = provisionCloudAgent +module.exports.messagesUpdateStatus = messagesUpdateStatus +module.exports.generatePublicInvitation = generatePublicInvitation +module.exports.credentialCreateWithOffer = credentialCreateWithOffer +module.exports.credentialRelease = credentialRelease +module.exports.credentialSendRequest = credentialSendRequest +module.exports.credentialDeclineOffer = credentialDeclineOffer +module.exports.credentialSerialize = credentialSerialize +module.exports.credentialDeserialize = credentialDeserialize +module.exports.v2CredentialUpdateStateWithMessage = v2CredentialUpdateStateWithMessage +module.exports.v2CredentialUpdateState = v2CredentialUpdateState +module.exports.credentialGetState = credentialGetState +module.exports.credentialGetOffers = credentialGetOffers +module.exports.credentialGetAttributes = credentialGetAttributes +module.exports.credentialGetAttachment = credentialGetAttachment +module.exports.credentialGetTailsLocation = credentialGetTailsLocation +module.exports.credentialGetTailsHash = credentialGetTailsHash +module.exports.credentialGetRevRegId = credentialGetRevRegId +module.exports.credentialGetThreadId = credentialGetThreadId +module.exports.credentialdefCreateV2 = credentialdefCreateV2 +module.exports.credentialdefPublish = credentialdefPublish +module.exports.credentialdefDeserialize = credentialdefDeserialize +module.exports.credentialdefRelease = credentialdefRelease +module.exports.credentialdefSerialize = credentialdefSerialize +module.exports.credentialdefGetCredDefId = credentialdefGetCredDefId +module.exports.credentialdefUpdateState = credentialdefUpdateState +module.exports.credentialdefGetState = credentialdefGetState +module.exports.disclosedProofCreateWithRequest = disclosedProofCreateWithRequest +module.exports.disclosedProofRelease = disclosedProofRelease +module.exports.disclosedProofSendProof = disclosedProofSendProof +module.exports.disclosedProofRejectProof = disclosedProofRejectProof +module.exports.disclosedProofGetProofMsg = disclosedProofGetProofMsg +module.exports.disclosedProofSerialize = disclosedProofSerialize +module.exports.disclosedProofDeserialize = disclosedProofDeserialize +module.exports.v2DisclosedProofUpdateState = v2DisclosedProofUpdateState +module.exports.v2DisclosedProofUpdateStateWithMessage = v2DisclosedProofUpdateStateWithMessage +module.exports.disclosedProofGetState = disclosedProofGetState +module.exports.disclosedProofGetRequests = disclosedProofGetRequests +module.exports.disclosedProofRetrieveCredentials = disclosedProofRetrieveCredentials +module.exports.disclosedProofGetProofRequestAttachment = disclosedProofGetProofRequestAttachment +module.exports.disclosedProofGenerateProof = disclosedProofGenerateProof +module.exports.disclosedProofDeclinePresentationRequest = disclosedProofDeclinePresentationRequest +module.exports.disclosedProofGetThreadId = disclosedProofGetThreadId +module.exports.issuerCredentialDeserialize = issuerCredentialDeserialize +module.exports.issuerCredentialSerialize = issuerCredentialSerialize +module.exports.issuerCredentialUpdateStateV2 = issuerCredentialUpdateStateV2 +module.exports.issuerCredentialUpdateStateWithMessageV2 = issuerCredentialUpdateStateWithMessageV2 +module.exports.issuerCredentialGetState = issuerCredentialGetState +module.exports.issuerCredentialGetRevRegId = issuerCredentialGetRevRegId +module.exports.issuerCredentialCreate = issuerCredentialCreate +module.exports.issuerCredentialRevokeLocal = issuerCredentialRevokeLocal +module.exports.issuerCredentialIsRevokable = issuerCredentialIsRevokable +module.exports.issuerCredentialSendCredential = issuerCredentialSendCredential +module.exports.issuerCredentialSendOfferV2 = issuerCredentialSendOfferV2 +module.exports.issuerCredentialMarkOfferMsgSent = issuerCredentialMarkOfferMsgSent +module.exports.issuerCredentialBuildOfferMsgV2 = issuerCredentialBuildOfferMsgV2 +module.exports.issuerCredentialGetOfferMsg = issuerCredentialGetOfferMsg +module.exports.issuerCredentialRelease = issuerCredentialRelease +module.exports.issuerCredentialGetThreadId = issuerCredentialGetThreadId +module.exports.getLedgerAuthorAgreement = getLedgerAuthorAgreement +module.exports.setActiveTxnAuthorAgreementMeta = setActiveTxnAuthorAgreementMeta +module.exports.createService = createService +module.exports.getServiceFromLedger = getServiceFromLedger +module.exports.getVerkeyFromLedger = getVerkeyFromLedger +module.exports.getLedgerTxn = getLedgerTxn +module.exports.initDefaultLogger = initDefaultLogger +module.exports.mediatedConnectionGeneratePublicInvite = mediatedConnectionGeneratePublicInvite +module.exports.mediatedConnectionGetPwDid = mediatedConnectionGetPwDid +module.exports.mediatedConnectionGetTheirPwDid = mediatedConnectionGetTheirPwDid +module.exports.mediatedConnectionGetThreadId = mediatedConnectionGetThreadId +module.exports.mediatedConnectionGetState = mediatedConnectionGetState +module.exports.mediatedConnectionGetSourceId = mediatedConnectionGetSourceId +module.exports.mediatedConnectionCreate = mediatedConnectionCreate +module.exports.mediatedConnectionCreateWithInvite = mediatedConnectionCreateWithInvite +module.exports.mediatedConnectionSendMessage = mediatedConnectionSendMessage +module.exports.mediatedConnectionCreateWithConnectionRequestV2 = mediatedConnectionCreateWithConnectionRequestV2 +module.exports.mediatedConnectionSendHandshakeReuse = mediatedConnectionSendHandshakeReuse +module.exports.mediatedConnectionUpdateStateWithMessage = mediatedConnectionUpdateStateWithMessage +module.exports.mediatedConnectionHandleMessage = mediatedConnectionHandleMessage +module.exports.mediatedConnectionUpdateState = mediatedConnectionUpdateState +module.exports.mediatedConnectionDeleteConnection = mediatedConnectionDeleteConnection +module.exports.mediatedConnectionConnect = mediatedConnectionConnect +module.exports.mediatedConnectionSerialize = mediatedConnectionSerialize +module.exports.mediatedConnectionDeserialize = mediatedConnectionDeserialize +module.exports.mediatedConnectionRelease = mediatedConnectionRelease +module.exports.mediatedConnectionInviteDetails = mediatedConnectionInviteDetails +module.exports.mediatedConnectionSendPing = mediatedConnectionSendPing +module.exports.mediatedConnectionSendDiscoveryFeatures = mediatedConnectionSendDiscoveryFeatures +module.exports.mediatedConnectionInfo = mediatedConnectionInfo +module.exports.mediatedConnectionMessagesDownload = mediatedConnectionMessagesDownload +module.exports.mediatedConnectionSignData = mediatedConnectionSignData +module.exports.mediatedConnectionVerifySignature = mediatedConnectionVerifySignature +module.exports.outOfBandReceiverCreate = outOfBandReceiverCreate +module.exports.outOfBandReceiverExtractMessage = outOfBandReceiverExtractMessage +module.exports.outOfBandReceiverConnectionExists = outOfBandReceiverConnectionExists +module.exports.outOfBandReceiverBuildConnection = outOfBandReceiverBuildConnection +module.exports.outOfBandReceiverGetThreadId = outOfBandReceiverGetThreadId +module.exports.outOfBandReceiverSerialize = outOfBandReceiverSerialize +module.exports.outOfBandReceiverDeserialize = outOfBandReceiverDeserialize +module.exports.outOfBandReceiverRelease = outOfBandReceiverRelease +module.exports.outOfBandSenderCreate = outOfBandSenderCreate +module.exports.outOfBandSenderAppendMessage = outOfBandSenderAppendMessage +module.exports.outOfBandSenderAppendService = outOfBandSenderAppendService +module.exports.outOfBandSenderAppendServiceDid = outOfBandSenderAppendServiceDid +module.exports.outOfBandSenderToMessage = outOfBandSenderToMessage +module.exports.outOfBandSenderGetThreadId = outOfBandSenderGetThreadId +module.exports.outOfBandSenderSerialize = outOfBandSenderSerialize +module.exports.outOfBandSenderDeserialize = outOfBandSenderDeserialize +module.exports.outOfBandSenderRelease = outOfBandSenderRelease +module.exports.openMainPool = openMainPool +module.exports.closeMainPool = closeMainPool +module.exports.proofCreate = proofCreate +module.exports.proofGetProofMsg = proofGetProofMsg +module.exports.proofRelease = proofRelease +module.exports.proofSendRequest = proofSendRequest +module.exports.proofGetRequestMsg = proofGetRequestMsg +module.exports.proofSerialize = proofSerialize +module.exports.proofDeserialize = proofDeserialize +module.exports.v2ProofUpdateState = v2ProofUpdateState +module.exports.v2ProofUpdateStateWithMessage = v2ProofUpdateStateWithMessage +module.exports.proofGetState = proofGetState +module.exports.proofGetProofState = proofGetProofState +module.exports.proofGetThreadId = proofGetThreadId +module.exports.markPresentationRequestMsgSent = markPresentationRequestMsgSent +module.exports.revocationRegistryCreate = revocationRegistryCreate +module.exports.revocationRegistryPublish = revocationRegistryPublish +module.exports.revocationRegistryPublishRevocations = revocationRegistryPublishRevocations +module.exports.revocationRegistryGetRevRegId = revocationRegistryGetRevRegId +module.exports.revocationRegistryGetTailsHash = revocationRegistryGetTailsHash +module.exports.revocationRegistrySerialize = revocationRegistrySerialize +module.exports.revocationRegistryDeserialize = revocationRegistryDeserialize +module.exports.revocationRegistryRelease = revocationRegistryRelease +module.exports.schemaGetAttributes = schemaGetAttributes +module.exports.schemaPrepareForEndorser = schemaPrepareForEndorser +module.exports.schemaCreate = schemaCreate +module.exports.schemaGetSchemaId = schemaGetSchemaId +module.exports.schemaDeserialize = schemaDeserialize +module.exports.schemaSerialize = schemaSerialize +module.exports.schemaRelease = schemaRelease +module.exports.schemaUpdateState = schemaUpdateState +module.exports.schemaGetState = schemaGetState +module.exports.enableMocks = enableMocks +module.exports.shutdown = shutdown +module.exports.getVersion = getVersion +module.exports.walletOpenAsMain = walletOpenAsMain +module.exports.walletCreateMain = walletCreateMain +module.exports.walletCloseMain = walletCloseMain +module.exports.vcxInitIssuerConfig = vcxInitIssuerConfig +module.exports.configureIssuerWallet = configureIssuerWallet +module.exports.unpack = unpack +module.exports.createPairwiseInfo = createPairwiseInfo +module.exports.walletImport = walletImport +module.exports.walletExport = walletExport +module.exports.getVerkeyFromWallet = getVerkeyFromWallet +module.exports.rotateVerkey = rotateVerkey +module.exports.rotateVerkeyStart = rotateVerkeyStart +module.exports.rotateVerkeyApply = rotateVerkeyApply diff --git a/wrappers/vcx-napi-rs/npm/darwin-arm64/README.md b/wrappers/vcx-napi-rs/npm/darwin-arm64/README.md new file mode 100644 index 0000000000..c21978c933 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/darwin-arm64/README.md @@ -0,0 +1,3 @@ +# `@hyperledger/vcx-napi-rs-darwin-arm64` + +This is the **aarch64-apple-darwin** binary for `@hyperledger/vcx-napi-rs` diff --git a/wrappers/vcx-napi-rs/npm/darwin-arm64/package.json b/wrappers/vcx-napi-rs/npm/darwin-arm64/package.json new file mode 100644 index 0000000000..8bf952ade6 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/darwin-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@hyperledger/vcx-napi-rs-darwin-arm64", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "main": "vcx-napi-rs.darwin-arm64.node", + "files": [ + "vcx-napi-rs.darwin-arm64.node" + ], + "description": "aries-vcx napi", + "license": "Apache-2.0", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/wrappers/vcx-napi-rs/npm/darwin-x64/README.md b/wrappers/vcx-napi-rs/npm/darwin-x64/README.md new file mode 100644 index 0000000000..b74ef7b783 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/darwin-x64/README.md @@ -0,0 +1,3 @@ +# `@hyperledger/vcx-napi-rs-darwin-x64` + +This is the **x86_64-apple-darwin** binary for `@hyperledger/vcx-napi-rs` diff --git a/wrappers/vcx-napi-rs/npm/darwin-x64/package.json b/wrappers/vcx-napi-rs/npm/darwin-x64/package.json new file mode 100644 index 0000000000..edc033f965 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/darwin-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@hyperledger/vcx-napi-rs-darwin-x64", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "main": "vcx-napi-rs.darwin-x64.node", + "files": [ + "vcx-napi-rs.darwin-x64.node" + ], + "description": "aries-vcx napi", + "license": "Apache-2.0", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/wrappers/vcx-napi-rs/npm/linux-x64-gnu/README.md b/wrappers/vcx-napi-rs/npm/linux-x64-gnu/README.md new file mode 100644 index 0000000000..186248f84b --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@hyperledger/vcx-napi-rs-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@hyperledger/vcx-napi-rs` diff --git a/wrappers/vcx-napi-rs/npm/linux-x64-gnu/package.json b/wrappers/vcx-napi-rs/npm/linux-x64-gnu/package.json new file mode 100644 index 0000000000..a479dc7d88 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/linux-x64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "@hyperledger/vcx-napi-rs-linux-x64-gnu", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "vcx-napi-rs.linux-x64-gnu.node", + "files": [ + "vcx-napi-rs.linux-x64-gnu.node" + ], + "libc": [ + "glibc" + ], + "description": "aries-vcx napi", + "license": "Apache-2.0", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/wrappers/vcx-napi-rs/npm/linux-x64-musl/README.md b/wrappers/vcx-napi-rs/npm/linux-x64-musl/README.md new file mode 100644 index 0000000000..79e4dfabd8 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@hyperledger/vcx-napi-rs-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `@hyperledger/vcx-napi-rs` diff --git a/wrappers/vcx-napi-rs/npm/linux-x64-musl/package.json b/wrappers/vcx-napi-rs/npm/linux-x64-musl/package.json new file mode 100644 index 0000000000..1283d4c867 --- /dev/null +++ b/wrappers/vcx-napi-rs/npm/linux-x64-musl/package.json @@ -0,0 +1,21 @@ +{ + "name": "@hyperledger/vcx-napi-rs-linux-x64-musl", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "vcx-napi-rs.linux-x64-musl.node", + "files": [ + "vcx-napi-rs.linux-x64-musl.node" + ], + "libc": [ + "musl" + ], + "description": "aries-vcx napi", + "license": "Apache-2.0", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/wrappers/vcx-napi-rs/package-lock.json b/wrappers/vcx-napi-rs/package-lock.json new file mode 100644 index 0000000000..921f03c13c --- /dev/null +++ b/wrappers/vcx-napi-rs/package-lock.json @@ -0,0 +1,77 @@ +{ + "name": "@hyperledger/vcx-napi-rs", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@hyperledger/vcx-napi-rs", + "license": "Apache-2.0", + "devDependencies": { + "@napi-rs/cli": "^2.9.1", + "@types/node": "^18.11.18", + "typescript": "^4.8.4" + }, + "optionalDependencies": { + "@hyperledger/vcx-napi-rs-darwin-arm64": "undefined", + "@hyperledger/vcx-napi-rs-darwin-x64": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-gnu": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-musl": "undefined" + } + }, + "node_modules/@napi-rs/cli": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.14.1.tgz", + "integrity": "sha512-+mnge6gvdbOrwtYrBO7iMlTjXcaRk17wDqzxSG4SPBKPhI3HroWY+tRsx+OdluAuRyJZOkWTdsvGnMsGO1ff/A==", + "dev": true, + "bin": { + "napi": "scripts/index.js" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/@types/node": { + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "dev": true + }, + "node_modules/typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + } + }, + "dependencies": { + "@napi-rs/cli": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.14.1.tgz", + "integrity": "sha512-+mnge6gvdbOrwtYrBO7iMlTjXcaRk17wDqzxSG4SPBKPhI3HroWY+tRsx+OdluAuRyJZOkWTdsvGnMsGO1ff/A==", + "dev": true + }, + "@types/node": { + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "dev": true + }, + "typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "dev": true + } + } +} diff --git a/wrappers/vcx-napi-rs/package.json b/wrappers/vcx-napi-rs/package.json new file mode 100644 index 0000000000..41c5226485 --- /dev/null +++ b/wrappers/vcx-napi-rs/package.json @@ -0,0 +1,54 @@ +{ + "name": "@hyperledger/vcx-napi-rs", + "package": "@hyperledger/vcx-napi-rs", + "devDependencies": { + "@napi-rs/cli": "^2.9.1", + "@types/node": "^18.11.18", + "typescript": "^4.8.4" + }, + "main": "index.js", + "files": [ + "index.js", + "index.d.ts" + ], + "scripts": { + "artifacts": "napi artifacts", + "prepublish": "napi prepublish --skip-gh-release", + "build:ts": "tsc -p ./tsconfig.json", + "build:napi": "napi build --platform --release --features test_utils", + "build:napi:debug": "napi build --platform --features test_utils", + "create-npm-dir": "napi create-npm-dir -t ." + }, + "napi": { + "name": "vcx-napi-rs", + "triples": { + "defaults": false, + "additional": [ + "x86_64-apple-darwin", + "aarch64-apple-darwin", + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl" + ] + } + }, + "publishConfig": { + "access": "public" + }, + "contributors": [ + { + "name": "Hyperledger Indy Contributors", + "email": "indy@lists.hyperledger.org" + } + ], + "bugs": { + "url": "https://github.com/hyperledger/aries-vcx/issues" + }, + "description": "aries-vcx napi", + "license": "Apache-2.0", + "optionalDependencies": { + "@hyperledger/vcx-napi-rs-darwin-x64": "undefined", + "@hyperledger/vcx-napi-rs-darwin-arm64": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-gnu": "undefined", + "@hyperledger/vcx-napi-rs-linux-x64-musl": "undefined" + } +} \ No newline at end of file diff --git a/wrappers/vcx-napi-rs/src/api/agency_client.rs b/wrappers/vcx-napi-rs/src/api/agency_client.rs new file mode 100644 index 0000000000..75dad3336c --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/agency_client.rs @@ -0,0 +1,74 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_global::agency_client; +use vcx::aries_vcx::agency_client::configuration::{AgencyClientConfig, AgentProvisionConfig}; +use vcx::aries_vcx::agency_client::messages::update_message::UIDsByConn; +use vcx::aries_vcx::agency_client::MessageStatusCode; +use vcx::errors::error::{LibvcxError, LibvcxErrorKind}; +use vcx::serde_json; +use vcx::serde_json::json; + +use crate::error::to_napi_err; + +#[napi] +pub async fn update_webhook_url(webhook_url: String) -> napi::Result<()> { + agency_client::update_webhook_url(&webhook_url) + .await + .map_err(to_napi_err) +} + +#[napi] +pub fn create_agency_client_for_main_wallet(config: String) -> napi::Result<()> { + let config = serde_json::from_str::(&config) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Deserialization error parsing config: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + agency_client::create_agency_client_for_main_wallet(&config).map_err(to_napi_err)?; + Ok(()) +} + +#[napi] +pub async fn provision_cloud_agent(config: String) -> napi::Result { + let config = serde_json::from_str::(&config) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Deserialization error parsing config: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + let agency_client_config = agency_client::provision_cloud_agent(&config) + .await + .map_err(to_napi_err)?; + Ok(json!(agency_client_config).to_string()) +} + +// todo: can we accept Vec instead of Stringified JSON in place of uids_by_conns? +#[napi] +pub async fn messages_update_status(status_code: String, uids_by_conns: String) -> napi::Result<()> { + let status_code: MessageStatusCode = serde_json::from_str(&format!("\"{}\"", status_code)) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Deserialization error parsing status_code: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + let uids_by_conns: Vec = serde_json::from_str(&uids_by_conns) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Deserialization error parsing uids_by_conns: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + + agency_client::agency_update_messages(status_code, uids_by_conns) + .await + .map_err(to_napi_err)?; + Ok(()) +} diff --git a/wrappers/vcx-napi-rs/src/api/agent.rs b/wrappers/vcx-napi-rs/src/api/agent.rs new file mode 100644 index 0000000000..9d76ea81db --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/agent.rs @@ -0,0 +1,8 @@ +use crate::error::to_napi_err; +use napi_derive::napi; +use vcx::api_vcx::api_handle::mediated_connection; + +#[napi] +pub fn generate_public_invitation(public_did: String, label: String) -> napi::Result { + mediated_connection::generate_public_invitation(&public_did, &label).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/credential.rs b/wrappers/vcx-napi-rs/src/api/credential.rs new file mode 100644 index 0000000000..fa9e79490a --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/credential.rs @@ -0,0 +1,101 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_handle::credential; + +use crate::error::to_napi_err; + +#[napi] +fn credential_create_with_offer(source_id: String, offer: String) -> napi::Result { + credential::credential_create_with_offer(&source_id, &offer).map_err(to_napi_err) +} + +#[napi] +fn credential_release(handle: u32) -> napi::Result<()> { + credential::release(handle).map_err(to_napi_err) +} + +#[napi] +async fn credential_send_request(handle: u32, handle_connection: u32) -> napi::Result<()> { + credential::send_credential_request(handle, handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn credential_decline_offer(handle: u32, handle_connection: u32, comment: Option) -> napi::Result<()> { + credential::decline_offer(handle, handle_connection, comment.as_deref()) + .await + .map_err(to_napi_err) +} + +#[napi] +fn credential_serialize(handle: u32) -> napi::Result { + credential::to_string(handle).map_err(to_napi_err) +} + +#[napi] +fn credential_deserialize(data: String) -> napi::Result { + credential::from_string(&data).map_err(to_napi_err) +} + +// todo: flip order of arguments +#[napi] +async fn v2_credential_update_state_with_message( + handle_credential: u32, + message: Option, + connection_handle: u32, +) -> napi::Result { + credential::update_state(handle_credential, message.as_deref(), connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn v2_credential_update_state(handle_credential: u32, connection_handle: u32) -> napi::Result { + credential::update_state(handle_credential, None, connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +fn credential_get_state(handle: u32) -> napi::Result { + credential::get_state(handle).map_err(to_napi_err) +} + +// todo: move this to mediated_connection +#[napi] +async fn credential_get_offers(handle_connection: u32) -> napi::Result { + credential::get_credential_offer_messages_with_conn_handle(handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +fn credential_get_attributes(handle: u32) -> napi::Result { + credential::get_attributes(handle).map_err(to_napi_err) +} + +#[napi] +fn credential_get_attachment(handle: u32) -> napi::Result { + credential::get_attachment(handle).map_err(to_napi_err) +} + +#[napi] +fn credential_get_tails_location(handle: u32) -> napi::Result { + credential::get_tails_location(handle).map_err(to_napi_err) +} + +#[napi] +fn credential_get_tails_hash(handle: u32) -> napi::Result { + credential::get_tails_hash(handle).map_err(to_napi_err) +} + +#[napi] +fn credential_get_rev_reg_id(handle: u32) -> napi::Result { + credential::get_rev_reg_id(handle).map_err(to_napi_err) +} + +#[napi] +fn credential_get_thread_id(handle: u32) -> napi::Result { + credential::get_thread_id(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/credential_definition.rs b/wrappers/vcx-napi-rs/src/api/credential_definition.rs new file mode 100644 index 0000000000..74a74cc38d --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/credential_definition.rs @@ -0,0 +1,51 @@ +use napi_derive::napi; + +use crate::error::to_napi_err; +use vcx::api_vcx::api_handle::credential_def; + +#[napi] +async fn credentialdef_create_v2_( + source_id: String, + schema_id: String, + tag: String, + support_revocation: bool, +) -> napi::Result { + credential_def::create(source_id, schema_id, tag, support_revocation) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn credentialdef_publish(handle: u32) -> napi::Result<()> { + credential_def::publish(handle).await.map_err(to_napi_err) +} + +#[napi] +fn credentialdef_deserialize(serialized: String) -> napi::Result { + credential_def::from_string(&serialized).map_err(to_napi_err) +} + +#[napi] +fn credentialdef_release(handle: u32) -> napi::Result<()> { + credential_def::release(handle).map_err(to_napi_err) +} + +#[napi] +fn credentialdef_serialize(handle: u32) -> napi::Result { + credential_def::to_string(handle).map_err(to_napi_err) +} + +#[napi] +fn credentialdef_get_cred_def_id(handle: u32) -> napi::Result { + credential_def::get_cred_def_id(handle).map_err(to_napi_err) +} + +#[napi] +async fn credentialdef_update_state(handle: u32) -> napi::Result { + credential_def::update_state(handle).await.map_err(to_napi_err) +} + +#[napi] +fn credentialdef_get_state(handle: u32) -> napi::Result { + credential_def::get_state(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/disclosed_proof.rs b/wrappers/vcx-napi-rs/src/api/disclosed_proof.rs new file mode 100644 index 0000000000..f8d1e8e86e --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/disclosed_proof.rs @@ -0,0 +1,113 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_handle::disclosed_proof; + +use crate::error::to_napi_err; + +#[napi] +fn disclosed_proof_create_with_request(source_id: String, proof_req: String) -> napi::Result { + disclosed_proof::create_with_proof_request(&source_id, &proof_req).map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_release(handle: u32) -> napi::Result<()> { + disclosed_proof::release(handle).map_err(to_napi_err) +} + +#[napi] +async fn disclosed_proof_send_proof(handle: u32, handle_connection: u32) -> napi::Result<()> { + disclosed_proof::send_proof(handle, handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn disclosed_proof_reject_proof(handle: u32, handle_connection: u32) -> napi::Result<()> { + disclosed_proof::reject_proof(handle, handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_get_proof_msg(handle: u32) -> napi::Result { + disclosed_proof::generate_proof_msg(handle).map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_serialize(handle: u32) -> napi::Result { + disclosed_proof::to_string(handle).map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_deserialize(data: String) -> napi::Result { + disclosed_proof::from_string(&data).map_err(to_napi_err) +} + +#[napi] +async fn v2_disclosed_proof_update_state(handle: u32, connection_handle: u32) -> napi::Result { + disclosed_proof::update_state(handle, None, connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn v2_disclosed_proof_update_state_with_message( + handle: u32, + message: String, + connection_handle: u32, +) -> napi::Result { + disclosed_proof::update_state(handle, Some(&message), connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_get_state(handle: u32) -> napi::Result { + disclosed_proof::get_state(handle).map_err(to_napi_err) +} + +// todo: move to mediated connection +#[napi] +async fn disclosed_proof_get_requests(handle_connection: u32) -> napi::Result { + disclosed_proof::get_proof_request_messages(handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn disclosed_proof_retrieve_credentials(handle: u32) -> napi::Result { + disclosed_proof::retrieve_credentials(handle).await.map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_get_proof_request_attachment(handle: u32) -> napi::Result { + disclosed_proof::get_proof_request_attachment(handle).map_err(to_napi_err) +} + +#[napi] +async fn disclosed_proof_generate_proof( + handle: u32, + credentials: String, + self_attested_attrs: String, +) -> napi::Result<()> { + disclosed_proof::generate_proof(handle, &credentials, &self_attested_attrs) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn disclosed_proof_decline_presentation_request( + handle: u32, + connection_handle: u32, + reason: Option, + proposal: Option, +) -> napi::Result<()> { + disclosed_proof::decline_presentation_request(handle, connection_handle, reason.as_deref(), proposal.as_deref()) + .await + .map_err(to_napi_err) +} + +#[napi] +fn disclosed_proof_get_thread_id(handle: u32) -> napi::Result { + disclosed_proof::get_thread_id(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/issuer_credential.rs b/wrappers/vcx-napi-rs/src/api/issuer_credential.rs new file mode 100644 index 0000000000..9c990790a7 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/issuer_credential.rs @@ -0,0 +1,115 @@ +use crate::error::to_napi_err; +use napi_derive::napi; +use vcx::api_vcx::api_handle::issuer_credential; +use vcx::aries_vcx::messages::a2a::A2AMessage; +use vcx::serde_json::json; + +#[napi] +fn issuer_credential_deserialize(credential_data: String) -> napi::Result { + issuer_credential::from_string(&credential_data).map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_serialize(handle_credential: u32) -> napi::Result { + issuer_credential::to_string(handle_credential).map_err(to_napi_err) +} + +#[napi] +async fn issuer_credential_update_state_v2(handle_credential: u32, connection_handle: u32) -> napi::Result { + issuer_credential::update_state(handle_credential, None, connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn issuer_credential_update_state_with_message_v2( + handle_credential: u32, + connection_handle: u32, + message: String, +) -> napi::Result { + issuer_credential::update_state(handle_credential, Some(&message), connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_get_state(handle_credential: u32) -> napi::Result { + issuer_credential::get_state(handle_credential).map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_get_rev_reg_id(handle_credential: u32) -> napi::Result { + issuer_credential::get_rev_reg_id(handle_credential).map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_create(source_id: String) -> napi::Result { + issuer_credential::issuer_credential_create(source_id).map_err(to_napi_err) +} + +#[napi] +async fn issuer_credential_revoke_local(handle_credential: u32) -> napi::Result<()> { + issuer_credential::revoke_credential_local(handle_credential) + .await + .map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_is_revokable(handle_credential: u32) -> napi::Result { + issuer_credential::is_revokable(handle_credential).map_err(to_napi_err) +} + +#[napi] +async fn issuer_credential_send_credential(handle_credential: u32, handle_connection: u32) -> napi::Result { + issuer_credential::send_credential(handle_credential, handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn issuer_credential_send_offer_v2(handle_credential: u32, handle_connection: u32) -> napi::Result<()> { + issuer_credential::send_credential_offer_v2(handle_credential, handle_connection) + .await + .map_err(to_napi_err)?; + Ok(()) +} + +#[napi] +fn issuer_credential_mark_offer_msg_sent(handle_credential: u32) -> napi::Result<()> { + issuer_credential::mark_credential_offer_msg_sent(handle_credential).map_err(to_napi_err) +} + +#[napi] +async fn issuer_credential_build_offer_msg_v2( + credential_handle: u32, + cred_def_handle: u32, + rev_reg_handle: u32, + credential_json: String, + comment: Option, +) -> napi::Result<()> { + issuer_credential::build_credential_offer_msg_v2( + credential_handle, + cred_def_handle, + rev_reg_handle, + &credential_json, + comment.as_deref(), + ) + .await + .map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_get_offer_msg(credential_handle: u32) -> napi::Result { + let res: A2AMessage = issuer_credential::get_credential_offer_msg(credential_handle).map_err(to_napi_err)?; + Ok(json!(res).to_string()) +} + +#[napi] +fn issuer_credential_release(credential_handle: u32) -> napi::Result<()> { + issuer_credential::release(credential_handle).map_err(to_napi_err) +} + +#[napi] +fn issuer_credential_get_thread_id(credential_handle: u32) -> napi::Result { + issuer_credential::get_thread_id(credential_handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/ledger.rs b/wrappers/vcx-napi-rs/src/api/ledger.rs new file mode 100644 index 0000000000..5f2b4c29d7 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/ledger.rs @@ -0,0 +1,53 @@ +use napi_derive::napi; + +use crate::error::to_napi_err; +use vcx::api_vcx::api_global::ledger; +use vcx::serde_json::json; + +#[napi] +async fn get_ledger_author_agreement() -> napi::Result { + let res = ledger::ledger_get_txn_author_agreement().await.map_err(to_napi_err)?; + Ok(res) +} + +// todo: ideally time_of_acceptance is u64, but napi doesn't support u64 +#[napi] +fn set_active_txn_author_agreement_meta( + text: Option, + version: Option, + hash: Option, + acc_mech_type: String, + time_of_acceptance: u32, +) -> napi::Result<()> { + ledger::ledger_set_txn_author_agreement(text, version, hash, acc_mech_type, time_of_acceptance as u64) + .map_err(to_napi_err) +} + +#[napi] +async fn create_service( + target_did: String, + recipient_keys: Vec, + routing_keys: Vec, + endpoint: String, +) -> napi::Result { + let res = ledger::ledger_write_endpoint_legacy(&target_did, recipient_keys, routing_keys, endpoint) + .await + .map_err(to_napi_err)?; + Ok(json!(res).to_string()) +} + +#[napi] +async fn get_service_from_ledger(target_did: String) -> napi::Result { + let res = ledger::ledger_get_service(&target_did).await.map_err(to_napi_err)?; + Ok(json!(res).to_string()) +} + +#[napi] +async fn get_verkey_from_ledger(did: String) -> napi::Result { + ledger::get_verkey_from_ledger(&did).await.map_err(to_napi_err) +} + +#[napi] +async fn get_ledger_txn(seq_no: i32, submitter_did: Option) -> napi::Result { + ledger::get_ledger_txn(seq_no, submitter_did).await.map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/logging.rs b/wrappers/vcx-napi-rs/src/api/logging.rs new file mode 100644 index 0000000000..df560047f1 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/logging.rs @@ -0,0 +1,10 @@ +use napi_derive::napi; + +use vcx::aries_vcx::utils::test_logger::LibvcxDefaultLogger; + +use crate::error::ariesvcx_to_napi_err; + +#[napi] +pub fn init_default_logger(pattern: Option) -> napi::Result<()> { + LibvcxDefaultLogger::init(pattern).map_err(ariesvcx_to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/mediated_connection.rs b/wrappers/vcx-napi-rs/src/api/mediated_connection.rs new file mode 100644 index 0000000000..e6e646ebae --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/mediated_connection.rs @@ -0,0 +1,280 @@ +use napi::bindgen_prelude::Buffer; +use napi_derive::napi; +use vcx::api_vcx::api_handle::mediated_connection; +use vcx::api_vcx::api_handle::mediated_connection::parse_status_codes; + +use vcx::aries_vcx::protocols::connection::pairwise_info::PairwiseInfo; +use vcx::errors::error::{LibvcxError, LibvcxErrorKind}; +use vcx::serde_json; + +use crate::error::to_napi_err; + +#[napi] +pub fn mediated_connection_generate_public_invite(public_did: String, label: String) -> napi::Result { + trace!( + "mediated_connection_generate_public_invite >>> public_did: {:?}, label: {:?}", + public_did, + label + ); + mediated_connection::generate_public_invitation(&public_did, &label).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_get_pw_did(handle: u32) -> napi::Result { + trace!("mediated_connection_get_pw_did >>> handle: {:?}", handle); + mediated_connection::get_pw_did(handle).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_get_their_pw_did(handle: u32) -> napi::Result { + trace!("mediated_connection_get_their_pw_did >>> handle: {:?}", handle); + mediated_connection::get_their_pw_did(handle).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_get_thread_id(handle: u32) -> napi::Result { + trace!("mediated_connection_get_thread_id >>> handle: {:?}", handle); + mediated_connection::get_thread_id(handle).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_get_state(handle: u32) -> u32 { + trace!("mediated_connection_get_state >>> handle: {:?}", handle); + mediated_connection::get_state(handle) +} + +#[napi] +pub fn mediated_connection_get_source_id(handle: u32) -> napi::Result { + trace!("mediated_connection_get_source_id >>> handle: {:?}", handle); + mediated_connection::get_source_id(handle).map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_create(source_id: String) -> napi::Result { + trace!("mediated_connection_create >>> source_id: {:?}", source_id); + mediated_connection::create_connection(&source_id) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_create_with_invite(source_id: String, details: String) -> napi::Result { + trace!( + "mediated_connection_create_with_invite >>> source_id: {:?}, details: {:?}", + source_id, + details + ); + mediated_connection::create_connection_with_invite(&source_id, &details) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_send_message(handle: u32, msg: String) -> napi::Result<()> { + trace!( + "mediated_connection_send_message >>> handle: {:?}, msg: {:?}", + handle, + msg + ); + mediated_connection::send_generic_message(handle, &msg) + .await + .map(|_res| ()) + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_create_with_connection_request_v2( + request: String, + pw_info: String, +) -> napi::Result { + trace!( + "mediated_connection_create_with_connection_request_v2 >>> request: {:?}, pw_info: {:?}", + request, + pw_info + ); + let pw_info: PairwiseInfo = serde_json::from_str(&pw_info) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidJson, + format!("Cannot deserialize pw info: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + mediated_connection::create_with_request_v2(&request, pw_info) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_send_handshake_reuse(handle: u32, oob_msg: String) -> napi::Result<()> { + trace!( + "mediated_connection_send_handshake_reuse >>> handle: {:?}, oob_msg: {:?}", + handle, + oob_msg + ); + mediated_connection::send_handshake_reuse(handle, &oob_msg) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_update_state_with_message(handle: u32, message: String) -> napi::Result { + trace!( + "mediated_connection_update_state_with_message >>> handle: {:?}, message: {:?}", + handle, + message + ); + mediated_connection::update_state_with_message(handle, &message) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_handle_message(handle: u32, message: String) -> napi::Result<()> { + trace!( + "mediated_connection_handle_message >>> handle: {:?}, message: {:?}", + handle, + message + ); + mediated_connection::handle_message(handle, &message) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_update_state(handle: u32) -> napi::Result { + trace!("mediated_connection_update_state >>> handle: {:?}", handle); + mediated_connection::update_state(handle).await.map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_delete_connection(handle: u32) -> napi::Result<()> { + trace!("mediated_connection_delete_connection >>> handle: {:?}", handle); + mediated_connection::delete_connection(handle) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_connect(handle: u32) -> napi::Result<()> { + trace!("mediated_connection_connect >>> handle: {:?}", handle); + mediated_connection::connect(handle).await.map_err(to_napi_err)?; + Ok(()) +} + +#[napi] +pub fn mediated_connection_serialize(handle: u32) -> napi::Result { + trace!("mediated_connection_serialize >>> handle: {:?}", handle); + mediated_connection::to_string(handle).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_deserialize(connection_data: String) -> napi::Result { + trace!( + "mediated_connection_deserialize >>> connection_data: {:?}", + connection_data + ); + mediated_connection::from_string(&connection_data).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_release(handle: u32) -> napi::Result<()> { + trace!("mediated_connection_release >>> handle: {:?}", handle); + mediated_connection::release(handle).map_err(to_napi_err) +} + +#[napi] +pub fn mediated_connection_invite_details(handle: u32) -> napi::Result { + trace!("mediated_connection_invite_details >>> handle: {:?}", handle); + mediated_connection::get_invite_details(handle).map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_send_ping(handle: u32, comment: Option) -> napi::Result<()> { + trace!( + "mediated_connection_send_ping >>> handle: {:?}, comment: {:?}", + handle, + comment + ); + mediated_connection::send_ping(handle, comment.as_deref()) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_send_discovery_features( + handle: u32, + query: Option, + comment: Option, +) -> napi::Result<()> { + trace!( + "mediated_connection_send_discovery_features >>> handle: {:?}, query: {:?}, comment: {:?}", + handle, + query, + comment + ); + mediated_connection::send_discovery_features(handle, query.as_deref(), comment.as_deref()) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_info(handle: u32) -> napi::Result { + trace!("mediated_connection_info >>> handle: {:?}", handle); + mediated_connection::get_connection_info(handle) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_messages_download( + conn_handles: Vec, + status_codes: Option, + uids: Option, +) -> napi::Result { + trace!( + "mediated_connection_messages_download >>> conn_handles: {:?}, status_codes: {:?}, uids: {:?}", + conn_handles, + status_codes, + uids + ); + let status_codes = if let Some(status_codes) = status_codes { + let v: Vec<&str> = status_codes.split(',').collect(); + let v = v.iter().map(|s| s.to_string()).collect::>(); + Some(v) + } else { + None + }; + + let status_codes = parse_status_codes(status_codes).map_err(to_napi_err)?; + + let uids = if let Some(uids) = uids { + let v: Vec<&str> = uids.split(',').collect(); + let v = v.iter().map(|s| s.to_string()).collect::>(); + Some(v) + } else { + None + }; + + mediated_connection::download_messages(conn_handles, status_codes, uids) + .await + .map(|msgs| serde_json::json!(msgs).to_string()) + .map_err(to_napi_err) +} + +#[napi] +pub async fn mediated_connection_sign_data(handle: u32, data: Buffer) -> napi::Result { + trace!("mediated_connection_sign_data >>> handle: {:?}", handle); + let res = mediated_connection::sign_data(handle, &data.to_vec()) + .await + .map_err(to_napi_err)?; + Ok(Buffer::from(res)) +} + +#[napi] +pub async fn mediated_connection_verify_signature(handle: u32, data: Buffer, signature: Buffer) -> napi::Result { + trace!("mediated_connection_verify_signature >>> handle: {:?}", handle); + mediated_connection::verify_signature(handle, &data.to_vec(), &signature.to_vec()) + .await + .map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/mod.rs b/wrappers/vcx-napi-rs/src/api/mod.rs new file mode 100644 index 0000000000..aab8af88a6 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/mod.rs @@ -0,0 +1,18 @@ +pub mod agency_client; +pub mod agent; +pub mod credential; +pub mod credential_definition; +pub mod disclosed_proof; +pub mod issuer_credential; +pub mod ledger; +pub mod logging; +pub mod mediated_connection; +pub mod out_of_band_receiver; +pub mod out_of_band_sender; +pub mod pool; +pub mod proof; +pub mod revocation_registry; +pub mod schema; +pub mod testing; +pub mod utils; +pub mod wallet; diff --git a/wrappers/vcx-napi-rs/src/api/out_of_band_receiver.rs b/wrappers/vcx-napi-rs/src/api/out_of_band_receiver.rs new file mode 100644 index 0000000000..ff51a33c5d --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/out_of_band_receiver.rs @@ -0,0 +1,47 @@ +use napi_derive::napi; +use vcx::api_vcx::api_handle::out_of_band; + +use crate::error::to_napi_err; + +#[napi] +fn out_of_band_receiver_create(msg: String) -> napi::Result { + out_of_band::create_out_of_band_msg_from_msg(&msg).map_err(to_napi_err) +} + +#[napi] +fn out_of_band_receiver_extract_message(handle: u32) -> napi::Result { + out_of_band::extract_a2a_message(handle).map_err(to_napi_err) +} + +#[napi] +pub async fn out_of_band_receiver_connection_exists(handle: u32, conn_handles: Vec) -> napi::Result { + out_of_band::connection_exists(handle, &conn_handles) + .await + .map(|res| res.0) + .map_err(to_napi_err) +} + +#[napi] +pub async fn out_of_band_receiver_build_connection(handle: u32) -> napi::Result { + out_of_band::build_connection(handle).await.map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_receiver_get_thread_id(handle: u32) -> napi::Result { + out_of_band::get_thread_id_receiver(handle).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_receiver_serialize(handle: u32) -> napi::Result { + out_of_band::to_string_receiver(handle).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_receiver_deserialize(oob_data: String) -> napi::Result { + out_of_band::from_string_receiver(&oob_data).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_receiver_release(handle: u32) -> napi::Result<()> { + out_of_band::release_receiver(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/out_of_band_sender.rs b/wrappers/vcx-napi-rs/src/api/out_of_band_sender.rs new file mode 100644 index 0000000000..15e44c39cc --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/out_of_band_sender.rs @@ -0,0 +1,49 @@ +use napi_derive::napi; +use vcx::api_vcx::api_handle::out_of_band; + +use crate::error::to_napi_err; + +#[napi] +pub fn out_of_band_sender_create(config: String) -> napi::Result { + out_of_band::create_out_of_band(&config).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_append_message(handle: u32, msg: String) -> napi::Result<()> { + out_of_band::append_message(handle, &msg).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_append_service(handle: u32, service: String) -> napi::Result<()> { + out_of_band::append_service(handle, &service).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_append_service_did(handle: u32, did: String) -> napi::Result<()> { + out_of_band::append_service_did(handle, &did).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_to_message(handle: u32) -> napi::Result { + out_of_band::to_a2a_message(handle).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_get_thread_id(handle: u32) -> napi::Result { + out_of_band::get_thread_id_sender(handle).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_serialize(handle: u32) -> napi::Result { + out_of_band::to_string_sender(handle).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_deserialize(oob_data: String) -> napi::Result { + out_of_band::from_string_sender(&oob_data).map_err(to_napi_err) +} + +#[napi] +pub fn out_of_band_sender_release(handle: u32) -> napi::Result<()> { + out_of_band::release_sender(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/pool.rs b/wrappers/vcx-napi-rs/src/api/pool.rs new file mode 100644 index 0000000000..4e4cc803a1 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/pool.rs @@ -0,0 +1,23 @@ +use napi_derive::napi; +use vcx::api_vcx::api_global::pool; +use vcx::aries_vcx::indy::ledger::pool::PoolConfig; +use vcx::errors::error::{LibvcxError, LibvcxErrorKind}; +use vcx::serde_json; + +use crate::error::to_napi_err; + +// implement fn open_main_pool and close_main_pool using layer functions, make sure the function +// is async if the respective layer is async +#[napi] +async fn open_main_pool(pool_config: String) -> napi::Result<()> { + let pool_config = serde_json::from_str::(&pool_config) + .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidJson, format!("Serialization error: {:?}", err))) + .map_err(to_napi_err)?; + pool::open_main_pool(&pool_config).await.map_err(to_napi_err)?; + Ok(()) +} + +#[napi] +async fn close_main_pool() -> napi::Result<()> { + pool::close_main_pool().await.map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/proof.rs b/wrappers/vcx-napi-rs/src/api/proof.rs new file mode 100644 index 0000000000..264166cadc --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/proof.rs @@ -0,0 +1,95 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_handle::proof; + +use crate::error::to_napi_err; + +#[napi] +async fn proof_create( + source_id: String, + requested_attrs: String, + requested_predicates: String, + revocation_details: String, + name: String, +) -> napi::Result { + proof::create_proof( + source_id, + requested_attrs, + requested_predicates, + revocation_details, + name, + ) + .await + .map_err(to_napi_err) +} + +#[napi] +fn proof_get_proof_msg(handle: u32) -> napi::Result { + proof::get_presentation_msg(handle).map_err(to_napi_err) +} + +#[napi] +fn proof_release(handle: u32) -> napi::Result<()> { + proof::release(handle).map_err(to_napi_err) +} + +#[napi] +async fn proof_send_request(handle_proof: u32, handle_connection: u32) -> napi::Result<()> { + proof::send_proof_request(handle_proof, handle_connection) + .await + .map_err(to_napi_err) +} + +#[napi] +fn proof_get_request_msg(handle: u32) -> napi::Result { + proof::get_presentation_request_msg(handle).map_err(to_napi_err) +} + +#[napi] +fn proof_serialize(handle: u32) -> napi::Result { + proof::to_string(handle).map_err(to_napi_err) +} + +#[napi] +fn proof_deserialize(data: String) -> napi::Result { + proof::from_string(&data).map_err(to_napi_err) +} + +// todo: fix argument order +#[napi] +async fn v2_proof_update_state(handle_proof: u32, connection_handle: u32) -> napi::Result { + proof::update_state(handle_proof, None, connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn v2_proof_update_state_with_message( + handle_proof: u32, + message: String, + connection_handle: u32, +) -> napi::Result { + proof::update_state(handle_proof, Some(&message), connection_handle) + .await + .map_err(to_napi_err) +} + +#[napi] +fn proof_get_state(handle: u32) -> napi::Result { + proof::get_state(handle).map_err(to_napi_err) +} + +#[napi] +fn proof_get_proof_state(handle: u32) -> napi::Result { + proof::get_proof_state(handle).map_err(to_napi_err) +} + +#[napi] +fn proof_get_thread_id(handle: u32) -> napi::Result { + proof::get_thread_id(handle).map_err(to_napi_err) +} + +#[napi] +fn mark_presentation_request_msg_sent(handle: u32) -> napi::Result<()> { + proof::mark_presentation_request_msg_sent(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/revocation_registry.rs b/wrappers/vcx-napi-rs/src/api/revocation_registry.rs new file mode 100644 index 0000000000..aff05f6408 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/revocation_registry.rs @@ -0,0 +1,55 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_handle::revocation_registry; +use vcx::api_vcx::api_handle::revocation_registry::RevocationRegistryConfig; +use vcx::errors::error::{LibvcxError, LibvcxErrorKind}; +use vcx::serde_json; + +use crate::error::to_napi_err; + +#[napi] +async fn revocation_registry_create(config: String) -> napi::Result { + let config = serde_json::from_str::(&config) + .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidJson, format!("Serialization error: {:?}", err))) + .map_err(to_napi_err)?; + revocation_registry::create(config).await.map_err(to_napi_err) +} + +#[napi] +async fn revocation_registry_publish(handle: u32, tails_url: String) -> napi::Result { + revocation_registry::publish(handle, &tails_url) + .await + .map_err(to_napi_err) +} + +#[napi] +async fn revocation_registry_publish_revocations(handle: u32) -> napi::Result<()> { + revocation_registry::publish_revocations(handle) + .await + .map_err(to_napi_err) +} + +#[napi] +fn revocation_registry_get_rev_reg_id(handle: u32) -> napi::Result { + revocation_registry::get_rev_reg_id(handle).map_err(to_napi_err) +} + +#[napi] +fn revocation_registry_get_tails_hash(handle: u32) -> napi::Result { + revocation_registry::get_tails_hash(handle).map_err(to_napi_err) +} + +#[napi] +fn revocation_registry_serialize(handle: u32) -> napi::Result { + revocation_registry::to_string(handle).map_err(to_napi_err) +} + +#[napi] +fn revocation_registry_deserialize(data: String) -> napi::Result { + revocation_registry::from_string(&data).map_err(to_napi_err) +} + +#[napi] +fn revocation_registry_release(handle: u32) -> napi::Result<()> { + revocation_registry::release(handle).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/schema.rs b/wrappers/vcx-napi-rs/src/api/schema.rs new file mode 100644 index 0000000000..0555e535b4 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/schema.rs @@ -0,0 +1,51 @@ +use napi_derive::napi; + +use crate::error::to_napi_err; +use vcx::api_vcx::api_handle::schema; + +#[napi] +fn schema_get_attributes(_source_id: String, _schema_id: String) -> napi::Result<()> { + unimplemented!("Not implemented in napi wrapper yet") +} + +#[napi] +fn schema_prepare_for_endorser() -> napi::Result<()> { + unimplemented!("Not implemented in napi wrapper yet") +} + +#[napi] +async fn schema_create(source_id: String, name: String, version: String, data: String) -> napi::Result { + schema::create_and_publish_schema(&source_id, name, version, data) + .await + .map_err(to_napi_err) +} + +#[napi] +fn schema_get_schema_id(handle_schema: u32) -> napi::Result { + schema::get_schema_id(handle_schema).map_err(to_napi_err) +} + +#[napi] +fn schema_deserialize(serialized: String) -> napi::Result { + schema::from_string(&serialized).map_err(to_napi_err) +} + +#[napi] +fn schema_serialize(handle_schema: u32) -> napi::Result { + schema::to_string(handle_schema).map_err(to_napi_err) +} + +#[napi] +fn schema_release(handle_schema: u32) -> napi::Result<()> { + schema::release(handle_schema).map_err(to_napi_err) +} + +#[napi] +async fn schema_update_state(handle_schema: u32) -> napi::Result { + schema::update_state(handle_schema).await.map_err(to_napi_err) +} + +#[napi] +fn schema_get_state(handle_schema: u32) -> napi::Result { + schema::get_state(handle_schema).map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/api/testing.rs b/wrappers/vcx-napi-rs/src/api/testing.rs new file mode 100644 index 0000000000..2cb2f9b4ef --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/testing.rs @@ -0,0 +1,11 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_global::settings; + +use crate::error::to_napi_err; + +#[napi] +pub fn enable_mocks() -> ::napi::Result<()> { + settings::enable_mocks().map_err(to_napi_err)?; + Ok(()) +} diff --git a/wrappers/vcx-napi-rs/src/api/utils.rs b/wrappers/vcx-napi-rs/src/api/utils.rs new file mode 100644 index 0000000000..2bb18f7129 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/utils.rs @@ -0,0 +1,15 @@ +use napi_derive::napi; + +use vcx::api_vcx::api_global::state::state_vcx_shutdown; +use vcx::api_vcx::api_global::VERSION_STRING; + +#[napi] +pub fn shutdown(delete_all: Option) -> ::napi::Result<()> { + state_vcx_shutdown(delete_all.unwrap_or(false)); + Ok(()) +} + +#[napi] +pub fn get_version() -> ::napi::Result { + Ok(VERSION_STRING.clone()) +} diff --git a/wrappers/vcx-napi-rs/src/api/wallet.rs b/wrappers/vcx-napi-rs/src/api/wallet.rs new file mode 100644 index 0000000000..dddb3f8838 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/api/wallet.rs @@ -0,0 +1,116 @@ +use napi::bindgen_prelude::Buffer; +use napi_derive::napi; +use vcx::api_vcx::api_global::settings::settings_init_issuer_config; +use vcx::api_vcx::api_global::{ledger, wallet}; +use vcx::aries_vcx::indy::wallet::{IssuerConfig, RestoreWalletConfigs, WalletConfig}; +use vcx::errors::error::{LibvcxError, LibvcxErrorKind}; +use vcx::serde_json; +use vcx::serde_json::json; + +use crate::error::to_napi_err; + +#[napi] +pub async fn wallet_open_as_main(wallet_config: String) -> napi::Result { + let wallet_config = serde_json::from_str::(&wallet_config) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Serialization error: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + let handle = wallet::open_as_main_wallet(&wallet_config).await.map_err(to_napi_err)?; + Ok(handle.0) +} + +#[napi] +pub async fn wallet_create_main(wallet_config: String) -> napi::Result<()> { + let wallet_config = serde_json::from_str::(&wallet_config) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Serialization error: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + wallet::create_main_wallet(&wallet_config).await.map_err(to_napi_err) +} + +#[napi] +pub async fn wallet_close_main() -> napi::Result<()> { + wallet::close_main_wallet().await.map_err(to_napi_err) +} + +#[napi] +pub async fn vcx_init_issuer_config(config: String) -> napi::Result<()> { + let config = serde_json::from_str::(&config) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Serialization error: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + settings_init_issuer_config(&config).map_err(to_napi_err) +} + +#[napi] +pub async fn configure_issuer_wallet(enterprise_seed: String) -> napi::Result { + let res = wallet::wallet_configure_issuer(&enterprise_seed) + .await + .map_err(to_napi_err)?; + Ok(json!(res).to_string()) +} + +#[napi] +pub async fn unpack(data: Buffer) -> napi::Result { + wallet::wallet_unpack_message_to_string(&data.to_vec()) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn create_pairwise_info() -> napi::Result { + let res = wallet::wallet_create_pairwise_did().await.map_err(to_napi_err)?; + Ok(json!(res).to_string()) +} + +#[napi] +pub async fn wallet_import(config: String) -> napi::Result<()> { + let config = serde_json::from_str::(&config) + .map_err(|err| { + LibvcxError::from_msg( + LibvcxErrorKind::InvalidConfiguration, + format!("Serialization error: {:?}", err), + ) + }) + .map_err(to_napi_err)?; + wallet::wallet_import(&config).await.map_err(to_napi_err) +} + +#[napi] +pub async fn wallet_export(path: String, backup_key: String) -> napi::Result<()> { + wallet::export_main_wallet(&path, &backup_key) + .await + .map_err(to_napi_err) +} + +#[napi] +pub async fn get_verkey_from_wallet(did: String) -> napi::Result { + wallet::key_for_local_did(&did).await.map_err(to_napi_err) +} + +#[napi] +pub async fn rotate_verkey(did: String) -> napi::Result<()> { + ledger::rotate_verkey(&did).await.map_err(to_napi_err) +} + +#[napi] +pub async fn rotate_verkey_start(did: String) -> napi::Result { + wallet::replace_did_keys_start(&did).await.map_err(to_napi_err) +} + +#[napi] +pub async fn rotate_verkey_apply(did: String, temp_vk: String) -> napi::Result<()> { + wallet::rotate_verkey_apply(&did, &temp_vk).await.map_err(to_napi_err) +} diff --git a/wrappers/vcx-napi-rs/src/error.rs b/wrappers/vcx-napi-rs/src/error.rs new file mode 100644 index 0000000000..f758ab4ee4 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/error.rs @@ -0,0 +1,17 @@ +use vcx::aries_vcx::errors::error::AriesVcxError; +use vcx::errors::error::LibvcxError; +use vcx::serde_json::json; + +pub fn to_napi_err(err: LibvcxError) -> napi::Error { + let reason = json!({ + "vcxErrKind": err.kind().to_string(), + "vcxErrCode": u32::from(err.kind()), + "vcxErrMessage": err.msg, + }) + .to_string(); + napi::Error::new(napi::Status::GenericFailure, format!("vcx_err_json:{reason}")) +} + +pub fn ariesvcx_to_napi_err(err: AriesVcxError) -> napi::Error { + to_napi_err(LibvcxError::from(err)) +} diff --git a/wrappers/vcx-napi-rs/src/lib.rs b/wrappers/vcx-napi-rs/src/lib.rs new file mode 100644 index 0000000000..e2699a6428 --- /dev/null +++ b/wrappers/vcx-napi-rs/src/lib.rs @@ -0,0 +1,8 @@ +#![allow(clippy::unnecessary_to_owned)] + +#[macro_use] +extern crate log; +extern crate core; + +pub mod api; +pub mod error; diff --git a/wrappers/vcx-napi-rs/tsconfig.json b/wrappers/vcx-napi-rs/tsconfig.json new file mode 100644 index 0000000000..605f4bd4c7 --- /dev/null +++ b/wrappers/vcx-napi-rs/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "declaration": true, + "downlevelIteration": true, + "importHelpers": true, + "allowJs": true, + "module": "CommonJS", + "moduleResolution": "node", + "newLine": "LF", + "noEmitHelpers": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "skipLibCheck": true, + "suppressImplicitAnyIndexErrors": true, + "suppressExcessPropertyErrors": true, + "forceConsistentCasingInFileNames": true, + "preserveSymlinks": true, + "target": "ES2015", + "sourceMap": true, + "esModuleInterop": true, + "stripInternal": true, + "resolveJsonModule": true, + "importsNotUsedAsValues": "remove", + "outDir": "scripts", + "lib": ["dom", "DOM.Iterable", "ES2019", "ES2020", "esnext"], + "outDir": "./dist", + "target": "ES2018", + "skipLibCheck": false + }, + "include": ["."], + "exclude": ["dist", "node_modules"] +}