liusong1111 / synapse-extension

MIT License
0 stars 0 forks source link

[bug] verify password #12

Open liusong1111 opened 4 years ago

liusong1111 commented 4 years ago

https://github.com/rebase-network/synapse-extension/blob/af0985a81b5a6d578b3605bb459b4487283ffab4/src/background/index.ts#L432

    const privateKeyBuffer = await PasswordKeystore.decrypt(wallet.keystore, password);
    const Uint8ArrayPk = new Uint8Array(privateKeyBuffer.data);

privateKeyBuffer === null when input wrong password

syuukawa commented 4 years ago

https://github.com/rebase-network/synapse-extension/blob/af0985a81b5a6d578b3605bb459b4487283ffab4/src/background/index.ts#L432

    const privateKeyBuffer = await PasswordKeystore.decrypt(wallet.keystore, password);
    const Uint8ArrayPk = new Uint8Array(privateKeyBuffer.data);

privateKeyBuffer === null when input wrong password

https://github.com/rebase-network/synapse-extension/commit/1f2fe969f3ac024bbcd874b07a983cd976bf9b1a#diff-ee2d18d7a95b95060c6d5ec0ca2caeeb

katat commented 4 years ago

Hi @syuukawa

Thanks for making these updates according to the feedback by @liusong1111.

There is an area I would need a bit of clarification. I saw the newly added checks also include a notification to the other part of the Chrome extension but it is commented out. Will this part of the code be reactivated at a certain point? I think it would be helpful to let the user know if it is an invalid password instead of silence the error.

syuukawa commented 4 years ago

Hi Kata Choi

The check about password just has added, Just like .

const privateKeyBuffer = await PasswordKeystore.decrypt(wallet.keystore, password);
if (privateKeyBuffer === null) {
  const responseEorrorMsg = {
    type: MESSAGE_TYPE.SEND_TX_ERROR,
    success: true,
    message: 'INVALID_PASSWORD',
    data: '',
  };
  browser.runtime.sendMessage(responseEorrorMsg);
  return;
}

First, I fixed the issues and then added the message about invaild password, they are not in the same commit, so it is not react in the code.

It can be found here

https://github.com/rebase-network/synapse-extension/blob/master/src/background/index.ts https://github.com/rebase-network/synapse-extension/blob/master/src/background/index.ts

If any questions ,Let me know, thanks

Syuukawa

在 2020年7月27日,下午4:33,Kata Choi notifications@github.com 写道:

Hi @syuukawa https://github.com/syuukawa Thanks for making these updates according to the feedback by @liusong1111 https://github.com/liusong1111.

There is an area I would need a bit of clarification. I saw the newly added checks also include a notification to the other part of the Chrome extension but it is commented out. Will this part of the code be reactivated at a certain point? I think it would be helpful to let the user know if it is an invalid password instead of silence the error.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/liusong1111/synapse-extension/issues/12#issuecomment-664201649, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE66OAZQ242STNJ7WVXHQ4TR5U3V7ANCNFSM4PAZ4PYQ.