mirror of
				https://github.com/Xahau/xahau.js.git
				synced 2025-11-04 04:55:48 +00:00 
			
		
		
		
	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:
		
				
					committed by
					
						
						Caleb Kniffen
					
				
			
			
				
	
			
			
			
						parent
						
							5607320ce2
						
					
				
				
					commit
					217b111ef2
				
			@@ -20,9 +20,7 @@ To use `xrpl.js` with React, you need to install shims for core NodeJS modules.
 | 
			
		||||
   ```shell
 | 
			
		||||
   npm install --save-dev \
 | 
			
		||||
       buffer \
 | 
			
		||||
       crypto-browserify \
 | 
			
		||||
       process \
 | 
			
		||||
       stream-browserify
 | 
			
		||||
       process
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
2. Modify your webpack configuration
 | 
			
		||||
@@ -41,8 +39,6 @@ To use `xrpl.js` with React, you need to install shims for core NodeJS modules.
 | 
			
		||||
      module.exports = function override(config) {
 | 
			
		||||
        const fallback = config.resolve.fallback || {};
 | 
			
		||||
        Object.assign(fallback, {
 | 
			
		||||
          crypto: require.resolve("crypto-browserify"),
 | 
			
		||||
          stream: require.resolve("stream-browserify"),
 | 
			
		||||
          ws: require.resolve("xrpl/dist/npm/client/WSWrapper"),
 | 
			
		||||
        });
 | 
			
		||||
        config.resolve.fallback = fallback;
 | 
			
		||||
@@ -152,8 +148,6 @@ build: {
 | 
			
		||||
resolve: {
 | 
			
		||||
  alias: {
 | 
			
		||||
    events: 'events',
 | 
			
		||||
    crypto: 'crypto-browserify',
 | 
			
		||||
    stream: 'stream-browserify',
 | 
			
		||||
    ws: 'xrpl/dist/npm/client/WSWrapper',
 | 
			
		||||
  },
 | 
			
		||||
}})
 | 
			
		||||
@@ -166,8 +160,6 @@ npm install --save-dev @esbuild-plugins/node-globals-polyfill \
 | 
			
		||||
		rollup-plugin-polyfill-node \
 | 
			
		||||
		&& npm install
 | 
			
		||||
		events \
 | 
			
		||||
		crypto-browserify \
 | 
			
		||||
		stream-browserify \
 | 
			
		||||
		xrpl
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user