1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Reject eth_getEncryptionPublicKey for ledger hw wallets (#10326)

Fixes #10111

Determine if the msgParams/address for the newRequestEncryptionPublicKey is a ledger keyring via getKeyringForAccount and return a promise rejection.
This commit is contained in:
Thomas Huang 2021-02-01 12:39:09 -08:00 committed by GitHub
parent 469ccd20b3
commit 23bab62008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1643,6 +1643,13 @@ export default class MetamaskController extends EventEmitter {
* Passed back to the requesting Dapp.
*/
async newRequestEncryptionPublicKey(msgParams, req) {
const address = msgParams
const keyring = await this.keyringController.getKeyringForAccount(address)
if (keyring.type === 'Ledger Hardware') {
return new Promise((_, reject) => {
reject(new Error('Ledger does not support eth_getEncryptionPublicKey.'))
})
}
const promise = this.encryptionPublicKeyManager.addUnapprovedMessageAsync(
msgParams,
req,