From d0a54556fa62cddda6be091b6f091655c77b49f3 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 21:43:05 +0100 Subject: [PATCH 01/19] fix(sev-snp-utils-sdk): LIT-2841 - Fix up test file for `sev-snp-utils-sdk` - Remove `@ts-nocheck` pragma - Fix two test cases that were being called without `cert` as an argument (error was hidden by `@ts-nocheck` pragma) - Fix unnecessary TextEncoder/TextDecoder injection -- this is done by our jest config - Use `cross-fetch` to ponyfill fetch - Remove unused imports --- .../src/lib/sev-snp-utils-sdk.spec.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/sev-snp-utils-sdk/src/lib/sev-snp-utils-sdk.spec.ts b/packages/sev-snp-utils-sdk/src/lib/sev-snp-utils-sdk.spec.ts index 4ec4ebd755..e477bc6f03 100644 --- a/packages/sev-snp-utils-sdk/src/lib/sev-snp-utils-sdk.spec.ts +++ b/packages/sev-snp-utils-sdk/src/lib/sev-snp-utils-sdk.spec.ts @@ -1,13 +1,6 @@ -// @ts-nocheck -import { TextEncoder, TextDecoder } from 'util'; -import * as fetch from 'node-fetch'; - -global.TextEncoder = TextEncoder; -// @ts-ignore -global.TextDecoder = TextDecoder; +import fetch from 'cross-fetch'; import * as sevSnpUtilsSdk from './sev-snp-utils-sdk'; -import { uint8arrayFromString } from '../../../uint8arrays/src/lib/uint8arrays'; // a valid vcek url returned by the get_vcek_url function run on the VALID_REPORT below const VALID_REPORT_VCEK_URL = @@ -39,7 +32,7 @@ describe('sevSnpUtilsSdk', () => { await sevSnpUtilsSdk.initWasmSevSnpUtilsSdk(); const certData = await fetch(VALID_REPORT_VCEK_URL); cert = new Uint8Array(await certData.arrayBuffer()); - }); + }, 10000); // Sometimes this step takes more than the default 5000ms as init'ing wasm is a hefty task it('should verify an attestation report', async () => { let verified = false; @@ -57,10 +50,10 @@ describe('sevSnpUtilsSdk', () => { it('should fail to verify a corrupt attestation report', async () => { let verified = false; try { - await sevSnpUtilsSdk.verify_attestation_report(CORRUPT_REPORT); + await sevSnpUtilsSdk.verify_attestation_report(CORRUPT_REPORT, cert); verified = true; } catch (e) { - console.error(e); + console.info(e); } // assert @@ -70,10 +63,10 @@ describe('sevSnpUtilsSdk', () => { it('should fail to verify an attestation report with bad sigs', async () => { let verified = false; try { - await sevSnpUtilsSdk.verify_attestation_report(BAD_SIG_REPORT); + await sevSnpUtilsSdk.verify_attestation_report(BAD_SIG_REPORT, cert); verified = true; } catch (e) { - console.error(e); + console.info(e); } // assert From ed3806a6bc8fc792f29e126996cbf180395ee967 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 21:56:25 +0100 Subject: [PATCH 02/19] chore(global): LIT-2841 - Replace explicit `node-fetch` dep with `cross-fetch` and remove soon-to-be-unused `ipfs-http-client` and `ipfs-unixfs-importer` deps --- package.json | 10 +- yarn.lock | 575 +++++++-------------------------------------------- 2 files changed, 78 insertions(+), 507 deletions(-) diff --git a/package.json b/package.json index fe5850d4e3..0a68a8662f 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "commander": "^9.4.0", "concurrently": "^7.4.0", "core-js": "^3.6.5", + "cross-fetch": "^3.1.4", "crypto-browserify": "^3.12.0", "cypress-wait-until": "^1.7.2", "cypress-watch-and-reload": "^1.10.3", @@ -120,15 +121,12 @@ "find-config": "^1.0.0", "g": "^2.0.1", "https-browserify": "^1.0.0", - "ipfs-http-client": "56.0.0", - "ipfs-unixfs-importer": "^12.0.0", "jose": "^4.14.4", "jszip": "^3.10.1", "micromodal": "^0.4.10", "multiformats": "^9.7.1", "nanoid": "3.3.4", "next": "13.3.0", - "node-fetch": "^2.6.1", "react": "18.0.0", "react-dom": "18.0.0", "regenerator-runtime": "0.13.7", @@ -152,6 +150,8 @@ "@nx/jest": "17.3.0", "@nx/js": "17.3.0", "@nx/linter": "17.3.0", + "@nx/next": "17.3.0", + "@nx/node": "17.3.0", "@nx/plugin": "17.3.0", "@nx/react": "17.3.0", "@nx/web": "17.3.0", @@ -199,9 +199,7 @@ "ts-jest": "29.1.2", "ts-node": "10.9.1", "typedoc": "^0.23.10", - "typescript": "~4.7.2", - "@nx/next": "17.3.0", - "@nx/node": "17.3.0" + "typescript": "~4.7.2" }, "workspaces": [ "packages/*" diff --git a/yarn.lock b/yarn.lock index 85becec924..9493696879 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27,11 +27,6 @@ rxjs "7.8.1" source-map "0.7.4" -"@assemblyscript/loader@^0.9.4": - version "0.9.4" - resolved "https://registry.yarnpkg.com/@assemblyscript/loader/-/loader-0.9.4.tgz#a483c54c1253656bb33babd464e3154a173e1577" - integrity sha512-HazVq9zwTVwGmqdwYzu7WyQ6FQVZ7SwET0KKQuKm55jD0IfUpZgN0OPIiZG3zV1iSrVYcN0bdwLRXI/VNCYsUA== - "@async-generators/from-emitter@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@async-generators/from-emitter/-/from-emitter-0.3.0.tgz#3496bf2a25f40ddbf2bcf5873ae3ceb3f4aa2dc4" @@ -2062,44 +2057,6 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== -"@ipld/dag-cbor@^6.0.3": - version "6.0.15" - resolved "https://registry.yarnpkg.com/@ipld/dag-cbor/-/dag-cbor-6.0.15.tgz#aebe7a26c391cae98c32faedb681b1519e3d2372" - integrity sha512-Vm3VTSTwlmGV92a3C5aeY+r2A18zbH2amehNhsX8PBa3muXICaWrN8Uri85A5hLH7D7ElhE8PdjxD6kNqUmTZA== - dependencies: - cborg "^1.5.4" - multiformats "^9.5.4" - -"@ipld/dag-cbor@^7.0.0": - version "7.0.3" - resolved "https://registry.yarnpkg.com/@ipld/dag-cbor/-/dag-cbor-7.0.3.tgz#aa31b28afb11a807c3d627828a344e5521ac4a1e" - integrity sha512-1VVh2huHsuohdXC1bGJNE8WR72slZ9XE2T3wbBBq31dm7ZBatmKLLxrB+XAqafxfRFjv08RZmj/W/ZqaM13AuA== - dependencies: - cborg "^1.6.0" - multiformats "^9.5.4" - -"@ipld/dag-json@^8.0.1": - version "8.0.11" - resolved "https://registry.yarnpkg.com/@ipld/dag-json/-/dag-json-8.0.11.tgz#8d30cc2dfacb0aef04d327465d3df91e79e8b6ce" - integrity sha512-Pea7JXeYHTWXRTIhBqBlhw7G53PJ7yta3G/sizGEZyzdeEwhZRr0od5IQ0r2ZxOt1Do+2czddjeEPp+YTxDwCA== - dependencies: - cborg "^1.5.4" - multiformats "^9.5.4" - -"@ipld/dag-pb@^2.1.3": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@ipld/dag-pb/-/dag-pb-2.1.18.tgz#12d63e21580e87c75fd1a2c62e375a78e355c16f" - integrity sha512-ZBnf2fuX9y3KccADURG5vb9FaOeMjFkCrNysB0PtftME/4iCTjxfaLoNq/IAh5fTqUOMXvryN6Jyka4ZGuMLIg== - dependencies: - multiformats "^9.5.4" - -"@ipld/dag-pb@^4.0.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@ipld/dag-pb/-/dag-pb-4.1.0.tgz#4ebec92eeb9e8f317b8ef971221c6dac7b12b302" - integrity sha512-LJU451Drqs5zjFm7jI4Hs3kHlilOqkjcSfPiQgVsZnWaYb2C7YdfhnclrVn/X+ucKejlU9BL3+gXFCZUXkMuCg== - dependencies: - multiformats "^13.1.0" - "@isaacs/cliui@^8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" @@ -3382,14 +3339,6 @@ "@motionone/dom" "^10.16.4" tslib "^2.3.1" -"@multiformats/murmur3@^2.0.0": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@multiformats/murmur3/-/murmur3-2.1.8.tgz#81c1c15b6391109f3febfca4b3205196615a04e9" - integrity sha512-6vId1C46ra3R1sbJUOFCZnsUIveR9oF20yhPmAFxPm0JfrX3/ZRCgP3YDrBzlGoEppOXnA9czHeYc0T9mB6hbA== - dependencies: - multiformats "^13.0.0" - murmurhash3js-revisited "^3.0.0" - "@mysten/bcs@0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@mysten/bcs/-/bcs-0.7.3.tgz#b2e4558a8feb9fd3a0dc2ff4e94c37e1f8a7c7e5" @@ -5762,7 +5711,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== -"@types/minimatch@^3.0.3", "@types/minimatch@^3.0.4": +"@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== @@ -7033,11 +6982,6 @@ ansistyles@~0.1.3: resolved "https://registry.yarnpkg.com/ansistyles/-/ansistyles-0.1.3.tgz#5de60415bda071bb37127854c864f41b23254539" integrity sha512-6QWEyvMgIXX0eO972y7YPBLSBsq7UWKFAoNNTLGaOJ9bstcEL9sCbcjf96dVfNDdUsRoGOK82vWFJlKApXds7g== -any-signal@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/any-signal/-/any-signal-3.0.1.tgz#49cae34368187a3472e31de28fb5cb1430caa9a6" - integrity sha512-xgZgJtKEa9YmDqXodIgl7Fl1C8yNXr8w6gXjqK3LW4GcEiYT+6AQfJSE/8SPsEpLLmcvbv8YU+qet94UewHxqg== - anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -8491,27 +8435,11 @@ bl@^4.0.3, bl@^4.1.0: inherits "^2.0.4" readable-stream "^3.4.0" -bl@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-5.1.0.tgz#183715f678c7188ecef9fe475d90209400624273" - integrity sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ== - dependencies: - buffer "^6.0.3" - inherits "^2.0.4" - readable-stream "^3.4.0" - blakejs@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -blob-to-it@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/blob-to-it/-/blob-to-it-1.0.4.tgz#f6caf7a4e90b7bb9215fa6a318ed6bd8ad9898cb" - integrity sha512-iCmk0W4NdbrWgRRuxOriU8aM5ijeVLI61Zulsmg/lUHNr7pYjoj+U77opLefNagevtrrbMt3JQ5Qip7ar178kA== - dependencies: - browser-readablestream-to-it "^1.0.3" - blob-util@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/blob-util/-/blob-util-2.0.2.tgz#3b4e3c281111bb7f11128518006cdc60b403a1eb" @@ -8673,11 +8601,6 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browser-readablestream-to-it@^1.0.0, browser-readablestream-to-it@^1.0.1, browser-readablestream-to-it@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/browser-readablestream-to-it/-/browser-readablestream-to-it-1.0.3.tgz#ac3e406c7ee6cdf0a502dd55db33bab97f7fba76" - integrity sha512-+12sHB+Br8HIh6VAMVEG5r3UXCyESIgDW7kzk3BjIXa43DVqVwL7GC5TW3jeh+72dtcH99pPVpw0X8i0jt+/kw== - browserify-aes@^1.0.4, browserify-aes@^1.0.6, browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -8851,7 +8774,7 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer@6.0.3, buffer@^6.0.1, buffer@^6.0.3: +buffer@6.0.3, buffer@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== @@ -9177,11 +9100,6 @@ cbor@^8.1.0: dependencies: nofilter "^3.1.0" -cborg@^1.5.4, cborg@^1.6.0: - version "1.10.2" - resolved "https://registry.yarnpkg.com/cborg/-/cborg-1.10.2.tgz#83cd581b55b3574c816f82696307c7512db759a1" - integrity sha512-b3tFPA9pUr2zCUiCfRd2+wok2/LBSNUMKOuRRok+WlvvAgEt/PlbgPTsZUcwCOs53IJvLgTp0eotwtosE6njug== - chalk-template@0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/chalk-template/-/chalk-template-0.4.0.tgz#692c034d0ed62436b9062c1707fadcd0f753204b" @@ -10647,14 +10565,6 @@ d@1, d@^1.0.1, d@^1.0.2: es5-ext "^0.10.64" type "^2.7.2" -dag-jose@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/dag-jose/-/dag-jose-1.0.0.tgz#52e42d70cb5bee31ae4e8e3ab860615568d7ad73" - integrity sha512-U0b/YsIPBp6YZNTFrVjwLZAlY3qGRxZTIEcM/CcQmrVrCWq9MWQq9pheXVSPLIhF4SNwzp2SikPva4/BIrJY+g== - dependencies: - "@ipld/dag-cbor" "^6.0.3" - multiformats "^9.0.2" - damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -11173,15 +11083,6 @@ dir-glob@^3.0.0, dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -dns-over-http-resolver@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/dns-over-http-resolver/-/dns-over-http-resolver-1.2.3.tgz#194d5e140a42153f55bb79ac5a64dd2768c36af9" - integrity sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA== - dependencies: - debug "^4.3.1" - native-fetch "^3.0.0" - receptacle "^1.3.2" - dns-packet@^5.2.2: version "5.6.1" resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.6.1.tgz#ae888ad425a9d1478a0674256ab866de1012cf2f" @@ -11439,13 +11340,6 @@ ejs@^3.1.7: dependencies: jake "^10.8.5" -electron-fetch@^1.7.2: - version "1.9.1" - resolved "https://registry.yarnpkg.com/electron-fetch/-/electron-fetch-1.9.1.tgz#e28bfe78d467de3f2dec884b1d72b8b05322f30f" - integrity sha512-M9qw6oUILGVrcENMSRRefE1MbHPIz0h79EKIeJWK9v563aT9Qkh8aEHPO1H5vi970wPirNY+jO9OpFoLiMsMGA== - dependencies: - encoding "^0.1.13" - electron-to-chromium@^1.3.47, electron-to-chromium@^1.4.668: version "1.4.711" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.711.tgz#f9fd04007878cc27ac327d5c6ce300f8b516f635" @@ -13004,7 +12898,7 @@ ethers@^4.0.32, ethers@^4.0.45, ethers@^4.0.47: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@^5.0.13, ethers@^5.1.4, ethers@^5.7.1, ethers@^5.7.2, "ethersv5@npm:ethers@^5.0.32": +ethers@^5.0.13, ethers@^5.1.4, ethers@^5.7.1, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -13049,6 +12943,42 @@ etherscan-api@^10.2.0: gh-pages "4.0.0" querystring "0.2.1" +"ethersv5@npm:ethers@^5.0.32": + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" @@ -13367,11 +13297,6 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-fifo@^1.0.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" - integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== - fast-glob@3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" @@ -14044,11 +13969,6 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2, get-intrinsic@ has-symbols "^1.0.3" hasown "^2.0.0" -get-iterator@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-iterator/-/get-iterator-1.0.2.tgz#cd747c02b4c084461fac14f48f6b45a80ed25c82" - integrity sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg== - get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" @@ -14528,14 +14448,6 @@ h3@^1.10.2, h3@^1.11.1: uncrypto "^0.1.3" unenv "^1.9.0" -hamt-sharding@^3.0.0: - version "3.0.6" - resolved "https://registry.yarnpkg.com/hamt-sharding/-/hamt-sharding-3.0.6.tgz#3643107a3021af66ac95684aec87b196add5ba57" - integrity sha512-nZeamxfymIWLpVcAN0CRrb7uVq3hCOGj9IcL6NMA6VVCVWqj+h9Jo/SmaWuS92AEDf1thmHsM5D5c70hM3j2Tg== - dependencies: - sparse-array "^1.3.1" - uint8arrays "^5.0.1" - handle-thing@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -15381,20 +15293,6 @@ interface-blockstore@^4.0.0: interface-store "^3.0.0" multiformats "^11.0.0" -interface-datastore@^6.0.2: - version "6.1.1" - resolved "https://registry.yarnpkg.com/interface-datastore/-/interface-datastore-6.1.1.tgz#5150a00de2e7513eaadba58bcafd059cb50004c1" - integrity sha512-AmCS+9CT34pp2u0QQVXjKztkuq3y5T+BIciuiHDDtDZucZD8VudosnSdUyXJV6IsRkN5jc4RFDhCk1O6Q3Gxjg== - dependencies: - interface-store "^2.0.2" - nanoid "^3.0.2" - uint8arrays "^3.0.0" - -interface-store@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-2.0.2.tgz#83175fd2b0c501585ed96db54bb8ba9d55fce34c" - integrity sha512-rScRlhDcz6k199EkHqT8NpM87ebN89ICOzILoBHgaG36/WX50N32BnU/kpZgCGPLhARRAWUUX5/cyaIjt7Kipg== - interface-store@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-3.0.4.tgz#670d95ef45f3b7061d154c3cbfaf39a538167ad7" @@ -15445,7 +15343,7 @@ ip-address@^9.0.5: jsbn "1.1.0" sprintf-js "^1.1.3" -ip-regex@^4.0.0, ip-regex@^4.1.0: +ip-regex@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== @@ -15460,126 +15358,6 @@ ipaddr.js@^2.0.1: resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.1.0.tgz#2119bc447ff8c257753b196fc5f1ce08a4cdf39f" integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== -ipfs-core-types@^0.10.0, ipfs-core-types@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/ipfs-core-types/-/ipfs-core-types-0.10.3.tgz#89ebe98199d4d829f2b20104bfa3299f808c80fe" - integrity sha512-GNid2lRBjR5qgScCglgk7w9Hk3TZAwPHQXxOLQx72wgyc0jF2U5NXRoKW0GRvX8NPbHmsrFszForIqxd23I1Gw== - dependencies: - "@ipld/dag-pb" "^2.1.3" - interface-datastore "^6.0.2" - ipfs-unixfs "^6.0.3" - multiaddr "^10.0.0" - multiformats "^9.5.1" - -ipfs-core-utils@^0.14.0: - version "0.14.3" - resolved "https://registry.yarnpkg.com/ipfs-core-utils/-/ipfs-core-utils-0.14.3.tgz#d04c631c472507bdefc58d4e8d1d9109efbb411c" - integrity sha512-aBkewVhgAj3NWXPwu6imj0wADGiGVZmJzqKzODOJsibDjkx6FGdMv8kvvqtLnK8LS/dvSk9yk32IDtuDyYoV7Q== - dependencies: - any-signal "^3.0.0" - blob-to-it "^1.0.1" - browser-readablestream-to-it "^1.0.1" - debug "^4.1.1" - err-code "^3.0.1" - ipfs-core-types "^0.10.3" - ipfs-unixfs "^6.0.3" - ipfs-utils "^9.0.6" - it-all "^1.0.4" - it-map "^1.0.4" - it-peekable "^1.0.2" - it-to-stream "^1.0.0" - merge-options "^3.0.4" - multiaddr "^10.0.0" - multiaddr-to-uri "^8.0.0" - multiformats "^9.5.1" - nanoid "^3.1.23" - parse-duration "^1.0.0" - timeout-abort-controller "^3.0.0" - uint8arrays "^3.0.0" - -ipfs-http-client@56.0.0: - version "56.0.0" - resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-56.0.0.tgz#f42fa2bbf987bfa128ce0025de5d668586f4a815" - integrity sha512-JF3on9c0hB9XHk/UCxbyC6rSpERuj8F/0QcN/HImZoHNUKZ0/T8DpgVopocKdmGi1gr3Izlop7poaXomSt8Nug== - dependencies: - "@ipld/dag-cbor" "^7.0.0" - "@ipld/dag-json" "^8.0.1" - "@ipld/dag-pb" "^2.1.3" - any-signal "^3.0.0" - dag-jose "^1.0.0" - debug "^4.1.1" - err-code "^3.0.1" - ipfs-core-types "^0.10.0" - ipfs-core-utils "^0.14.0" - ipfs-utils "^9.0.2" - it-first "^1.0.6" - it-last "^1.0.4" - merge-options "^3.0.4" - multiaddr "^10.0.0" - multiformats "^9.4.13" - parse-duration "^1.0.0" - stream-to-it "^0.2.2" - uint8arrays "^3.0.0" - -ipfs-unixfs-importer@^12.0.0: - version "12.0.1" - resolved "https://registry.yarnpkg.com/ipfs-unixfs-importer/-/ipfs-unixfs-importer-12.0.1.tgz#316a52d8a793e9e006b1ee43edc50b83e00ef306" - integrity sha512-//VPZOqbONtc1HNtb+sBrw+nIGijHEloSm1O3LVR5orSlhHQ8X7+OCkeqceFBhu40tPMe/TwgAPrkvh+fXL+bA== - dependencies: - "@ipld/dag-pb" "^4.0.0" - "@multiformats/murmur3" "^2.0.0" - err-code "^3.0.1" - hamt-sharding "^3.0.0" - interface-blockstore "^4.0.0" - ipfs-unixfs "^9.0.0" - it-all "^2.0.0" - it-batch "^2.0.0" - it-first "^2.0.0" - it-parallel-batch "^2.0.0" - merge-options "^3.0.4" - multiformats "^11.0.0" - rabin-wasm "^0.1.4" - uint8arraylist "^2.3.3" - uint8arrays "^4.0.2" - -ipfs-unixfs@^6.0.3: - version "6.0.9" - resolved "https://registry.yarnpkg.com/ipfs-unixfs/-/ipfs-unixfs-6.0.9.tgz#f6613b8e081d83faa43ed96e016a694c615a9374" - integrity sha512-0DQ7p0/9dRB6XCb0mVCTli33GzIzSVx5udpJuVM47tGcD+W+Bl4LsnoLswd3ggNnNEakMv1FdoFITiEnchXDqQ== - dependencies: - err-code "^3.0.1" - protobufjs "^6.10.2" - -ipfs-unixfs@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/ipfs-unixfs/-/ipfs-unixfs-9.0.1.tgz#d06e688e07ef4ce08d610337ba2fe8c143c386e7" - integrity sha512-jh2CbXyxID+v3jLml9CqMwjdSS9ZRnsGfQGGPOfem0/hT/L48xUeTPvh7qLFWkZcIMhZtG+fnS1teei8x5uGBg== - dependencies: - err-code "^3.0.1" - protobufjs "^7.0.0" - -ipfs-utils@^9.0.2, ipfs-utils@^9.0.6: - version "9.0.14" - resolved "https://registry.yarnpkg.com/ipfs-utils/-/ipfs-utils-9.0.14.tgz#24f5fda1f4567685eb32bca2543d518f95fd8704" - integrity sha512-zIaiEGX18QATxgaS0/EOQNoo33W0islREABAcxXE8n7y2MGAlB+hdsxXn4J0hGZge8IqVQhW8sWIb+oJz2yEvg== - dependencies: - any-signal "^3.0.0" - browser-readablestream-to-it "^1.0.0" - buffer "^6.0.1" - electron-fetch "^1.7.2" - err-code "^3.0.1" - is-electron "^2.2.0" - iso-url "^1.1.5" - it-all "^1.0.4" - it-glob "^1.0.1" - it-to-stream "^1.0.0" - merge-options "^3.0.4" - nanoid "^3.1.20" - native-fetch "^3.0.0" - node-fetch "^2.6.8" - react-native-fetch-api "^3.0.0" - stream-to-it "^0.2.2" - iron-webcrypto@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/iron-webcrypto/-/iron-webcrypto-1.1.0.tgz#f902f0cdbd77554b2195ecbb65558c311b01edfd" @@ -15746,11 +15524,6 @@ is-docker@^3.0.0: resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== -is-electron@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.2.tgz#3778902a2044d76de98036f5dc58089ac4d80bb9" - integrity sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg== - is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -15866,13 +15639,6 @@ is-interactive@^1.0.0: resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== -is-ip@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-3.1.0.tgz#2ae5ddfafaf05cb8008a62093cf29734f657c5d8" - integrity sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q== - dependencies: - ip-regex "^4.0.0" - is-lambda@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-lambda/-/is-lambda-1.0.1.tgz#3d9877899e6a53efc0160504cde15f82e6f061d5" @@ -15952,7 +15718,7 @@ is-path-inside@^3.0.1, is-path-inside@^3.0.2, is-path-inside@^3.0.3: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -is-plain-obj@2.1.0, is-plain-obj@^2.0.0, is-plain-obj@^2.1.0: +is-plain-obj@2.1.0, is-plain-obj@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== @@ -16184,11 +15950,6 @@ isexe@^3.1.1: resolved "https://registry.yarnpkg.com/isexe/-/isexe-3.1.1.tgz#4a407e2bd78ddfb14bea0c27c6f7072dde775f0d" integrity sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ== -iso-url@^1.1.5: - version "1.2.1" - resolved "https://registry.yarnpkg.com/iso-url/-/iso-url-1.2.1.tgz#db96a49d8d9a64a1c889fc07cc525d093afb1811" - integrity sha512-9JPDgCN4B7QPkLtYAAOrEuAWvP9rWvR5offAr0/SeF046wIkglqH3VXgYYP6NcsKslH80UIVgmPqNe3j7tG2ng== - isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" @@ -16333,21 +16094,11 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -it-all@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/it-all/-/it-all-1.0.6.tgz#852557355367606295c4c3b7eff0136f07749335" - integrity sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A== - it-all@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/it-all/-/it-all-2.0.1.tgz#45d530ecf6e13fb81d7ba583cdfd55ffdb376b05" integrity sha512-9UuJcCRZsboz+HBQTNOau80Dw+ryGaHYFP/cPYzFBJBFcfDathMYnhHk4t52en9+fcyDGPTdLB+lFc1wzQIroA== -it-batch@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/it-batch/-/it-batch-2.0.1.tgz#a0822be9b18743c41d8525835f788a7f297ba41f" - integrity sha512-2gWFuPzamh9Dh3pW+OKjc7UwJ41W4Eu2AinVAfXDMfrC5gXfm3b1TF+1UzsygBUgKBugnxnGP+/fFRyn+9y1mQ== - it-drain@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/it-drain/-/it-drain-2.0.1.tgz#f50f6ce5cb8592a9d6337c9b5e780348877b152d" @@ -16358,63 +16109,11 @@ it-filter@^2.0.0: resolved "https://registry.yarnpkg.com/it-filter/-/it-filter-2.0.2.tgz#c849b3de4a12a2de3cc45be734ee55f69a0ed284" integrity sha512-gocw1F3siqupegsOzZ78rAc9C+sYlQbI2af/TmzgdrR613MyEJHbvfwBf12XRekGG907kqXSOGKPlxzJa6XV1Q== -it-first@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/it-first/-/it-first-1.0.7.tgz#a4bef40da8be21667f7d23e44dae652f5ccd7ab1" - integrity sha512-nvJKZoBpZD/6Rtde6FXqwDqDZGF1sCADmr2Zoc0hZsIvnE449gRFnGctxDf09Bzc/FWnHXAdaHVIetY6lrE0/g== - -it-first@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/it-first/-/it-first-2.0.1.tgz#75d66b254c385ae3a1906def060a69006a437cef" - integrity sha512-noC1oEQcWZZMUwq7VWxHNLML43dM+5bviZpfmkxkXlvBe60z7AFRqpZSga9uQBo792jKv9otnn1IjA4zwgNARw== - -it-glob@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/it-glob/-/it-glob-1.0.2.tgz#bab9b04d6aaac42884502f3a0bfee84c7a29e15e" - integrity sha512-Ch2Dzhw4URfB9L/0ZHyY+uqOnKvBNeS/SMcRiPmJfpHiM0TsUZn+GkpcZxAoF3dJVdPm/PuIk3A4wlV7SUo23Q== - dependencies: - "@types/minimatch" "^3.0.4" - minimatch "^3.0.4" - -it-last@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/it-last/-/it-last-1.0.6.tgz#4106232e5905ec11e16de15a0e9f7037eaecfc45" - integrity sha512-aFGeibeiX/lM4bX3JY0OkVCFkAw8+n9lkukkLNivbJRvNz8lI3YXv5xcqhFUV2lDJiraEK3OXRDbGuevnnR67Q== - -it-map@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/it-map/-/it-map-1.0.6.tgz#6aa547e363eedcf8d4f69d8484b450bc13c9882c" - integrity sha512-XT4/RM6UHIFG9IobGlQPFQUrlEKkU4eBUFG3qhWhfAdh1JfF2x11ShCrKCdmZ0OiZppPfoLuzcfA4cey6q3UAQ== - -it-parallel-batch@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/it-parallel-batch/-/it-parallel-batch-2.0.1.tgz#23eb07bbeb73521253d7c8a1566b53137103077c" - integrity sha512-tXh567/JfDGJ90Zi//H9HkL7kY27ARp0jf2vu2jUI6PUVBWfsoT+gC4eT41/b4+wkJXSGgT8ZHnivAOlMfcNjA== - dependencies: - it-batch "^2.0.0" - -it-peekable@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/it-peekable/-/it-peekable-1.0.3.tgz#8ebe933767d9c5aa0ae4ef8e9cb3a47389bced8c" - integrity sha512-5+8zemFS+wSfIkSZyf0Zh5kNN+iGyccN02914BY4w/Dj+uoFEoPSvj5vaWn8pNZJNSxzjW0zHRxC3LUb2KWJTQ== - it-take@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/it-take/-/it-take-2.0.1.tgz#f9e5ddf0b73a18ba00e62fb532d9d3cde3fe4ce6" integrity sha512-DL7kpZNjuoeSTnB9dMAJ0Z3m2T29LRRAU+HIgkiQM+1jH3m8l9e/1xpWs8JHTlbKivbqSFrQMTc8KVcaQNmsaA== -it-to-stream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/it-to-stream/-/it-to-stream-1.0.0.tgz#6c47f91d5b5df28bda9334c52782ef8e97fe3a4a" - integrity sha512-pLULMZMAB/+vbdvbZtebC0nWBTbG581lk6w8P7DfIIIKUfa8FbY7Oi0FxZcFPbxvISs7A9E+cMpLDBc1XhpAOA== - dependencies: - buffer "^6.0.3" - fast-fifo "^1.0.0" - get-iterator "^1.0.2" - p-defer "^3.0.0" - p-fifo "^1.0.0" - readable-stream "^3.6.0" - iterator.prototype@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0" @@ -18261,11 +17960,6 @@ long@^4.0.0: resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -long@^5.0.0: - version "5.2.3" - resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" - integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== - loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -18572,13 +18266,6 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== -merge-options@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7" - integrity sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ== - dependencies: - is-plain-obj "^2.1.0" - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -19025,25 +18712,6 @@ ms@2.1.3, ms@^2.0.0, ms@^2.1.1, ms@^2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multiaddr-to-uri@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/multiaddr-to-uri/-/multiaddr-to-uri-8.0.0.tgz#65efe4b1f9de5f6b681aa42ff36a7c8db7625e58" - integrity sha512-dq4p/vsOOUdVEd1J1gl+R2GFrXJQH8yjLtz4hodqdVbieg39LvBOdMQRdQnfbg5LSM/q1BYNVf5CBbwZFFqBgA== - dependencies: - multiaddr "^10.0.0" - -multiaddr@^10.0.0: - version "10.0.1" - resolved "https://registry.yarnpkg.com/multiaddr/-/multiaddr-10.0.1.tgz#0d15848871370860a4d266bb44d93b3dac5d90ef" - integrity sha512-G5upNcGzEGuTHkzxezPrrD6CaIHR9uo+7MwqhNVcXTs33IInon4y7nMiGxl2CY5hG7chvYQUQhz5V52/Qe3cbg== - dependencies: - dns-over-http-resolver "^1.2.3" - err-code "^3.0.1" - is-ip "^3.1.0" - multiformats "^9.4.5" - uint8arrays "^3.0.0" - varint "^6.0.0" - multibase@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" @@ -19093,12 +18761,7 @@ multiformats@^12.0.1: resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-12.1.3.tgz#cbf7a9861e11e74f8228b21376088cb43ba8754e" integrity sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw== -multiformats@^13.0.0, multiformats@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.1.0.tgz#5aa9d2175108a448fc3bdb54ba8a3d0b6cab3ac3" - integrity sha512-HzdtdBwxsIkzpeXzhQ5mAhhuxcHbjEHH+JQoxt7hG/2HGFjjwyolLo7hbaexcnhoEuV4e0TNJ8kkpMjiEYY4VQ== - -multiformats@^9.0.2, multiformats@^9.4.13, multiformats@^9.4.2, multiformats@^9.4.5, multiformats@^9.5.1, multiformats@^9.5.4, multiformats@^9.7.1: +multiformats@^9.4.2, multiformats@^9.7.1: version "9.9.0" resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.9.0.tgz#c68354e7d21037a8f1f8833c8ccd68618e8f1d37" integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg== @@ -19123,11 +18786,6 @@ multimatch@^5.0.0: arrify "^2.0.1" minimatch "^3.0.4" -murmurhash3js-revisited@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" - integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g== - mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -19158,7 +18816,7 @@ nanoid@3.3.4: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== -nanoid@^3.0.2, nanoid@^3.1.20, nanoid@^3.1.23, nanoid@^3.3.4: +nanoid@^3.3.4: version "3.3.7" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== @@ -19195,11 +18853,6 @@ nash@^3.0.0: lodash "^4.17.5" minimist "^1.1.0" -native-fetch@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/native-fetch/-/native-fetch-3.0.0.tgz#06ccdd70e79e171c365c75117959cf4fe14a09bb" - integrity sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -19294,7 +18947,7 @@ node-fetch-native@^1.4.0, node-fetch-native@^1.6.1, node-fetch-native@^1.6.2: resolved "https://registry.yarnpkg.com/node-fetch-native/-/node-fetch-native-1.6.2.tgz#f439000d972eb0c8a741b65dcda412322955e1c6" integrity sha512-69mtXOFZ6hSkYiXAVB5SqaRvrbITC/NPyqv7yuu/qw0nmgPyYbIMYYNIDhNtwPrzk0ptrimrLz/hhjvm4w5Z+w== -node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.6.8: +node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -20312,11 +19965,6 @@ p-cancelable@^3.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== -p-defer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83" - integrity sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw== - p-each-series@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.2.0.tgz#105ab0357ce72b202a8a8b94933672657b5e2a9a" @@ -20329,14 +19977,6 @@ p-event@^2.1.0: dependencies: p-timeout "^2.0.1" -p-fifo@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-fifo/-/p-fifo-1.0.0.tgz#e29d5cf17c239ba87f51dde98c1d26a9cfe20a63" - integrity sha512-IjoCxXW48tqdtDFz6fqo5q1UfFVjjVZe8TC1QRflvNUJtNfCUhxOUw6MOVZhDPjqhSzc26xKdugsO17gmzd5+A== - dependencies: - fast-fifo "^1.0.0" - p-defer "^3.0.0" - p-filter@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-filter/-/p-filter-2.1.0.tgz#1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c" @@ -20632,11 +20272,6 @@ parse-conflict-json@^2.0.1: just-diff "^5.0.1" just-diff-apply "^5.2.0" -parse-duration@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/parse-duration/-/parse-duration-1.1.0.tgz#5192084c5d8f2a3fd676d04a451dbd2e05a1819c" - integrity sha512-z6t9dvSJYaPoQq7quMzdEagSFtpGu+utzHqqxmpVWNNZRIXnvqyCvn9XsTdh7c/w0Bqmdz3RB3YnRaKtpRtEXQ== - parse-headers@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.5.tgz#069793f9356a54008571eb7f9761153e6c770da9" @@ -21266,7 +20901,7 @@ proto-list@~1.2.1: resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== -protobufjs@^6.10.2, protobufjs@^6.8.8, protobufjs@~6.11.2, protobufjs@~6.11.3: +protobufjs@^6.8.8, protobufjs@~6.11.2, protobufjs@~6.11.3: version "6.11.4" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.4.tgz#29a412c38bf70d89e537b6d02d904a6f448173aa" integrity sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw== @@ -21285,24 +20920,6 @@ protobufjs@^6.10.2, protobufjs@^6.8.8, protobufjs@~6.11.2, protobufjs@~6.11.3: "@types/node" ">=13.7.0" long "^4.0.0" -protobufjs@^7.0.0: - version "7.2.6" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.6.tgz#4a0ccd79eb292717aacf07530a07e0ed20278215" - integrity sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/node" ">=13.7.0" - long "^5.0.0" - protocols@^2.0.0, protocols@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/protocols/-/protocols-2.0.1.tgz#8f155da3fc0f32644e83c5782c8e8212ccf70a86" @@ -21557,18 +21174,6 @@ quick-lru@^5.1.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== -rabin-wasm@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/rabin-wasm/-/rabin-wasm-0.1.5.tgz#5b625ca007d6a2cbc1456c78ae71d550addbc9c9" - integrity sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA== - dependencies: - "@assemblyscript/loader" "^0.9.4" - bl "^5.0.0" - debug "^4.3.1" - minimist "^1.2.5" - node-fetch "^2.6.1" - readable-stream "^3.6.0" - radix3@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/radix3/-/radix3-1.1.1.tgz#60a56876ffec62c88a22396a6a1c4c7efe9eb4b1" @@ -21656,13 +21261,6 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== -react-native-fetch-api@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/react-native-fetch-api/-/react-native-fetch-api-3.0.0.tgz#81e1bb6562c292521bc4eca52fe1097f4c1ebab5" - integrity sha512-g2rtqPjdroaboDKTsJCTlcmtw54E25OjyaunUP0anOZn4Fuo2IKs8BVfe02zVggA/UysbmfSnRJIqtNkAgggNA== - dependencies: - p-defer "^3.0.0" - react-router-dom@6.11.2: version "6.11.2" resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.11.2.tgz#324d55750ffe2ecd54ca4ec6b7bc7ab01741f170" @@ -21861,13 +21459,6 @@ real-require@^0.1.0: resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.1.0.tgz#736ac214caa20632847b7ca8c1056a0767df9381" integrity sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg== -receptacle@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/receptacle/-/receptacle-1.3.2.tgz#a7994c7efafc7a01d0e2041839dab6c4951360d2" - integrity sha512-HrsFvqZZheusncQRiEE7GatOAETrARKV/lnfYicIm8lbvp/JQOdADOfhjBd2DajvoszEyxSM6RlAAIZgEoeu/A== - dependencies: - ms "^2.1.1" - redent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" @@ -22260,11 +21851,6 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -retimer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/retimer/-/retimer-3.0.0.tgz#98b751b1feaf1af13eb0228f8ea68b8f9da530df" - integrity sha512-WKE0j11Pa0ZJI5YIk0nflGI7SQsfl2ljihVy7ogh7DeQSeYAUi0ubZ/yEueGtDfUPk6GH5LRw1hBdLq4IwUBWA== - retry@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" @@ -23166,11 +22752,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -sparse-array@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/sparse-array/-/sparse-array-1.3.2.tgz#0e1a8b71706d356bc916fe754ff496d450ec20b0" - integrity sha512-ZT711fePGn3+kQyLuv1fpd3rNSkNF8vd5Kv2D+qnOANeyKs3fx6bUMGWRPvgTTcYV64QMqZKZwcuaQSP3AZ0tg== - spawn-command@^0.0.2-1: version "0.0.2-1" resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" @@ -23453,13 +23034,6 @@ stream-shift@^1.0.2: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.3.tgz#85b8fab4d71010fc3ba8772e8046cc49b8a3864b" integrity sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ== -stream-to-it@^0.2.2: - version "0.2.4" - resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-0.2.4.tgz#d2fd7bfbd4a899b4c0d6a7e6a533723af5749bd0" - integrity sha512-4vEbkSs83OahpmBybNJXlJd7d6/RxzkkSdT3I0mnGt79Xd2Kk+e1JqbvAvsQfCeKj3aKb0QIWkyK3/n0j506vQ== - dependencies: - get-iterator "^1.0.2" - streamsearch@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" @@ -23500,7 +23074,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -23518,6 +23092,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -23614,7 +23197,7 @@ stringify-package@^1.0.1: resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -23642,6 +23225,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -24203,13 +23793,6 @@ timed-out@^4.0.1: resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== -timeout-abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/timeout-abort-controller/-/timeout-abort-controller-3.0.0.tgz#dd57ffca041652c03769904f8d95afd93fb95595" - integrity sha512-O3e+2B8BKrQxU2YRyEjC/2yFdb33slI22WRdUaDx6rvysfi9anloNZyR2q0l6LnePo5qH7gSM7uZtvvwZbc2yA== - dependencies: - retimer "^3.0.0" - timers-browserify@^2.0.12: version "2.0.12" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.12.tgz#44a45c11fbf407f34f97bccd1577c652361b00ee" @@ -24712,13 +24295,6 @@ uglify-js@^3.1.4: resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== -uint8arraylist@^2.3.3: - version "2.4.8" - resolved "https://registry.yarnpkg.com/uint8arraylist/-/uint8arraylist-2.4.8.tgz#5a4d17f4defd77799cb38e93fd5db0f0dceddc12" - integrity sha512-vc1PlGOzglLF0eae1M8mLRTBivsvrGsdmJ5RbK3e+QRvRLOZfZhQROTwH/OfyF3+ZVUg9/8hE8bmKP2CvP9quQ== - dependencies: - uint8arrays "^5.0.1" - uint8arrays@^3.0.0, uint8arrays@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" @@ -24726,20 +24302,13 @@ uint8arrays@^3.0.0, uint8arrays@^3.1.0: dependencies: multiformats "^9.4.2" -uint8arrays@^4.0.2, uint8arrays@^4.0.3: +uint8arrays@^4.0.3: version "4.0.10" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-4.0.10.tgz#3ec5cde3348903c140e87532fc53f46b8f2e921f" integrity sha512-AnJNUGGDJAgFw/eWu/Xb9zrVKEGlwJJCaeInlf3BkecE/zcTobk5YXYIPNQJO1q5Hh1QZrQQHf0JvcHqz2hqoA== dependencies: multiformats "^12.0.1" -uint8arrays@^5.0.1: - version "5.0.3" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-5.0.3.tgz#92b894d9c4269ba97c51544d6e1f279fe6f80d1f" - integrity sha512-6LBuKji28kHjgPJMkQ6GDaBb1lRwIhyOYq6pDGwYMoDPfImE9SkuYENVmR0yu9yGgs2clHUSY9fKDukR+AXfqQ== - dependencies: - multiformats "^13.0.0" - ultron@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" @@ -25259,11 +24828,6 @@ varint@^5.0.0: resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== -varint@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0" - integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== - varuint-bitcoin@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz#e76c138249d06138b480d4c5b40ef53693e24e92" @@ -25930,7 +25494,7 @@ wordwrapjs@^4.0.0: reduce-flatten "^2.0.0" typical "^5.2.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -25965,6 +25529,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From da85371b94fd51033b91e1c22b83320ae704d701 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 21:58:01 +0100 Subject: [PATCH 03/19] chore(lit-node-client): LIT-2841 - Remove unnecessary polyfilling of fetch (it's done in `lit-node-client-nodejs`, which this wraps!) --- packages/lit-node-client/src/index.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/lit-node-client/src/index.ts b/packages/lit-node-client/src/index.ts index 91c73a1761..f69a56cdfb 100644 --- a/packages/lit-node-client/src/index.ts +++ b/packages/lit-node-client/src/index.ts @@ -1,13 +1,5 @@ -import { isNode, log } from '@lit-protocol/misc'; import * as _LitNodeClient from './lib/lit-node-client'; -// ==================== Environment ==================== -if (isNode()) { - log('Oh hey you are running in Node.js!'); - const fetch = require('node-fetch'); - globalThis.fetch = fetch; -} - const LitNodeClient = _LitNodeClient.LitNodeClient; if (!globalThis.LitNodeClient) { globalThis.LitNodeClient = LitNodeClient; From fe87372c4fd2c825639215176e9c1aff48915d62 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 22:03:37 +0100 Subject: [PATCH 04/19] fix(lit-node-client-nodejs): LIT-2841 - Replace `node-fetch` polyfill with `cross-fetch/polyfill` usage. Squelch ESLint errors in global hackery. --- packages/lit-node-client-nodejs/src/index.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/index.ts b/packages/lit-node-client-nodejs/src/index.ts index 9a9aa68354..c7ac7d2536 100644 --- a/packages/lit-node-client-nodejs/src/index.ts +++ b/packages/lit-node-client-nodejs/src/index.ts @@ -1,14 +1,11 @@ -import { isNode, log } from '@lit-protocol/misc'; +import 'cross-fetch/polyfill'; + import * as _LitNodeClientNodeJs from './lib/lit-node-client-nodejs'; // ==================== Environment ==================== -if (isNode()) { - log('Oh hey you are running in Node.js!'); - const fetch = require('node-fetch'); - globalThis.fetch = fetch; -} - declare global { + // This `declare global` hackery _must_ use var to work. + // eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any var LitNodeClientNodeJs: any; } From 318c47d508f5abee45cac5f91fd8c7b705f744ff Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 22:28:53 +0100 Subject: [PATCH 05/19] build(global): LIT-2841 - Remove unused polyfills files, pragmas, and associated tools.mjs command --- packages/auth-helpers/src/index.ts | 4 -- packages/contracts-sdk/polyfills.js | 8 --- packages/contracts-sdk/src/index.ts | 4 -- packages/crypto/src/index.ts | 4 -- packages/encryption/polyfills.js | 8 --- packages/encryption/src/index.ts | 4 -- packages/lit-node-client-nodejs/polyfills.js | 8 --- packages/lit-node-client-nodejs/src/index.ts | 4 -- packages/lit-node-client/polyfills.js | 8 --- packages/lit-node-client/src/index.ts | 4 -- packages/pkp-base/polyfills.js | 8 --- packages/pkp-base/src/index.ts | 4 -- packages/pkp-client/polyfills.js | 8 --- packages/pkp-client/src/index.ts | 5 +- packages/pkp-cosmos/polyfills.js | 8 --- packages/pkp-cosmos/src/index.ts | 3 -- packages/pkp-ethers/polyfills.js | 8 --- packages/pkp-ethers/src/index.ts | 8 +-- packages/uint8arrays/polyfills.js | 8 --- packages/uint8arrays/src/index.ts | 4 -- tools/scripts/build.mjs | 3 -- tools/scripts/tools.mjs | 53 +------------------- 22 files changed, 4 insertions(+), 172 deletions(-) delete mode 100644 packages/contracts-sdk/polyfills.js delete mode 100644 packages/encryption/polyfills.js delete mode 100644 packages/lit-node-client-nodejs/polyfills.js delete mode 100644 packages/lit-node-client/polyfills.js delete mode 100644 packages/pkp-base/polyfills.js delete mode 100644 packages/pkp-client/polyfills.js delete mode 100644 packages/pkp-cosmos/polyfills.js delete mode 100644 packages/pkp-ethers/polyfills.js delete mode 100644 packages/uint8arrays/polyfills.js diff --git a/packages/auth-helpers/src/index.ts b/packages/auth-helpers/src/index.ts index dfce533e8a..6f47917e46 100644 --- a/packages/auth-helpers/src/index.ts +++ b/packages/auth-helpers/src/index.ts @@ -1,7 +1,3 @@ -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- - export * from './lib/models'; export * from './lib/session-capability-object'; export * from './lib/resources'; diff --git a/packages/contracts-sdk/polyfills.js b/packages/contracts-sdk/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/contracts-sdk/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/contracts-sdk/src/index.ts b/packages/contracts-sdk/src/index.ts index d3eeb52a9a..ded2807ed8 100644 --- a/packages/contracts-sdk/src/index.ts +++ b/packages/contracts-sdk/src/index.ts @@ -1,7 +1,3 @@ export * from './lib/contracts-sdk'; export * from './lib/addresses'; export * from './lib/utils'; - -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- diff --git a/packages/crypto/src/index.ts b/packages/crypto/src/index.ts index 622e2b1704..d16dfb2b1e 100644 --- a/packages/crypto/src/index.ts +++ b/packages/crypto/src/index.ts @@ -1,5 +1 @@ export * from './lib/crypto'; - -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- diff --git a/packages/encryption/polyfills.js b/packages/encryption/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/encryption/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/encryption/src/index.ts b/packages/encryption/src/index.ts index f0e8a4476a..536bf61c43 100644 --- a/packages/encryption/src/index.ts +++ b/packages/encryption/src/index.ts @@ -1,6 +1,2 @@ export * from './lib/encryption'; export * from './lib/params-validators'; - -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- diff --git a/packages/lit-node-client-nodejs/polyfills.js b/packages/lit-node-client-nodejs/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/lit-node-client-nodejs/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/lit-node-client-nodejs/src/index.ts b/packages/lit-node-client-nodejs/src/index.ts index c7ac7d2536..fee8e217a8 100644 --- a/packages/lit-node-client-nodejs/src/index.ts +++ b/packages/lit-node-client-nodejs/src/index.ts @@ -47,7 +47,3 @@ export { uint8arrayFromString, uint8arrayToString, } from '@lit-protocol/uint8arrays'; - -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- diff --git a/packages/lit-node-client/polyfills.js b/packages/lit-node-client/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/lit-node-client/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/lit-node-client/src/index.ts b/packages/lit-node-client/src/index.ts index f69a56cdfb..a1bc1e4bcf 100644 --- a/packages/lit-node-client/src/index.ts +++ b/packages/lit-node-client/src/index.ts @@ -16,7 +16,3 @@ export { } from '@lit-protocol/auth-browser'; export * from '@lit-protocol/lit-node-client-nodejs'; - -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- diff --git a/packages/pkp-base/polyfills.js b/packages/pkp-base/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/pkp-base/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/pkp-base/src/index.ts b/packages/pkp-base/src/index.ts index 818b2f3b61..ef27bcb4a0 100644 --- a/packages/pkp-base/src/index.ts +++ b/packages/pkp-base/src/index.ts @@ -1,5 +1 @@ -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- - export { PKPBase } from './lib/pkp-base'; diff --git a/packages/pkp-client/polyfills.js b/packages/pkp-client/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/pkp-client/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/pkp-client/src/index.ts b/packages/pkp-client/src/index.ts index ca8a3c43e8..213bdd109a 100644 --- a/packages/pkp-client/src/index.ts +++ b/packages/pkp-client/src/index.ts @@ -1,7 +1,4 @@ -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- - +// eslint-disable-next-line import/default import ethers from 'ethers'; export { PKPClient } from './lib/pkp-client'; export { ethers }; diff --git a/packages/pkp-cosmos/polyfills.js b/packages/pkp-cosmos/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/pkp-cosmos/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/pkp-cosmos/src/index.ts b/packages/pkp-cosmos/src/index.ts index 0c44b4d7fe..edb1be02cf 100644 --- a/packages/pkp-cosmos/src/index.ts +++ b/packages/pkp-cosmos/src/index.ts @@ -1,6 +1,3 @@ -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- import { PKPCosmosWallet } from './lib/pkp-cosmos'; export { PKPCosmosWallet }; diff --git a/packages/pkp-ethers/polyfills.js b/packages/pkp-ethers/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/pkp-ethers/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/pkp-ethers/src/index.ts b/packages/pkp-ethers/src/index.ts index dba23b4460..eda8f5f8c3 100644 --- a/packages/pkp-ethers/src/index.ts +++ b/packages/pkp-ethers/src/index.ts @@ -1,9 +1,3 @@ -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- - -import { PKPEthersWallet } from './lib/pkp-ethers'; - import { methodHandlers, ethRequestHandler, @@ -19,7 +13,7 @@ import { sendRawTransactionHandler, isEthRequest, } from './lib/handler'; - +import { PKPEthersWallet } from './lib/pkp-ethers'; import { SupportedETHSigningMethods } from './lib/pkp-ethers-types'; export { diff --git a/packages/uint8arrays/polyfills.js b/packages/uint8arrays/polyfills.js deleted file mode 100644 index 83a34e7013..0000000000 --- a/packages/uint8arrays/polyfills.js +++ /dev/null @@ -1,8 +0,0 @@ -// This field will be automatically injected into the ./dist/packages//index.js file -// between the autogen:polyfills:start/end comments - -try { - globalThis.crypto = require('crypto').webcrypto; -} catch (e) { - // swallow -} diff --git a/packages/uint8arrays/src/index.ts b/packages/uint8arrays/src/index.ts index 1434ee0943..13139f00a6 100644 --- a/packages/uint8arrays/src/index.ts +++ b/packages/uint8arrays/src/index.ts @@ -1,7 +1,3 @@ -// ----- autogen:polyfills:start ----- -// -// ----- autogen:polyfills:end ----- - import { uint8arrayFromString, uint8arrayToString, diff --git a/tools/scripts/build.mjs b/tools/scripts/build.mjs index d77205a97f..286c9b2cf9 100644 --- a/tools/scripts/build.mjs +++ b/tools/scripts/build.mjs @@ -37,9 +37,6 @@ const build = async (name) => { greenLog('Building Tsc...'); await runCommand(`yarn nx run ${name}:_buildTsc`); - greenLog('Polyfilling...'); - await childRunCommand(`yarn tools --polyfills ${name}`); - await childRunCommand(`yarn tools postBuildIndividual --target=${name}`); // greenLog('Setting up local development tools...'); diff --git a/tools/scripts/tools.mjs b/tools/scripts/tools.mjs index 560f084a87..9a509ea292 100644 --- a/tools/scripts/tools.mjs +++ b/tools/scripts/tools.mjs @@ -42,7 +42,6 @@ const optionMaps = new Map([ ['--switch', () => switchFunc()], ['--dev', () => devFunc()], ['--watch', () => watchFunc()], - ['--polyfills', () => polyfillsFunc()], ['--comment', () => commentFunc()], ['--remove-local-dev', () => removeLocalDevFunc()], ['--setup-local-dev', () => setupLocalDevFunc()], @@ -385,7 +384,7 @@ async function findFunc() { greenLog( ` Usage: node tools/scripts/tools.mjs --find [option] - [option]: + [option]: --imports: find all imports from a directory `, true @@ -471,7 +470,6 @@ async function buildFunc() { await childRunCommand(`yarn gen:html`); await childRunCommand(`yarn gen:react`); await childRunCommand(`yarn gen:nodejs`); - await childRunCommand(`yarn tools --polyfills ${TARGET}`); } if (BUILD_TYPE === '--packages') { @@ -500,14 +498,7 @@ async function buildFunc() { spawnListener(command, { onDone: () => { console.log('Done!'); - - // spawnListener(command, { - // onDone: async () => { - // console.log("Done!"); - // await runCommand('yarn postBuild:mapDistFolderNameToPackageJson'); exit(); - // } - // }) }, }); } @@ -950,7 +941,6 @@ async function watchFunc() { childRunCommand( `nodemon --watch packages/${TARGET} --ext js,ts --exec "yarn tools --build --target ${TARGET}"` ); - // spawnListener(`yarn tools --polyfills lit-node-client`); } } } @@ -1006,45 +996,6 @@ async function checkFunc() { process.exit(0); } -async function polyfillsFunc() { - const PROJECT_NAME = args[1]; - - if (!PROJECT_NAME || PROJECT_NAME === '' || PROJECT_NAME === '--help') { - greenLog( - ` - Usage: node tools/scripts/tools.mjs --polyfills [project] - [project]: the project to add polyfills to - `, - true - ); - - exit(); - } - - try { - const polyfill = await readFile(`packages/${PROJECT_NAME}/polyfills.js`); - - const buildIndexJsPath = `dist/packages/${PROJECT_NAME}/src/index.js`; - const builtIndexJs = await readFile(buildIndexJsPath); - - const newBuiltIndexJs = replaceAutogen({ - oldContent: builtIndexJs, - startsWith: '// ----- autogen:polyfills:start -----', - endsWith: '// ----- autogen:polyfills:end -----', - newContent: polyfill, - }); - - await writeFile(buildIndexJsPath, newBuiltIndexJs); - - greenLog('✅ Polyfills injected into index.js'); - } catch (e) { - yellowLog( - `No packages/${PROJECT_NAME}/polyfills.js found for ` + PROJECT_NAME - ); - } - exit(); -} - async function commentFunc() { const C = args[1] ?? '='; @@ -1077,7 +1028,7 @@ async function commentFunc() { console.log( ` // ${line}${up.join('')}${line} -// ${MESSAGE} +// ${MESSAGE} // ${line}${down.join('')}${line} ` ); From fd6064e28b940c87a4b814e8dd4916484e69c078 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 22:33:35 +0100 Subject: [PATCH 06/19] build(encryption): LIT-2841 - Remove postBuild file that monkey-patched `ipfs-http-client` --- packages/encryption/postBuild.mjs | 32 ------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 packages/encryption/postBuild.mjs diff --git a/packages/encryption/postBuild.mjs b/packages/encryption/postBuild.mjs deleted file mode 100644 index a995d1bc27..0000000000 --- a/packages/encryption/postBuild.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import fs from 'fs'; -import { - greenLog, - readFile, - redLog, - writeFile, -} from '../../tools/scripts/utils.mjs'; - -const TARGET_FILE = 'dist/packages/encryption/src/lib/encryption.js'; - -const fileContent = await readFile(TARGET_FILE); - -const newContent = fileContent.replace( - `const ipfsClient = require("ipfs-http-client");`, - `// The following line is automatically modified by encryption/postbuild.mjs - let ipfsClient = null; - try{ - ipfsClient = require("ipfs-http-client"); - }catch(e){ - console.log("ipfs-http-client is not supported in this environment!"); - } - // The above line is automatically modified by encryption/postbuild.mjs` -); - -try { - await writeFile(TARGET_FILE, newContent); - greenLog(`✅ Successfully wrote to ${TARGET_FILE}`, true); -} catch (e) { - redLog(`Failed to write to ${TARGET_FILE}!`, true); -} - -process.exit(); From 495d11595660314c0ddefcb801cabd541be95c3e Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Mon, 8 Apr 2024 22:33:56 +0100 Subject: [PATCH 07/19] build(global): LIT-2841 - Remove unused `postBuildIndividual` tooling --- tools/scripts/build.mjs | 2 -- tools/scripts/tools.mjs | 22 ---------------------- 2 files changed, 24 deletions(-) diff --git a/tools/scripts/build.mjs b/tools/scripts/build.mjs index 286c9b2cf9..2c372ebf49 100644 --- a/tools/scripts/build.mjs +++ b/tools/scripts/build.mjs @@ -37,8 +37,6 @@ const build = async (name) => { greenLog('Building Tsc...'); await runCommand(`yarn nx run ${name}:_buildTsc`); - await childRunCommand(`yarn tools postBuildIndividual --target=${name}`); - // greenLog('Setting up local development tools...'); // await childRunCommand(`yarn build:setupLocalDev ${name}`); diff --git a/tools/scripts/tools.mjs b/tools/scripts/tools.mjs index 9a509ea292..595aaea285 100644 --- a/tools/scripts/tools.mjs +++ b/tools/scripts/tools.mjs @@ -51,7 +51,6 @@ const optionMaps = new Map([ ['--version', () => versionFunc()], ['--verify', () => validateDependencyVersions()], ['--postBuild', () => postBuild()], - ['postBuildIndividual', () => postBuildIndividualFunc()], ['fixTsConfig', () => fixTsConfigFunc()], ['check', () => checkFunc()], ]); @@ -85,7 +84,6 @@ function helpFunc() { --version: show version --verify: validate dependency versions --postBuild: post build - postBuildIndividual: post build individual fixTsConfig: fix tsconfig `, true @@ -462,9 +460,6 @@ async function buildFunc() { } await childRunCommand(`yarn nx run ${TARGET}:_buildTsc`); - await childRunCommand( - `yarn tools --postBuildIndividual --target ${TARGET}` - ); await childRunCommand(`yarn postBuild:mapDistFolderNameToPackageJson`); await childRunCommand(`yarn postBuild:mapDepsToDist`); await childRunCommand(`yarn gen:html`); @@ -945,23 +940,6 @@ async function watchFunc() { } } -async function postBuildIndividualFunc() { - const POSTBUILD_FILE = 'postbuild.mjs'; - - const TARGET = findArg(args, '--target'); - const PROJECT_PATH = `packages/${TARGET}`; - const DIST_PATH = `dist/packages/${TARGET}`; - const POSTBUILD_PATH = `${PROJECT_PATH}/${POSTBUILD_FILE}`; - - if (!fs.existsSync(POSTBUILD_PATH)) { - process.exit(); - } - - greenLog(`👷 ${POSTBUILD_PATH} file found! Running...`, true); - await childRunCommand(`node ${POSTBUILD_PATH}`); - process.exit(); -} - async function fixTsConfigFunc() { const TSCONFIG = JSON.parse(await readFile('tsconfig.json')); From b5187136c3f727be9911750adda773b292015cc6 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 11 Apr 2024 00:54:28 +0100 Subject: [PATCH 08/19] fix(encryption)!: LIT-2841 - Remove `ipfs-http-client` and use `cross-fetch` for POSTing data to Infura --- packages/encryption/src/lib/encryption.ts | 155 +++++++++++++--------- 1 file changed, 94 insertions(+), 61 deletions(-) diff --git a/packages/encryption/src/lib/encryption.ts b/packages/encryption/src/lib/encryption.ts index 0da27ca35e..177af00939 100644 --- a/packages/encryption/src/lib/encryption.ts +++ b/packages/encryption/src/lib/encryption.ts @@ -1,11 +1,10 @@ -import { - EITHER_TYPE, - ILitError, - LIT_ERROR, - NETWORK_PUB_KEY, -} from '@lit-protocol/constants'; -import { verifySignature } from '@lit-protocol/crypto'; +import fetch from 'cross-fetch'; +// @ts-expect-error jszip types don't resolve. :sad_panda: +import * as JSZip from 'jszip/dist/jszip.js'; +import { EITHER_TYPE, ILitError, LIT_ERROR } from '@lit-protocol/constants'; +import { verifySignature } from '@lit-protocol/crypto'; +import { checkType, isBrowser, log, throwError } from '@lit-protocol/misc'; import { DecryptFromIpfsProps, DecryptRequest, @@ -16,7 +15,6 @@ import { EncryptRequestBase, EncryptResponse, EncryptStringRequest, - EncryptToIpfsDataType, EncryptToIpfsPayload, EncryptToIpfsProps, EncryptZipRequest, @@ -26,26 +24,64 @@ import { SigningAccessControlConditionJWTPayload, VerifyJWTProps, } from '@lit-protocol/types'; - -// @ts-ignore -import * as JSZip from 'jszip/dist/jszip.js'; - import { uint8arrayFromString, uint8arrayToString, } from '@lit-protocol/uint8arrays'; -import { checkType, isBrowser, log, throwError } from '@lit-protocol/misc'; - import { safeParams } from './params-validators'; -import * as ipfsClient from 'ipfs-http-client'; +const createIpfsPayload = (serialisedData: string) => { + const boundary = '---------------------------' + Date.now().toString(16); // Generate a unique boundary + const buffer = new TextEncoder().encode(serialisedData); + + const payload = `--${boundary}\r\nContent-Disposition: form-data; name="file"; filename="string.txt"\r\nContent-Type: text/plain\r\n\r\n${new TextDecoder().decode( + buffer + )}\r\n--${boundary}--\r\n`; + + return { payload, boundary }; +}; + +async function postToInfuraIpfs({ + serialisedData, + infuraId, + infuraSecretKey, +}: { + serialisedData: string; + infuraId: string; + infuraSecretKey: string; +}) { + const { payload, boundary } = createIpfsPayload(serialisedData); + const res = await fetch( + `https://ipfs.infura.io:5001/api/v0/add?pin=true&cid-version=1&hash=sha2-256`, + { + method: 'POST', + headers: { + accept: 'application/json', + 'Content-Type': `multipart/form-data; boundary=${boundary}`, + authorization: `Basic ${Buffer.from( + `${infuraId}:${infuraSecretKey}` + ).toString('base64')}`, + }, + body: payload, + } + ); + + if (res.status !== 200) { + throw new Error(`Failed to post to Infura IPFS: ${res.statusText}`); + } + + // https://docs.infura.io/api/networks/ipfs/http-api-methods/add#response + const { Hash } = (await res.json()) as { Hash: string }; + + return Hash; +} /** * * Encrypt a string or file using the LIT network public key and upload all the metadata required to decrypt i.e. accessControlConditions, evmContractConditions, solRpcConditions, unifiedAccessControlConditions & chain to IPFS using the ipfs-client-http SDK & returns the IPFS CID. * - * @param { EncryptToIpfsProps } - The params required to encrypt & upload to IPFS + * @param params { EncryptToIpfsProps } - The params required to encrypt & upload to IPFS * * @returns { Promise } - IPFS CID * @@ -92,43 +128,17 @@ export const encryptToIpfs = async ( errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, }); - let ciphertext: string; - let dataToEncryptHash: string; - let dataType: EncryptToIpfsDataType; - if (string !== undefined) { - const encryptResponse = await encryptString( + const { ciphertext, dataToEncryptHash } = await encryptString( { ...params, dataToEncrypt: string, }, litNodeClient ); - ciphertext = encryptResponse.ciphertext; - dataToEncryptHash = encryptResponse.dataToEncryptHash; - dataType = 'string'; - } else { - const encryptResponse = await encryptFile( - { ...params, file: file! }, - litNodeClient - ); - ciphertext = encryptResponse.ciphertext; - dataToEncryptHash = encryptResponse.dataToEncryptHash; - dataType = 'file'; - } - const authorization = - 'Basic ' + Buffer.from(`${infuraId}:${infuraSecretKey}`).toString('base64'); - const ipfs = ipfsClient.create({ - url: 'https://ipfs.infura.io:5001/api/v0', - headers: { - authorization, - }, - }); - - try { - const res = await ipfs.add( - JSON.stringify({ + return await postToInfuraIpfs({ + serialisedData: JSON.stringify({ ciphertext, dataToEncryptHash, accessControlConditions, @@ -136,17 +146,33 @@ export const encryptToIpfs = async ( solRpcConditions, unifiedAccessControlConditions, chain, - dataType, - } as EncryptToIpfsPayload) + dataType: 'string', + } as EncryptToIpfsPayload), + infuraId, + infuraSecretKey, + }); + } else if (file) { + const { ciphertext, dataToEncryptHash } = await encryptFile( + { ...params, file }, + litNodeClient ); - return res.path; - } catch (e) { - return throwError({ - message: 'Unable to upload to IPFS', - errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, - errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, + return await postToInfuraIpfs({ + serialisedData: JSON.stringify({ + ciphertext, + dataToEncryptHash, + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions, + chain, + dataType: 'file', + } as EncryptToIpfsPayload), + infuraId, + infuraSecretKey, }); + } else { + throw new Error(`You must provide either 'file' or 'string'.`); } }; @@ -183,6 +209,9 @@ export const decryptFromIpfs = async ( }); try { + // FIXME: We use Infura to upload, but pinata to fetch, which could lead to false failures to GET + // When recently POSTed items haven't replicated yet. + // Ideally, we shouldn't be responsible for deciding which IPFS hosts someone uses for these operations. const metadata: EncryptToIpfsPayload = await ( await fetch(`https://gateway.pinata.cloud/ipfs/${ipfsCid}`) ).json(); @@ -333,18 +362,18 @@ export const zipAndEncryptString = async ( }; /** - * + * * Zip and encrypt multiple files. - * + * * @param { Array } files - The files to encrypt * @param { EncryptRequestBase } paramsBase - The params required to encrypt a file * @param { ILitNodeClient } litNodeClient - The Lit Node Client - * + * * @returns { Promise } - The encrypted file and the hash of the file - + */ export const zipAndEncryptFiles = async ( - files: Array, + files: File[], paramsBase: EncryptRequestBase, litNodeClient: ILitNodeClient ): Promise => { @@ -403,7 +432,7 @@ export const zipAndEncryptFiles = async ( export const decryptToZip = async ( params: DecryptRequest, litNodeClient: ILitNodeClient -): Promise<{ [key: string]: JSZip.JSZipObject }> => { +): Promise> => { // -- validate const paramsIsSafe = safeParams({ functionName: 'decrypt', @@ -693,7 +722,7 @@ export const encryptFile = async ( }); // encrypt the file - var fileAsArrayBuffer = await params.file.arrayBuffer(); + const fileAsArrayBuffer = await params.file.arrayBuffer(); return litNodeClient.encrypt({ ...params, @@ -733,10 +762,14 @@ export const decryptToFile = async ( }; declare global { + // `var` is required for global hackery + // FIXME: `any` types for wasm are no bueno + // eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any var wasmExports: any; + // eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any var wasmECDSA: any; + // eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any var LitNodeClient: any; - // var litNodeClient: ILitNodeClient; } /** From 69c4f33558258010ca73b33535833a3f81353ac1 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 11 Apr 2024 21:31:24 +0100 Subject: [PATCH 09/19] types!(types): LIT-2841 - Update interfaces to replace to/from ipfs encrypt/decrypt with to/from Json encrypt/decrypt - Removed `...IpfsProps` and `...IpfsPayload` interfaces - Defined `...JsonProps` and `...JsonPayload` interfaces - Used `MultipleAccessControlConditions` interface in a bunch of places where we had duplicated the entire interface, comments and all, in-line in other interfaces. - Used `EncryptRequestBase` as the basis for the new Json interfaces instead of duplicating the contents of that interface in-line - Clarified `sessionSigs` from being an `any` type in a few interfaces, to being a `SessionSigsMap` type. --- packages/types/src/lib/interfaces.ts | 130 ++++++--------------------- 1 file changed, 25 insertions(+), 105 deletions(-) diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index 7b567699bc..7891706dfe 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -1,5 +1,5 @@ import { Provider } from '@ethersproject/abstract-provider'; -// @ts-ignore +// @ts-expect-error JSZip types are not properly resolved by TSC :( import * as JSZip from 'jszip/dist/jszip.js'; import { @@ -12,8 +12,6 @@ import { AcceptedFileType, AccessControlConditions, Chain, - ConditionType, - EncryptedSymmetricKey, EvmContractConditions, IRelayAuthStatus, JsonRequest, @@ -321,34 +319,22 @@ export interface JsonSigningResourceId { } export interface MultipleAccessControlConditions { - // The access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. + // The access control conditions that the user must meet to obtain this signed token. This could be possession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. accessControlConditions?: AccessControlConditions; - // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. + // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be possession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. evmContractConditions?: EvmContractConditions; - // Solana RPC call conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. + // Solana RPC call conditions that the user must meet to obtain this signed token. This could be possession of an NFT, for example. solRpcConditions?: SolRpcConditions; // An array of unified access control conditions. You may use AccessControlCondition, EVMContractCondition, or SolRpcCondition objects in this array, but make sure you add a conditionType for each one. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. unifiedAccessControlConditions?: UnifiedAccessControlConditions; } -export interface JsonAccsRequest { - // The access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - accessControlConditions?: AccessControlConditions; - - // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - evmContractConditions?: EvmContractConditions; - - // Solana RPC call conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. - solRpcConditions?: SolRpcConditions; - - // An array of unified access control conditions. You may use AccessControlCondition, EVMContractCondition, or SolRpcCondition objects in this array, but make sure you add a conditionType for each one. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - unifiedAccessControlConditions?: UnifiedAccessControlConditions; - +export interface JsonAccsRequest extends MultipleAccessControlConditions { // The chain name of the chain that you are querying. See ALL_LIT_CHAINS for currently supported chains. - chain?: string; + chain?: Chain; // The resourceId representing something on the web via a URL resourceId?: JsonSigningResourceId; @@ -385,19 +371,8 @@ export interface GetSignedTokenRequest sessionSigs?: SessionSigsMap; } -export interface SigningAccessControlConditionRequest { - // The access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - accessControlConditions?: AccessControlConditions; - - // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - evmContractConditions?: EvmContractConditions; - - // Solana RPC call conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. - solRpcConditions?: SolRpcConditions; - - // An array of unified access control conditions. You may use AccessControlCondition, EVMContractCondition, or SolRpcCondition objects in this array, but make sure you add a conditionType for each one. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - unifiedAccessControlConditions?: UnifiedAccessControlConditions; - +export interface SigningAccessControlConditionRequest + extends MultipleAccessControlConditions { // The chain name of the chain that you are querying. See ALL_LIT_CHAINS for currently supported chains. chain?: string; @@ -452,15 +427,14 @@ export type ExecuteJsProps = JsonExecutionRequest & { debug?: boolean; }; -export interface EncryptRequestBase { - accessControlConditions?: AccessControlConditions; - evmContractConditions?: EvmContractConditions; - solRpcConditions?: SolRpcConditions; - unifiedAccessControlConditions?: UnifiedAccessControlConditions; - +export interface EncryptRequestBase extends MultipleAccessControlConditions { + // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. chain: Chain; + // The authSig of the user. Returned via the checkAndSignAuthMessage function authSig?: AuthSig; + + // the session signatures to use to authorize the user with the nodes sessionSigs?: SessionSigsMap; } @@ -753,28 +727,7 @@ export interface JsonHandshakeResponse { latestBlockhash?: string; } -export interface EncryptToIpfsProps { - // The authSig of the user. Returned via the checkAndSignAuthMessage function - authSig?: AuthSig; - - // the session signatures to use to authorize the user with the nodes - sessionSigs?: any; - - // The access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - accessControlConditions?: AccessControlConditions; - - // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - evmContractConditions?: EvmContractConditions; - - // Solana RPC call conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. - solRpcConditions?: SolRpcConditions; - - // An array of unified access control conditions. You may use AccessControlCondition, EVMContractCondition, or SolRpcCondition objects in this array, but make sure you add a conditionType for each one. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - unifiedAccessControlConditions?: UnifiedAccessControlConditions; - - // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. - chain: Chain; - +export interface EncryptToJsonProps extends EncryptRequestBase { // The string you wish to encrypt string?: string; @@ -783,69 +736,36 @@ export interface EncryptToIpfsProps { // An instance of LitNodeClient that is already connected litNodeClient: ILitNodeClient; - - // Your Infura Project Id - infuraId: string; - - // Your Infura API Key Secret - infuraSecretKey: string; } -export type EncryptToIpfsDataType = 'string' | 'file'; - -export interface EncryptToIpfsPayload { - // The access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - accessControlConditions?: AccessControlConditions; - - // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - evmContractConditions?: EvmContractConditions; - - // Solana RPC call conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. - solRpcConditions?: SolRpcConditions; - - // An array of unified access control conditions. You may use AccessControlCondition, EVMContractCondition, or SolRpcCondition objects in this array, but make sure you add a conditionType for each one. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - unifiedAccessControlConditions?: UnifiedAccessControlConditions; - - // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. - chain: Chain; +export type EncryptToJsonDataType = 'string' | 'file'; +export interface EncryptToJsonPayload extends EncryptRequestBase { ciphertext: string; dataToEncryptHash: string; - dataType: EncryptToIpfsDataType; + dataType: EncryptToJsonDataType; } -export interface DecryptFromIpfsProps { +export interface DecryptFromJsonProps { // The authSig of the user. Returned via the checkAndSignAuthMessage function authSig?: AuthSig; // the session signatures to use to authorize the user with the nodes - sessionSigs?: any; - - // The ipfsCid/ipfsHash of the encrypted string & metadata stored on IPFS - ipfsCid: string; + sessionSigs?: SessionSigsMap; // An instance of LitNodeClient that is already connected litNodeClient: ILitNodeClient; + + parsedJsonData: EncryptToJsonPayload; } -export interface EncryptFileAndZipWithMetadataProps { +export interface EncryptFileAndZipWithMetadataProps + extends MultipleAccessControlConditions { // The authSig of the user. Returned via the checkAndSignAuthMessage function authSig?: AuthSig; // the session signatures to use to authorize the user with the nodes - sessionSigs?: any; - - // The access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - accessControlConditions?: AccessControlConditions; - - // EVM Smart Contract access control conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. This is different than accessControlConditions because accessControlConditions only supports a limited number of contract calls. evmContractConditions supports any contract call. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - evmContractConditions?: EvmContractConditions; - - // Solana RPC call conditions that the user must meet to obtain this signed token. This could be posession of an NFT, for example. - solRpcConditions?: SolRpcConditions; - - // An array of unified access control conditions. You may use AccessControlCondition, EVMContractCondition, or SolRpcCondition objects in this array, but make sure you add a conditionType for each one. You must pass either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions. - unifiedAccessControlConditions?: UnifiedAccessControlConditions; + sessionSigs?: SessionSigsMap; // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. chain: string; @@ -865,7 +785,7 @@ export interface DecryptZipFileWithMetadataProps { authSig?: AuthSig; // the session signatures to use to authorize the user with the nodes - sessionSigs?: any; + sessionSigs?: SessionSigsMap; // The zip file blob with metadata inside it and the encrypted asset file: File | Blob; From 51707cfecb4646ab35387ab89c241aa68da48681 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 11 Apr 2024 21:32:42 +0100 Subject: [PATCH 10/19] feat!(encryption): LIT-2841 - Define validators for Encrypt/DecryptToJson, and remove now-unused ipfs validator - Also eslint --fixed the file, and replaced an `any` type on `AuthMethodValidator` with `AuthMethod` type. - Removed unused `decryptToZip` validator that used an `any` type; that method actually just uses the `decrypt` validator anyway --- .../encryption/src/lib/params-validators.ts | 99 ++++++++++++------- 1 file changed, 61 insertions(+), 38 deletions(-) diff --git a/packages/encryption/src/lib/params-validators.ts b/packages/encryption/src/lib/params-validators.ts index 08fd6813ca..f459637ffa 100644 --- a/packages/encryption/src/lib/params-validators.ts +++ b/packages/encryption/src/lib/params-validators.ts @@ -3,6 +3,8 @@ * returns a boolean value indicating whether the validation is passed or not. */ +import { isHexString } from 'ethers/lib/utils'; + import { EITHER_TYPE, ELeft, @@ -10,20 +12,26 @@ import { IEither, LIT_ERROR, } from '@lit-protocol/constants'; - +import { + checkIfAuthSigRequiresChainParam, + checkType, + is, + log, +} from '@lit-protocol/misc'; import { AcceptedFileType, AccessControlConditions, + AuthMethod, AuthSig, - DecryptFileProps, - DecryptFromIpfsProps, + DecryptFromJsonProps, DecryptRequest, DecryptZipFileWithMetadataProps, EncryptFileAndZipWithMetadataProps, EncryptFileRequest, EncryptRequest, EncryptStringRequest, - EncryptToIpfsProps, + EncryptToJsonPayload, + EncryptToJsonProps, EncryptZipRequest, EvmContractConditions, ExecuteJsProps, @@ -33,13 +41,6 @@ import { UnifiedAccessControlConditions, } from '@lit-protocol/types'; -import { - checkIfAuthSigRequiresChainParam, - checkType, - is, - log, -} from '@lit-protocol/misc'; -import { isHexString } from 'ethers/lib/utils'; import { isValidBooleanExpression } from './utils'; export const safeParams = ({ @@ -66,9 +67,10 @@ export const safeParams = ({ return ERight(undefined); }; -export const paramsValidators: { - [key: string]: (params: any) => ParamsValidator[]; -} = { +export const paramsValidators: Record< + string, + (params: any) => ParamsValidator[] +> = { executeJs: (params: ExecuteJsProps) => [ new AuthMaterialValidator('executeJs', params), new ExecuteJsValidator('executeJs', params), @@ -112,18 +114,15 @@ export const paramsValidators: { new FileValidator('decryptZipFileWithMetadata', params.file), ], - decryptToZip: (params: any) => [ - new FileValidator('decryptToZip', params.encryptedZipBlob), - ], - - encryptToIpfs: (params: EncryptToIpfsProps) => [ - new AccessControlConditionsValidator('encryptToIpfs', params), - new AuthMaterialValidator('encryptToIpfs', params, true), - new IpfsValidator('encryptToIpfs', params), + encryptToJson: (params: EncryptToJsonProps) => [ + new AccessControlConditionsValidator('encryptToJson', params), + new AuthMaterialValidator('encryptToJson', params, true), + new EncryptToJsonValidator('encryptToJson', params), ], - decryptFromIpfs: (params: DecryptFromIpfsProps) => [ - new AuthMaterialValidator('decryptFromIpfs', params), + decryptFromJson: (params: DecryptFromJsonProps) => [ + new AuthMaterialValidator('decryptFromJson', params), + new DecryptFromJsonValidator('decryptFromJson', params.parsedJsonData), ], encryptFileAndZipWithMetadata: ( @@ -156,11 +155,11 @@ interface ParamsValidator { validate: () => IEither; } -class IpfsValidator implements ParamsValidator { +class EncryptToJsonValidator implements ParamsValidator { private fnName: string; - private params: EncryptToIpfsProps; + private params: EncryptToJsonProps; - constructor(fnName: string, params: EncryptToIpfsProps) { + constructor(fnName: string, params: EncryptToJsonProps) { this.fnName = fnName; this.params = params; } @@ -178,7 +177,7 @@ class IpfsValidator implements ParamsValidator { } } - const { file, string, infuraId, infuraSecretKey } = this.params; + const { file, string } = this.params; if (string === undefined && file === undefined) return ELeft({ @@ -187,19 +186,43 @@ class IpfsValidator implements ParamsValidator { errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, }); - if (!infuraId || !infuraSecretKey) + if (string !== undefined && file !== undefined) return ELeft({ - message: - 'Please provide your Infura Project Id and Infura API Key Secret to add the encrypted metadata on IPFS', + message: 'Provide only either a string or file to encrypt', errorKind: LIT_ERROR.INVALID_PARAM_TYPE.kind, errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, }); - if (string !== undefined && file !== undefined) + return ERight(undefined); + } +} + +class DecryptFromJsonValidator implements ParamsValidator { + private fnName: string; + private params: EncryptToJsonPayload; + + constructor(fnName: string, params: EncryptToJsonPayload) { + this.fnName = fnName; + this.params = params; + } + + validate(): IEither { + const validators = [new StringValidator(this.fnName, this.params.dataType)]; + + for (const validator of validators) { + const validationResponse = validator.validate(); + if (validationResponse.type === EITHER_TYPE.ERROR) { + return validationResponse; + } + } + + const { dataType } = this.params; + + if (dataType !== 'string' && dataType !== 'file') return ELeft({ - message: 'Provide only either a string or file to encrypt', - errorKind: LIT_ERROR.INVALID_PARAM_TYPE.kind, - errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, + message: `dataType of ${dataType} is not valid. Must be 'string' or 'file'.`, + errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, + errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, }); return ERight(undefined); @@ -261,15 +284,15 @@ class StringValidator implements ParamsValidator { class AuthMethodValidator implements ParamsValidator { private fnName: string; - private authMethods?: Object[]; + private authMethods?: AuthMethod[]; - constructor(fnName: string, authMethods?: Object[]) { + constructor(fnName: string, authMethods?: AuthMethod[]) { this.fnName = fnName; this.authMethods = authMethods; } validate(): IEither { - const { fnName, authMethods } = this; + const { authMethods } = this; if ( authMethods && From 1382ee068a3a61737fd9d6b611f36672637c33d1 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 11 Apr 2024 21:37:37 +0100 Subject: [PATCH 11/19] feat!(encryption): LIT-2841 - Initial cut of replacing encrypt to and from ipfs methods with `encryptoToJson` and `decryptToJson` methods --- packages/encryption/src/lib/encryption.ts | 234 +++++++--------------- 1 file changed, 74 insertions(+), 160 deletions(-) diff --git a/packages/encryption/src/lib/encryption.ts b/packages/encryption/src/lib/encryption.ts index 177af00939..577cd2e5b2 100644 --- a/packages/encryption/src/lib/encryption.ts +++ b/packages/encryption/src/lib/encryption.ts @@ -1,4 +1,3 @@ -import fetch from 'cross-fetch'; // @ts-expect-error jszip types don't resolve. :sad_panda: import * as JSZip from 'jszip/dist/jszip.js'; @@ -6,7 +5,6 @@ import { EITHER_TYPE, ILitError, LIT_ERROR } from '@lit-protocol/constants'; import { verifySignature } from '@lit-protocol/crypto'; import { checkType, isBrowser, log, throwError } from '@lit-protocol/misc'; import { - DecryptFromIpfsProps, DecryptRequest, DecryptZipFileWithMetadata, DecryptZipFileWithMetadataProps, @@ -15,14 +13,15 @@ import { EncryptRequestBase, EncryptResponse, EncryptStringRequest, - EncryptToIpfsPayload, - EncryptToIpfsProps, EncryptZipRequest, IJWT, ILitNodeClient, MetadataForFile, SigningAccessControlConditionJWTPayload, VerifyJWTProps, + EncryptToJsonPayload, + EncryptToJsonProps, + DecryptFromJsonProps, } from '@lit-protocol/types'; import { uint8arrayFromString, @@ -30,68 +29,21 @@ import { } from '@lit-protocol/uint8arrays'; import { safeParams } from './params-validators'; - -const createIpfsPayload = (serialisedData: string) => { - const boundary = '---------------------------' + Date.now().toString(16); // Generate a unique boundary - const buffer = new TextEncoder().encode(serialisedData); - - const payload = `--${boundary}\r\nContent-Disposition: form-data; name="file"; filename="string.txt"\r\nContent-Type: text/plain\r\n\r\n${new TextDecoder().decode( - buffer - )}\r\n--${boundary}--\r\n`; - - return { payload, boundary }; -}; - -async function postToInfuraIpfs({ - serialisedData, - infuraId, - infuraSecretKey, -}: { - serialisedData: string; - infuraId: string; - infuraSecretKey: string; -}) { - const { payload, boundary } = createIpfsPayload(serialisedData); - const res = await fetch( - `https://ipfs.infura.io:5001/api/v0/add?pin=true&cid-version=1&hash=sha2-256`, - { - method: 'POST', - headers: { - accept: 'application/json', - 'Content-Type': `multipart/form-data; boundary=${boundary}`, - authorization: `Basic ${Buffer.from( - `${infuraId}:${infuraSecretKey}` - ).toString('base64')}`, - }, - body: payload, - } - ); - - if (res.status !== 200) { - throw new Error(`Failed to post to Infura IPFS: ${res.statusText}`); - } - - // https://docs.infura.io/api/networks/ipfs/http-api-methods/add#response - const { Hash } = (await res.json()) as { Hash: string }; - - return Hash; -} - /** + * Encrypt a string or file using the LIT network public key and serialise all the metadata required to decrypt + * i.e. accessControlConditions, evmContractConditions, solRpcConditions, unifiedAccessControlConditions & chain to JSON * - * Encrypt a string or file using the LIT network public key and upload all the metadata required to decrypt i.e. accessControlConditions, evmContractConditions, solRpcConditions, unifiedAccessControlConditions & chain to IPFS using the ipfs-client-http SDK & returns the IPFS CID. + * Useful for encrypting/decrypting data in IPFS or other storage without compressing it in a ZIP file. * - * @param params { EncryptToIpfsProps } - The params required to encrypt & upload to IPFS + * @param params { EncryptToJsonProps } - The params required to encrypt either a file or string and serialise it to JSON * - * @returns { Promise } - IPFS CID + * @returns { Promise } - JSON serialised string of the encrypted data and associated metadata necessary to decrypt it later * */ -export const encryptToIpfs = async ( - params: EncryptToIpfsProps +export const encryptToJson = async ( + params: EncryptToJsonProps ): Promise => { const { - authSig, - sessionSigs, accessControlConditions, evmContractConditions, solRpcConditions, @@ -100,25 +52,12 @@ export const encryptToIpfs = async ( string, file, litNodeClient, - infuraId, - infuraSecretKey, } = params; // -- validate const paramsIsSafe = safeParams({ - functionName: 'encryptToIpfs', - params: { - authSig, - sessionSigs, - accessControlConditions, - evmContractConditions, - solRpcConditions, - unifiedAccessControlConditions, - chain, - string, - file, - litNodeClient, - }, + functionName: 'encryptToJson', + params, }); if (paramsIsSafe.type === EITHER_TYPE.ERROR) @@ -137,40 +76,32 @@ export const encryptToIpfs = async ( litNodeClient ); - return await postToInfuraIpfs({ - serialisedData: JSON.stringify({ - ciphertext, - dataToEncryptHash, - accessControlConditions, - evmContractConditions, - solRpcConditions, - unifiedAccessControlConditions, - chain, - dataType: 'string', - } as EncryptToIpfsPayload), - infuraId, - infuraSecretKey, - }); + return JSON.stringify({ + ciphertext, + dataToEncryptHash, + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions, + chain, + dataType: 'string', + } as EncryptToJsonPayload); } else if (file) { const { ciphertext, dataToEncryptHash } = await encryptFile( { ...params, file }, litNodeClient ); - return await postToInfuraIpfs({ - serialisedData: JSON.stringify({ - ciphertext, - dataToEncryptHash, - accessControlConditions, - evmContractConditions, - solRpcConditions, - unifiedAccessControlConditions, - chain, - dataType: 'file', - } as EncryptToIpfsPayload), - infuraId, - infuraSecretKey, - }); + return JSON.stringify({ + ciphertext, + dataToEncryptHash, + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions, + chain, + dataType: 'file', + } as EncryptToJsonPayload); } else { throw new Error(`You must provide either 'file' or 'string'.`); } @@ -178,27 +109,23 @@ export const encryptToIpfs = async ( /** * - * Decrypt & return the string or file (in Uint8Array format) using its metadata stored on IPFS with the given ipfsCid. + * Decrypt & return a previously encrypted string (as a string) or file (as a Uint8Array) using the metadata included + * in the parsed JSON data * - * @param { DecryptFromIpfsProps } - The params required to decrypt from IPFS + * @param params { DecryptFromJsonProps } - The params required to decrypt a parsed JSON blob containing appropriate metadata * - * @returns { Promise } - The decrypted string or file (in Uint8Array format) + * @returns { Promise } - The decrypted `string` or file (as a `Uint8Array`) depending on `dataType` property in the parsed JSON provided * */ -export const decryptFromIpfs = async ( - params: DecryptFromIpfsProps +export const decryptFromJson = async ( + params: DecryptFromJsonProps ): Promise => { - const { authSig, sessionSigs, ipfsCid, litNodeClient } = params; + const { authSig, sessionSigs, parsedJsonData, litNodeClient } = params; // -- validate const paramsIsSafe = safeParams({ - functionName: 'decryptFromIpfs', - params: { - authSig, - sessionSigs, - ipfsCid, - litNodeClient, - }, + functionName: 'decryptFromJson', + params, }); if (paramsIsSafe.type === EITHER_TYPE.ERROR) @@ -208,52 +135,39 @@ export const decryptFromIpfs = async ( errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, }); - try { - // FIXME: We use Infura to upload, but pinata to fetch, which could lead to false failures to GET - // When recently POSTed items haven't replicated yet. - // Ideally, we shouldn't be responsible for deciding which IPFS hosts someone uses for these operations. - const metadata: EncryptToIpfsPayload = await ( - await fetch(`https://gateway.pinata.cloud/ipfs/${ipfsCid}`) - ).json(); - if (metadata.dataType === 'string') { - return decryptToString( - { - accessControlConditions: metadata.accessControlConditions, - evmContractConditions: metadata.evmContractConditions, - solRpcConditions: metadata.solRpcConditions, - unifiedAccessControlConditions: - metadata.unifiedAccessControlConditions, - ciphertext: metadata.ciphertext, - dataToEncryptHash: metadata.dataToEncryptHash, - chain: metadata.chain, - authSig, - sessionSigs, - }, - litNodeClient - ); - } else { - return decryptToFile( - { - accessControlConditions: metadata.accessControlConditions, - evmContractConditions: metadata.evmContractConditions, - solRpcConditions: metadata.solRpcConditions, - unifiedAccessControlConditions: - metadata.unifiedAccessControlConditions, - ciphertext: metadata.ciphertext, - dataToEncryptHash: metadata.dataToEncryptHash, - chain: metadata.chain, - authSig, - sessionSigs, - }, - litNodeClient - ); - } - } catch (e) { - return throwError({ - message: 'Unable to fetch or decrypt from IPFS', - errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, - errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, - }); + // FIXME: The return type of this function is inferrable based on the value of `params.dataType` + if (parsedJsonData.dataType === 'string') { + return decryptToString( + { + accessControlConditions: parsedJsonData.accessControlConditions, + evmContractConditions: parsedJsonData.evmContractConditions, + solRpcConditions: parsedJsonData.solRpcConditions, + unifiedAccessControlConditions: + parsedJsonData.unifiedAccessControlConditions, + ciphertext: parsedJsonData.ciphertext, + dataToEncryptHash: parsedJsonData.dataToEncryptHash, + chain: parsedJsonData.chain, + authSig, + sessionSigs, + }, + litNodeClient + ); + } else { + return decryptToFile( + { + accessControlConditions: parsedJsonData.accessControlConditions, + evmContractConditions: parsedJsonData.evmContractConditions, + solRpcConditions: parsedJsonData.solRpcConditions, + unifiedAccessControlConditions: + parsedJsonData.unifiedAccessControlConditions, + ciphertext: parsedJsonData.ciphertext, + dataToEncryptHash: parsedJsonData.dataToEncryptHash, + chain: parsedJsonData.chain, + authSig, + sessionSigs, + }, + litNodeClient + ); } }; From b6ba5c82b011d700059f4374361e667bbaf2463b Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 11 Apr 2024 21:38:11 +0100 Subject: [PATCH 12/19] feat!(lit-node-client-nodejs): LIT-2841 - Replace exported `encryptToIpfs` and `decryptFromIpfs` with our new to/from JSON methods --- packages/lit-node-client-nodejs/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/index.ts b/packages/lit-node-client-nodejs/src/index.ts index fee8e217a8..7836b62701 100644 --- a/packages/lit-node-client-nodejs/src/index.ts +++ b/packages/lit-node-client-nodejs/src/index.ts @@ -19,14 +19,14 @@ export * from './lib/lit-node-client-nodejs'; export { decryptToFile, + decryptFromJson, decryptToString, decryptToZip, decryptZipFileWithMetadata, - decryptFromIpfs, encryptFile, encryptFileAndZipWithMetadata, + encryptToJson, encryptString, - encryptToIpfs, encryptZip, verifyJwt, zipAndEncryptFiles, From 44119164bfc57c450a343fea1a9d9f6db2d685c7 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Tue, 16 Apr 2024 14:07:03 +0100 Subject: [PATCH 13/19] chore(encryption): LIT-2841 - Code review feedback - make `dataType` handling throw if not `file` or `string` --- packages/encryption/src/lib/encryption.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/encryption/src/lib/encryption.ts b/packages/encryption/src/lib/encryption.ts index 577cd2e5b2..ae77eca22e 100644 --- a/packages/encryption/src/lib/encryption.ts +++ b/packages/encryption/src/lib/encryption.ts @@ -152,7 +152,7 @@ export const decryptFromJson = async ( }, litNodeClient ); - } else { + } else if (parsedJsonData.dataType === 'file') { return decryptToFile( { accessControlConditions: parsedJsonData.accessControlConditions, @@ -168,6 +168,8 @@ export const decryptFromJson = async ( }, litNodeClient ); + } else { + throw new Error(`Datatype "${parsedJsonData.dataType}" is not supported.`); } }; From dec1568bb4697e9cd0cc96b3522cfc66ebcb9de9 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Tue, 16 Apr 2024 15:48:22 +0100 Subject: [PATCH 14/19] chore(contracts-sdk): LIT-2841 - Make `connect()` logging less spammy for `LitContracts` - No longer logs huge arrays of numbers that represent the ABIs - ESLint --fix'd the file --- .../contracts-sdk/src/lib/contracts-sdk.ts | 101 +++++++++--------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/packages/contracts-sdk/src/lib/contracts-sdk.ts b/packages/contracts-sdk/src/lib/contracts-sdk.ts index 0edfbf6fa7..439baf96b8 100644 --- a/packages/contracts-sdk/src/lib/contracts-sdk.ts +++ b/packages/contracts-sdk/src/lib/contracts-sdk.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { BigNumber, BigNumberish, BytesLike, ethers } from 'ethers'; import { hexToDec, decToHex, intToIP } from './hex2dec'; import bs58 from 'bs58'; @@ -73,10 +74,7 @@ try { // - index: The index of the current item being processed in the array // - array: The array being iterated over // @return {Array} The array of callback return values -export const asyncForEachReturn = async ( - array: Array, - callback: Function -) => { +export const asyncForEachReturn = async (array: any[], callback: Function) => { const list = []; for (let index = 0; index < array.length; index++) { @@ -319,7 +317,7 @@ export class LitContracts { ) { console.warn('THIS.SIGNER:', this.signer); - let STORAGE_KEY = 'lit-contracts-sdk-private-key'; + const STORAGE_KEY = 'lit-contracts-sdk-private-key'; this.log("Let's see if you have a private key in your local storage!"); @@ -373,7 +371,7 @@ export class LitContracts { if ('litNodeClient' in this.signer && 'rpcProvider' in this.signer) { this.log(` // *********************************************************************************************** - // THIS IS A PKP WALLET, USING IT AS A SIGNER AND ITS RPC PROVIDER AS PROVIDER + // THIS IS A PKP WALLET, USING IT AS A SIGNER AND ITS RPC PROVIDER AS PROVIDER // *********************************************************************************************** `); @@ -392,13 +390,26 @@ export class LitContracts { this.log('Your Provider(from signer):', this.provider); } - let addresses: any = await LitContracts.getContractAddresses( + const addresses: any = await LitContracts.getContractAddresses( this.network, this.customContext?.provider ?? this.provider, this.customContext ); - this.log('resolved contract addresses for: ', this.network, addresses); + const logAddresses = Object.entries(addresses).reduce( + (output, [key, val]) => { + // @ts-expect-error since the object hash returned by `getContractAddresses` is `any`, we have no types here + output[key] = val.address; + return output; + }, + {} + ); + + console.log( + 'resolved contract addresses for: ', + this.network, + logAddresses + ); // ----- autogen:init:start ----- // Generated at 2023-11-07T01:50:52.460Z @@ -574,7 +585,7 @@ export class LitContracts { } if (!context) { - let contractData = await LitContracts._resolveContractContext( + const contractData = await LitContracts._resolveContractContext( network, context ); @@ -594,7 +605,7 @@ export class LitContracts { // if we have contract context then we determine if there exists a `resolverAddres` // if there is a resolver address we assume we are using a contract resolver for bootstrapping of contracts if (!context.resolverAddress) { - let stakingContract = (context as LitContractContext).Staking; + const stakingContract = (context as LitContractContext).Staking; if (!stakingContract.address) { throw new Error( @@ -607,7 +618,7 @@ export class LitContracts { provider ); } else { - let contractContext = await LitContracts._getContractsFromResolver( + const contractContext = await LitContracts._getContractsFromResolver( context as LitContractResolverContext, provider, ['Staking'] @@ -629,16 +640,16 @@ export class LitContracts { private static async _getContractsFromResolver( context: LitContractResolverContext, provider: ethers.providers.JsonRpcProvider, - contractNames?: Array + contractNames?: (keyof LitContractContext)[] ): Promise { const rpcUrl = DEFAULT_RPC; - let resolverContract = new ethers.Contract( + const resolverContract = new ethers.Contract( context.resolverAddress, context.abi, provider ); - let getContract = async function ( + const getContract = async function ( contract: keyof LitContractContext, environment: number ): Promise { @@ -731,9 +742,9 @@ export class LitContracts { ]; } - let addresses: LitContractContext = {} as LitContractContext; + const addresses: LitContractContext = {} as LitContractContext; for (const contract of contractNames) { - let contracts = context?.contractContext; + const contracts = context?.contractContext; addresses[contract] = { address: await getContract(contract, context.environment), abi: contracts?.[contract]?.abi ?? undefined, @@ -759,8 +770,8 @@ export class LitContracts { ); } - let flatten = []; - let keys = Object.keys(context); + const flatten = []; + const keys = Object.keys(context); for (const key of keys) { context[key].name = key; flatten.push(context[key]); @@ -997,7 +1008,7 @@ export class LitContracts { if (scopes.length <= 0) { throw new Error(`❌ Permission scopes are required! [0] No Permissions -[1] Sign Anything +[1] Sign Anything [2] Only Sign Messages Read more here: https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scopes @@ -1039,7 +1050,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope const receipt = await tx.wait(); - let events = 'events' in receipt ? receipt.events : receipt.logs; + const events = 'events' in receipt ? receipt.events : receipt.logs; if (!events) { throw new Error('No events found in receipt'); @@ -1165,7 +1176,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope }); const txHash = res.hash; - let tx = await res.wait(); + const tx = await res.wait(); this.log('Transaction:', tx); const tokenId = ethers.BigNumber.from(tx.logs[0].topics[3]); @@ -1252,7 +1263,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope const size = cid.multihash.size; const digest = '0x' + Buffer.from(cid.multihash.digest).toString('hex'); - let ipfsHash: IPFSHash = { + const ipfsHash: IPFSHash = { digest, hashFunction, size, @@ -1267,7 +1278,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope const format = 'YYYY/MM/DD HH:mm:ss'; - let timestampFormatted: Date = new Date(parseInt(timestamp) * 1000); + const timestampFormatted: Date = new Date(parseInt(timestamp) * 1000); return date.format(timestampFormatted, format); }, @@ -1284,9 +1295,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope * @retu * */ - getTokensByAddress: async ( - ownerAddress: string - ): Promise> => { + getTokensByAddress: async (ownerAddress: string): Promise => { if (!this.connected) { throw new Error( 'Contracts are not connected. Please call connect() first' @@ -1303,7 +1312,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope ); } - let tokens = []; + const tokens = []; for (let i = 0; ; i++) { let token; @@ -1336,9 +1345,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope * @returns { Array } a list of PKP NFTs * */ - getTokens: async ( - latestNumberOfTokens: number - ): Promise> => { + getTokens: async (latestNumberOfTokens: number): Promise => { if (!this.connected) { throw new Error( 'Contracts are not connected. Please call connect() first' @@ -1348,7 +1355,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope throw new Error('Contract is not available'); } - let tokens = []; + const tokens = []; for (let i = 0; ; i++) { if (i >= latestNumberOfTokens) { @@ -1377,7 +1384,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope */ getTokensInfoByAddress: async ( ownerAddress: string - ): Promise> => { + ): Promise => { const tokenIds = await this.pkpNftContractUtils.read.getTokensByAddress( ownerAddress ); @@ -1427,14 +1434,14 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope ); this.log('...populating tx'); - let tx = await this.pkpNftContract.write.populateTransaction.mintNext( - 2, - { value: mintCost } - ); + const tx = + await this.pkpNftContract.write.populateTransaction.mintNext(2, { + value: mintCost, + }); this.log('tx:', tx); this.log('...signing tx'); - let signedTx = await this.signer.signTransaction(tx); + const signedTx = await this.signer.signTransaction(tx); this.log('signedTx:', signedTx); this.log('sending signed tx...'); @@ -1452,7 +1459,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope const res: any = await sentTx.wait(); this.log('res:', res); - let events = 'events' in res ? res.events : res.logs; + const events = 'events' in res ? res.events : res.logs; let tokenIdFromEvent; @@ -1488,16 +1495,16 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope signatures: IPubkeyRouter.SignatureStruct[], txOpts?: any ) => { - let cost = await this.pkpNftContract.read.mintCost(); + const cost = await this.pkpNftContract.read.mintCost(); const tx = await this.pkpNftContract.write.claimAndMint( 2, derivedKeyId, signatures, txOpts ?? { value: cost } ); - let txRec = await tx.wait(); - let events: any = 'events' in txRec ? txRec.events : txRec.logs; - let tokenId = events[1].topics[1]; + const txRec = await tx.wait(); + const events: any = 'events' in txRec ? txRec.events : txRec.logs; + const tokenId = events[1].topics[1]; return { tx, res: txRec, tokenId }; }, }, @@ -1538,9 +1545,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope return bool; }, - getPermittedAddresses: async ( - tokenId: string - ): Promise> => { + getPermittedAddresses: async (tokenId: string): Promise => { if (!this.connected) { throw new Error( 'Contracts are not connected. Please call connect() first' @@ -1552,7 +1557,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope this.log('[getPermittedAddresses] input:', tokenId); - let addresses: Array = []; + let addresses: string[] = []; const maxTries = 5; let tries = 0; @@ -1591,7 +1596,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope * @returns { Promise> } * */ - getPermittedActions: async (tokenId: any): Promise> => { + getPermittedActions: async (tokenId: any): Promise => { if (!this.connected) { throw new Error( 'Contracts are not connected. Please call connect() first' @@ -1602,7 +1607,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope throw new Error('Contract is not available'); } - let actions: Array = []; + let actions: any[] = []; const maxTries = 5; let tries = 0; From 54bd94bfed61e870fb7e3c06fcf8b3a42a677b1d Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Tue, 16 Apr 2024 18:51:31 +0100 Subject: [PATCH 15/19] chore(contracts-sdk): LIT-2841 - Use local logger instead of `console.log` --- packages/contracts-sdk/src/lib/contracts-sdk.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/contracts-sdk/src/lib/contracts-sdk.ts b/packages/contracts-sdk/src/lib/contracts-sdk.ts index 439baf96b8..3c0ae8fdaf 100644 --- a/packages/contracts-sdk/src/lib/contracts-sdk.ts +++ b/packages/contracts-sdk/src/lib/contracts-sdk.ts @@ -405,11 +405,7 @@ export class LitContracts { {} ); - console.log( - 'resolved contract addresses for: ', - this.network, - logAddresses - ); + this.log('resolved contract addresses for: ', this.network, logAddresses); // ----- autogen:init:start ----- // Generated at 2023-11-07T01:50:52.460Z From ca4428305880efabc4029d6f5ed4601724fe36be Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Wed, 17 Apr 2024 23:24:21 +0100 Subject: [PATCH 16/19] =?UTF-8?q?fix(encryption):=20LIT-2841=20-=20Infer?= =?UTF-8?q?=20return=20type=20of=20`decryptFromJson()`=20properly=20based?= =?UTF-8?q?=20on=20`parsedJsonData.dataType`=20arg=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/encryption/src/lib/encryption.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/encryption/src/lib/encryption.ts b/packages/encryption/src/lib/encryption.ts index ae77eca22e..f292a5b2d7 100644 --- a/packages/encryption/src/lib/encryption.ts +++ b/packages/encryption/src/lib/encryption.ts @@ -117,9 +117,15 @@ export const encryptToJson = async ( * @returns { Promise } - The decrypted `string` or file (as a `Uint8Array`) depending on `dataType` property in the parsed JSON provided * */ -export const decryptFromJson = async ( - params: DecryptFromJsonProps -): Promise => { +export async function decryptFromJson( + params: T +): Promise< + T extends { parsedJsonData: { dataType: 'file' } } + ? ReturnType + : T extends { parsedJsonData: { dataType: 'string' } } + ? ReturnType + : never +> { const { authSig, sessionSigs, parsedJsonData, litNodeClient } = params; // -- validate @@ -171,7 +177,7 @@ export const decryptFromJson = async ( } else { throw new Error(`Datatype "${parsedJsonData.dataType}" is not supported.`); } -}; +} // ---------- Local Helpers ---------- From 29ffde9cda656d7c9dc2079c944ac23e5f569710 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Wed, 17 Apr 2024 23:35:09 +0100 Subject: [PATCH 17/19] fix(encryption): LIT-2841 - Use the same string output as the paramsValidator uses --- packages/encryption/src/lib/encryption.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/encryption/src/lib/encryption.ts b/packages/encryption/src/lib/encryption.ts index f292a5b2d7..3e7e29bcd2 100644 --- a/packages/encryption/src/lib/encryption.ts +++ b/packages/encryption/src/lib/encryption.ts @@ -175,7 +175,9 @@ export async function decryptFromJson( litNodeClient ); } else { - throw new Error(`Datatype "${parsedJsonData.dataType}" is not supported.`); + throw new Error( + `dataType of ${parsedJsonData.dataType} is not valid. Must be 'string' or 'file'.` + ); } } From 0c3bac257c67f1c077ec2ad5c85eb71266e921ac Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 18 Apr 2024 17:48:06 +0100 Subject: [PATCH 18/19] fix(encryption): LIT-2841 - Remove overly strict requirement that both `string` and `file` be passed to `EncryptToJsonValidator` --- packages/encryption/src/lib/params-validators.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/encryption/src/lib/params-validators.ts b/packages/encryption/src/lib/params-validators.ts index f459637ffa..3e687b4cdd 100644 --- a/packages/encryption/src/lib/params-validators.ts +++ b/packages/encryption/src/lib/params-validators.ts @@ -165,18 +165,6 @@ class EncryptToJsonValidator implements ParamsValidator { } validate(): IEither { - const validators = [ - new FileValidator(this.fnName, this.params.file), - new StringValidator(this.fnName, this.params.string), - ]; - - for (const validator of validators) { - const validationResponse = validator.validate(); - if (validationResponse.type === EITHER_TYPE.ERROR) { - return validationResponse; - } - } - const { file, string } = this.params; if (string === undefined && file === undefined) @@ -188,7 +176,8 @@ class EncryptToJsonValidator implements ParamsValidator { if (string !== undefined && file !== undefined) return ELeft({ - message: 'Provide only either a string or file to encrypt', + message: + 'Provide only a "string" or "file" to encrypt; you cannot provide both', errorKind: LIT_ERROR.INVALID_PARAM_TYPE.kind, errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, }); From 93cdeb36a0715af121b63b04e32973db856da458 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 18 Apr 2024 17:48:52 +0100 Subject: [PATCH 19/19] test(encryption): LIT-2841 - Implement e2e tests for encrypting and decrypting from JSON strings including metadata --- ...st-pkp-encryption-decryption-json-file.mjs | 57 +++++++++++++++++++ ...-pkp-encryption-decryption-json-string.mjs | 50 ++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-file.mjs create mode 100644 e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-string.mjs diff --git a/e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-file.mjs b/e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-file.mjs new file mode 100644 index 0000000000..369ba7d234 --- /dev/null +++ b/e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-file.mjs @@ -0,0 +1,57 @@ +import path from 'path'; +import * as LitJsSdk from '@lit-protocol/lit-node-client'; +import { success, fail, testThis } from '../../tools/scripts/utils.mjs'; +import { client } from '../00-setup.mjs'; + +export async function main() { + // ==================== Setup ==================== + const chain = 'ethereum'; + const accessControlConditions = [ + { + contractAddress: '', + standardContractType: '', + chain, + method: 'eth_getBalance', + parameters: [':userAddress', 'latest'], + returnValueTest: { + comparator: '>=', + value: '0', + }, + }, + ]; + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + + // ==================== Test Logic ==================== + const encryptedJsonStr = await LitJsSdk.encryptToJson({ + accessControlConditions, + authSig: globalThis.LitCI.CONTROLLER_AUTHSIG, + chain, + file: blob, + litNodeClient: client, + }); + + const decryptedFile = await LitJsSdk.decryptFromJson({ + authSig: globalThis.LitCI.CONTROLLER_AUTHSIG, + parsedJsonData: JSON.parse(encryptedJsonStr), + litNodeClient: client, + }); + + // ==================== Post-Validation ==================== + if (blobArray.length !== decryptedFile.length) { + return fail( + `decrypted file should match the original file but received ${decryptedFile}` + ); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decryptedFile[i]) { + return fail(`decrypted file should match the original file`); + } + } + + // ==================== Success ==================== + return success('File was encrypted and then decrypted successfully'); +} + +await testThis({ name: path.basename(import.meta.url), fn: main }); diff --git a/e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-string.mjs b/e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-string.mjs new file mode 100644 index 0000000000..c53d2143b5 --- /dev/null +++ b/e2e-nodejs/group-pkp-encryption-decryption/test-pkp-encryption-decryption-json-string.mjs @@ -0,0 +1,50 @@ +import path from 'path'; +import * as LitJsSdk from '@lit-protocol/lit-node-client'; +import { success, fail, testThis } from '../../tools/scripts/utils.mjs'; +import { client } from '../00-setup.mjs'; + +export async function main() { + // ==================== Setup ==================== + const chain = 'ethereum'; + const accessControlConditions = [ + { + contractAddress: '', + standardContractType: '', + chain, + method: 'eth_getBalance', + parameters: [':userAddress', 'latest'], + returnValueTest: { + comparator: '>=', + value: '0', + }, + }, + ]; + const message = 'Hello world'; + + // ==================== Test Logic ==================== + const encryptedJsonStr = await LitJsSdk.encryptToJson({ + accessControlConditions, + authSig: globalThis.LitCI.CONTROLLER_AUTHSIG, + chain, + string: message, + litNodeClient: client, + }); + + const decryptedMessage = await LitJsSdk.decryptFromJson({ + authSig: globalThis.LitCI.CONTROLLER_AUTHSIG, + parsedJsonData: JSON.parse(encryptedJsonStr), + litNodeClient: client, + }); + + // ==================== Post-Validation ==================== + if (message !== decryptedMessage) { + return fail( + `decryptedMessage should be ${message} but received ${decryptedMessage}` + ); + } + + // ==================== Success ==================== + return success('Message was encrypted and then decrypted successfully'); +} + +await testThis({ name: path.basename(import.meta.url), fn: main });