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,18 +1645,34 @@ export default class MetamaskController extends EventEmitter {
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.'))
})
switch (keyring.type) {
case 'Ledger Hardware': {
return new Promise((_, reject) => {
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(
msgParams,
req,
)
this.sendUpdate()
this.opts.showUserConfirmation()
return promise
}
}
const promise = this.encryptionPublicKeyManager.addUnapprovedMessageAsync(
msgParams,
req,
)
this.sendUpdate()
this.opts.showUserConfirmation()
return promise
}
/**