using the web3.eth.account.create()
method returns:
{
address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
signTransaction: function(tx){...},
sign: function(data){...},
encrypt: function(password){...}
}
How to make safety saving private keys to mongodb?
I was researching bcrypt, hashcode, but hascode is not safety and bcrypt encoding requires to remember private key, but it is difficult.
Earlier I have worked with Java Spring Boot and there was bcrypt password encoder, but I dont know how it will work in node.js
2
Answers
you can use nodejs crypto and use a global secret
and if you feel like that might not be strong enough you can add a random string to the encryption
You can use Mongodb’s Encryption Key Management here.
The following example creates a Data Encryption Key with an alternate name.
Read more about ClientEncryption.encrypt