liusong1111 / synapse-extension

MIT License
0 stars 0 forks source link

what if the first wallet is imported instead of created? #13

Open liusong1111 opened 4 years ago

liusong1111 commented 4 years ago

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

    // get the current keystore and check the password
    const currentPublicKey = _currentWallet.currentWallet.publicKey;
    const currWallet = findInWalletsByPublicKey(currentPublicKey, _wallets.wallets);
    const currKeystore = currWallet.keystore;
    const privateKeyObj = await PasswordKeystore.checkByPassword(currKeystore, password);

    if (privateKeyObj == null) {
      chrome.runtime.sendMessage({
        // 'password incorrect',
        type: MESSAGE_TYPE.IMPORT_PRIVATE_KEY_ERR,
      });
      return;
    }

It seems that all wallets use the same password. When user imports a wallet, it check the currentWallet use the same password that user just inputs.

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