Psychedelic / plug

Plug is a browser extension for users of the Internet Computer that allows you to access your ICP, Cycles, and other tokens as well as log into IC apps with one click.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confused about the connect state returned by `window.ic.plug.isConnected` method

sandianyu opened this issue · comments

Plug version: 0.4.7
Chrome version: 98.0.4758.102

Repro steps:
1.Go to sonic, do not connect the plug, copy the following code to console

const getPlugConnected = async () =>  {
  const isConnected = await window.ic.plug.isConnected();
  console.log("isConnected", isConnected);
};

getPlugConnected();

Print false

2.Connected the plug wallet, then run getPlugConnected() in console. Print true

3.Go to "My Account" page, lock the plug wallet, then run getPlugConnected(). Print true

I thought what step 3 print should be false, because the plug is locked by now

Hi!
Even though the wallet is locked, you are indeed connected to the page.
If the page then tries to interact with plug in any way, the pop up will show the login screen first for the user to log in.