1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Reject Trezor eth_getEncryptionPublicKey requests (#10330)

Further implements request rejection on eth_getEncryptionPublicKey for Trezor as they do not implement this method either.
This commit is contained in:
Thomas Huang 2021-02-02 07:25:30 -08:00 committed by GitHub
parent 12161bb0c6
commit 6a89261f28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1645,11 +1645,25 @@ export default class MetamaskController extends EventEmitter {
async newRequestEncryptionPublicKey(msgParams, req) { async newRequestEncryptionPublicKey(msgParams, req) {
const address = msgParams const address = msgParams
const keyring = await this.keyringController.getKeyringForAccount(address) const keyring = await this.keyringController.getKeyringForAccount(address)
if (keyring.type === 'Ledger Hardware') {
switch (keyring.type) {
case 'Ledger Hardware': {
return new Promise((_, reject) => { return new Promise((_, reject) => {
reject(new Error('Ledger does not support eth_getEncryptionPublicKey.')) reject(
new Error('Ledger does not support eth_getEncryptionPublicKey.'),
)
}) })
} }
case 'Trezor Hardware': {
return new Promise((_, reject) => {
reject(
new Error('Trezor does not support eth_getEncryptionPublicKey.'),
)
})
}
default: {
const promise = this.encryptionPublicKeyManager.addUnapprovedMessageAsync( const promise = this.encryptionPublicKeyManager.addUnapprovedMessageAsync(
msgParams, msgParams,
req, req,
@ -1658,6 +1672,8 @@ export default class MetamaskController extends EventEmitter {
this.opts.showUserConfirmation() this.opts.showUserConfirmation()
return promise return promise
} }
}
}
/** /**
* Signifies a user's approval to receiving encryption public key in queue. * Signifies a user's approval to receiving encryption public key in queue.