aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-10-11 02:52:26 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-11-06 07:07:09 +0800
commit226601a956594d00817cdb1fa5214242aae7936c (patch)
treeca3b8a64b685599ef8ef26d4bf3396170949d122 /app
parentbfcb73ad533b7c2acea012a586c2a391811faf03 (diff)
downloadtangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.gz
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.bz2
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.lz
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.xz
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.zst
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.zip
EIP-1102: add user privacy option
Diffstat (limited to 'app')
-rw-r--r--app/_locales/cs/messages.json6
-rw-r--r--app/_locales/de/messages.json6
-rw-r--r--app/_locales/en/messages.json12
-rw-r--r--app/_locales/es/messages.json6
-rw-r--r--app/_locales/fr/messages.json12
-rw-r--r--app/_locales/hn/messages.json6
-rw-r--r--app/_locales/ht/messages.json39
-rw-r--r--app/_locales/it/messages.json6
-rw-r--r--app/_locales/ja/messages.json6
-rw-r--r--app/_locales/ko/messages.json6
-rw-r--r--app/_locales/nl/messages.json6
-rw-r--r--app/_locales/ph/messages.json6
-rw-r--r--app/_locales/pt/messages.json6
-rw-r--r--app/_locales/ru/messages.json6
-rw-r--r--app/_locales/th/messages.json6
-rw-r--r--app/_locales/tml/messages.json6
-rw-r--r--app/_locales/tr/messages.json6
-rw-r--r--app/_locales/vi/messages.json6
-rw-r--r--app/_locales/zh_CN/messages.json6
-rw-r--r--app/_locales/zh_TW/messages.json6
-rw-r--r--app/scripts/contentscript.js27
-rw-r--r--app/scripts/controllers/provider-approval.js41
-rw-r--r--app/scripts/inpage.js4
-rw-r--r--app/scripts/metamask-controller.js4
24 files changed, 188 insertions, 53 deletions
diff --git a/app/_locales/cs/messages.json b/app/_locales/cs/messages.json
index caae14b5d..fde553c9e 100644
--- a/app/_locales/cs/messages.json
+++ b/app/_locales/cs/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Režim súkromia"
+ },
+ "privacyModeDescription": {
+ "message": "Webové stránky musia požiadať o prístup k zobrazeniu informácií o vašom účte."
+ },
"exposeAccounts": {
"message": "Vystavte účty"
},
diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json
index 00ef2cc23..9404a9824 100644
--- a/app/_locales/de/messages.json
+++ b/app/_locales/de/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Datenschutzmodus"
+ },
+ "privacyModeDescription": {
+ "message": "Websites müssen Zugriff anfordern, um Ihre Kontoinformationen anzuzeigen."
+ },
"exposeAccounts": {
"message": "Expose Konten"
},
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json
index de5d71758..f34a22bd5 100644
--- a/app/_locales/en/messages.json
+++ b/app/_locales/en/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Privacy Mode"
+ },
+ "privacyModeDescription": {
+ "message": "Websites must request access to view your account information."
+ },
"exposeAccounts": {
"message": "Expose Accounts"
},
@@ -15,13 +21,13 @@
"message": "Approved website data cleared successfully."
},
"approvalData": {
- "message": "Approval Data"
+ "message": "Privacy Data"
},
"approvalDataDescription": {
- "message": "Clear approved website data so all sites must request approval again."
+ "message": "Clear privacy data so all websites must request access to view account information again."
},
"clearApprovalData": {
- "message": "Clear Approval Data"
+ "message": "Clear Privacy Data"
},
"reject": {
"message": "Reject"
diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json
index 01cd2bf94..55276e1ec 100644
--- a/app/_locales/es/messages.json
+++ b/app/_locales/es/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Modo privado"
+ },
+ "privacyModeDescription": {
+ "message": "Los sitios web deben solicitar acceso para ver la información de su cuenta."
+ },
"exposeAccounts": {
"message": "Exponer cuentas"
},
diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json
index 474df09af..17306d0f2 100644
--- a/app/_locales/fr/messages.json
+++ b/app/_locales/fr/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Les sites Web doivent demander un accès pour afficher les informations de votre compte."
+ },
+ "privacyModeDescription": {
+ "message": "Les sites Web doivent demander un accès pour afficher les informations de votre compte."
+ },
"exposeAccounts": {
"message": "Exposer les comptes"
},
@@ -23,12 +29,6 @@
"clearApprovalData": {
"message": "Effacer les données d'approbation"
},
- "approve": {
- "message": "Approuver"
- },
- "reject": {
- "message": "Rejeter"
- },
"providerAPIRequest": {
"message": "Demande d'API Web3"
},
diff --git a/app/_locales/hn/messages.json b/app/_locales/hn/messages.json
index ff60e4951..8e2281418 100644
--- a/app/_locales/hn/messages.json
+++ b/app/_locales/hn/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "गोपनीयता मोड"
+ },
+ "privacyModeDescription": {
+ "message": "वेबसाइटों को आपकी खाता जानकारी देखने के लिए पहुंच का अनुरोध करना होगा।"
+ },
"exposeAccounts": {
"message": "खातों का पर्दाफाश करें"
},
diff --git a/app/_locales/ht/messages.json b/app/_locales/ht/messages.json
index 81ce18018..ff44af903 100644
--- a/app/_locales/ht/messages.json
+++ b/app/_locales/ht/messages.json
@@ -1,4 +1,43 @@
{
+ "privacyMode": {
+ "message": "Mòd Privacy"
+ },
+ "privacyModeDescription": {
+ "message": "Sou sit entènèt yo dwe mande aksè pou wè enfòmasyon kont ou."
+ },
+ "exposeAccounts": {
+ "message": "Ekspoze Kont"
+ },
+ "exposeDescription": {
+ "message": "Ekspoze kont sou sitwèb aktyèl la. Itil pou dapps eritaj."
+ },
+ "confirmExpose": {
+ "message": "Èske ou sèten ou vle ekspoze kont ou sou sit entènèt aktyèl la?"
+ },
+ "confirmClear": {
+ "message": "Èske ou sèten ou vle klè sitwèb apwouve?"
+ },
+ "clearApprovalDataSuccess": {
+ "message": "Done sou sit wèb apwouve yo te klarifye avèk siksè."
+ },
+ "approvalData": {
+ "message": "Done sou vi prive"
+ },
+ "approvalDataDescription": {
+ "message": "Done sou vi prive klè pou tout sit entènèt yo dwe mande aksè pou wè enfòmasyon kont ankò."
+ },
+ "clearApprovalData": {
+ "message": "Klè Done sou vi prive"
+ },
+ "providerAPIRequest": {
+ "message": "Ethereum API Mande"
+ },
+ "reviewProviderRequest": {
+ "message": "Tanpri revize sa API demann Ethereum."
+ },
+ "providerRequestInfo": {
+ "message": "Domèn ki nan lis anba a ap mande pou jwenn aksè a blòkchou Ethereum ak pou wè kont ou ye kounye a. Toujou double tcheke ke ou sou sit ki kòrèk la anvan apwouve aksè."
+ },
"accept": {
"message": "Aksepte"
},
diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json
index 2bd1c9c7a..83ecf0e85 100644
--- a/app/_locales/it/messages.json
+++ b/app/_locales/it/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Modalità di privacy"
+ },
+ "privacyModeDescription": {
+ "message": "I siti Web devono richiedere l'accesso per visualizzare le informazioni del tuo account."
+ },
"exposeAccounts": {
"message": "Expose Accounts"
},
diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json
index 4700ff722..8ae363030 100644
--- a/app/_locales/ja/messages.json
+++ b/app/_locales/ja/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "プライバシーモード"
+ },
+ "privacyModeDescription": {
+ "message": "ウェブサイトはあなたのアカウント情報を閲覧するためのアクセスを要求する必要があります。"
+ },
"exposeAccounts": {
"message": "アカウントを公開する"
},
diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json
index 05ea020ae..b41a3326f 100644
--- a/app/_locales/ko/messages.json
+++ b/app/_locales/ko/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "개인 정보 보호 모드"
+ },
+ "privacyModeDescription": {
+ "message": "웹 사이트는 계정 정보를 볼 수있는 액세스 권한을 요청해야합니다."
+ },
"exposeAccounts": {
"message": "계정 노출"
},
diff --git a/app/_locales/nl/messages.json b/app/_locales/nl/messages.json
index 55b6a9e00..5d9f1f3ab 100644
--- a/app/_locales/nl/messages.json
+++ b/app/_locales/nl/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Privacy-modus"
+ },
+ "privacyModeDescription": {
+ "message": "Websites moeten toegang vragen om uw accountgegevens te bekijken."
+ },
"exposeAccounts": {
"message": "Expose Accounts"
},
diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json
index 1ae4f1e63..cef686868 100644
--- a/app/_locales/ph/messages.json
+++ b/app/_locales/ph/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Mode ng Privacy"
+ },
+ "privacyModeDescription": {
+ "message": "Dapat humiling ng access ang mga website upang tingnan ang impormasyon ng iyong account."
+ },
"exposeAccounts": {
"message": "Ilantad ang Mga Account"
},
diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json
index c36242c0b..8e07aaef5 100644
--- a/app/_locales/pt/messages.json
+++ b/app/_locales/pt/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Modo de privacidade"
+ },
+ "privacyModeDescription": {
+ "message": "Os sites devem solicitar acesso para visualizar as informações da sua conta."
+ },
"exposeAccounts": {
"message": "Expor contas"
},
diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json
index b657d569e..917b2b615 100644
--- a/app/_locales/ru/messages.json
+++ b/app/_locales/ru/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Режим конфиденциальности"
+ },
+ "privacyModeDescription": {
+ "message": "Веб-сайты должны запрашивать доступ для просмотра информации об учетной записи."
+ },
"exposeAccounts": {
"message": "Открыть счета"
},
diff --git a/app/_locales/th/messages.json b/app/_locales/th/messages.json
index 5bcddaace..7fabe4eac 100644
--- a/app/_locales/th/messages.json
+++ b/app/_locales/th/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "โหมดความเป็นส่วนตัว"
+ },
+ "privacyModeDescription": {
+ "message": "เว็บไซต์ต้องขอเข้าถึงเพื่อดูข้อมูลบัญชีของคุณ"
+ },
"exposeAccounts": {
"message": "เปิดเผยบัญชี"
},
diff --git a/app/_locales/tml/messages.json b/app/_locales/tml/messages.json
index 3037554f2..0643ce205 100644
--- a/app/_locales/tml/messages.json
+++ b/app/_locales/tml/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "தனியுரிமை முறை"
+ },
+ "privacyModeDescription": {
+ "message": "உங்கள் கணக்குத் தகவலை பார்வையிட வலைத்தளங்கள் அணுகலைக் கோர வேண்டும்."
+ },
"exposeAccounts": {
"message": "கணக்குகளை அம்பலப்படுத்துங்கள்"
},
diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json
index 60418b650..1bb149eaa 100644
--- a/app/_locales/tr/messages.json
+++ b/app/_locales/tr/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Gizlilik modu"
+ },
+ "privacyModeDescription": {
+ "message": "Web siteleri, hesap bilgilerinizi görmek için erişim istemek zorundadır."
+ },
"exposeAccounts": {
"message": "Hesapları Açığa Çıkar"
},
diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json
index 67c2da52e..f0837ba98 100644
--- a/app/_locales/vi/messages.json
+++ b/app/_locales/vi/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "Chế độ riêng tư"
+ },
+ "privacyModeDescription": {
+ "message": "Trang web phải yêu cầu quyền truy cập để xem thông tin tài khoản của bạn."
+ },
"exposeAccounts": {
"message": "Hiển thị tài khoản"
},
diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json
index 5fdfe961e..911ddf476 100644
--- a/app/_locales/zh_CN/messages.json
+++ b/app/_locales/zh_CN/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "隐私模式"
+ },
+ "privacyModeDescription": {
+ "message": "网站必须请求访问权限才能查看您的帐户信息。"
+ },
"exposeAccounts": {
"message": "公开账户"
},
diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json
index 6167c2c33..3b048fd91 100644
--- a/app/_locales/zh_TW/messages.json
+++ b/app/_locales/zh_TW/messages.json
@@ -1,4 +1,10 @@
{
+ "privacyMode": {
+ "message": "隱私模式"
+ },
+ "privacyModeDescription": {
+ "message": "網站必須請求訪問權限才能查看您的帳戶信息。"
+ },
"exposeAccounts": {
"message": "公開賬戶"
},
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index b1c1e9a0d..29fa3f5c7 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -24,7 +24,7 @@ if (shouldInjectWeb3()) {
injectScript(inpageBundle)
setupStreams()
listenForProviderRequest()
- checkForcedInjection()
+ checkPrivacyMode()
}
/**
@@ -125,9 +125,9 @@ function listenForProviderRequest () {
origin: source.location.hostname,
})
break
- case 'ETHEREUM_PROVIDER_STATUS':
+ case 'ETHEREUM_QUERY_STATUS':
extension.runtime.sendMessage({
- action: 'provider-status-request',
+ action: 'init-status-request',
origin: source.location.hostname,
})
break
@@ -144,14 +144,7 @@ function listenForProviderRequest () {
case 'reject-provider-request':
injectScript(`window.dispatchEvent(new CustomEvent('ethereumprovider', { detail: { error: 'User rejected provider access' }}))`)
break
- case 'force-injection':
- extension.storage.local.get(['forcedOrigins'], ({ forcedOrigins = [] }) => {
- extension.storage.local.set({ forcedOrigins: [ ...forcedOrigins, window.location.hostname ] }, () => {
- injectScript(`window.location.reload()`)
- })
- })
- break
- case 'provider-status':
+ case 'answer-status-request':
injectScript(`window.dispatchEvent(new CustomEvent('ethereumproviderstatus', { detail: { isEnabled: ${isEnabled}}}))`)
break
}
@@ -159,15 +152,11 @@ function listenForProviderRequest () {
}
/**
- * Checks the current origin to see if it exists in the extension's locally-stored list
- * off user-whitelisted dapp origins. If it is, this origin will be marked as approved,
- * meaning the publicConfig stream will be enabled. This is only meant to ease the transition
- * to 1102 and will be removed in the future.
+ * Checks if MetaMask is currently operating in "privacy mode", meaning
+ * dapps must call ethereum.enable in order to access user accounts
*/
-function checkForcedInjection () {
- extension.storage.local.get(['forcedOrigins'], ({ forcedOrigins = [] }) => {
- originApproved = forcedOrigins.indexOf(window.location.hostname) > -1
- })
+function checkPrivacyMode () {
+ extension.runtime.sendMessage({ action: 'init-privacy-request' })
}
/**
diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js
index 918fc8ad0..a44d2b3ab 100644
--- a/app/scripts/controllers/provider-approval.js
+++ b/app/scripts/controllers/provider-approval.js
@@ -1,5 +1,4 @@
const ObservableStore = require('obs-store')
-const extension = require('extensionizer')
/**
* A controller that services user-approved requests for a full Ethereum provider API
@@ -10,22 +9,25 @@ class ProviderApprovalController {
*
* @param {Object} [config] - Options to configure controller
*/
- constructor ({ closePopup, openPopup, platform, publicConfigStore } = {}) {
+ constructor ({ closePopup, openPopup, platform, preferencesController, publicConfigStore } = {}) {
this.store = new ObservableStore()
this.closePopup = closePopup
this.openPopup = openPopup
this.platform = platform
this.publicConfigStore = publicConfigStore
this.approvedOrigins = {}
+ this.preferencesController = preferencesController
platform && platform.addMessageListener && platform.addMessageListener(({ action, origin }) => {
if (!action) { return }
switch (action) {
case 'init-provider-request':
this.handleProviderRequest(origin)
break
- case 'provider-status-request':
+ case 'init-status-request':
this.handleProviderStatusRequest(origin)
break
+ case 'init-privacy-request':
+ this.handlePrivacyStatusRequest()
}
})
}
@@ -35,9 +37,9 @@ class ProviderApprovalController {
*
* @param {string} origin - Origin of the window requesting full provider access
*/
- async handleProviderRequest (origin) {
+ handleProviderRequest (origin) {
this.store.updateState({ providerRequests: [{ origin }] })
- if (await this.isApproved(origin)) {
+ if (this.isApproved(origin)) {
this.approveProviderRequest(origin)
return
}
@@ -45,13 +47,21 @@ class ProviderApprovalController {
}
/**
- * Called by a tab to detemrine if a full Ethereum provider API is exposed
+ * Called by a tab to determine if a full Ethereum provider API is exposed
*
* @param {string} origin - Origin of the window requesting provider status
*/
async handleProviderStatusRequest (origin) {
- const isEnabled = await this.isApproved(origin)
- this.platform && this.platform.sendMessage({ action: 'provider-status', isEnabled }, { active: true })
+ const isEnabled = this.isApproved(origin)
+ this.platform && this.platform.sendMessage({ action: 'answer-status-request', isEnabled }, { active: true })
+ }
+
+ handlePrivacyStatusRequest () {
+ const privacyMode = this.preferencesController.getFeatureFlags().privacyMode
+ if (!privacyMode) {
+ this.platform && this.platform.sendMessage({ action: 'approve-provider-request' }, { active: true })
+ this.publicConfigStore.emit('update', this.publicConfigStore.getState())
+ }
}
/**
@@ -87,7 +97,6 @@ class ProviderApprovalController {
*/
clearApprovedOrigins () {
this.approvedOrigins = {}
- extension.storage.local.set({ forcedOrigins: [] })
}
/**
@@ -97,18 +106,8 @@ class ProviderApprovalController {
* @returns {boolean} - True if the origin has been approved
*/
isApproved (origin) {
- return new Promise(resolve => {
- extension.storage.local.get(['forcedOrigins'], ({ forcedOrigins = [] }) => {
- resolve(this.approvedOrigins[origin] || forcedOrigins.indexOf(origin) > -1)
- })
- })
- }
-
- /**
- * Called when a user forces the exposure of a full Ethereum provider API
- */
- forceInjection () {
- this.platform.sendMessage({ action: 'force-injection' }, { active: true })
+ const privacyMode = this.preferencesController.getFeatureFlags().privacyMode
+ return !privacyMode || this.approvedOrigins[origin]
}
}
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index c5f4ee4c9..c5cbcc120 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -56,10 +56,10 @@ inpageProvider.isEnabled = function () {
if (typeof detail.error !== 'undefined') {
reject(detail.error)
} else {
- resolve(detail.isEnabled)
+ resolve(!!detail.isEnabled)
}
})
- window.postMessage({ type: 'ETHEREUM_PROVIDER_STATUS' }, '*')
+ window.postMessage({ type: 'ETHEREUM_QUERY_STATUS' }, '*')
})
}
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index d8f8a4602..2265838fb 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -224,6 +224,7 @@ module.exports = class MetamaskController extends EventEmitter {
closePopup: opts.closePopup,
openPopup: opts.openPopup,
platform: opts.platform,
+ preferencesController: this.preferencesController,
publicConfigStore: this.publicConfigStore,
})
@@ -275,7 +276,7 @@ module.exports = class MetamaskController extends EventEmitter {
getAccounts: async ({ origin }) => {
// Expose no accounts if this origin has not been approved, preventing
// account-requring RPC methods from completing successfully
- const isApproved = await this.providerApprovalController.isApproved(origin)
+ const isApproved = this.providerApprovalController.isApproved(origin)
if (origin !== 'MetaMask' && !isApproved) { return [] }
const isUnlocked = this.keyringController.memStore.getState().isUnlocked
const selectedAddress = this.preferencesController.getSelectedAddress()
@@ -455,7 +456,6 @@ module.exports = class MetamaskController extends EventEmitter {
approveProviderRequest: providerApprovalController.approveProviderRequest.bind(providerApprovalController),
clearApprovedOrigins: providerApprovalController.clearApprovedOrigins.bind(providerApprovalController),
rejectProviderRequest: providerApprovalController.rejectProviderRequest.bind(providerApprovalController),
- forceInjection: providerApprovalController.forceInjection.bind(providerApprovalController),
}
}