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 encrypt/decrypt feature #7831

Merged
merged 51 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2254d39
Implementation for "eth_decryptMessage". It allows using private user…
logvik Oct 3, 2019
0299e0c
npm version for eth-json-rpc-middleware
logvik Jan 10, 2020
fd55bf3
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 10, 2020
0d7deb0
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 14, 2020
908d054
merged with origin repository
logvik Jan 15, 2020
b78fcb7
lint
logvik Jan 15, 2020
334e392
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 15, 2020
445c7ac
Use published versions of dependencies
Gudahtt Jan 15, 2020
e1f0a78
Merge pull request #1 from Gudahtt/use-published-deps
logvik Jan 15, 2020
8630a22
fix for yarn, eth-json-rpc-middleware from NPM
logvik Jan 15, 2020
b3e4c7c
fixes for i18n, mock-state, unapproved messages count
logvik Jan 15, 2020
e98d91b
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 16, 2020
d4b0bdb
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 19, 2020
176a5c1
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 20, 2020
4816564
updated version for eth-keyring-controller
logvik Jan 21, 2020
5655e5f
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 21, 2020
7499aed
i18n issues are fixed
logvik Jan 21, 2020
c61033c
the fix in wording
logvik Jan 21, 2020
58a6144
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 22, 2020
1ed0b02
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 23, 2020
abddc13
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 24, 2020
af17ae8
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 25, 2020
fdb7856
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 27, 2020
9883e01
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 28, 2020
774bc54
fixed quotes for lint
logvik Jan 28, 2020
61f9a63
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 29, 2020
cb1dad9
1) fixed bug when the message for decryption is empty
logvik Jan 29, 2020
acdb2f8
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Jan 29, 2020
61c3f72
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 3, 2020
4959c31
removed unnecessary methods for 3box
logvik Feb 4, 2020
acee8d8
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 4, 2020
f35146c
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 4, 2020
5b99d09
package.json and yarn.lock are given by the origin
logvik Feb 4, 2020
895d833
fixes after Gudahtt reviewing
logvik Feb 4, 2020
31648b2
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 4, 2020
73c2aa1
fix for the last review by Gudahtt
logvik Feb 5, 2020
5110eb4
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 5, 2020
2ba61e7
fix for lint errors
logvik Feb 5, 2020
fda35a1
better handling for edges cases
logvik Feb 6, 2020
f5d9074
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 6, 2020
4f180e3
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 6, 2020
34ecc27
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 8, 2020
19e44af
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 10, 2020
74e99e9
fixes after jennypollack review
logvik Feb 10, 2020
2c32b68
Fixes for the metric messages
logvik Feb 13, 2020
b5c5f25
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 13, 2020
b8099ca
fixes for names of decrypt/encrypt RPC methods
logvik Feb 14, 2020
08433ee
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 15, 2020
9b8c2dc
removed the link on the private npm package
logvik Feb 15, 2020
108f90d
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
logvik Feb 19, 2020
7308af8
fix for lint
logvik Feb 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 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 Spend Limit"
},
"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 @@ -1609,5 +1609,35 @@
},
"zeroGasPriceOnSpeedUpError": {
"message": "Zero gas price on speed up"
},
"decryptRequest": {
"message": "Decrypt request"
},
"decrypt": {
"message": "Decrypt"
},
"decryptMessageNotice": {
"message": "$1 would like to read this message to complete your action",
"description": "$1 is website or dapp name"
},
"decryptMetamask": {
"message": "Decrypt message"
},
"decryptCopy": {
"message": "Copy encrypted message"
},
"decryptInlineError": {
"message": "This message cannot be decrypted due to error: $1",
"description": "$1 is error message"
},
"provide": {
"message": "Provide"
},
"encryptionPublicKeyRequest": {
"message": "Request encryption public key"
},
"encryptionPublicKeyNotice": {
"message": "$1 would like your public encryption key. By consenting, this site will be able to compose encrypted messages to you.",
"description": "$1 is website or dapp name"
}
}
42 changes: 41 additions & 1 deletion app/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
"customRPC": {
"message": "Пользовательский RPC"
},
"dataBackupFoundInfo": {
"message": "Некоторые данные вашей учетной записи были экспортированы во время предыдущей установки MetaMask. Это может включать ваши настройки, контакты и токены. Вы хотите импортировать эти данные сейчас?"
},
"decimalsMustZerotoTen": {
"message": "Количество десятичных разрядов должно быть минимум 0 и максимум 36."
},
Expand Down Expand Up @@ -962,8 +965,11 @@
"noConversionRateAvailable": {
"message": "Курсы валют недоступны"
},
"noThanks": {
"message": "Нет, спасибо"
},
"notEnoughGas": {
"message": "Нехватает газа"
"message": "Не хватает газа"
},
"noWebcamFoundTitle": {
"message": "Веб-камера не найдена"
Expand Down Expand Up @@ -1046,6 +1052,10 @@
"restoreAccountWithSeed": {
"message": "Восстановите свой аккаунт с помощью секретной фразы"
},
"restoreWalletPreferences": {
"message": "Были найдены данные экспортированные от $1. Вы желаете восстановить настройки вашего кошелька?",
"description": "$1 is the date at which the data was backed up"
},
"requestsAwaitingAcknowledgement": {
"message": "запросы, ожидающие подтверждения"
},
Expand Down Expand Up @@ -1339,5 +1349,35 @@
},
"yourPrivateSeedPhrase": {
"message": "Ваша сид-фраза"
},
"decryptRequest": {
"message": "Запрос расшифровки"
},
"decrypt": {
"message": "Расшифровать"
},
"decryptMessageNotice": {
"message": "Для $1 необходимо прочитать это сообщение, чтобы завершить Ваше действие",
"description": "$1 is website or dapp name"
},
"decryptMetamask": {
"message": "Расшифровать сообщение"
},
"decryptCopy": {
"message": "Скопировать расшифрованное сообщение"
},
"decryptInlineError": {
"message": "Это сообщение не может быть дешифровано из-за ошибки: $1",
"description": "$1 is error message"
},
"provide": {
"message": "Предоставить"
},
"encryptionPublicKeyRequest": {
"message": "Запрос публичного ключа шифрования"
},
"encryptionPublicKeyNotice": {
"message": "$1 запрашивает ваш открытый ключ шифрования. По согласованию, этот сайт сможет создавать для Вас зашифрованные сообщения.",
"description": "$1 is website or dapp name"
}
}
15 changes: 12 additions & 3 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ initialize().catch(log.error)
* @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} EncryptionPublicKeyMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedEncryptionPublicKeyMsgCount - The number of messages in EncryptionPublicKeyMsgs.
* @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.
logvik marked this conversation as resolved.
Show resolved Hide resolved
* @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 @@ -413,6 +417,8 @@ 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.encryptionPublicKeyManager.on('updateBadge', updateBadge)
controller.typedMessageManager.on('updateBadge', updateBadge)
controller.permissionsController.permissions.subscribe(updateBadge)

Expand All @@ -424,10 +430,13 @@ 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 unapprovedEncryptionPublicKeyMsgCount = controller.encryptionPublicKeyManager.unapprovedEncryptionPublicKeyMsgCount
const unapprovedTypedMessagesCount = controller.typedMessageManager.unapprovedTypedMessagesCount
const pendingPermissionRequests = Object.keys(controller.permissionsController.permissions.state.permissionsRequests).length
const count = unapprovedTxCount + unapprovedMsgCount + unapprovedPersonalMsgs + unapprovedTypedMsgs + pendingPermissionRequests
const count = unapprovedTxCount + unapprovedMsgCount + unapprovedPersonalMsgCount + unapprovedDecryptMsgCount + unapprovedEncryptionPublicKeyMsgCount +
unapprovedTypedMessagesCount + pendingPermissionRequests
if (count) {
label = String(count)
}
Expand Down
4 changes: 4 additions & 0 deletions app/scripts/controllers/network/createMetamaskMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ function createMetamaskMiddleware ({
processTypedMessageV3,
processTypedMessageV4,
processPersonalMessage,
processDecryptMessage,
processEncryptionPublicKey,
getPendingNonce,
getPendingTransactionByHash,
}) {
Expand All @@ -31,6 +33,8 @@ function createMetamaskMiddleware ({
processTypedMessageV3,
processTypedMessageV4,
processPersonalMessage,
processDecryptMessage,
processEncryptionPublicKey,
}),
createPendingNonceMiddleware({ getPendingNonce }),
createPendingTxMiddleware({ getPendingTransactionByHash }),
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/controllers/permissions/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ export const SAFE_METHODS = [
'eth_uninstallFilter',
'metamask_watchAsset',
'wallet_watchAsset',
'eth_getEncryptionPublicKey',
'eth_decrypt',
]
Loading