I trying to save e-mails of my users in contract but I can simulate the from when I call methods of contract.
Contract.sol
contract Test {
...
mapping (address => string) private _emails;
function getEmail(address from) public view returns (string memory) {
require(msg.sender == from, 'No!');
return _emails[msg.sender];
}
}
app.js (web3js)
let email = await Contract.methods.getEmail(any_other_address).call({from: any_other_address});
console.log(email);
output
[email protected]
I thought msg.sender couldn't be manipulated by from in web3.js. Is there a safe way to save emails in the contract?