fix key import

This commit is contained in:
Nicolas Cantu 2026-01-06 01:14:49 +01:00
parent a4a39fd0ba
commit 27cb1a7b5b
5 changed files with 30 additions and 4 deletions

View File

@ -1,13 +1,27 @@
import Link from 'next/link' import Link from 'next/link'
import { useNostrAuth } from '@/hooks/useNostrAuth' import { useNostrAuth } from '@/hooks/useNostrAuth'
import { t } from '@/lib/i18n'
export function KeyIndicator() { export function KeyIndicator() {
const { pubkey, isUnlocked } = useNostrAuth() const { pubkey, isUnlocked } = useNostrAuth()
// Red if private key is accessible (unlocked) // Determine color and title based on key status
// Green if only public key is accessible (connected but not unlocked) let color: string
const color = isUnlocked ? 'text-red-500' : 'text-green-500' let title: string
const title = isUnlocked ? 'Private key accessible (Settings)' : pubkey ? 'Public key accessible (Settings)' : 'Settings'
if (!pubkey) {
// Gray if no key is available - allows importing a key
color = 'text-gray-500'
title = t('settings.keyManagement.import.title')
} else if (isUnlocked) {
// Red if private key is accessible (unlocked)
color = 'text-red-500'
title = t('settings.keyManagement.status.privateKey')
} else {
// Green if only public key is accessible (connected but not unlocked)
color = 'text-green-500'
title = t('settings.keyManagement.status.publicKey')
}
return ( return (
<Link <Link

View File

@ -138,8 +138,11 @@ settings.keyManagement.copy=Copy
settings.keyManagement.copied=✓ Copied settings.keyManagement.copied=✓ Copied
settings.keyManagement.noAccount.title=No account found settings.keyManagement.noAccount.title=No account found
settings.keyManagement.noAccount.description=Create a new account by importing a private key. The key will be encrypted using a two-level encryption system. settings.keyManagement.noAccount.description=Create a new account by importing a private key. The key will be encrypted using a two-level encryption system.
settings.keyManagement.import.title=Import key (Settings)
settings.keyManagement.import.button.new=Import Private Key settings.keyManagement.import.button.new=Import Private Key
settings.keyManagement.import.button.replace=Replace Account (Import New Key) settings.keyManagement.import.button.replace=Replace Account (Import New Key)
settings.keyManagement.status.privateKey=Private key accessible (Settings)
settings.keyManagement.status.publicKey=Public key accessible (Settings)
settings.keyManagement.import.warning.title=⚠️ Important settings.keyManagement.import.warning.title=⚠️ Important
settings.keyManagement.import.warning.description=After importing, you will receive <strong>4 recovery words</strong> (BIP39 dictionary) to secure your account. These words encrypt a Key Encryption Key (KEK) stored in the browser's Credentials API, which then encrypts your private key stored in IndexedDB (two-level encryption system). settings.keyManagement.import.warning.description=After importing, you will receive <strong>4 recovery words</strong> (BIP39 dictionary) to secure your account. These words encrypt a Key Encryption Key (KEK) stored in the browser's Credentials API, which then encrypts your private key stored in IndexedDB (two-level encryption system).
settings.keyManagement.import.warning.replace=Warning: Importing a new key will replace your existing account. Make sure you have your recovery phrase saved before proceeding. settings.keyManagement.import.warning.replace=Warning: Importing a new key will replace your existing account. Make sure you have your recovery phrase saved before proceeding.

View File

@ -138,8 +138,11 @@ settings.keyManagement.copy=Copier
settings.keyManagement.copied=✓ Copié settings.keyManagement.copied=✓ Copié
settings.keyManagement.noAccount.title=Aucun compte trouvé settings.keyManagement.noAccount.title=Aucun compte trouvé
settings.keyManagement.noAccount.description=Créez un nouveau compte en important une clé privée. La clé sera chiffrée à l'aide d'un système de chiffrement à deux niveaux. settings.keyManagement.noAccount.description=Créez un nouveau compte en important une clé privée. La clé sera chiffrée à l'aide d'un système de chiffrement à deux niveaux.
settings.keyManagement.import.title=Importer une clé (Paramètres)
settings.keyManagement.import.button.new=Importer une clé privée settings.keyManagement.import.button.new=Importer une clé privée
settings.keyManagement.import.button.replace=Remplacer le compte (Importer une nouvelle clé) settings.keyManagement.import.button.replace=Remplacer le compte (Importer une nouvelle clé)
settings.keyManagement.status.privateKey=Clé privée accessible (Paramètres)
settings.keyManagement.status.publicKey=Clé publique accessible (Paramètres)
settings.keyManagement.import.warning.title=⚠️ Important settings.keyManagement.import.warning.title=⚠️ Important
settings.keyManagement.import.warning.description=Après l'import, vous recevrez <strong>4 mots de récupération</strong> (dictionnaire BIP39) pour sécuriser votre compte. Ces mots chiffrent une clé de chiffrement (KEK) stockée dans l'API Credentials du navigateur, qui chiffre ensuite votre clé privée stockée dans IndexedDB (système de chiffrement à deux niveaux). settings.keyManagement.import.warning.description=Après l'import, vous recevrez <strong>4 mots de récupération</strong> (dictionnaire BIP39) pour sécuriser votre compte. Ces mots chiffrent une clé de chiffrement (KEK) stockée dans l'API Credentials du navigateur, qui chiffre ensuite votre clé privée stockée dans IndexedDB (système de chiffrement à deux niveaux).
settings.keyManagement.import.warning.replace=Avertissement : L'importation d'une nouvelle clé remplacera votre compte existant. Assurez-vous d'avoir sauvegardé votre phrase de récupération avant de continuer. settings.keyManagement.import.warning.replace=Avertissement : L'importation d'une nouvelle clé remplacera votre compte existant. Assurez-vous d'avoir sauvegardé votre phrase de récupération avant de continuer.

View File

@ -139,8 +139,11 @@ settings.keyManagement.copy=Copy
settings.keyManagement.copied=✓ Copied settings.keyManagement.copied=✓ Copied
settings.keyManagement.noAccount.title=No account found settings.keyManagement.noAccount.title=No account found
settings.keyManagement.noAccount.description=Create a new account by importing a private key. The key will be encrypted using a two-level encryption system. settings.keyManagement.noAccount.description=Create a new account by importing a private key. The key will be encrypted using a two-level encryption system.
settings.keyManagement.import.title=Import key (Settings)
settings.keyManagement.import.button.new=Import Private Key settings.keyManagement.import.button.new=Import Private Key
settings.keyManagement.import.button.replace=Replace Account (Import New Key) settings.keyManagement.import.button.replace=Replace Account (Import New Key)
settings.keyManagement.status.privateKey=Private key accessible (Settings)
settings.keyManagement.status.publicKey=Public key accessible (Settings)
settings.keyManagement.import.warning.title=⚠️ Important settings.keyManagement.import.warning.title=⚠️ Important
settings.keyManagement.import.warning.description=After importing, you will receive <strong>4 recovery words</strong> (BIP39 dictionary) to secure your account. These words encrypt a Key Encryption Key (KEK) stored in the browser's Credentials API, which then encrypts your private key stored in IndexedDB (two-level encryption system). settings.keyManagement.import.warning.description=After importing, you will receive <strong>4 recovery words</strong> (BIP39 dictionary) to secure your account. These words encrypt a Key Encryption Key (KEK) stored in the browser's Credentials API, which then encrypts your private key stored in IndexedDB (two-level encryption system).
settings.keyManagement.import.warning.replace=Warning: Importing a new key will replace your existing account. Make sure you have your recovery phrase saved before proceeding. settings.keyManagement.import.warning.replace=Warning: Importing a new key will replace your existing account. Make sure you have your recovery phrase saved before proceeding.

View File

@ -139,8 +139,11 @@ settings.keyManagement.copy=Copier
settings.keyManagement.copied=✓ Copié settings.keyManagement.copied=✓ Copié
settings.keyManagement.noAccount.title=Aucun compte trouvé settings.keyManagement.noAccount.title=Aucun compte trouvé
settings.keyManagement.noAccount.description=Créez un nouveau compte en important une clé privée. La clé sera chiffrée à l'aide d'un système de chiffrement à deux niveaux. settings.keyManagement.noAccount.description=Créez un nouveau compte en important une clé privée. La clé sera chiffrée à l'aide d'un système de chiffrement à deux niveaux.
settings.keyManagement.import.title=Importer une clé (Paramètres)
settings.keyManagement.import.button.new=Importer une clé privée settings.keyManagement.import.button.new=Importer une clé privée
settings.keyManagement.import.button.replace=Remplacer le compte (Importer une nouvelle clé) settings.keyManagement.import.button.replace=Remplacer le compte (Importer une nouvelle clé)
settings.keyManagement.status.privateKey=Clé privée accessible (Paramètres)
settings.keyManagement.status.publicKey=Clé publique accessible (Paramètres)
settings.keyManagement.import.warning.title=⚠️ Important settings.keyManagement.import.warning.title=⚠️ Important
settings.keyManagement.import.warning.description=Après l'import, vous recevrez <strong>4 mots de récupération</strong> (dictionnaire BIP39) pour sécuriser votre compte. Ces mots chiffrent une clé de chiffrement (KEK) stockée dans l'API Credentials du navigateur, qui chiffre ensuite votre clé privée stockée dans IndexedDB (système de chiffrement à deux niveaux). settings.keyManagement.import.warning.description=Après l'import, vous recevrez <strong>4 mots de récupération</strong> (dictionnaire BIP39) pour sécuriser votre compte. Ces mots chiffrent une clé de chiffrement (KEK) stockée dans l'API Credentials du navigateur, qui chiffre ensuite votre clé privée stockée dans IndexedDB (système de chiffrement à deux niveaux).
settings.keyManagement.import.warning.replace=Avertissement : L'importation d'une nouvelle clé remplacera votre compte existant. Assurez-vous d'avoir sauvegardé votre phrase de récupération avant de continuer. settings.keyManagement.import.warning.replace=Avertissement : L'importation d'une nouvelle clé remplacera votre compte existant. Assurez-vous d'avoir sauvegardé votre phrase de récupération avant de continuer.