From 00be6b147da5b4bc8880da005efab51394a2ea54 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 9 May 2022 23:32:43 +1000 Subject: [PATCH] Remove crypto-browserify --- CHANGELOG.md | 2 ++ examples/web-chat/config/webpack.extend.js | 4 ++-- package-lock.json | 1 - package.json | 4 +++- webpack.config.bundle.js | 2 +- webpack.config.js | 2 +- webpack.config.min.bundle.js | 2 +- webpack.config.min.js | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a86f5973b2..237d1a373a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Prefer the use of `BigInt` over integer literal (`n` postfix) to facilitate the use of a polyfill. +- Replaced `secp256k1` and hence `elliptic` dependencies with `@noble/secp256k1`, + reducing package size, number of dependency and removing need for `crypto-browserify` polyfill. ### Fixed diff --git a/examples/web-chat/config/webpack.extend.js b/examples/web-chat/config/webpack.extend.js index c081232a2f..c0b2c160e1 100644 --- a/examples/web-chat/config/webpack.extend.js +++ b/examples/web-chat/config/webpack.extend.js @@ -8,7 +8,7 @@ module.exports = { Object.assign(config.resolve.fallback, { assert: require.resolve("assert"), buffer: require.resolve("buffer"), - crypto: require.resolve("crypto-browserify"), + crypto: false, http: require.resolve("http-browserify"), https: require.resolve("https-browserify"), stream: require.resolve("stream-browserify"), @@ -41,7 +41,7 @@ module.exports = { Object.assign(config.resolve.fallback, { assert: require.resolve("assert"), buffer: require.resolve("buffer"), - crypto: require.resolve("crypto-browserify"), + crypto: false, http: require.resolve("http-browserify"), https: require.resolve("https-browserify"), stream: require.resolve("stream-browserify"), diff --git a/package-lock.json b/package-lock.json index a6fc7172d9..069421f61c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,6 @@ "assert": "^2.0.0", "buffer": "^6.0.3", "chai": "^4.3.4", - "crypto-browserify": "^3.12.0", "cspell": "^5.14.0", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", diff --git a/package.json b/package.json index 78b41c8c76..742bb43072 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,9 @@ "deploy": "node ci/deploy.js", "reset-hard": "git clean -dfx && git reset --hard && npm i && npm run build && for d in examples/*/; do (cd $d; npm i); done" }, + "browser": { + "crypto": false + }, "engines": { "node": ">=16" }, @@ -101,7 +104,6 @@ "assert": "^2.0.0", "buffer": "^6.0.3", "chai": "^4.3.4", - "crypto-browserify": "^3.12.0", "cspell": "^5.14.0", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", diff --git a/webpack.config.bundle.js b/webpack.config.bundle.js index db4d4b130f..9ad2082392 100644 --- a/webpack.config.bundle.js +++ b/webpack.config.bundle.js @@ -24,7 +24,7 @@ module.exports = { extensions: ['.ts', '.js'], fallback: { buffer: require.resolve('buffer/'), - crypto: require.resolve('crypto-browserify'), + crypto: false, stream: require.resolve('stream-browserify'), assert: require.resolve('assert'), }, diff --git a/webpack.config.js b/webpack.config.js index 9f0f4f3a48..9dc80c76ff 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,7 +24,7 @@ module.exports = { extensions: ['.ts', '.js'], fallback: { buffer: require.resolve('buffer/'), - crypto: require.resolve('crypto-browserify'), + crypto: false, stream: require.resolve('stream-browserify'), assert: require.resolve('assert'), }, diff --git a/webpack.config.min.bundle.js b/webpack.config.min.bundle.js index a8aca38a4e..f260cc0805 100644 --- a/webpack.config.min.bundle.js +++ b/webpack.config.min.bundle.js @@ -24,7 +24,7 @@ module.exports = { extensions: ['.ts', '.js'], fallback: { buffer: require.resolve('buffer/'), - crypto: require.resolve('crypto-browserify'), + crypto: false, stream: require.resolve('stream-browserify'), assert: require.resolve('assert'), }, diff --git a/webpack.config.min.js b/webpack.config.min.js index 38813a5841..8175c87033 100644 --- a/webpack.config.min.js +++ b/webpack.config.min.js @@ -24,7 +24,7 @@ module.exports = { extensions: ['.ts', '.js'], fallback: { buffer: require.resolve('buffer/'), - crypto: require.resolve('crypto-browserify'), + crypto: false, stream: require.resolve('stream-browserify'), assert: require.resolve('assert'), },