diff --git a/.gitignore b/.gitignore index c4daa6c..8ccc9d7 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ database/ system-user-*.json orbitdb ipfsdata +.ipfsdata ipfs-service-provider.sh !README.md diff --git a/bin/server.js b/bin/server.js index 4fa37fe..04638b6 100644 --- a/bin/server.js +++ b/bin/server.js @@ -1,3 +1,12 @@ +/* + This Koa server has two interfaces: + - REST API over HTTP + - JSON RPC over IPFS + + The architecture of the code follows the Clean Architecture pattern: + https://troutsblog.com/blog/clean-architecture +*/ + // npm libraries const Koa = require('koa') const bodyParser = require('koa-bodyparser') @@ -12,73 +21,75 @@ const cors = require('kcors') // Local libraries const config = require('../config') // this first. -// const IPFSLib = require('../src/lib/ipfs') const AdminLib = require('../src/adapters/admin') -const adminLib = new AdminLib() -// const JSONRPC = require('../src/rpc') -// const rpc = new JSONRPC() - const errorMiddleware = require('../src/controllers/rest-api/middleware/error') const { wlogger } = require('../src/adapters/wlogger') -async function startServer () { - // Create a Koa instance. - const app = new Koa() - app.keys = [config.session] +class Server { + constructor () { + this.adminLib = new AdminLib() + } - // Connect to the Mongo Database. - mongoose.Promise = global.Promise - mongoose.set('useCreateIndex', true) // Stop deprecation warning. - await mongoose.connect(config.database, { - useUnifiedTopology: true, - useNewUrlParser: true - }) + async startServer () { + try { + // Create a Koa instance. + const app = new Koa() + app.keys = [config.session] - // MIDDLEWARE START + // Connect to the Mongo Database. + mongoose.Promise = global.Promise + mongoose.set('useCreateIndex', true) // Stop deprecation warning. + await mongoose.connect(config.database, { + useUnifiedTopology: true, + useNewUrlParser: true + }) - app.use(convert(logger())) - app.use(bodyParser()) - app.use(session()) - app.use(errorMiddleware()) + // MIDDLEWARE START - // Used to generate the docs. - app.use(mount('/', serve(`${process.cwd()}/docs`))) + app.use(convert(logger())) + app.use(bodyParser()) + app.use(session()) + app.use(errorMiddleware()) - // Mount the page for displaying logs. - app.use(mount('/logs', serve(`${process.cwd()}/config/logs`))) + // Used to generate the docs. + app.use(mount('/', serve(`${process.cwd()}/docs`))) - // User Authentication - require('../config/passport') - app.use(passport.initialize()) - app.use(passport.session()) + // Mount the page for displaying logs. + app.use(mount('/logs', serve(`${process.cwd()}/config/logs`))) - // Attach REST API and JSON RPC controllers to the app. - const Controllers = require('../src/controllers') - const controllers = new Controllers() - controllers.attachControllers(app) + // User Authentication + require('../config/passport') + app.use(passport.initialize()) + app.use(passport.session()) - // Enable CORS for testing - // THIS IS A SECURITY RISK. COMMENT OUT FOR PRODUCTION - app.use(cors({ origin: '*' })) + // Attach REST API and JSON RPC controllers to the app. + const Controllers = require('../src/controllers') + const controllers = new Controllers() + await controllers.attachControllers(app) - // MIDDLEWARE END + app.controllers = controllers - console.log(`Running server in environment: ${config.env}`) - wlogger.info(`Running server in environment: ${config.env}`) + // Enable CORS for testing + // THIS IS A SECURITY RISK. COMMENT OUT FOR PRODUCTION + app.use(cors({ origin: '*' })) - await app.listen(config.port) - console.log(`Server started on ${config.port}`) + // MIDDLEWARE END - // Create the system admin user. - const success = await adminLib.createSystemUser() - if (success) console.log('System admin user created.') + console.log(`Running server in environment: ${config.env}`) + wlogger.info(`Running server in environment: ${config.env}`) - return app + await app.listen(config.port) + console.log(`Server started on ${config.port}`) + + // Create the system admin user. + const success = await this.adminLib.createSystemUser() + if (success) console.log('System admin user created.') + + return app + } catch (err) { + console.error('Could not start server. Error: ', err) + } + } } -// startServer() -// export default app -// module.exports = app -module.exports = { - startServer -} +module.exports = Server diff --git a/config/env/common.js b/config/env/common.js index 7662a5f..271c7c9 100644 --- a/config/env/common.js +++ b/config/env/common.js @@ -31,6 +31,21 @@ module.exports = { ? process.env.EMAILPASS : 'emailpassword', + // FullStack.cash account information, used for automatic JWT handling. + getJwtAtStartup: false, + authServer: process.env.AUTHSERVER + ? process.env.AUTHSERVER + : 'https://auth.fullstack.cash', + apiServer: process.env.APISERVER + ? process.env.APISERVER + : 'https://api.fullstack.cash/v5/', + fullstackLogin: process.env.FULLSTACKLOGIN + ? process.env.FULLSTACKLOGIN + : 'demo@demo.com', + fullstackPassword: process.env.FULLSTACKPASS + ? process.env.FULLSTACKPASS + : 'demo', + // IPFS settings. isCircuitRelay: process.env.ENABLE_CIRCUIT_RELAY ? true : false, diff --git a/database/README.md b/database/README.md deleted file mode 100644 index 16897c3..0000000 --- a/database/README.md +++ /dev/null @@ -1 +0,0 @@ -This is where the mongodb docker container stores its db files. diff --git a/index.js b/index.js index 4d82406..3788713 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ -const server = require('./bin/server.js') +const Server = require('./bin/server.js') +const server = new Server() server.startServer() diff --git a/package-lock.json b/package-lock.json index eff5d4d..4f6b3f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,22 @@ { "name": "ipfs-service-provider", - "version": "1.0.0", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.0.0", + "version": "1.3.0", "license": "MIT", "dependencies": { - "@psf/bch-js": "^4.20.1", + "@psf/bch-js": "^4.20.3", "axios": "^0.21.1", "bcryptjs": "^2.4.3", "glob": "^7.1.6", - "ipfs": "^0.54.4", - "ipfs-coord": "^3.2.0", + "ipfs": "0.54.4", + "ipfs-coord": "^5.0.0", "jsonrpc-lite": "^2.2.0", "jsonwebtoken": "^8.5.1", + "jwt-bch-lib": "^1.3.0", "kcors": "^2.2.2", "koa": "^2.13.1", "koa-bodyparser": "^4.3.0", @@ -53,6 +54,34 @@ "uuid": "^8.3.2" } }, + "../ipfs-coord": { + "version": "5.0.0", + "extraneous": true, + "license": "MIT", + "dependencies": { + "bch-encrypt-lib": "^2.0.0", + "orbit-db": "^0.26.1" + }, + "devDependencies": { + "@psf/bch-js": "^4.18.0", + "apidoc": "^0.25.0", + "chai": "^4.2.0", + "coveralls": "^3.1.0", + "eslint": "7.17.0", + "eslint-config-prettier": "^7.1.0", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-standard": "^4.0.0", + "husky": "^4.3.6", + "lodash.clonedeep": "^4.5.0", + "mocha": "^8.2.1", + "nyc": "^15.1.0", + "semantic-release": "^17.4.2", + "sinon": "^9.2.2", + "standard": "^16.0.3" + } + }, "node_modules/@achingbrain/electron-fetch": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/@achingbrain/electron-fetch/-/electron-fetch-1.7.2.tgz", @@ -329,9 +358,9 @@ } }, "node_modules/@ethersproject/abstract-provider": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.4.0.tgz", - "integrity": "sha512-vPBR7HKUBY0lpdllIn7tLIzNN7DrVnhCLKSzY0l8WAwxz686m/aL7ASDzrVxV93GJtIub6N2t4dfZ29CkPOxgA==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.4.1.tgz", + "integrity": "sha512-3EedfKI3LVpjSKgAxoUaI+gB27frKsxzm+r21w9G60Ugk+3wVLQwhi1LsEJAKNV7WoZc8CIpNrATlL1QFABjtQ==", "funding": [ { "type": "individual", @@ -353,9 +382,9 @@ } }, "node_modules/@ethersproject/abstract-signer": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.4.0.tgz", - "integrity": "sha512-AieQAzt05HJZS2bMofpuxMEp81AHufA5D6M4ScKwtolj041nrfIbIi8ciNW7+F59VYxXq+V4c3d568Q6l2m8ew==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.4.1.tgz", + "integrity": "sha512-SkkFL5HVq1k4/25dM+NWP9MILgohJCgGv5xT5AcRruGz4ILpfHeBtO/y6j+Z3UN/PAjDeb4P7E51Yh8wcGNLGA==", "funding": [ { "type": "individual", @@ -434,9 +463,9 @@ } }, "node_modules/@ethersproject/bignumber": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.4.0.tgz", - "integrity": "sha512-OXUu9f9hO3vGRIPxU40cignXZVaYyfx6j9NNMjebKdnaCL3anCLSSy8/b8d03vY6dh7duCC0kW72GEC4tZer2w==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.4.1.tgz", + "integrity": "sha512-fJhdxqoQNuDOk6epfM7yD6J8Pol4NUCy1vkaGAkuujZm0+lNow//MKu1hLhRiYV4BsOHyBv5/lsTjF+7hWwhJg==", "funding": [ { "type": "individual", @@ -495,9 +524,9 @@ } }, "node_modules/@ethersproject/contracts": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.4.0.tgz", - "integrity": "sha512-hkO3L3IhS1Z3ZtHtaAG/T87nQ7KiPV+/qnvutag35I0IkiQ8G3ZpCQ9NNOpSCzn4pWSW4CfzmtE02FcqnLI+hw==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.4.1.tgz", + "integrity": "sha512-m+z2ZgPy4pyR15Je//dUaymRUZq5MtDajF6GwFbGAVmKz/RF+DNIPwF0k5qEcL3wPGVqUjFg2/krlCRVTU4T5w==", "funding": [ { "type": "individual", @@ -650,9 +679,9 @@ ] }, "node_modules/@ethersproject/networks": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.4.1.tgz", - "integrity": "sha512-8SvowCKz9Uf4xC5DTKI8+il8lWqOr78kmiqAVLYT9lzB8aSmJHQMD1GSuJI0CW4hMAnzocpGpZLgiMdzsNSPig==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.4.2.tgz", + "integrity": "sha512-eekOhvJyBnuibfJnhtK46b8HimBc5+4gqpvd1/H9LEl7Q7/qhsIhM81dI9Fcnjpk3jB1aTy6bj0hz3cifhNeYw==", "funding": [ { "type": "individual", @@ -705,9 +734,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.4.1.tgz", - "integrity": "sha512-p06eiFKz8nu/5Ju0kIX024gzEQIgE5pvvGrBCngpyVjpuLtUIWT3097Agw4mTn9/dEA0FMcfByzFqacBMSgCVg==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.4.3.tgz", + "integrity": "sha512-VURwkaWPoUj7jq9NheNDT5Iyy64Qcyf6BOFDwVdHsmLmX/5prNjFrgSX3GHPE4z1BRrVerDxe2yayvXKFm/NNg==", "funding": [ { "type": "individual", @@ -1649,9 +1678,9 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "node_modules/@psf/bch-js": { - "version": "4.20.1", - "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-4.20.1.tgz", - "integrity": "sha512-U/saVHfHA0535w5Z68mHH+8emPJE6LulTcX40kWBjk3Qd3etb9S9j5aqxK0axcwN0s5o2O7AYkfF0NFwPEoa9Q==", + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-4.20.3.tgz", + "integrity": "sha512-GLuRhTnqVg+cyydEXf+Y2wNOHyJ1+q2/nyt283D9Xq9tQodGBxfT9tydhktWoLVuzlOujdiLxL4KwXDHeaUkhQ==", "dependencies": { "@psf/bip21": "^2.0.1", "@psf/bip32-utils": "^1.0.0", @@ -2296,12 +2325,15 @@ } }, "node_modules/@semantic-release/npm/node_modules/normalize-url": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-5.3.0.tgz", - "integrity": "sha512-9/nOVLYYe/dO/eJeQUNaGUF4m4Z5E7cb9oNTKabH+bNf19mqj60txTcveQxL0GlcWLXCxkOu2/LwL8oW0idIDA==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-5.3.1.tgz", + "integrity": "sha512-K1c7+vaAP+Yh5bOGmA10PGPpp+6h7WZrl7GwqKhUflBc9flU9pzG27DDeB9+iuhZkE3BJZOcgN1P/2sS5pqrWw==", "dev": true, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@semantic-release/npm/node_modules/read-pkg": { @@ -4247,6 +4279,12 @@ "fsevents": "~2.1.2" } }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "optional": true + }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -6982,9 +7020,9 @@ } }, "node_modules/ethers": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.4.1.tgz", - "integrity": "sha512-SrcddMdCgP1hukDvCPd87Aipbf4NWjQvdfAbZ65XSZGbfyuYPtIrUJPDH5B1SBRsdlfiEgX3eoz28DdBDzMNFg==", + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.4.4.tgz", + "integrity": "sha512-zaTs8yaDjfb0Zyj8tT6a+/hEkC+kWAA350MWRp6yP5W7NdGcURRPMOpOU+6GtkfxV9wyJEShWesqhE/TjdqpMA==", "funding": [ { "type": "individual", @@ -6997,24 +7035,24 @@ ], "dependencies": { "@ethersproject/abi": "5.4.0", - "@ethersproject/abstract-provider": "5.4.0", - "@ethersproject/abstract-signer": "5.4.0", + "@ethersproject/abstract-provider": "5.4.1", + "@ethersproject/abstract-signer": "5.4.1", "@ethersproject/address": "5.4.0", "@ethersproject/base64": "5.4.0", "@ethersproject/basex": "5.4.0", - "@ethersproject/bignumber": "5.4.0", + "@ethersproject/bignumber": "5.4.1", "@ethersproject/bytes": "5.4.0", "@ethersproject/constants": "5.4.0", - "@ethersproject/contracts": "5.4.0", + "@ethersproject/contracts": "5.4.1", "@ethersproject/hash": "5.4.0", "@ethersproject/hdnode": "5.4.0", "@ethersproject/json-wallets": "5.4.0", "@ethersproject/keccak256": "5.4.0", "@ethersproject/logger": "5.4.0", - "@ethersproject/networks": "5.4.1", + "@ethersproject/networks": "5.4.2", "@ethersproject/pbkdf2": "5.4.0", "@ethersproject/properties": "5.4.0", - "@ethersproject/providers": "5.4.1", + "@ethersproject/providers": "5.4.3", "@ethersproject/random": "5.4.0", "@ethersproject/rlp": "5.4.0", "@ethersproject/sha2": "5.4.0", @@ -7549,6 +7587,15 @@ "node": ">=10" } }, + "node_modules/fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "optional": true, + "dependencies": { + "minipass": "^2.6.0" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -7636,12 +7683,6 @@ "readable-stream": "^2.0.6" } }, - "node_modules/gc-stats/node_modules/chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", - "optional": true - }, "node_modules/gc-stats/node_modules/code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -7678,15 +7719,6 @@ "node": ">=0.10" } }, - "node_modules/gc-stats/node_modules/fs-minipass": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", - "optional": true, - "dependencies": { - "minipass": "^2.2.1" - } - }, "node_modules/gc-stats/node_modules/gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -7730,25 +7762,6 @@ "node": ">=0.10.0" } }, - "node_modules/gc-stats/node_modules/minipass": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", - "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", - "optional": true, - "dependencies": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "node_modules/gc-stats/node_modules/minizlib": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", - "optional": true, - "dependencies": { - "minipass": "^2.2.1" - } - }, "node_modules/gc-stats/node_modules/needle": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.1.tgz", @@ -7921,30 +7934,6 @@ "node": ">=0.10.0" } }, - "node_modules/gc-stats/node_modules/tar": { - "version": "4.4.8", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", - "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", - "optional": true, - "dependencies": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - }, - "engines": { - "node": ">=4.5" - } - }, - "node_modules/gc-stats/node_modules/yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "optional": true - }, "node_modules/gcp-metadata": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.1.tgz", @@ -8120,9 +8109,9 @@ } }, "node_modules/glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "dependencies": { "is-glob": "^4.0.1" @@ -8248,14 +8237,6 @@ "node": ">=10" } }, - "node_modules/google-p12-pem/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -9652,14 +9633,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/ipfs-cli/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/ipfs-cli/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -9755,9 +9728,9 @@ } }, "node_modules/ipfs-coord": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-3.2.0.tgz", - "integrity": "sha512-OmAhpoHTmQUxFhR5Z6Cl5SnN/2PrHLD+OtGR6ffyIowMzFeCK9/cmj/0FSOLAtNBEOg0vi4F6lc3HM82cnbhnw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-5.0.0.tgz", + "integrity": "sha512-62hXmbJsfjZksZCk/2MGdmFTQkWEffPB0wL1YFV+VXwDSqJ56QG2NKhZxJr359a/XMPmn90bOxJI4YNNPzCGUg==", "dependencies": { "bch-encrypt-lib": "^2.0.0", "orbit-db": "^0.26.1" @@ -10123,14 +10096,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/ipfs-core/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/ipfs-core/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -12241,14 +12206,6 @@ "web-encoding": "^1.0.2" } }, - "node_modules/ipns/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/ipns/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -13544,6 +13501,14 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/jwt-bch-lib": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jwt-bch-lib/-/jwt-bch-lib-1.3.0.tgz", + "integrity": "sha512-CZs3jUHJlWvConvoTeLDogDEwUysKeojYJxfUhbwJKJrtDCSfi3ZWbsZZ8WN30Xs28aZPDB+qlHPJlTXQmup0w==", + "dependencies": { + "axios": "^0.21.1" + } + }, "node_modules/k-bucket": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/k-bucket/-/k-bucket-5.1.0.tgz", @@ -14162,9 +14127,9 @@ } }, "node_modules/libp2p-crypto": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.3.tgz", - "integrity": "sha512-ro7/5Tu+f8p2+qDS1JrROnO++nNaAaBFs+VVXVHLuTMnbnMASu1eUtSlWPk1uOwikAlBFTvfqe5J1bK6Bpq6Pg==", + "version": "0.16.4", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.4.tgz", + "integrity": "sha512-II8HxKc9jbmQp34pprlluNxsBCWJDjHRPYJzuRy7ragztNip9Zb7uJ4lCje6gGzz4DNAcHkAUn+GqCIK1592iA==", "dependencies": { "asmcrypto.js": "^2.3.2", "asn1.js": "^5.0.1", @@ -14176,7 +14141,7 @@ "keypair": "^1.0.1", "libp2p-crypto-secp256k1": "~0.3.0", "multihashing-async": "~0.5.1", - "node-forge": "~0.9.1", + "node-forge": "^0.10.0", "pem-jwk": "^2.0.0", "protons": "^1.0.1", "rsa-pem-to-jwk": "^1.1.3", @@ -14624,14 +14589,6 @@ "npm": ">=6.0.0" } }, - "node_modules/libp2p-interfaces/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/libp2p-interfaces/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -14833,14 +14790,6 @@ "npm": ">=6.0.0" } }, - "node_modules/libp2p-kad-dht/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/libp2p-kad-dht/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -15083,14 +15032,6 @@ "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" }, - "node_modules/libp2p-noise/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/libp2p-noise/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -15732,14 +15673,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/libp2p/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/libp2p/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -16789,6 +16722,31 @@ "node": ">= 6" } }, + "node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "optional": true, + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "node_modules/minipass/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "optional": true + }, + "node_modules/minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "optional": true, + "dependencies": { + "minipass": "^2.9.0" + } + }, "node_modules/mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -17471,11 +17429,11 @@ } }, "node_modules/node-forge": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.2.tgz", - "integrity": "sha512-naKSScof4Wn+aoHU6HBsifh92Zeicm1GDQKd1vp3Y/kOi8ub0DozCa9KpvYNCXslFHYRmLNiqRopGdTGwNLpNw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", "engines": { - "node": ">= 4.5.0" + "node": ">= 6.0.0" } }, "node_modules/node-gyp-build": { @@ -17600,21 +17558,22 @@ } }, "node_modules/normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", "engines": { "node": ">=8" } }, "node_modules/npm": { - "version": "7.7.6", - "resolved": "https://registry.npmjs.org/npm/-/npm-7.7.6.tgz", - "integrity": "sha512-4dOo2M/SRzRNWH1e0tmcJMFkDjHJKsJQlxpi3OgJ/N/BsIvbdQFFMioG0vmuFVAev7P2f/rShApb18jk5RpdXA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/npm/-/npm-7.20.5.tgz", + "integrity": "sha512-vRyu1V79n5BzKn4vkanag1xEjEMLIZ48Ry1V7IyAvHQHi8syOEiYWvUMxNpeDk+e8JKAKCNG3lIYJDm3pM8VMQ==", "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", "@npmcli/config", + "@npmcli/package-json", "@npmcli/run-script", "abbrev", "ansicolors", @@ -17637,6 +17596,7 @@ "leven", "libnpmaccess", "libnpmdiff", + "libnpmexec", "libnpmfund", "libnpmhook", "libnpmorg", @@ -17681,40 +17641,42 @@ ], "dev": true, "dependencies": { - "@npmcli/arborist": "^2.2.9", + "@npmcli/arborist": "^2.8.0", "@npmcli/ci-detect": "^1.2.0", - "@npmcli/config": "^2.0.0", - "@npmcli/run-script": "^1.8.4", + "@npmcli/config": "^2.2.0", + "@npmcli/package-json": "^1.0.1", + "@npmcli/run-script": "^1.8.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", "archy": "~1.0.0", "byte-size": "^7.0.1", - "cacache": "^15.0.6", - "chalk": "^4.1.0", + "cacache": "^15.2.0", + "chalk": "^4.1.2", "chownr": "^2.0.0", "cli-columns": "^3.1.2", "cli-table3": "^0.6.0", "columnify": "~1.5.4", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", + "glob": "^7.1.7", + "graceful-fs": "^4.2.8", "hosted-git-info": "^4.0.2", "ini": "^2.0.0", - "init-package-json": "^2.0.2", + "init-package-json": "^2.0.3", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^2.3.1", "leven": "^3.1.0", - "libnpmaccess": "^4.0.1", + "libnpmaccess": "^4.0.2", "libnpmdiff": "^2.0.4", - "libnpmfund": "^1.0.2", - "libnpmhook": "^6.0.1", - "libnpmorg": "^2.0.1", + "libnpmexec": "^2.0.1", + "libnpmfund": "^1.1.0", + "libnpmhook": "^6.0.2", + "libnpmorg": "^2.0.2", "libnpmpack": "^2.0.1", - "libnpmpublish": "^4.0.0", - "libnpmsearch": "^3.1.0", - "libnpmteam": "^2.0.2", - "libnpmversion": "^1.1.0", - "make-fetch-happen": "^8.0.14", + "libnpmpublish": "^4.0.1", + "libnpmsearch": "^3.1.1", + "libnpmteam": "^2.0.3", + "libnpmversion": "^1.2.1", + "make-fetch-happen": "^9.0.4", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -17722,25 +17684,25 @@ "ms": "^2.1.2", "node-gyp": "^7.1.2", "nopt": "^5.0.0", - "npm-audit-report": "^2.1.4", - "npm-package-arg": "^8.1.2", + "npm-audit-report": "^2.1.5", + "npm-package-arg": "^8.1.5", "npm-pick-manifest": "^6.1.1", - "npm-profile": "^5.0.2", - "npm-registry-fetch": "^9.0.0", + "npm-profile": "^5.0.3", + "npm-registry-fetch": "^11.0.0", "npm-user-validate": "^1.0.1", - "npmlog": "~4.1.2", + "npmlog": "^5.0.0", "opener": "^1.5.2", - "pacote": "^11.3.1", + "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", "read-package-json": "^3.0.1", - "read-package-json-fast": "^2.0.2", + "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "ssri": "^8.0.1", - "tar": "^6.1.0", + "tar": "^6.1.6", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^1.0.4", @@ -17768,7 +17730,7 @@ } }, "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "2.2.9", + "version": "2.8.0", "dev": true, "inBundle": true, "license": "ISC", @@ -17779,30 +17741,38 @@ "@npmcli/move-file": "^1.1.0", "@npmcli/name-from-folder": "^1.0.1", "@npmcli/node-gyp": "^1.0.1", + "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^1.8.2", "bin-links": "^2.2.1", "cacache": "^15.0.3", "common-ancestor-path": "^1.0.1", "json-parse-even-better-errors": "^2.3.1", - "json-stringify-nice": "^1.1.1", + "json-stringify-nice": "^1.1.4", + "mkdirp": "^1.0.4", "mkdirp-infer-owner": "^2.0.0", "npm-install-checks": "^4.0.0", - "npm-package-arg": "^8.1.0", + "npm-package-arg": "^8.1.5", "npm-pick-manifest": "^6.1.0", - "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.6", + "npm-registry-fetch": "^11.0.0", + "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", + "proc-log": "^1.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", "read-package-json-fast": "^2.0.2", "readdir-scoped-modules": "^1.1.0", + "rimraf": "^3.0.2", "semver": "^7.3.5", + "ssri": "^8.0.1", "tar": "^6.1.0", "treeverse": "^1.0.4", "walk-up-path": "^1.0.0" }, "bin": { "arborist": "bin/index.js" + }, + "engines": { + "node": ">= 10" } }, "node_modules/npm/node_modules/@npmcli/ci-detect": { @@ -17812,7 +17782,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/config": { - "version": "2.0.0", + "version": "2.2.0", "dev": true, "inBundle": true, "license": "ISC", @@ -17840,19 +17810,18 @@ } }, "node_modules/npm/node_modules/@npmcli/git": { - "version": "2.0.6", + "version": "2.1.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/promise-spawn": "^1.1.0", + "@npmcli/promise-spawn": "^1.3.2", "lru-cache": "^6.0.0", - "mkdirp": "^1.0.3", - "npm-pick-manifest": "^6.0.0", + "mkdirp": "^1.0.4", + "npm-pick-manifest": "^6.1.1", "promise-inflight": "^1.0.1", "promise-retry": "^2.0.1", - "semver": "^7.3.2", - "unique-filename": "^1.1.1", + "semver": "^7.3.5", "which": "^2.0.2" } }, @@ -17923,6 +17892,15 @@ "inBundle": true, "license": "ISC" }, + "node_modules/npm/node_modules/@npmcli/package-json": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^2.3.1" + } + }, "node_modules/npm/node_modules/@npmcli/promise-spawn": { "version": "1.3.2", "dev": true, @@ -17933,7 +17911,7 @@ } }, "node_modules/npm/node_modules/@npmcli/run-script": { - "version": "1.8.4", + "version": "1.8.5", "dev": true, "inBundle": true, "license": "ISC", @@ -18119,7 +18097,7 @@ "license": "MIT" }, "node_modules/npm/node_modules/balanced-match": { - "version": "1.0.0", + "version": "1.0.2", "dev": true, "inBundle": true, "license": "MIT" @@ -18185,7 +18163,7 @@ } }, "node_modules/npm/node_modules/cacache": { - "version": "15.0.6", + "version": "15.2.0", "dev": true, "inBundle": true, "license": "ISC", @@ -18219,7 +18197,7 @@ "license": "Apache-2.0" }, "node_modules/npm/node_modules/chalk": { - "version": "4.1.0", + "version": "4.1.2", "dev": true, "inBundle": true, "license": "MIT", @@ -18385,6 +18363,15 @@ "inBundle": true, "license": "MIT" }, + "node_modules/npm/node_modules/color-support": { + "version": "1.1.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, "node_modules/npm/node_modules/colors": { "version": "1.4.0", "dev": true, @@ -18454,7 +18441,7 @@ } }, "node_modules/npm/node_modules/debug": { - "version": "4.3.1", + "version": "4.3.2", "dev": true, "inBundle": true, "license": "MIT", @@ -18617,7 +18604,6 @@ "node_modules/npm/node_modules/form-data": { "version": "2.3.3", "dev": true, - "inBundle": true, "license": "MIT", "dependencies": { "asynckit": "^0.4.0", @@ -18653,51 +18639,23 @@ "license": "MIT" }, "node_modules/npm/node_modules/gauge": { - "version": "2.7.4", + "version": "3.0.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "aproba": "^1.0.3", + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/npm/node_modules/gauge/node_modules/aproba": { - "version": "1.2.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/gauge/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "number-is-nan": "^1.0.0" + "string-width": "^1.0.1 || ^2.0.0", + "strip-ansi": "^3.0.1 || ^4.0.0", + "wide-align": "^1.1.2" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm/node_modules/gauge/node_modules/string-width": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" + "node": ">=10" } }, "node_modules/npm/node_modules/getpass": { @@ -18710,7 +18668,7 @@ } }, "node_modules/npm/node_modules/glob": { - "version": "7.1.6", + "version": "7.1.7", "dev": true, "inBundle": true, "license": "ISC", @@ -18730,7 +18688,7 @@ } }, "node_modules/npm/node_modules/graceful-fs": { - "version": "4.2.6", + "version": "4.2.8", "dev": true, "inBundle": true, "license": "ISC" @@ -18854,7 +18812,7 @@ } }, "node_modules/npm/node_modules/iconv-lite": { - "version": "0.6.2", + "version": "0.6.3", "dev": true, "inBundle": true, "license": "MIT", @@ -18867,7 +18825,7 @@ } }, "node_modules/npm/node_modules/ignore-walk": { - "version": "3.0.3", + "version": "3.0.4", "dev": true, "inBundle": true, "license": "ISC", @@ -18925,17 +18883,17 @@ } }, "node_modules/npm/node_modules/init-package-json": { - "version": "2.0.2", + "version": "2.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "glob": "^7.1.1", - "npm-package-arg": "^8.1.0", + "npm-package-arg": "^8.1.2", "promzard": "^0.3.0", "read": "~1.0.1", - "read-package-json": "^3.0.0", - "semver": "^7.3.2", + "read-package-json": "^3.0.1", + "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^3.0.0" }, @@ -18971,7 +18929,7 @@ } }, "node_modules/npm/node_modules/is-core-module": { - "version": "2.2.0", + "version": "2.5.0", "dev": true, "inBundle": true, "license": "MIT", @@ -19045,7 +19003,7 @@ "license": "MIT" }, "node_modules/npm/node_modules/json-stringify-nice": { - "version": "1.1.1", + "version": "1.1.4", "dev": true, "inBundle": true, "license": "ISC", @@ -19084,7 +19042,7 @@ } }, "node_modules/npm/node_modules/just-diff": { - "version": "3.0.2", + "version": "3.1.1", "dev": true, "inBundle": true, "license": "MIT" @@ -19105,15 +19063,15 @@ } }, "node_modules/npm/node_modules/libnpmaccess": { - "version": "4.0.1", + "version": "4.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", "minipass": "^3.1.1", - "npm-package-arg": "^8.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-package-arg": "^8.1.2", + "npm-registry-fetch": "^11.0.0" }, "engines": { "node": ">=10" @@ -19130,44 +19088,66 @@ "binary-extensions": "^2.2.0", "diff": "^5.0.0", "minimatch": "^3.0.4", - "npm-package-arg": "^8.1.1", - "pacote": "^11.3.0", + "npm-package-arg": "^8.1.4", + "pacote": "^11.3.4", "tar": "^6.1.0" }, "engines": { "node": ">=10" } }, - "node_modules/npm/node_modules/libnpmfund": { - "version": "1.0.2", + "node_modules/npm/node_modules/libnpmexec": { + "version": "2.0.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^2.0.0" + "@npmcli/arborist": "^2.3.0", + "@npmcli/ci-detect": "^1.3.0", + "@npmcli/run-script": "^1.8.4", + "chalk": "^4.1.0", + "mkdirp-infer-owner": "^2.0.0", + "npm-package-arg": "^8.1.2", + "pacote": "^11.3.1", + "proc-log": "^1.0.0", + "read": "^1.0.7", + "read-package-json-fast": "^2.0.2", + "walk-up-path": "^1.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/libnpmfund": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^2.5.0" } }, "node_modules/npm/node_modules/libnpmhook": { - "version": "6.0.1", + "version": "6.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" }, "engines": { "node": ">=10" } }, "node_modules/npm/node_modules/libnpmorg": { - "version": "2.0.1", + "version": "2.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" }, "engines": { "node": ">=10" @@ -19188,56 +19168,56 @@ } }, "node_modules/npm/node_modules/libnpmpublish": { - "version": "4.0.0", + "version": "4.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "normalize-package-data": "^3.0.0", - "npm-package-arg": "^8.1.0", - "npm-registry-fetch": "^9.0.0", + "normalize-package-data": "^3.0.2", + "npm-package-arg": "^8.1.2", + "npm-registry-fetch": "^11.0.0", "semver": "^7.1.3", - "ssri": "^8.0.0" + "ssri": "^8.0.1" }, "engines": { "node": ">=10" } }, "node_modules/npm/node_modules/libnpmsearch": { - "version": "3.1.0", + "version": "3.1.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" }, "engines": { "node": ">=10" } }, "node_modules/npm/node_modules/libnpmteam": { - "version": "2.0.2", + "version": "2.0.4", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" }, "engines": { "node": ">=10" } }, "node_modules/npm/node_modules/libnpmversion": { - "version": "1.1.0", + "version": "1.2.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^2.0.6", - "@npmcli/run-script": "^1.8.3", + "@npmcli/git": "^2.0.7", + "@npmcli/run-script": "^1.8.4", "json-parse-even-better-errors": "^2.3.1", - "semver": "^7.3.4", + "semver": "^7.3.5", "stringify-package": "^1.0.1" } }, @@ -19254,13 +19234,13 @@ } }, "node_modules/npm/node_modules/make-fetch-happen": { - "version": "8.0.14", + "version": "9.0.4", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "agentkeepalive": "^4.1.3", - "cacache": "^15.0.5", + "cacache": "^15.2.0", "http-cache-semantics": "^4.1.0", "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", @@ -19271,6 +19251,7 @@ "minipass-fetch": "^1.3.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.2", "promise-retry": "^2.0.1", "socks-proxy-agent": "^5.0.0", "ssri": "^8.0.0" @@ -19280,7 +19261,7 @@ } }, "node_modules/npm/node_modules/mime-db": { - "version": "1.46.0", + "version": "1.49.0", "dev": true, "inBundle": true, "license": "MIT", @@ -19289,12 +19270,12 @@ } }, "node_modules/npm/node_modules/mime-types": { - "version": "2.1.29", + "version": "2.1.32", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "mime-db": "1.46.0" + "mime-db": "1.49.0" }, "engines": { "node": ">= 0.6" @@ -19337,7 +19318,7 @@ } }, "node_modules/npm/node_modules/minipass-fetch": { - "version": "1.3.3", + "version": "1.3.4", "dev": true, "inBundle": true, "license": "MIT", @@ -19450,6 +19431,15 @@ "inBundle": true, "license": "ISC" }, + "node_modules/npm/node_modules/negotiator": { + "version": "0.6.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/npm/node_modules/node-gyp": { "version": "7.1.2", "dev": true, @@ -19474,6 +19464,66 @@ "node": ">= 10.12.0" } }, + "node_modules/npm/node_modules/node-gyp/node_modules/aproba": { + "version": "1.2.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/node-gyp/node_modules/gauge": { + "version": "2.7.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/npmlog": { + "version": "4.1.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/string-width": { + "version": "1.0.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/npm/node_modules/nopt": { "version": "5.0.0", "dev": true, @@ -19505,7 +19555,7 @@ } }, "node_modules/npm/node_modules/npm-audit-report": { - "version": "2.1.4", + "version": "2.1.5", "dev": true, "inBundle": true, "license": "ISC", @@ -19517,7 +19567,7 @@ } }, "node_modules/npm/node_modules/npm-bundled": { - "version": "1.1.1", + "version": "1.1.2", "dev": true, "inBundle": true, "license": "ISC", @@ -19544,7 +19594,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/npm-package-arg": { - "version": "8.1.2", + "version": "8.1.5", "dev": true, "inBundle": true, "license": "ISC", @@ -19558,7 +19608,7 @@ } }, "node_modules/npm/node_modules/npm-packlist": { - "version": "2.1.5", + "version": "2.2.2", "dev": true, "inBundle": true, "license": "ISC", @@ -19588,26 +19638,24 @@ } }, "node_modules/npm/node_modules/npm-profile": { - "version": "5.0.2", + "version": "5.0.4", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" }, "engines": { "node": ">=10" } }, "node_modules/npm/node_modules/npm-registry-fetch": { - "version": "9.0.0", + "version": "11.0.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/ci-detect": "^1.0.0", - "lru-cache": "^6.0.0", - "make-fetch-happen": "^8.0.9", + "make-fetch-happen": "^9.0.1", "minipass": "^3.1.3", "minipass-fetch": "^1.3.0", "minipass-json-stream": "^1.0.1", @@ -19625,15 +19673,15 @@ "license": "BSD-2-Clause" }, "node_modules/npm/node_modules/npmlog": { - "version": "4.1.2", + "version": "5.0.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "^1.1.5", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" } }, "node_modules/npm/node_modules/number-is-nan": { @@ -19697,12 +19745,12 @@ } }, "node_modules/npm/node_modules/pacote": { - "version": "11.3.1", + "version": "11.3.5", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^2.0.1", + "@npmcli/git": "^2.1.0", "@npmcli/installed-package-contents": "^1.0.6", "@npmcli/promise-spawn": "^1.2.0", "@npmcli/run-script": "^1.8.2", @@ -19715,7 +19763,7 @@ "npm-package-arg": "^8.0.1", "npm-packlist": "^2.1.4", "npm-pick-manifest": "^6.0.0", - "npm-registry-fetch": "^9.0.0", + "npm-registry-fetch": "^11.0.0", "promise-retry": "^2.0.1", "read-package-json-fast": "^2.0.1", "rimraf": "^3.0.2", @@ -19750,7 +19798,7 @@ } }, "node_modules/npm/node_modules/path-parse": { - "version": "1.0.6", + "version": "1.0.7", "dev": true, "inBundle": true, "license": "MIT" @@ -19761,6 +19809,12 @@ "inBundle": true, "license": "MIT" }, + "node_modules/npm/node_modules/proc-log": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, "node_modules/npm/node_modules/process-nextick-args": { "version": "2.0.1", "dev": true, @@ -19879,7 +19933,7 @@ } }, "node_modules/npm/node_modules/read-package-json-fast": { - "version": "2.0.2", + "version": "2.0.3", "dev": true, "inBundle": true, "license": "ISC", @@ -19949,6 +20003,20 @@ "node": ">= 6" } }, + "node_modules/npm/node_modules/request/node_modules/form-data": { + "version": "2.3.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, "node_modules/npm/node_modules/request/node_modules/tough-cookie": { "version": "2.5.0", "dev": true, @@ -20049,7 +20117,7 @@ } }, "node_modules/npm/node_modules/socks": { - "version": "2.6.0", + "version": "2.6.1", "dev": true, "inBundle": true, "license": "MIT", @@ -20103,7 +20171,7 @@ } }, "node_modules/npm/node_modules/spdx-license-ids": { - "version": "3.0.7", + "version": "3.0.9", "dev": true, "inBundle": true, "license": "CC0-1.0" @@ -20214,7 +20282,7 @@ } }, "node_modules/npm/node_modules/tar": { - "version": "6.1.0", + "version": "6.1.6", "dev": true, "inBundle": true, "license": "ISC", @@ -21784,14 +21852,6 @@ "npm": ">=6.0.0" } }, - "node_modules/peer-id/node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/peer-id/node_modules/node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -24968,6 +25028,30 @@ "path-parse": "^1.0.6" } }, + "node_modules/tar": { + "version": "4.4.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.15.tgz", + "integrity": "sha512-ItbufpujXkry7bHH9NpQyTXPbJ72iTlXgkBAYsAjDXk3Ds8t/3NfO5P4xZGy7u+sYuQUbimgzswX4uQIEeNVOA==", + "optional": true, + "dependencies": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "engines": { + "node": ">=4.5" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "optional": true + }, "node_modules/tdigest": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.1.tgz", @@ -25224,9 +25308,9 @@ "dev": true }, "node_modules/trim-newlines": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.0.tgz", - "integrity": "sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true, "engines": { "node": ">=8" @@ -26619,9 +26703,9 @@ } }, "@ethersproject/abstract-provider": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.4.0.tgz", - "integrity": "sha512-vPBR7HKUBY0lpdllIn7tLIzNN7DrVnhCLKSzY0l8WAwxz686m/aL7ASDzrVxV93GJtIub6N2t4dfZ29CkPOxgA==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.4.1.tgz", + "integrity": "sha512-3EedfKI3LVpjSKgAxoUaI+gB27frKsxzm+r21w9G60Ugk+3wVLQwhi1LsEJAKNV7WoZc8CIpNrATlL1QFABjtQ==", "requires": { "@ethersproject/bignumber": "^5.4.0", "@ethersproject/bytes": "^5.4.0", @@ -26633,9 +26717,9 @@ } }, "@ethersproject/abstract-signer": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.4.0.tgz", - "integrity": "sha512-AieQAzt05HJZS2bMofpuxMEp81AHufA5D6M4ScKwtolj041nrfIbIi8ciNW7+F59VYxXq+V4c3d568Q6l2m8ew==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.4.1.tgz", + "integrity": "sha512-SkkFL5HVq1k4/25dM+NWP9MILgohJCgGv5xT5AcRruGz4ILpfHeBtO/y6j+Z3UN/PAjDeb4P7E51Yh8wcGNLGA==", "requires": { "@ethersproject/abstract-provider": "^5.4.0", "@ethersproject/bignumber": "^5.4.0", @@ -26674,9 +26758,9 @@ } }, "@ethersproject/bignumber": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.4.0.tgz", - "integrity": "sha512-OXUu9f9hO3vGRIPxU40cignXZVaYyfx6j9NNMjebKdnaCL3anCLSSy8/b8d03vY6dh7duCC0kW72GEC4tZer2w==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.4.1.tgz", + "integrity": "sha512-fJhdxqoQNuDOk6epfM7yD6J8Pol4NUCy1vkaGAkuujZm0+lNow//MKu1hLhRiYV4BsOHyBv5/lsTjF+7hWwhJg==", "requires": { "@ethersproject/bytes": "^5.4.0", "@ethersproject/logger": "^5.4.0", @@ -26707,9 +26791,9 @@ } }, "@ethersproject/contracts": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.4.0.tgz", - "integrity": "sha512-hkO3L3IhS1Z3ZtHtaAG/T87nQ7KiPV+/qnvutag35I0IkiQ8G3ZpCQ9NNOpSCzn4pWSW4CfzmtE02FcqnLI+hw==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.4.1.tgz", + "integrity": "sha512-m+z2ZgPy4pyR15Je//dUaymRUZq5MtDajF6GwFbGAVmKz/RF+DNIPwF0k5qEcL3wPGVqUjFg2/krlCRVTU4T5w==", "requires": { "@ethersproject/abi": "^5.4.0", "@ethersproject/abstract-provider": "^5.4.0", @@ -26806,9 +26890,9 @@ "integrity": "sha512-xYdWGGQ9P2cxBayt64d8LC8aPFJk6yWCawQi/4eJ4+oJdMMjEBMrIcIMZ9AxhwpPVmnBPrsB10PcXGmGAqgUEQ==" }, "@ethersproject/networks": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.4.1.tgz", - "integrity": "sha512-8SvowCKz9Uf4xC5DTKI8+il8lWqOr78kmiqAVLYT9lzB8aSmJHQMD1GSuJI0CW4hMAnzocpGpZLgiMdzsNSPig==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.4.2.tgz", + "integrity": "sha512-eekOhvJyBnuibfJnhtK46b8HimBc5+4gqpvd1/H9LEl7Q7/qhsIhM81dI9Fcnjpk3jB1aTy6bj0hz3cifhNeYw==", "requires": { "@ethersproject/logger": "^5.4.0" } @@ -26831,9 +26915,9 @@ } }, "@ethersproject/providers": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.4.1.tgz", - "integrity": "sha512-p06eiFKz8nu/5Ju0kIX024gzEQIgE5pvvGrBCngpyVjpuLtUIWT3097Agw4mTn9/dEA0FMcfByzFqacBMSgCVg==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.4.3.tgz", + "integrity": "sha512-VURwkaWPoUj7jq9NheNDT5Iyy64Qcyf6BOFDwVdHsmLmX/5prNjFrgSX3GHPE4z1BRrVerDxe2yayvXKFm/NNg==", "requires": { "@ethersproject/abstract-provider": "^5.4.0", "@ethersproject/abstract-signer": "^5.4.0", @@ -27603,9 +27687,9 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "@psf/bch-js": { - "version": "4.20.1", - "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-4.20.1.tgz", - "integrity": "sha512-U/saVHfHA0535w5Z68mHH+8emPJE6LulTcX40kWBjk3Qd3etb9S9j5aqxK0axcwN0s5o2O7AYkfF0NFwPEoa9Q==", + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-4.20.3.tgz", + "integrity": "sha512-GLuRhTnqVg+cyydEXf+Y2wNOHyJ1+q2/nyt283D9Xq9tQodGBxfT9tydhktWoLVuzlOujdiLxL4KwXDHeaUkhQ==", "requires": { "@psf/bip21": "^2.0.1", "@psf/bip32-utils": "^1.0.0", @@ -28154,9 +28238,9 @@ }, "dependencies": { "normalize-url": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-5.3.0.tgz", - "integrity": "sha512-9/nOVLYYe/dO/eJeQUNaGUF4m4Z5E7cb9oNTKabH+bNf19mqj60txTcveQxL0GlcWLXCxkOu2/LwL8oW0idIDA==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-5.3.1.tgz", + "integrity": "sha512-K1c7+vaAP+Yh5bOGmA10PGPpp+6h7WZrl7GwqKhUflBc9flU9pzG27DDeB9+iuhZkE3BJZOcgN1P/2sS5pqrWw==", "dev": true }, "read-pkg": { @@ -29808,6 +29892,12 @@ "readdirp": "~3.5.0" } }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "optional": true + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -32154,29 +32244,29 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, "ethers": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.4.1.tgz", - "integrity": "sha512-SrcddMdCgP1hukDvCPd87Aipbf4NWjQvdfAbZ65XSZGbfyuYPtIrUJPDH5B1SBRsdlfiEgX3eoz28DdBDzMNFg==", + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.4.4.tgz", + "integrity": "sha512-zaTs8yaDjfb0Zyj8tT6a+/hEkC+kWAA350MWRp6yP5W7NdGcURRPMOpOU+6GtkfxV9wyJEShWesqhE/TjdqpMA==", "requires": { "@ethersproject/abi": "5.4.0", - "@ethersproject/abstract-provider": "5.4.0", - "@ethersproject/abstract-signer": "5.4.0", + "@ethersproject/abstract-provider": "5.4.1", + "@ethersproject/abstract-signer": "5.4.1", "@ethersproject/address": "5.4.0", "@ethersproject/base64": "5.4.0", "@ethersproject/basex": "5.4.0", - "@ethersproject/bignumber": "5.4.0", + "@ethersproject/bignumber": "5.4.1", "@ethersproject/bytes": "5.4.0", "@ethersproject/constants": "5.4.0", - "@ethersproject/contracts": "5.4.0", + "@ethersproject/contracts": "5.4.1", "@ethersproject/hash": "5.4.0", "@ethersproject/hdnode": "5.4.0", "@ethersproject/json-wallets": "5.4.0", "@ethersproject/keccak256": "5.4.0", "@ethersproject/logger": "5.4.0", - "@ethersproject/networks": "5.4.1", + "@ethersproject/networks": "5.4.2", "@ethersproject/pbkdf2": "5.4.0", "@ethersproject/properties": "5.4.0", - "@ethersproject/providers": "5.4.1", + "@ethersproject/providers": "5.4.3", "@ethersproject/random": "5.4.0", "@ethersproject/rlp": "5.4.0", "@ethersproject/sha2": "5.4.0", @@ -32624,6 +32714,15 @@ "universalify": "^2.0.0" } }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "optional": true, + "requires": { + "minipass": "^2.6.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -32695,12 +32794,6 @@ "readable-stream": "^2.0.6" } }, - "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", - "optional": true - }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -32728,15 +32821,6 @@ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "optional": true }, - "fs-minipass": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -32777,25 +32861,6 @@ "number-is-nan": "^1.0.0" } }, - "minipass": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", - "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", - "optional": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, "needle": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.1.tgz", @@ -32940,27 +33005,6 @@ "requires": { "ansi-regex": "^2.0.0" } - }, - "tar": { - "version": "4.4.8", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", - "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - } - }, - "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "optional": true } } }, @@ -33117,9 +33161,9 @@ } }, "glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -33217,13 +33261,6 @@ "integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", "requires": { "node-forge": "^0.10.0" - }, - "dependencies": { - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - } } }, "got": { @@ -34598,11 +34635,6 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.22.tgz", "integrity": "sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==" }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -34673,9 +34705,9 @@ } }, "ipfs-coord": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-3.2.0.tgz", - "integrity": "sha512-OmAhpoHTmQUxFhR5Z6Cl5SnN/2PrHLD+OtGR6ffyIowMzFeCK9/cmj/0FSOLAtNBEOg0vi4F6lc3HM82cnbhnw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-5.0.0.tgz", + "integrity": "sha512-62hXmbJsfjZksZCk/2MGdmFTQkWEffPB0wL1YFV+VXwDSqJ56QG2NKhZxJr359a/XMPmn90bOxJI4YNNPzCGUg==", "requires": { "bch-encrypt-lib": "^2.0.0", "orbit-db": "^0.26.1" @@ -34960,11 +34992,6 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.22.tgz", "integrity": "sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==" }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -36670,11 +36697,6 @@ } } }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -37767,6 +37789,14 @@ "safe-buffer": "^5.0.1" } }, + "jwt-bch-lib": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jwt-bch-lib/-/jwt-bch-lib-1.3.0.tgz", + "integrity": "sha512-CZs3jUHJlWvConvoTeLDogDEwUysKeojYJxfUhbwJKJrtDCSfi3ZWbsZZ8WN30Xs28aZPDB+qlHPJlTXQmup0w==", + "requires": { + "axios": "^0.21.1" + } + }, "k-bucket": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/k-bucket/-/k-bucket-5.1.0.tgz", @@ -38436,11 +38466,6 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.22.tgz", "integrity": "sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==" }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -38494,9 +38519,9 @@ } }, "libp2p-crypto": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.3.tgz", - "integrity": "sha512-ro7/5Tu+f8p2+qDS1JrROnO++nNaAaBFs+VVXVHLuTMnbnMASu1eUtSlWPk1uOwikAlBFTvfqe5J1bK6Bpq6Pg==", + "version": "0.16.4", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.4.tgz", + "integrity": "sha512-II8HxKc9jbmQp34pprlluNxsBCWJDjHRPYJzuRy7ragztNip9Zb7uJ4lCje6gGzz4DNAcHkAUn+GqCIK1592iA==", "requires": { "asmcrypto.js": "^2.3.2", "asn1.js": "^5.0.1", @@ -38508,7 +38533,7 @@ "keypair": "^1.0.1", "libp2p-crypto-secp256k1": "~0.3.0", "multihashing-async": "~0.5.1", - "node-forge": "~0.9.1", + "node-forge": "^0.10.0", "pem-jwk": "^2.0.0", "protons": "^1.0.1", "rsa-pem-to-jwk": "^1.1.3", @@ -38914,11 +38939,6 @@ "varint": "^6.0.0" } }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -39093,11 +39113,6 @@ } } }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -39312,11 +39327,6 @@ } } }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -40529,6 +40539,33 @@ "kind-of": "^6.0.3" } }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "dependencies": { + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "optional": true + } + } + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "optional": true, + "requires": { + "minipass": "^2.9.0" + } + }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -41096,9 +41133,9 @@ "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-forge": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.2.tgz", - "integrity": "sha512-naKSScof4Wn+aoHU6HBsifh92Zeicm1GDQKd1vp3Y/kOi8ub0DozCa9KpvYNCXslFHYRmLNiqRopGdTGwNLpNw==" + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, "node-gyp-build": { "version": "4.1.1", @@ -41194,50 +41231,52 @@ "dev": true }, "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" }, "npm": { - "version": "7.7.6", - "resolved": "https://registry.npmjs.org/npm/-/npm-7.7.6.tgz", - "integrity": "sha512-4dOo2M/SRzRNWH1e0tmcJMFkDjHJKsJQlxpi3OgJ/N/BsIvbdQFFMioG0vmuFVAev7P2f/rShApb18jk5RpdXA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/npm/-/npm-7.20.5.tgz", + "integrity": "sha512-vRyu1V79n5BzKn4vkanag1xEjEMLIZ48Ry1V7IyAvHQHi8syOEiYWvUMxNpeDk+e8JKAKCNG3lIYJDm3pM8VMQ==", "dev": true, "requires": { - "@npmcli/arborist": "^2.2.9", + "@npmcli/arborist": "^2.8.0", "@npmcli/ci-detect": "^1.2.0", - "@npmcli/config": "^2.0.0", - "@npmcli/run-script": "^1.8.4", + "@npmcli/config": "^2.2.0", + "@npmcli/package-json": "^1.0.1", + "@npmcli/run-script": "^1.8.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", "archy": "~1.0.0", "byte-size": "^7.0.1", - "cacache": "^15.0.6", - "chalk": "^4.1.0", + "cacache": "^15.2.0", + "chalk": "^4.1.2", "chownr": "^2.0.0", "cli-columns": "^3.1.2", "cli-table3": "^0.6.0", "columnify": "~1.5.4", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", + "glob": "^7.1.7", + "graceful-fs": "^4.2.8", "hosted-git-info": "^4.0.2", "ini": "^2.0.0", - "init-package-json": "^2.0.2", + "init-package-json": "^2.0.3", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^2.3.1", "leven": "^3.1.0", - "libnpmaccess": "^4.0.1", + "libnpmaccess": "^4.0.2", "libnpmdiff": "^2.0.4", - "libnpmfund": "^1.0.2", - "libnpmhook": "^6.0.1", - "libnpmorg": "^2.0.1", + "libnpmexec": "^2.0.1", + "libnpmfund": "^1.1.0", + "libnpmhook": "^6.0.2", + "libnpmorg": "^2.0.2", "libnpmpack": "^2.0.1", - "libnpmpublish": "^4.0.0", - "libnpmsearch": "^3.1.0", - "libnpmteam": "^2.0.2", - "libnpmversion": "^1.1.0", - "make-fetch-happen": "^8.0.14", + "libnpmpublish": "^4.0.1", + "libnpmsearch": "^3.1.1", + "libnpmteam": "^2.0.3", + "libnpmversion": "^1.2.1", + "make-fetch-happen": "^9.0.4", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -41245,25 +41284,25 @@ "ms": "^2.1.2", "node-gyp": "^7.1.2", "nopt": "^5.0.0", - "npm-audit-report": "^2.1.4", - "npm-package-arg": "^8.1.2", + "npm-audit-report": "^2.1.5", + "npm-package-arg": "^8.1.5", "npm-pick-manifest": "^6.1.1", - "npm-profile": "^5.0.2", - "npm-registry-fetch": "^9.0.0", + "npm-profile": "^5.0.3", + "npm-registry-fetch": "^11.0.0", "npm-user-validate": "^1.0.1", - "npmlog": "~4.1.2", + "npmlog": "^5.0.0", "opener": "^1.5.2", - "pacote": "^11.3.1", + "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", "read-package-json": "^3.0.1", - "read-package-json-fast": "^2.0.2", + "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "ssri": "^8.0.1", - "tar": "^6.1.0", + "tar": "^6.1.6", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^1.0.4", @@ -41273,7 +41312,7 @@ }, "dependencies": { "@npmcli/arborist": { - "version": "2.2.9", + "version": "2.8.0", "bundled": true, "dev": true, "requires": { @@ -41283,24 +41322,29 @@ "@npmcli/move-file": "^1.1.0", "@npmcli/name-from-folder": "^1.0.1", "@npmcli/node-gyp": "^1.0.1", + "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^1.8.2", "bin-links": "^2.2.1", "cacache": "^15.0.3", "common-ancestor-path": "^1.0.1", "json-parse-even-better-errors": "^2.3.1", - "json-stringify-nice": "^1.1.1", + "json-stringify-nice": "^1.1.4", + "mkdirp": "^1.0.4", "mkdirp-infer-owner": "^2.0.0", "npm-install-checks": "^4.0.0", - "npm-package-arg": "^8.1.0", + "npm-package-arg": "^8.1.5", "npm-pick-manifest": "^6.1.0", - "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.6", + "npm-registry-fetch": "^11.0.0", + "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", + "proc-log": "^1.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", "read-package-json-fast": "^2.0.2", "readdir-scoped-modules": "^1.1.0", + "rimraf": "^3.0.2", "semver": "^7.3.5", + "ssri": "^8.0.1", "tar": "^6.1.0", "treeverse": "^1.0.4", "walk-up-path": "^1.0.0" @@ -41312,7 +41356,7 @@ "dev": true }, "@npmcli/config": { - "version": "2.0.0", + "version": "2.2.0", "bundled": true, "dev": true, "requires": { @@ -41332,18 +41376,17 @@ } }, "@npmcli/git": { - "version": "2.0.6", + "version": "2.1.0", "bundled": true, "dev": true, "requires": { - "@npmcli/promise-spawn": "^1.1.0", + "@npmcli/promise-spawn": "^1.3.2", "lru-cache": "^6.0.0", - "mkdirp": "^1.0.3", - "npm-pick-manifest": "^6.0.0", + "mkdirp": "^1.0.4", + "npm-pick-manifest": "^6.1.1", "promise-inflight": "^1.0.1", "promise-retry": "^2.0.1", - "semver": "^7.3.2", - "unique-filename": "^1.1.1", + "semver": "^7.3.5", "which": "^2.0.2" } }, @@ -41396,6 +41439,14 @@ "bundled": true, "dev": true }, + "@npmcli/package-json": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "json-parse-even-better-errors": "^2.3.1" + } + }, "@npmcli/promise-spawn": { "version": "1.3.2", "bundled": true, @@ -41405,7 +41456,7 @@ } }, "@npmcli/run-script": { - "version": "1.8.4", + "version": "1.8.5", "bundled": true, "dev": true, "requires": { @@ -41540,7 +41591,7 @@ "dev": true }, "balanced-match": { - "version": "1.0.0", + "version": "1.0.2", "bundled": true, "dev": true }, @@ -41590,7 +41641,7 @@ "dev": true }, "cacache": { - "version": "15.0.6", + "version": "15.2.0", "bundled": true, "dev": true, "requires": { @@ -41619,7 +41670,7 @@ "dev": true }, "chalk": { - "version": "4.1.0", + "version": "4.1.2", "bundled": true, "dev": true, "requires": { @@ -41725,6 +41776,11 @@ "bundled": true, "dev": true }, + "color-support": { + "version": "1.1.3", + "bundled": true, + "dev": true + }, "colors": { "version": "1.4.0", "bundled": true, @@ -41777,7 +41833,7 @@ } }, "debug": { - "version": "4.3.1", + "version": "4.3.2", "bundled": true, "dev": true, "requires": { @@ -41893,7 +41949,6 @@ }, "form-data": { "version": "2.3.3", - "bundled": true, "dev": true, "requires": { "asynckit": "^0.4.0", @@ -41920,43 +41975,19 @@ "dev": true }, "gauge": { - "version": "2.7.4", + "version": "3.0.1", "bundled": true, "dev": true, "requires": { - "aproba": "^1.0.3", + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - } + "string-width": "^1.0.1 || ^2.0.0", + "strip-ansi": "^3.0.1 || ^4.0.0", + "wide-align": "^1.1.2" } }, "getpass": { @@ -41968,7 +41999,7 @@ } }, "glob": { - "version": "7.1.6", + "version": "7.1.7", "bundled": true, "dev": true, "requires": { @@ -41981,7 +42012,7 @@ } }, "graceful-fs": { - "version": "4.2.6", + "version": "4.2.8", "bundled": true, "dev": true }, @@ -42068,7 +42099,7 @@ } }, "iconv-lite": { - "version": "0.6.2", + "version": "0.6.3", "bundled": true, "dev": true, "optional": true, @@ -42077,7 +42108,7 @@ } }, "ignore-walk": { - "version": "3.0.3", + "version": "3.0.4", "bundled": true, "dev": true, "requires": { @@ -42119,16 +42150,16 @@ "dev": true }, "init-package-json": { - "version": "2.0.2", + "version": "2.0.3", "bundled": true, "dev": true, "requires": { "glob": "^7.1.1", - "npm-package-arg": "^8.1.0", + "npm-package-arg": "^8.1.2", "promzard": "^0.3.0", "read": "~1.0.1", - "read-package-json": "^3.0.0", - "semver": "^7.3.2", + "read-package-json": "^3.0.1", + "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^3.0.0" } @@ -42152,7 +42183,7 @@ } }, "is-core-module": { - "version": "2.2.0", + "version": "2.5.0", "bundled": true, "dev": true, "requires": { @@ -42210,7 +42241,7 @@ "dev": true }, "json-stringify-nice": { - "version": "1.1.1", + "version": "1.1.4", "bundled": true, "dev": true }, @@ -42236,7 +42267,7 @@ } }, "just-diff": { - "version": "3.0.2", + "version": "3.1.1", "bundled": true, "dev": true }, @@ -42251,14 +42282,14 @@ "dev": true }, "libnpmaccess": { - "version": "4.0.1", + "version": "4.0.3", "bundled": true, "dev": true, "requires": { "aproba": "^2.0.0", "minipass": "^3.1.1", - "npm-package-arg": "^8.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-package-arg": "^8.1.2", + "npm-registry-fetch": "^11.0.0" } }, "libnpmdiff": { @@ -42271,35 +42302,53 @@ "binary-extensions": "^2.2.0", "diff": "^5.0.0", "minimatch": "^3.0.4", - "npm-package-arg": "^8.1.1", - "pacote": "^11.3.0", + "npm-package-arg": "^8.1.4", + "pacote": "^11.3.4", "tar": "^6.1.0" } }, - "libnpmfund": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "@npmcli/arborist": "^2.0.0" - } - }, - "libnpmhook": { - "version": "6.0.1", - "bundled": true, - "dev": true, - "requires": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" - } - }, - "libnpmorg": { + "libnpmexec": { "version": "2.0.1", "bundled": true, "dev": true, + "requires": { + "@npmcli/arborist": "^2.3.0", + "@npmcli/ci-detect": "^1.3.0", + "@npmcli/run-script": "^1.8.4", + "chalk": "^4.1.0", + "mkdirp-infer-owner": "^2.0.0", + "npm-package-arg": "^8.1.2", + "pacote": "^11.3.1", + "proc-log": "^1.0.0", + "read": "^1.0.7", + "read-package-json-fast": "^2.0.2", + "walk-up-path": "^1.0.0" + } + }, + "libnpmfund": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "@npmcli/arborist": "^2.5.0" + } + }, + "libnpmhook": { + "version": "6.0.3", + "bundled": true, + "dev": true, "requires": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" + } + }, + "libnpmorg": { + "version": "2.0.3", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^11.0.0" } }, "libnpmpack": { @@ -42313,43 +42362,43 @@ } }, "libnpmpublish": { - "version": "4.0.0", + "version": "4.0.2", "bundled": true, "dev": true, "requires": { - "normalize-package-data": "^3.0.0", - "npm-package-arg": "^8.1.0", - "npm-registry-fetch": "^9.0.0", + "normalize-package-data": "^3.0.2", + "npm-package-arg": "^8.1.2", + "npm-registry-fetch": "^11.0.0", "semver": "^7.1.3", - "ssri": "^8.0.0" + "ssri": "^8.0.1" } }, "libnpmsearch": { - "version": "3.1.0", + "version": "3.1.2", "bundled": true, "dev": true, "requires": { - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" } }, "libnpmteam": { - "version": "2.0.2", + "version": "2.0.4", "bundled": true, "dev": true, "requires": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" } }, "libnpmversion": { - "version": "1.1.0", + "version": "1.2.1", "bundled": true, "dev": true, "requires": { - "@npmcli/git": "^2.0.6", - "@npmcli/run-script": "^1.8.3", + "@npmcli/git": "^2.0.7", + "@npmcli/run-script": "^1.8.4", "json-parse-even-better-errors": "^2.3.1", - "semver": "^7.3.4", + "semver": "^7.3.5", "stringify-package": "^1.0.1" } }, @@ -42362,12 +42411,12 @@ } }, "make-fetch-happen": { - "version": "8.0.14", + "version": "9.0.4", "bundled": true, "dev": true, "requires": { "agentkeepalive": "^4.1.3", - "cacache": "^15.0.5", + "cacache": "^15.2.0", "http-cache-semantics": "^4.1.0", "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", @@ -42378,22 +42427,23 @@ "minipass-fetch": "^1.3.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.2", "promise-retry": "^2.0.1", "socks-proxy-agent": "^5.0.0", "ssri": "^8.0.0" } }, "mime-db": { - "version": "1.46.0", + "version": "1.49.0", "bundled": true, "dev": true }, "mime-types": { - "version": "2.1.29", + "version": "2.1.32", "bundled": true, "dev": true, "requires": { - "mime-db": "1.46.0" + "mime-db": "1.49.0" } }, "minimatch": { @@ -42421,7 +42471,7 @@ } }, "minipass-fetch": { - "version": "1.3.3", + "version": "1.3.4", "bundled": true, "dev": true, "requires": { @@ -42498,6 +42548,11 @@ "bundled": true, "dev": true }, + "negotiator": { + "version": "0.6.2", + "bundled": true, + "dev": true + }, "node-gyp": { "version": "7.1.2", "bundled": true, @@ -42513,6 +42568,57 @@ "semver": "^7.3.2", "tar": "^6.0.2", "which": "^2.0.2" + }, + "dependencies": { + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } } }, "nopt": { @@ -42535,7 +42641,7 @@ } }, "npm-audit-report": { - "version": "2.1.4", + "version": "2.1.5", "bundled": true, "dev": true, "requires": { @@ -42543,7 +42649,7 @@ } }, "npm-bundled": { - "version": "1.1.1", + "version": "1.1.2", "bundled": true, "dev": true, "requires": { @@ -42564,7 +42670,7 @@ "dev": true }, "npm-package-arg": { - "version": "8.1.2", + "version": "8.1.5", "bundled": true, "dev": true, "requires": { @@ -42574,7 +42680,7 @@ } }, "npm-packlist": { - "version": "2.1.5", + "version": "2.2.2", "bundled": true, "dev": true, "requires": { @@ -42596,21 +42702,19 @@ } }, "npm-profile": { - "version": "5.0.2", + "version": "5.0.4", "bundled": true, "dev": true, "requires": { - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^11.0.0" } }, "npm-registry-fetch": { - "version": "9.0.0", + "version": "11.0.0", "bundled": true, "dev": true, "requires": { - "@npmcli/ci-detect": "^1.0.0", - "lru-cache": "^6.0.0", - "make-fetch-happen": "^8.0.9", + "make-fetch-happen": "^9.0.1", "minipass": "^3.1.3", "minipass-fetch": "^1.3.0", "minipass-json-stream": "^1.0.1", @@ -42624,14 +42728,14 @@ "dev": true }, "npmlog": { - "version": "4.1.2", + "version": "5.0.0", "bundled": true, "dev": true, "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "^1.1.5", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" } }, "number-is-nan": { @@ -42671,11 +42775,11 @@ } }, "pacote": { - "version": "11.3.1", + "version": "11.3.5", "bundled": true, "dev": true, "requires": { - "@npmcli/git": "^2.0.1", + "@npmcli/git": "^2.1.0", "@npmcli/installed-package-contents": "^1.0.6", "@npmcli/promise-spawn": "^1.2.0", "@npmcli/run-script": "^1.8.2", @@ -42688,7 +42792,7 @@ "npm-package-arg": "^8.0.1", "npm-packlist": "^2.1.4", "npm-pick-manifest": "^6.0.0", - "npm-registry-fetch": "^9.0.0", + "npm-registry-fetch": "^11.0.0", "promise-retry": "^2.0.1", "read-package-json-fast": "^2.0.1", "rimraf": "^3.0.2", @@ -42712,7 +42816,7 @@ "dev": true }, "path-parse": { - "version": "1.0.6", + "version": "1.0.7", "bundled": true, "dev": true }, @@ -42721,6 +42825,11 @@ "bundled": true, "dev": true }, + "proc-log": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "bundled": true, @@ -42803,7 +42912,7 @@ } }, "read-package-json-fast": { - "version": "2.0.2", + "version": "2.0.3", "bundled": true, "dev": true, "requires": { @@ -42863,6 +42972,16 @@ "uuid": "^3.3.2" }, "dependencies": { + "form-data": { + "version": "2.3.3", + "bundled": true, + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, "tough-cookie": { "version": "2.5.0", "bundled": true, @@ -42930,7 +43049,7 @@ "dev": true }, "socks": { - "version": "2.6.0", + "version": "2.6.1", "bundled": true, "dev": true, "requires": { @@ -42972,7 +43091,7 @@ } }, "spdx-license-ids": { - "version": "3.0.7", + "version": "3.0.9", "bundled": true, "dev": true }, @@ -43054,7 +43173,7 @@ } }, "tar": { - "version": "6.1.0", + "version": "6.1.6", "bundled": true, "dev": true, "requires": { @@ -44318,11 +44437,6 @@ "varint": "^6.0.0" } }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -46938,6 +47052,29 @@ } } }, + "tar": { + "version": "4.4.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.15.tgz", + "integrity": "sha512-ItbufpujXkry7bHH9NpQyTXPbJ72iTlXgkBAYsAjDXk3Ds8t/3NfO5P4xZGy7u+sYuQUbimgzswX4uQIEeNVOA==", + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "dependencies": { + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "optional": true + } + } + }, "tdigest": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.1.tgz", @@ -47148,9 +47285,9 @@ "dev": true }, "trim-newlines": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.0.tgz", - "integrity": "sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, "trim-off-newlines": { diff --git a/package.json b/package.json index 57ed9a4..916db19 100644 --- a/package.json +++ b/package.json @@ -23,14 +23,15 @@ }, "repository": "Permissionless-Software-Foundation/ipfs-service-provider", "dependencies": { - "@psf/bch-js": "^4.20.1", + "@psf/bch-js": "^4.20.3", "axios": "^0.21.1", "bcryptjs": "^2.4.3", "glob": "^7.1.6", - "ipfs": "^0.54.4", - "ipfs-coord": "^3.2.0", + "ipfs": "0.54.4", + "ipfs-coord": "^5.0.0", "jsonrpc-lite": "^2.2.0", "jsonwebtoken": "^8.5.1", + "jwt-bch-lib": "^1.3.0", "kcors": "^2.2.2", "koa": "^2.13.1", "koa-bodyparser": "^4.3.0", diff --git a/src/adapters/fullstack-jwt.js b/src/adapters/fullstack-jwt.js new file mode 100644 index 0000000..33d7248 --- /dev/null +++ b/src/adapters/fullstack-jwt.js @@ -0,0 +1,107 @@ +/* + A library of utility functions for working with FullStack.cash JWT tokens. + + Feel free to copy this library into your own app, as well as the unit tests + for this file. +*/ + +const JwtLib = require('jwt-bch-lib') +const BCHJS = require('@psf/bch-js') + +class FullStackJWT { + constructor (localConfig = {}) { + // Input Validation + this.authServer = localConfig.authServer + if (!this.authServer || typeof this.authServer !== 'string') { + throw new Error( + 'Must pass a url for the AUTH server when instantiating FullStackJWT class.' + ) + } + this.apiServer = localConfig.apiServer + if (!this.apiServer || typeof this.apiServer !== 'string') { + throw new Error( + 'Must pass a url for the API server when instantiating FullStackJWT class.' + ) + } + this.login = localConfig.fullstackLogin + if (!this.login || typeof this.login !== 'string') { + throw new Error( + 'Must pass a FullStack.cash login (email) instantiating FullStackJWT class.' + ) + } + this.password = localConfig.fullstackPassword + if (!this.password || typeof this.password !== 'string') { + throw new Error( + 'Must pass a FullStack.cash account password when instantiating FullStackJWT class.' + ) + } + + // Encapsulate dependencies + this.jwtLib = new JwtLib({ + // Overwrite default values with the values in the config file. + server: this.authServer, + login: this.login, + password: this.password + }) + + // State + this.apiToken = '' // Default value. + this.bchjs = {} + } + + // Get's a JWT token from FullStack.cash. + async getJWT () { + try { + // Skip connecting FullStack.cash auth server to the network if this is an E2E test. + if (process.env.TEST_TYPE === 'e2e') { + this.apiToken = 'faketoken' + return this.apiToken + } + + // Log into the auth server. + await this.jwtLib.register() + + this.apiToken = this.jwtLib.userData.apiToken + if (!this.apiToken) { + throw new Error('This account does not have a JWT') + } + console.log(`Retrieved JWT token: ${this.apiToken}\n`) + + // Ensure the JWT token is valid to use. + const isValid = await this.jwtLib.validateApiToken() + + // Get a new token with the same API level, if the existing token is not + // valid (probably expired). + if (!isValid.isValid) { + this.apiToken = await this.jwtLib.getApiToken( + this.jwtLib.userData.apiLevel + ) + console.log( + `The JWT token was not valid. Retrieved new JWT token: ${this.apiToken}\n` + ) + } else { + console.log('JWT token is valid.\n') + } + + return this.apiToken + } catch (err) { + console.error( + `Error trying to log into ${this.server} and retrieve JWT token.` + ) + throw err + } + } + + // Create an instance of bchjs with the validated JWT token. Returns this + // instance of bch-js. + instanceBchjs () { + this.bchjs = new BCHJS({ + restURL: this.apiServer, + apiToken: this.apiToken + }) + + return this.bchjs + } +} + +module.exports = FullStackJWT diff --git a/src/adapters/index.js b/src/adapters/index.js index 846e89f..95acde1 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -4,29 +4,54 @@ https://troutsblog.com/blog/clean-architecture */ +// Public NPM libraries +const BCHJS = require('@psf/bch-js') + // Load individual adapter libraries. const IPFSAdapter = require('./ipfs') const LocalDB = require('./localdb') const LogsAPI = require('./logapi') const Passport = require('./passport') const Nodemailer = require('./nodemailer') -const { wlogger } = require('./wlogger') +// const { wlogger } = require('./wlogger') const JSONFiles = require('./json-files') +const FullStackJWT = require('./fullstack-jwt') -// Instantiate adapter libraries. -const ipfs = new IPFSAdapter() -const localdb = new LocalDB() -const logapi = new LogsAPI() -const passport = new Passport() -const nodemailer = new Nodemailer() -const jsonFiles = new JSONFiles() +const config = require('../../config') -module.exports = { - ipfs, - localdb, - logapi, - passport, - nodemailer, - wlogger, - jsonFiles +class Adapters { + constructor (localConfig = {}) { + // Encapsulate dependencies + this.ipfs = new IPFSAdapter() + this.localdb = new LocalDB() + this.logapi = new LogsAPI() + this.passport = new Passport() + this.nodemailer = new Nodemailer() + this.jsonFiles = new JSONFiles() + this.bchjs = new BCHJS() + this.config = config + + // Get a valid JWT API key and instance bch-js. + this.fullStackJwt = new FullStackJWT(config) + } + + async start () { + try { + if (this.config.getJwtAtStartup) { + // Get a JWT token and instantiate bch-js with it. Then pass that instance + // to all the rest of the apps controllers and adapters. + await this.fullStackJwt.getJWT() + // Instantiate bch-js with the JWT token, and overwrite the placeholder for bch-js. + this.bchjs = await this.fullStackJwt.instanceBchjs() + } + + // Start the IPFS node. + await this.ipfs.start() + } catch (err) { + console.error('Error in adapters/index.js/start()') + throw err + } + } } + +module.exports = Adapters diff --git a/src/adapters/ipfs/ipfs-coord.js b/src/adapters/ipfs/ipfs-coord.js index 7406afd..baa0229 100644 --- a/src/adapters/ipfs/ipfs-coord.js +++ b/src/adapters/ipfs/ipfs-coord.js @@ -50,7 +50,7 @@ class IpfsCoordAdapter { }) // Wait for the ipfs-coord library to signal that it is ready. - await this.ipfsCoord.isReady() + await this.ipfsCoord.start() // Signal that this adapter is ready. this.isReady = true diff --git a/src/adapters/ipfs/ipfs.js b/src/adapters/ipfs/ipfs.js index 297a056..3b65360 100644 --- a/src/adapters/ipfs/ipfs.js +++ b/src/adapters/ipfs/ipfs.js @@ -25,7 +25,7 @@ class IpfsAdapter { try { // Ipfs Options const ipfsOptions = { - repo: './ipfsdata', + repo: './.ipfsdata/ipfs', start: true, config: { relay: { @@ -56,16 +56,6 @@ class IpfsAdapter { // Set the 'server' profile so the node does not scan private networks. await this.ipfs.config.profiles.apply('server') - // const nodeConfig = await this.ipfs.config.getAll() - // console.log( - // `IPFS node configuration: ${JSON.stringify(nodeConfig, null, 2)}` - // ) - - // Stop the IPFS node if we're running tests. - if (this.config.env === 'test') { - await this.ipfs.stop() - } - // Signal that this adapter is ready. this.isReady = true @@ -75,6 +65,10 @@ class IpfsAdapter { throw err } } + + async stop () { + await this.ipfs.stop() + } } module.exports = IpfsAdapter diff --git a/src/controllers/index.js b/src/controllers/index.js index 69034fe..b403499 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -7,7 +7,7 @@ // Public npm libraries. // Load the Clean Architecture Adapters library -const adapters = require('../adapters') +const Adapters = require('../adapters') // Load the JSON RPC Controller. const JSONRPC = require('./json-rpc') @@ -21,30 +21,30 @@ const RESTControllers = require('./rest-api') class Controllers { constructor (localConfig = {}) { - this.adapters = adapters - this.useCases = new UseCases({ adapters }) + this.adapters = new Adapters() + this.useCases = new UseCases({ adapters: this.adapters }) } async attachControllers (app) { + // Wait for any startup processes to complete for the Adapters libraries. + await this.adapters.start() + // Attach the REST controllers to the Koa app. this.attachRESTControllers(app) - // Start IPFS. - await this.adapters.ipfs.start() - this.attachRPCControllers() } // Top-level function for this library. // Start the various Controllers and attach them to the app. attachRESTControllers (app) { - const rESTControllers = new RESTControllers({ + const restControllers = new RESTControllers({ adapters: this.adapters, useCases: this.useCases }) // Attach the REST API Controllers associated with the boilerplate code to the Koa app. - rESTControllers.attachRESTControllers(app) + restControllers.attachRESTControllers(app) } // Add the JSON RPC router to the ipfs-coord adapter. diff --git a/test/e2e/automated/a01-auth.rest-e2e.js b/test/e2e/automated/a01-auth.rest-e2e.js index e4f367b..43bc3c5 100644 --- a/test/e2e/automated/a01-auth.rest-e2e.js +++ b/test/e2e/automated/a01-auth.rest-e2e.js @@ -10,7 +10,7 @@ const axios = require('axios').default // Local support libraries const config = require('../../../config') -const app = require('../../../bin/server') +const Server = require('../../../bin/server') const testUtils = require('../../utils/test-utils') const AdminLib = require('../../../src/adapters/admin') const adminLib = new AdminLib() @@ -22,9 +22,14 @@ const LOCALHOST = `http://localhost:${config.port}` describe('Auth', () => { before(async () => { + const app = new Server() + // This should be the first instruction. It starts the REST API server. await app.startServer() + // Stop the IPFS node for the rest of the e2e tests. + // await app.controllers.adapters.ipfs.stop() + // Delete all previous users in the database. await testUtils.deleteAllUsers() diff --git a/test/e2e/automated/a02-users.rest-e2e.js b/test/e2e/automated/a02-users.rest-e2e.js index 439c6e1..d4a0125 100644 --- a/test/e2e/automated/a02-users.rest-e2e.js +++ b/test/e2e/automated/a02-users.rest-e2e.js @@ -12,7 +12,8 @@ const LOCALHOST = `http://localhost:${config.port}` const context = {} const UserController = require('../../../src/controllers/rest-api/users/controller') -const adapters = require('../../../src/adapters') +const Adapters = require('../../../src/adapters') +const adapters = new Adapters() const UseCases = require('../../../src/use-cases/') let uut let sandbox diff --git a/test/unit/adapters/fullstack-jwt.adapter.unit.js b/test/unit/adapters/fullstack-jwt.adapter.unit.js new file mode 100644 index 0000000..28216b8 --- /dev/null +++ b/test/unit/adapters/fullstack-jwt.adapter.unit.js @@ -0,0 +1,162 @@ +/* + Unit tests for the jwt-bch-lib and fullstack-jwt.js adapter library. + +*/ + +const assert = require('chai').assert +const sinon = require('sinon') + +const FullStackJWT = require('../../../src/adapters/fullstack-jwt') + +describe('#FullStackJWT', () => { + let sandbox + let uut + + beforeEach(() => { + sandbox = sinon.createSandbox() + + const localConfig = { + authServer: 'someserver', + apiServer: 'someserver', + fullstackLogin: 'somelogin', + fullstackPassword: 'somepassword' + } + uut = new FullStackJWT(localConfig) + }) + afterEach(() => sandbox.restore()) + + describe('#constructor', () => { + it('should throw an error if auth server is not specified', () => { + try { + uut = new FullStackJWT() + + assert.fail('Unexpected code path') + console.log(uut) // For linting. + } catch (err) { + assert.include( + err.message, + 'Must pass a url for the AUTH server when instantiating FullStackJWT class.' + ) + } + }) + + it('should throw an error if api server is not specified', () => { + try { + const localConfig = { + authServer: 'someserver' + } + + uut = new FullStackJWT(localConfig) + + assert.fail('Unexpected code path') + console.log(uut) // For linting. + } catch (err) { + assert.include( + err.message, + 'Must pass a url for the API server when instantiating FullStackJWT class.' + ) + } + }) + + it('should throw an error if login is not specified', () => { + try { + const localConfig = { + authServer: 'someserver', + apiServer: 'someserver' + } + uut = new FullStackJWT(localConfig) + + assert.fail('Unexpected code path') + console.log(uut) // For linting. + } catch (err) { + assert.include( + err.message, + 'Must pass a FullStack.cash login (email) instantiating FullStackJWT class.' + ) + } + }) + + it('should throw an error if login is not specified', () => { + try { + const localConfig = { + authServer: 'someserver', + apiServer: 'someserver', + fullstackLogin: 'somelogin' + } + uut = new FullStackJWT(localConfig) + + assert.fail('Unexpected code path') + console.log(uut) // For linting. + } catch (err) { + assert.include( + err.message, + 'Must pass a FullStack.cash account password when instantiating FullStackJWT class.' + ) + } + }) + }) + + describe('#getJWT', () => { + it('should return the JWT token', async () => { + // Mock dependencies to force a code path. + sandbox.stub(uut.jwtLib, 'register').resolves({}) + uut.jwtLib.userData.apiToken = 'abc123' + sandbox.stub(uut.jwtLib, 'validateApiToken').resolves({ isValid: true }) + + const result = await uut.getJWT() + // console.log('result: ', result) + + assert.equal(result, 'abc123') + }) + + it('should catch and throw an error', async () => { + try { + // Force an error + sandbox.stub(uut.jwtLib, 'register').rejects(new Error('test error')) + + await uut.getJWT() + + assert.fail('Unexpected code path') + } catch (err) { + assert.include(err.message, 'test error') + } + }) + + it('should throw an error if user does not have a JWT', async () => { + try { + // Mock dependencies to force a code path. + sandbox.stub(uut.jwtLib, 'register').resolves({}) + + await uut.getJWT() + + assert.fail('Unexpected code path') + } catch (err) { + // console.log('err.message: ', err.message) + assert.include(err.message, 'This account does not have a JWT') + } + }) + + it('should retrieve a new JWT token if the old one invalid', async () => { + // Mock dependencies to force a code path. + sandbox.stub(uut.jwtLib, 'register').resolves({}) + uut.jwtLib.userData.apiToken = 'abc123' + uut.jwtLib.userData.apiLevel = 30 + sandbox.stub(uut.jwtLib, 'validateApiToken').resolves({ isValid: false }) + sandbox.stub(uut.jwtLib, 'getApiToken').resolves('xyz789') + + const result = await uut.getJWT() + // console.log('result: ', result) + + assert.equal(result, 'xyz789') + }) + }) + + describe('#instanceBchjs', () => { + it('should return an instance of bch-js', () => { + const result = uut.instanceBchjs() + // console.log('result: ', result) + + assert.property(result, 'restURL') + }) + }) +}) diff --git a/test/unit/controllers/controllers.unit.js b/test/unit/controllers/controllers.unit.js index 674e587..a60ddec 100644 --- a/test/unit/controllers/controllers.unit.js +++ b/test/unit/controllers/controllers.unit.js @@ -6,8 +6,6 @@ // const assert = require('chai').assert const sinon = require('sinon') -const adapters = require('../../../src/adapters') -// const { attachControllers } = require('../../../src/controllers') const Controllers = require('../../../src/controllers') describe('#Controllers', () => { @@ -25,8 +23,8 @@ describe('#Controllers', () => { describe('#attachControllers', () => { it('should attach the controllers', async () => { // mock IPFS - sandbox.stub(adapters.ipfs, 'start').resolves({}) - adapters.ipfs.ipfsCoordAdapter = { + sandbox.stub(uut.adapters, 'start').resolves({}) + uut.adapters.ipfs.ipfsCoordAdapter = { attachRPCRouter: () => {} }