feat: use @noble and @scure libraries for cryptography (#2273)

Switch to using `@noble/hashes`, `@noble/curves`, `@scure/base`,
`@scure/bip32`, and `@scure/bip39`. This replaces `crypto` polyfills
(such as `crypto-browserify`), `create-hash`, `elliptic`, `hash.js`,
`bn.js` (both versions), and their many dependencies.  This also means
there are 33 less dependencies downloaded when running a fresh
`npm install` and will make the project much easier to maintain.

This reduces the bundle size by 44% (82kb minified and gzipped) over
the current 3.0 branch as well as reducing the amount of configuration
required to bundle.

Closes #1814, #1817, #2272, and #2306

Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
This commit is contained in:
Nicholas Dudfield
2023-10-10 02:45:58 +07:00
committed by Caleb Kniffen
parent 5607320ce2
commit 217b111ef2
78 changed files with 2911 additions and 2621 deletions

View File

@@ -11,13 +11,7 @@ module.exports = merge(getDefaultConfiguration(), {
path: path.join(__dirname, 'build/'),
filename: `xrpl.default.js`,
},
plugins: [
new webpack.NormalModuleReplacementPlugin(/^ws$/, './WSWrapper'),
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/wordlists\/(?!english)/,
contextRegExp: /bip39\/src$/,
}),
],
plugins: [new webpack.NormalModuleReplacementPlugin(/^ws$/, './WSWrapper')],
resolve: {
alias: {
ws: './dist/npm/client/WSWrapper.js',