-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fontawesome script to index.html, create getAccount.js file, upda… #27
Conversation
…te truffle-config.js for celo network, and update dependencies in package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mmpotulo28 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
// get cell account and pprivatekey | ||
// return account and privatekey | ||
// account: string | ||
// privatekey: string | ||
// return: {account: string, privatekey: string} | ||
const Web3 = require('web3'); | ||
const web3 = new Web3( | ||
new Web3.providers.HttpProvider('http://alfajores-forno.celo-testnet.org'), | ||
); | ||
|
||
function getAccount() { | ||
let account = '0x' + web3.eth.accounts.create().address; | ||
let privatekey = web3.eth.accounts.create().privateKey; | ||
let mnemonic = web3.eth.accounts.create().mnemonic; | ||
return { account: account, privatekey: privatekey, mnemonic: mnemonic }; | ||
} | ||
|
||
console.log(getAccount()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 issue (security): Review the security implications of generating keys in client-side code.
Generating keys on the client-side can expose sensitive information. Consider server-side generation and secure transmission methods.
function getAccount() { | ||
let account = '0x' + web3.eth.accounts.create().address; | ||
let privatekey = web3.eth.accounts.create().privateKey; | ||
let mnemonic = web3.eth.accounts.create().mnemonic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring
)
let mnemonic = web3.eth.accounts.create().mnemonic; | |
let {mnemonic} = web3.eth.accounts.create(); |
Explanation
Object destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.From the Airbnb Javascript Style Guide
…te truffle-config.js for celo network, and update dependencies in package.json