Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation for eth_decryptMessage #7247

Closed
wants to merge 12 commits into from
14 changes: 13 additions & 1 deletion app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
"message": "Custom RPC"
},
"dataBackupFoundInfo": {
"message": "Some of your account data was backed up during a previous installation of MetaMask. This could include your settings, contacts and tokens. Would you like to restore this data now?"
"message": "Some of your account data was backed up during a previous installation of MetaMask. This could include your settings, contacts, and tokens. Would you like to restore this data now?"
},
"decimalsMustZerotoTen": {
"message": "Decimals must be at least 0, and not over 36."
Expand Down Expand Up @@ -1471,5 +1471,17 @@
},
"zeroGasPriceOnSpeedUpError": {
"message": "Zero gas price on speed up"
},
"decryptRequest" : {
"message": "Decrypt request"
},
"yourDecryptRequest" : {
"message": "Data decrypt"
},
"decrypt" : {
"message": "Decrypt"
},
"youDecrypt": {
"message": "You are decrypting"
}
}
27 changes: 26 additions & 1 deletion app/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
"customRPC": {
"message": "Пользовательский RPC"
},
"dataBackupFoundInfo": {
"message": "Некоторые данные вашей учетной записи были экспортированы во время предыдущей установки MetaMask. Это может включать ваши настройки, контакты и токены. Вы хотите импортировать эти данные сейчас?"
},
"decimalsMustZerotoTen": {
"message": "Количество десятичных разрядов должно быть минимум 0 и максимум 36."
},
Expand Down Expand Up @@ -314,6 +317,9 @@
"loadingTokens": {
"message": "Загрузка токенов..."
},
"localhost": {
"message": "Localhost 8545"
},
"login": {
"message": "Вход"
},
Expand Down Expand Up @@ -1022,8 +1028,11 @@
"noConversionRateAvailable": {
"message": "Курсы валют недоступны"
},
"noThanks": {
"message": "Нет, спасибо"
},
"notEnoughGas": {
"message": "Нехватает газа"
"message": "Не хватает газа"
},
"noWebcamFoundTitle": {
"message": "Веб-камера не найдена"
Expand Down Expand Up @@ -1106,6 +1115,10 @@
"restoreAccountWithSeed": {
"message": "Восстановите свой аккаунт с помощью секретной фразы"
},
"restoreWalletPreferences": {
"message": "Были найдены данные экспортированные от $1. Вы желаете восстановить настройки вашего кошелька?",
"description": "$1 это дата в которую данные были экспортированы"
},
"requestsAwaitingAcknowledgement": {
"message": "запросы, ожидающие подтверждения"
},
Expand Down Expand Up @@ -1399,5 +1412,17 @@
},
"yourPrivateSeedPhrase": {
"message": "Ваша сид-фраза"
},
"decryptRequest" : {
"message": "Запрос расшифровки"
},
"yourDecryptRequest" : {
"message": "Данные для расшифровки"
},
"decrypt" : {
"message": "Расшифровать"
},
"youDecrypt": {
"message": "Вы расшифровываете"
}
}
11 changes: 8 additions & 3 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ const { submitMeshMetricsEntry } = setupMetamaskMeshMetrics()
* @property {number} unapprovedMsgCount - The number of messages in unapprovedMsgs.
* @property {Object} unapprovedPersonalMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedPersonalMsgCount - The number of messages in unapprovedPersonalMsgs.
* @property {Object} unapprovedDecryptMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedDecryptMsgCount - The number of messages in unapprovedDecryptMsgs.
* @property {Object} unapprovedTypedMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedTypedMsgCount - The number of messages in unapprovedTypedMsgs.
* @property {string[]} keyringTypes - An array of unique keyring identifying strings, representing available strategies for creating accounts.
Expand Down Expand Up @@ -401,6 +403,7 @@ function setupController (initState, initLangCode) {
controller.txController.on('update:badge', updateBadge)
controller.messageManager.on('updateBadge', updateBadge)
controller.personalMessageManager.on('updateBadge', updateBadge)
controller.decryptMessageManager.on('updateBadge', updateBadge)
controller.typedMessageManager.on('updateBadge', updateBadge)
controller.providerApprovalController.memStore.on('update', updateBadge)

Expand All @@ -412,10 +415,12 @@ function setupController (initState, initLangCode) {
let label = ''
const unapprovedTxCount = controller.txController.getUnapprovedTxCount()
const unapprovedMsgCount = controller.messageManager.unapprovedMsgCount
const unapprovedPersonalMsgs = controller.personalMessageManager.unapprovedPersonalMsgCount
const unapprovedTypedMsgs = controller.typedMessageManager.unapprovedTypedMessagesCount
const unapprovedPersonalMsgCount = controller.personalMessageManager.unapprovedPersonalMsgCount
const unapprovedDecryptMsgCount = controller.decryptMessageManager.unapprovedDecryptMsgCount
const unapprovedTypedMessagesCount = controller.typedMessageManager.unapprovedTypedMessagesCount
const pendingProviderRequests = controller.providerApprovalController.memStore.getState().providerRequests.length
const count = unapprovedTxCount + unapprovedMsgCount + unapprovedPersonalMsgs + unapprovedTypedMsgs + pendingProviderRequests
const count = unapprovedTxCount + unapprovedMsgCount + unapprovedPersonalMsgCount + unapprovedDecryptMsgCount +
unapprovedTypedMessagesCount + pendingProviderRequests
if (count) {
label = String(count)
}
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/controllers/network/createMetamaskMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function createMetamaskMiddleware ({
processTypedMessageV3,
processTypedMessageV4,
processPersonalMessage,
processDecryptMessage,
getPendingNonce,
}) {
const metamaskMiddleware = mergeMiddleware([
Expand All @@ -30,6 +31,7 @@ function createMetamaskMiddleware ({
processTypedMessageV3,
processTypedMessageV4,
processPersonalMessage,
processDecryptMessage,
}),
createPendingNonceMiddleware({ getPendingNonce }),
])
Expand Down
5 changes: 5 additions & 0 deletions app/scripts/controllers/threebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class ThreeBoxController {
withAppKeyOrigin: 'wallet://3box.metamask.io',
})
},
processDecryptMessage: (msgParams) => {
return Promise.resolve(keyringController.decryptMessage(msgParams, {
withAppKeyOrigin: 'wallet://3box.metamask.io',
}))
},
})

const initState = {
Expand Down
Loading