liusong1111 / synapse-extension

MIT License
0 stars 0 forks source link

passwordEncryptor's checkByPassword is unnecessary #14

Open liusong1111 opened 4 years ago

liusong1111 commented 4 years ago

https://github.com/rebase-network/synapse-extension/blob/af0985a81b5a6d578b3605bb459b4487283ffab4/src/wallet/passwordEncryptor.ts#L17

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

Because we can check whether decrypt returns null. And, decrypt is a heavy computation operation, we should avoid call it twice(checkByPassword will call it again)

syuukawa commented 4 years ago

https://github.com/rebase-network/synapse-extension/blob/af0985a81b5a6d578b3605bb459b4487283ffab4/src/wallet/passwordEncryptor.ts#L17

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

Because we can check whether decrypt returns null. And, decrypt is a heavy computation operation, we should avoid call it twice(checkByPassword will call it again)

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