I am trying to follow the example found at this site in order to authenticate users using the MetaMask functionality. Furthermore, the web3.js documentation at the following site, specifies this sign function:
web3.eth.personal.sign(dataToSign, address, password [, callback])
I have no issue in passing the dataToSign and address values to this function, however, how can I pass it the password?
Otherwise, is this the proper function to use in order to sign a nonce used for authenticating a user? Perhaps I need to use another function? This is my promise calling the function (with different possible alternative function):
return new Promise((resolve, reject) =>
// NOt sure which function among the ones below to use:
this.web3.eth.personal.sign(this.web3.fromUtf8(nonce), account, (err, signature) => { // Or
this.web3.eth.sign(nonce, account, (err, signature) => { // Or
this.web3.eth.accounts.sign(nonce, account, (err, signature) => { // Or
this.web3.eth.personal.sign(nonce, account, password, (err, signature) => {
if (err) return reject(err)
return resolve([account, signature])
})
)
I did not have much success with any of them.
Thank you. J