Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
web3-hd-wallet
Advanced tools
Web3 HD Wallet is a package that provides functionality to generate HD wallets and encrypt/decrypt private keys.
To install the package, use npm:
npm install web3-hd-wallet --save
const { HdWallet } = require('web3-hd-wallet');
const hdWallet = new HdWallet();
const mnemonic = hdWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
const wallets = hdWallet.generateHDWallets({
mnemonic: mnemonic,
numOfWallets: 3,
hdPath: "m/44'/60'/0'/0",
});
console.log('HD Wallets:', wallets);
const { Web3Eth } = require('web3-hd-wallet');
const web3Eth = new Web3Eth('http://localhost:8545');
const encryptedKey = web3Eth.encrypt({
privateKey: '0x1234567890abcdef',
password: 'testpassword',
});
console.log('Encrypted Key:', encryptedKey);
const decryptedWallet = web3Eth.decrypt({
keystoreJson: { /* Keystore JSON object */ },
password: 'testpassword',
});
console.log('Decrypted Wallet:', decryptedWallet);
generateMnemonic()
: string: Generates a random mnemonic phrase.generateHDWallets(params: IHdWallet)
: Array<{ address: string, privateKey: string }>: Generates multiple HD wallets based on the provided parameters. The params object should have the following properties:
mnemonic (string)
: The mnemonic phrase.numOfWallets (number)
: The number of wallets to generate.hdPath (string, optional)
: The HD derivation path (default: "m/44'/60'/0'/0").encrypt(params: IWeb3Encrypt)
: any: Encrypts a wallet private key. The params object should have the following properties:
privateKey (string)
: The private key to encrypt.password (string)
: The password used for encryption.decrypt(params: IWeb3Decrypt)
: any: Decrypts a keystore JSON. The params object should have the following properties:
keystoreJson (any)
: The keystore JSON object to decrypt.password (string)
: The password used for decryption.For detailed information about the parameters and return values, refer to the inline documentation in the source code.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Ethereum HD Wallet
The npm package web3-hd-wallet receives a total of 0 weekly downloads. As such, web3-hd-wallet popularity was classified as not popular.
We found that web3-hd-wallet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.