Skip to content

Commit

Permalink
Implementation encrypt/decrypt feature (MetaMask#7831)
Browse files Browse the repository at this point in the history
Implement `eth_decrypt` and `eth_getEncryptionPublicKey`. This allows decryption backed by the user's private key. The message decryption uses a confirmation flow similar to the messaging signing flow, where the message to be decrypted is also able to be decrypted inline for the user to read directly before confirming.
  • Loading branch information
logvik authored and yqrashawn committed Apr 27, 2020
1 parent b37d8e1 commit 06b94f8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@
"message": "Custom Spend Limit"
},
"dataBackupFoundInfo": {
"message": "Some of your account data was backed up during a previous installation of ConfluxPortal. 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 ConfluxPortal. 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@sentry/browser": "^5.11.1",
"@sentry/integrations": "^5.11.1",
"@yqrashawn/cfx-contract-metadata": "^0.0.7",
"@yqrashawn/cfx-json-rpc-middleware": "^4.4.3",
"@yqrashawn/cfx-json-rpc-middleware": "^4.4.4",
"@yqrashawn/conflux-portal-inpage-provider": "^4.0.8",
"@zxing/library": "^0.8.0",
"abi-decoder": "^1.2.0",
Expand Down
8 changes: 4 additions & 4 deletions ui/app/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,12 +1181,12 @@ export function cancelPersonalMsg (msgData) {

export const cancelMsg = cancelPersonalMsg

export function cancelDecryptMsg (msgData) {
export function cancelEncryptionPublicKeyMsg (msgData) {
return (dispatch) => {
dispatch(showLoadingIndication())
return new Promise((resolve, reject) => {
const id = msgData.id
background.cancelDecryptMessage(id, (err, newState) => {
background.cancelEncryptionPublicKey(id, (err, newState) => {
dispatch(updateMetamaskState(newState))
dispatch(hideLoadingIndication())

Expand All @@ -1203,12 +1203,12 @@ export function cancelDecryptMsg (msgData) {
}
}

export function cancelEncryptionPublicKeyMsg (msgData) {
export function cancelDecryptMsg (msgData) {
return (dispatch) => {
dispatch(showLoadingIndication())
return new Promise((resolve, reject) => {
const id = msgData.id
background.cancelEncryptionPublicKey(id, (err, newState) => {
background.cancelDecryptMessage(id, (err, newState) => {
dispatch(updateMetamaskState(newState))
dispatch(hideLoadingIndication())

Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2716,10 +2716,10 @@
resolved "https://registry.yarnpkg.com/@yqrashawn/cfx-contract-metadata/-/cfx-contract-metadata-0.0.7.tgz#304472f418c770eb9908304c6dd95a31934dbfd0"
integrity sha512-wVX6iwcoLLS+O5Un0ngint4qO+VKb+zwnUvpWu3LmBIWtexl+YTOMh8G746rkNlKkJyBi2ckQ8GlQo7mEfgumQ==

"@yqrashawn/cfx-json-rpc-middleware@^4.4.3":
version "4.4.3"
resolved "https://registry.yarnpkg.com/@yqrashawn/cfx-json-rpc-middleware/-/cfx-json-rpc-middleware-4.4.3.tgz#4a895eb093d93557544bb67a808ec19de4a23f8a"
integrity sha512-nh4R2EjcSs9pAbgbwORiHhcCqI7A7nA7bpP4UOKqTcucPH/JfiVTWWX2hO5ILumZnWCkP7Vd0Jng7I8lfLqc1A==
"@yqrashawn/cfx-json-rpc-middleware@^4.4.4":
version "4.4.4"
resolved "https://registry.yarnpkg.com/@yqrashawn/cfx-json-rpc-middleware/-/cfx-json-rpc-middleware-4.4.4.tgz#a6a2c3fb1d0fe03067045be74009ab2ac17778d8"
integrity sha512-QqstQrDis4+KeNNg5/aYGemQJx8GHAJAfk7Mpi18fsSdOGaw+XEeKGbyF2diNtmDVdnCj6Diswc8p4QN4DysBg==
dependencies:
btoa "^1.2.1"
clone "^2.1.1"
Expand Down Expand Up @@ -9917,9 +9917,9 @@ eth-json-rpc-middleware@^1.5.0:
tape "^4.6.3"

eth-json-rpc-middleware@^4.1.4, eth-json-rpc-middleware@^4.1.5:
version "4.2.0"
resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-4.2.0.tgz#cfb77c5056cb8001548c6c7d54f4af5fce04d489"
integrity sha512-90LljqRyJhkg7fOwKunh1lu1Mr5bspXMBDitaTGyGPPNiFTbMrhtfbf9fteYlXRFCbq+aIFWwl/X+P7nkrdkLg==
version "4.4.1"
resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-4.4.1.tgz#07d3dd0724c24a8d31e4a172ee96271da71b4228"
integrity sha512-yoSuRgEYYGFdVeZg3poWOwAlRI+MoBIltmOB86MtpoZjvLbou9EB/qWMOWSmH2ryCWLW97VYY6NWsmWm3OAA7A==
dependencies:
btoa "^1.2.1"
clone "^2.1.1"
Expand All @@ -9937,16 +9937,16 @@ eth-json-rpc-middleware@^4.1.4, eth-json-rpc-middleware@^4.1.5:
safe-event-emitter "^1.0.1"

eth-keyring-controller@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-5.3.0.tgz#8d85a67b894360ab7d601222ca71df8ed5f456c6"
integrity sha512-aoqYjKUbdOSgS1s63IsTp69QAMtLPTCqR4VAbCULps71o3yuaA9JRx2W+GAxqVNBtIdyZllxoOJlvErkO4iWNw==
version "5.5.0"
resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-5.5.0.tgz#f8b78f69a0b0005873af2d1a6b2c655d6de51351"
integrity sha512-kWaukiHLMYNYtB/1vZyj1r1G6wU8u+DIYVMq8QUyFAxwcBnemsKISVPIXgltgXkuUiB/t9oXsA54bWBredgrVg==
dependencies:
bip39 "^2.4.0"
bluebird "^3.5.0"
browser-passworder "^2.0.3"
eth-hd-keyring "^3.4.0"
eth-hd-keyring "^3.5.0"
eth-sig-util "^1.4.0"
eth-simple-keyring "^3.4.0"
eth-simple-keyring "^3.5.0"
ethereumjs-util "^5.1.2"
loglevel "^1.5.0"
obs-store "^4.0.3"
Expand Down

0 comments on commit 06b94f8

Please sign in to comment.