From 185909c50d25a6ff486cdbf2f7536973dd9e1b9e Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Tue, 24 May 2022 15:28:36 -0700 Subject: [PATCH] Localize encrypted chat --- frontend/src/components/Dialogs/AuditPGP.tsx | 125 +++++++------------ frontend/src/components/EncryptedChat.js | 92 +------------- frontend/src/locales/en.json | 29 ++++- frontend/src/locales/es.json | 22 +++- 4 files changed, 91 insertions(+), 177 deletions(-) diff --git a/frontend/src/components/Dialogs/AuditPGP.tsx b/frontend/src/components/Dialogs/AuditPGP.tsx index 75f7a721..3c5cf31c 100644 --- a/frontend/src/components/Dialogs/AuditPGP.tsx +++ b/frontend/src/components/Dialogs/AuditPGP.tsx @@ -22,6 +22,31 @@ import ContentCopy from "@mui/icons-material/ContentCopy"; import ForumIcon from '@mui/icons-material/Forum'; import { ExportIcon, NewTabIcon } from '../Icons'; +function CredentialTextfield(props){ + return( + + + {props.label}} + value={props.value} + variant='filled' + size='small' + InputProps={{ + endAdornment: + + navigator.clipboard.writeText(props.value)}> + + + , + }} + /> + + + ) +} + type Props = { open: boolean; onClose: () => void; @@ -66,89 +91,29 @@ const AuditPGPDialog = ({ - - - {t("Your public key")}} - value={own_pub_key} - variant='filled' - size='small' - InputProps={{ - endAdornment: - - navigator.clipboard.writeText(own_pub_key)}> - - - , - }} - /> - - + - - - {t("Peer public key")}} - value={peer_pub_key} - variant='filled' - size='small' - InputProps={{ - endAdornment: - - navigator.clipboard.writeText(peer_pub_key)}> - - - , - }} - /> - - + - - - {t("Your encrypted private key")}} - value={own_enc_priv_key} - variant='filled' - size='small' - InputProps={{ - endAdornment: - - navigator.clipboard.writeText(own_enc_priv_key)}> - - - , - }} - /> - - + - - - {t("Your private key passphrase (keep secure!)")}} - value={passphrase} - variant='filled' - size='small' - InputProps={{ - endAdornment: - - navigator.clipboard.writeText(passphrase)}> - - - , - }} - /> - - +
diff --git a/frontend/src/components/EncryptedChat.js b/frontend/src/components/EncryptedChat.js index 3905a274..c272a37b 100644 --- a/frontend/src/components/EncryptedChat.js +++ b/frontend/src/components/EncryptedChat.js @@ -241,102 +241,12 @@ class Chat extends Component { {this.state.messages.map((message, index) =>
  • - {/* If message sender is not our nick, gray color, if it is our nick, green color */} {message.userNick == this.props.ur_nick ? : } - {/* // - // - // - // } - // style={{backgroundColor: '#eeeeee'}} - // title={ - // - //
    - //
    - // {message.userNick} - // {message.validSignature ? - // - // : - // - // } - //
    - //
    - // - // this.setState(prevState => { - // const newShowPGP = [...prevState.showPGP]; - // newShowPGP[index] = !newShowPGP[index]; - // return {showPGP: newShowPGP}; - // })}> - // - // - //
    - //
    - // - // navigator.clipboard.writeText(this.state.showPGP[index] ? message.encryptedMessage : message.plainTextMessage)}> - // - // - // - //
    - //
    - //
    - // } - // subheader={this.state.showPGP[index] ? message.encryptedMessage : message.plainTextMessage} - // subheaderTypographyProps={{sx: {wordWrap: "break-word", width: '200px', color: '#444444', fontSize: this.state.showPGP[index]? 11 : null }}} - // /> - // : - // - // - // - // } - // style={{backgroundColor: '#fafafa'}} - // title={ - // - //
    - //
    - // {message.userNick} - // {message.validSignature ? - // - // : - // - // } - //
    - //
    - // - // this.setState(prevState => { - // const newShowPGP = [...prevState.showPGP]; - // newShowPGP[index] = !newShowPGP[index]; - // return {showPGP: newShowPGP}; - // })}> - // - // - //
    - //
    - // - // navigator.clipboard.writeText(this.state.showPGP[index] ? message.encryptedMessage : message.plainTextMessage)}> - // - // - // - //
    - //
    - //
    */} -
  • )} + )}
    { this.messagesEnd = el; }}>
    diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 2b430330..bde40124 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -259,9 +259,32 @@ "Type a message":"Type a message", "Connecting...":"Connecting...", "Send":"Send", - "The chat has no memory: if you leave, messages are lost.":"The chat has no memory: if you leave, messages are lost.", - "Learn easy PGP encryption.":"Learn easy PGP encryption.", - "PGP_guide_url":"https://learn.robosats.com/docs/pgp-encryption/", + "Verify your privacy":"Verify your privacy", + "Audit PGP":"Audit PGP", + "Save full log as a JSON file (messages and credentials)":"Save full log as a JSON file (messages and credentials)", + "Export":"Export", + "Don't trust, verify":"Don't trust, verify", + "Your communication is end-to-end encrypted with OpenPGP. You can verify the privacy of this chat using any tool based on the OpenPGP standard.":"Your communication is end-to-end encrypted with OpenPGP. You can verify the privacy of this chat using any tool based on the OpenPGP standard.", + "Learn how to verify":"Learn how to verify", + "Your PGP public key. Your peer uses it to encrypt messages only you can read.":"Your PGP public key. Your peer uses it to encrypt messages only you can read.", + "Your public key":"Your public key", + "Your peer PGP public key. You use it to encrypt messages only he can read and to verify your peer signed the incoming messages.":"Your peer PGP public key. You use it to encrypt messages only he can read.and to verify your peer signed the incoming messages.", + "Peer public key":"Peer public key", + "Your encrypted private key. You use it to decrypt the messages that your peer encrypted for you. You also use it to sign the messages you send.":"Your encrypted private key. You use it to decrypt the messages that your peer encrypted for you. You also use it to sign the messages you send.", + "Your encrypted private key":"Your encrypted private key", + "The passphrase to decrypt your private key. Only you know it! Do not share. It is also your robot token.":"The passphrase to decrypt your private key. Only you know it! Do not share. It is also your robot avatar user token.", + "Your private key passphrase (keep secure!)":"Your private key passphrase (keep secure!)", + "Save credentials as a JSON file":"Save credentials as a JSON file", + "Keys":"Keys", + "Save messages as a JSON file":"Save messages as a JSON file", + "Messages":"Messages", + + + + + + + "CONTRACT BOX - TradeBox.js": "The Contract Box that guides users trough the whole trade pipeline", "Contract Box":"Contract Box", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index 15b53471..26bcb836 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -258,9 +258,25 @@ "Type a message": "Escribe un mensaje", "Connecting...": "Conectando...", "Send": "Enviar", - "The chat has no memory: if you leave, messages are lost.": "Chat sin memoria: si lo cierras, los mensajes se pierden.", - "Learn easy PGP encryption.": "Aprende encriptación PGP.", - "PGP_guide_url":"https://learn.robosats.com/docs/pgp-encryption/es", + "Verify your privacy":"Verifica tu privacidad", + "Audit PGP":"Auditar", + "Save full log as a JSON file (messages and credentials)":"Guardar el log completo como JSON (credenciales y mensajes)", + "Export":"Exporta", + "Don't trust, verify":"No confíes, verifica", + "Your communication is end-to-end encrypted with OpenPGP. You can verify the privacy of this chat using any tool based on the OpenPGP standard.":"Tu comunicación se encripta de punta-a-punta con OpenPGP. Puedes verificar la privacida de este chat con cualquier herramienta de tercero basada en el estandar PGP.", + "Learn how to verify":"Aprende a verificar", + "Your PGP public key. Your peer uses it to encrypt messages only you can read.":"Esta es tu llave pública PGP. Tu contraparte la usa para encriptar mensajes que sólo tú puedes leer.", + "Your public key":"Tu llave pública", + "Your peer PGP public key. You use it to encrypt messages only he can read and to verify your peer signed the incoming messages.":"La llave pública PGP de tu contraparte. La usas para encriptar mensajes que solo él puede leer y verificar que es él quíen firmó los mensajes que recibes.", + "Peer public key":"Llave pública de tu contraparte", + "Your encrypted private key. You use it to decrypt the messages that your peer encrypted for you. You also use it to sign the messages you send.":"Tu llave privada PGP encriptada. La usas para desencriptar los mensajes que tu contraparte te envia. También la usas para firmar los mensajes que le envias.", + "Your encrypted private key":"Tu llave privada encriptada", + "The passphrase to decrypt your private key. Only you know it! Do not share. It is also your robot token.":"La contraseña para desencriptar tu llave privada. ¡Solo tú la sabes! Mantenla en secreto. También es el token de tu robot.", + "Your private key passphrase (keep secure!)":"La contraseña de tu llave privada ¡Mantener segura!", + "Save credentials as a JSON file":"Guardar credenciales como achivo JSON", + "Keys":"Llaves", + "Save messages as a JSON file":"Guardar mensajes como archivo JSON", + "Messages":"Mensajes", "CONTRACT BOX - TradeBox.js": "The Contract Box that guides users trough the whole trade pipeline", "Contract Box": "Contrato",