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

feat: re-prompt for keychain access [wip] #1220

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion public/locales/af/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Kritieke fout",
"day": "Dag",
"disconnect": "Ontkoppel",
"dismiss": "Dismiss",
"hashrate": "Hashtempo",
"installation-problem": "Installasieprobleem",
"max-temperature": "Maksimum temperatuur",
Expand All @@ -28,5 +29,6 @@
"utilization": "Benutting",
"version": "Weergawe",
"versions": "Weergawes",
"webgl-not-supported": "WebGL word nie ondersteun nie. Visuele modus gedeaktiveer."
"webgl-not-supported": "WebGL word nie ondersteun nie. Visuele modus gedeaktiveer.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/af/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/cn/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "严重错误",
"day": "天",
"disconnect": "断开连接",
"dismiss": "Dismiss",
"hashrate": "哈希率",
"installation-problem": "安装问题",
"max-temperature": "最高温度",
Expand All @@ -28,5 +29,6 @@
"utilization": "利用率",
"version": "版本",
"versions": "版本",
"webgl-not-supported": "不支持 WebGL。已禁用视觉模式。"
"webgl-not-supported": "不支持 WebGL。已禁用视觉模式。",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/cn/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Kritischer Fehler",
"day": "Tag",
"disconnect": "Trennen",
"dismiss": "Dismiss",
"hashrate": "Hashrate",
"installation-problem": "Installationsproblem",
"max-temperature": "Maximaltemperatur",
Expand All @@ -28,5 +29,6 @@
"utilization": "Auslastung",
"version": "Version",
"versions": "Versionen",
"webgl-not-supported": "WebGL wird nicht unterstützt. Visueller Modus deaktiviert."
"webgl-not-supported": "WebGL wird nicht unterstützt. Visueller Modus deaktiviert.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/de/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Critical error",
"day": "Day",
"disconnect": "Disconnect",
"dismiss": "Dismiss",
"hashrate": "Hashrate",
"installation-problem": "Installation problem",
"max-temperature": "Max temperature",
Expand All @@ -28,5 +29,6 @@
"utilization": "Utilization",
"version": "Version",
"versions": "Versions",
"webgl-not-supported": "WebGL not supported. Disabled visual mode."
"webgl-not-supported": "WebGL not supported. Disabled visual mode.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/en/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Erreur critique",
"day": "Jour",
"disconnect": "Déconnecter",
"dismiss": "Dismiss",
"hashrate": "Taux de hachage",
"installation-problem": "Problème d\"installation",
"max-temperature": "Température maximale",
Expand All @@ -28,5 +29,6 @@
"utilization": "Utilisation",
"version": "Version",
"versions": "Versions",
"webgl-not-supported": "WebGL non pris en charge. Mode visuel désactivé."
"webgl-not-supported": "WebGL non pris en charge. Mode visuel désactivé.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/fr/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "गंभीर त्रुटि",
"day": "दिन",
"disconnect": "डिस्कनेक्ट करें",
"dismiss": "Dismiss",
"hashrate": "हैश दर",
"installation-problem": "स्थापना समस्या",
"max-temperature": "अधिकतम तापमान",
Expand All @@ -28,5 +29,6 @@
"utilization": "उपयोग",
"version": "संस्करण",
"versions": "संस्करण",
"webgl-not-supported": "WebGL समर्थित नहीं है। दृश्य मोड अक्षम किया गया।"
"webgl-not-supported": "WebGL समर्थित नहीं है। दृश्य मोड अक्षम किया गया।",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/hi/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/id/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Kesalahan kritis",
"day": "Hari",
"disconnect": "Putuskan Koneksi",
"dismiss": "Dismiss",
"hashrate": "Hashrate",
"installation-problem": "Masalah instalasi",
"max-temperature": "Suhu maksimum",
Expand All @@ -28,5 +29,6 @@
"utilization": "Pemanfaatan",
"version": "Versi",
"versions": "Versi",
"webgl-not-supported": "WebGL tidak didukung. Mode visual dinonaktifkan."
"webgl-not-supported": "WebGL tidak didukung. Mode visual dinonaktifkan.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/id/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/ja/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "重大なエラー",
"day": "日",
"disconnect": "切断",
"dismiss": "Dismiss",
"hashrate": "ハッシュレート",
"installation-problem": "インストールの問題",
"max-temperature": "最大温度",
Expand All @@ -28,5 +29,6 @@
"utilization": "利用率",
"version": "バージョン",
"versions": "バージョン",
"webgl-not-supported": "WebGLがサポートされていません。ビジュアルモードが無効になりました。"
"webgl-not-supported": "WebGLがサポートされていません。ビジュアルモードが無効になりました。",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/ja/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/ko/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "치명적 오류",
"day": "일",
"disconnect": "연결 해제",
"dismiss": "Dismiss",
"hashrate": "해시레이트",
"installation-problem": "설치 문제",
"max-temperature": "최대 온도",
Expand All @@ -28,5 +29,6 @@
"utilization": "활용도",
"version": "버전",
"versions": "버전",
"webgl-not-supported": "WebGL이 지원되지 않습니다. 시각 모드가 비활성화되었습니다."
"webgl-not-supported": "WebGL이 지원되지 않습니다. 시각 모드가 비활성화되었습니다.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/ko/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/pl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Krytyczny błąd",
"day": "Dzień",
"disconnect": "Odłącz",
"dismiss": "Dismiss",
"hashrate": "Prędkość ( hashrate )",
"installation-problem": "Problem z instalacją",
"max-temperature": "Maksymalna temperatura",
Expand All @@ -28,5 +29,6 @@
"utilization": "Wykorzystanie",
"version": "Wersja",
"versions": "Wersje",
"webgl-not-supported": "WebGL nie jest obsługiwany. Tryb wizualny wyłączony."
"webgl-not-supported": "WebGL nie jest obsługiwany. Tryb wizualny wyłączony.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/pl/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/ru/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Критическая ошибка",
"day": "День",
"disconnect": "Отключить",
"dismiss": "Dismiss",
"hashrate": "Хэшрейт",
"installation-problem": "Проблема с установкой",
"max-temperature": "Максимальная температура",
Expand All @@ -28,5 +29,6 @@
"utilization": "Использование",
"version": "Версия",
"versions": "Версии",
"webgl-not-supported": "WebGL не поддерживается. Визуальный режим отключен."
"webgl-not-supported": "WebGL не поддерживается. Визуальный режим отключен.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/ru/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
4 changes: 3 additions & 1 deletion public/locales/tr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"critical-error": "Kritik Hata",
"day": "Gün",
"disconnect": "Bağlantıyı Kes",
"dismiss": "Dismiss",
"hashrate": "Hashrate",
"installation-problem": "Kurulum sorunu",
"max-temperature": "Maks. Sıcaklık",
Expand All @@ -28,5 +29,6 @@
"utilization": "Fayda",
"version": "Versiyon",
"versions": "Versiyon",
"webgl-not-supported": "WebGL desteklenmiyor. Görsel mod devre dışı bırakıldı."
"webgl-not-supported": "WebGL desteklenmiyor. Görsel mod devre dışı bırakıldı.",
"yes": "Yes"
}
4 changes: 4 additions & 0 deletions public/locales/tr/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"keychain-access": "Keychain Access",
"keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to <span>move them to the keychain?</span>"
}
13 changes: 12 additions & 1 deletion src-tauri/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::credential_manager::{Credential, KEYRING_ACCESSED};
use crate::credential_manager::{Credential, KEYRING_ACCESSED, USING_FALLBACK};
use std::{path::PathBuf, time::SystemTime};
use sys_locale::get_locale;

Expand Down Expand Up @@ -98,6 +98,8 @@ pub struct AppConfigFromFile {
auto_update: bool,
#[serde(default = "default_false")]
keyring_accessed: bool,
#[serde(default = "default_false")]
keyring_fallback: bool,
#[serde(default = "default_true")]
custom_power_levels_enabled: bool,
#[serde(default = "default_true")]
Expand Down Expand Up @@ -145,6 +147,7 @@ impl Default for AppConfigFromFile {
mmproxy_monero_nodes: vec!["https://xmr-01.tari.com".to_string()],
mmproxy_use_monero_fail: false,
keyring_accessed: false,
keyring_fallback: false,
auto_update: true,
reset_earnings: false,
custom_power_levels_enabled: true,
Expand Down Expand Up @@ -260,6 +263,7 @@ pub(crate) struct AppConfig {
custom_max_gpu_usage: Vec<GpuThreads>,
auto_update: bool,
keyring_accessed: bool,
keyring_fallback: bool,
custom_power_levels_enabled: bool,
sharing_enabled: bool,
visual_mode: bool,
Expand Down Expand Up @@ -310,6 +314,7 @@ impl AppConfig {
window_settings: default_window_settings(),
show_experimental_settings: false,
keyring_accessed: false,
keyring_fallback: false,
p2pool_stats_server_port: default_p2pool_stats_server_port(),
pre_release: false,
}
Expand Down Expand Up @@ -394,6 +399,11 @@ impl AppConfig {
config.keyring_accessed,
std::sync::atomic::Ordering::Relaxed,
);

USING_FALLBACK.store(
config.keyring_fallback,
std::sync::atomic::Ordering::Relaxed,
);
}
Err(e) => {
warn!(target: LOG_TARGET, "Failed to parse app config: {}", e.to_string());
Expand Down Expand Up @@ -783,6 +793,7 @@ impl AppConfig {
mmproxy_monero_nodes: self.mmproxy_monero_nodes.clone(),
mmproxy_use_monero_fail: self.mmproxy_use_monero_fail,
keyring_accessed: KEYRING_ACCESSED.load(std::sync::atomic::Ordering::Relaxed),
keyring_fallback: USING_FALLBACK.load(std::sync::atomic::Ordering::Relaxed),
auto_update: self.auto_update,
custom_power_levels_enabled: self.custom_power_levels_enabled,
sharing_enabled: self.sharing_enabled,
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/src/credential_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const KEYCHAIN_USERNAME_LEGACY: &str = "internal_wallet";
const KEYCHAIN_USERNAME: &str = "inner_wallet_credentials";

pub static KEYRING_ACCESSED: AtomicBool = AtomicBool::new(false);
pub static USING_FALLBACK: AtomicBool = AtomicBool::new(false);

pub struct CredentialManager {
service_name: String,
Expand Down Expand Up @@ -130,7 +131,11 @@ impl CredentialManager {
}

fn use_fallback(&self) -> bool {
self.fallback_mode.load(Ordering::SeqCst) || self.fallback_file().exists()
let use_fallback =
self.fallback_mode.load(Ordering::SeqCst) || self.fallback_file().exists();
USING_FALLBACK.store(use_fallback, Ordering::SeqCst);

use_fallback
}

fn set_fallback_mode(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/buttons/button.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ThemeColourGroup } from '@app/theme/palettes/colors.ts';

export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'gradient';
export type ButtonSize = 'xs' | 'small' | 'medium' | 'large';
export type ButtonColor = 'transparent' | 'primary' | 'secondary' | 'gradient' | 'error' | 'warning' | 'info';
export type ButtonColor = 'transparent' | 'error' | 'warning' | 'info' | ThemeColourGroup;

export type IconPosition = 'end' | 'start' | 'hug';

Expand Down
13 changes: 11 additions & 2 deletions src/components/elements/styled.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createElement, CSSProperties, ReactNode } from 'react';

import styled from 'styled-components';
import styled, { css } from 'styled-components';
import { TagVariants } from '@app/components/elements/Typography.tsx';

interface TypographyProps {
Expand All @@ -13,11 +13,20 @@ export const DynamicTypography = styled(({ variant = 'span', children, ...props
createElement(variant, props, children)
)`
font-family: ${({ fontFamily }) => fontFamily};
font-size: ${({ theme, variant }) => (variant === 'span' ? 'inherit' : theme.typography[variant].fontSize)};
font-size: ${({ theme, variant }) => theme.typography[variant].fontSize};
line-height: ${({ theme, variant }) => theme.typography[variant].lineHeight};
letter-spacing: ${({ theme, variant }) => theme.typography[variant].letterSpacing};
font-weight: ${({ theme, variant }) => theme.typography[variant].fontWeight || 'inherit'};
margin: 0;
color: inherit;
text-align: inherit;

${({ variant }) =>
variant === 'span' &&
css`
font-size: inherit;
line-height: inherit;
letter-spacing: inherit;
font-weight: inherit;
`}
`;
Loading
Loading