@@ -127,7 +127,7 @@ export const ChatProvider = ({ children }: { children: ComponentChildren }) => {
127127 }
128128 let key = sharedKeys . current [ peer ] ;
129129 if ( ! key ) key = await getOrCreateSharedKey ( peer ) ;
130- if ( ! key ) return { text : '[Messaggio criptato - chiave non disponibile ]' , ok : false } ;
130+ if ( ! key ) return { text : '[Encrypted message - key not available ]' , ok : false } ;
131131 try { const plain = await decryptMessage ( key , payload ) ; return { text : plain , ok : true } ; }
132132 catch ( e ) {
133133 if ( sk_fingerprint ) {
@@ -144,7 +144,7 @@ export const ChatProvider = ({ children }: { children: ComponentChildren }) => {
144144 }
145145 catch { }
146146 }
147- return { text : '[Messaggio criptato - impossibile decifrare ]' , ok : false } ;
147+ return { text : '[Encrypted message - unable to decrypt ]' , ok : false } ;
148148 }
149149 } , [ getOrCreateSharedKey ] ) ;
150150
@@ -255,9 +255,9 @@ export const ChatProvider = ({ children }: { children: ComponentChildren }) => {
255255 const key = await getOrCreateSharedKey ( peer ) ;
256256 if ( key ) {
257257 try { text = await decryptMessage ( key , content || text ) ; encrypted = false ; }
258- catch { text = '[Messaggio criptato - impossibile decifrare ]' ; }
258+ catch { text = '[Encrypted message - unable to decrypt ]' ; }
259259 }
260- else text = '[Messaggio criptato - chiave non disponibile ]' ;
260+ else text = '[Encrypted message - key not available ]' ;
261261 }
262262
263263 return {
@@ -523,7 +523,7 @@ export const ChatProvider = ({ children }: { children: ComponentChildren }) => {
523523 let key = sharedKeys . current [ peer ] ;
524524 if ( ! key ) { try { key = await getOrCreateSharedKey ( peer ) ; } catch { } }
525525 if ( ! key ) {
526- const msg : Message = { from_client : username , to_client : peer , text : text + ' (non criptato)' , timestamp : ts , public_key : '' , content : '' , encrypted : false } ;
526+ const msg : Message = { from_client : username , to_client : peer , text : text , timestamp : ts , public_key : '' , content : '' , encrypted : false } ;
527527 setPrivateMessages ( prev => ( { ...prev , [ peer ] : [ ...( prev [ peer ] || [ ] ) , msg ] } ) ) ;
528528 await queuedSendMessage ( { command : `send_private:${ peer } :${ text } ` , client_id : username } ) ;
529529 return ;
@@ -559,7 +559,7 @@ export const ChatProvider = ({ children }: { children: ComponentChildren }) => {
559559 const content = await toBase64 ( file ) ;
560560 const ts = new Date ( ) . toISOString ( ) ;
561561 const key = await getOrCreateSharedKey ( peer ) . catch ( ( ) => undefined ) ;
562- if ( ! key ) { const msg : Message = { from_client : username , to_client : peer , text : file . name + ' (non criptato)' , timestamp : ts , public_key : '' , content, file : true , filename : file . name , mimetype : file . type , encrypted : false } ; setPrivateMessages ( prev => ( { ...prev , [ peer ] : [ ...( prev [ peer ] || [ ] ) , msg ] } ) ) ; await queuedSendMessage ( { command : `send_private:${ peer } :${ file . name } ` , client_id : username , file : true , filename : file . name , mimetype : file . type , content } ) ; return ; }
562+ if ( ! key ) { const msg : Message = { from_client : username , to_client : peer , text : file . name , timestamp : ts , public_key : '' , content, file : true , filename : file . name , mimetype : file . type , encrypted : false } ; setPrivateMessages ( prev => ( { ...prev , [ peer ] : [ ...( prev [ peer ] || [ ] ) , msg ] } ) ) ; await queuedSendMessage ( { command : `send_private:${ peer } :${ file . name } ` , client_id : username , file : true , filename : file . name , mimetype : file . type , content } ) ; return ; }
563563 const msg : Message = { from_client : username , to_client : peer , text : file . name , timestamp : ts , public_key : '' , content, file : true , filename : file . name , mimetype : file . type , encrypted : true } ;
564564 setPrivateMessages ( prev => ( { ...prev , [ peer ] : [ ...( prev [ peer ] || [ ] ) , msg ] } ) ) ;
565565 await queuedSendMessage ( { command : `send_private:${ peer } :${ file . name } ` , client_id : username , file : true , filename : file . name , mimetype : file . type , content, encrypted : true } ) ;
0 commit comments