Metamask Update — Privacy Mode

Enigmatic
Coinmonks
3 min readNov 1, 2018

--

A couple months back, the awesome team at Metamask put up a blog post (https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) stating that from Nov 2nd onwards, Metamask will be updated to stop having Web3 exposing user accounts by default; Rather, would require the dApp to explicitly request for permission to access Metamask accounts.

Presently, “Privacy Mode” when rolled out, will still be disabled by default; It will, however, be eventually enabled by default on a future release.

So let’s have a look to see how this looks like.

Cooking up a quick test right here to retrieve Metamask’s first account with my current install of Metamask.

Works as is.
Using a pretty standard provider listener.

All fine and dandy. Now we will install the custom Metamask build found here, and turn on Privacy Mode:

Turning Privacy Mode on.
And it fails to get the address now!

Now that we see Privacy Mode does indeed prevent us from accessing Metamask directly, let us add in the codes required to enable the provider:

Creating an async function to ask for permission.
Detect web3 provider and calling for permission.

Refresh our test, and we should see a prompt:

Prompting for permission — Click Reject/Approve to your fancy.
After we click Approve — Refresh the page and it works!

The setting selected will be remembered by Metamask, and could be cleared by clicking on “Clear Privacy Data” found right above the option to enable “Privacy Mode”

And that’s it! Pretty straightforward. Huge shout out to team Metamask for making this much required change — Oh, and looking forward to seeing the Metamask mobile client soon as announced at DevCon4! ;)

Get Best Software Deals Directly In Your Inbox

--

--

Enigmatic
Coinmonks

Fond of blockchain related technology. Researches and code (albeit slowly with the latter). ❤ Coffee ❤