chat-e2ee icon indicating copy to clipboard operation
chat-e2ee copied to clipboard

User should be able to send image.

Open muke1908 opened this issue 1 year ago • 4 comments

Convert image to base64 and send it by calling await chatInstance.encrypt('some message').send(); https://github.com/muke1908/chat-e2ee/blob/master/service/README.md#3-send-message

muke1908 avatar Jul 06 '23 17:07 muke1908

Hi @muke1908 , I want to work on this issue. Can you assign me?

suman313 avatar Jul 07 '23 19:07 suman313

sure, thanks

muke1908 avatar Jul 07 '23 19:07 muke1908

Hi @muke1908 , I have checked the client side for the image sending. What I can see in "client/src/utils/imagePicker.tsx" we have : image where the selected image is already converted to base64 and it is sending to the server as base64 encoded string. So in my opinion there is no problem here. What I can figure out is the problem is while uploading the image in the server in "backend/externals/imgbb.ts" it cannot find the access to "IMAGE_BB_API_KEY"

  const form = new FormData();
  form.append("image", imageData);
  const url = `${api}?expiration=600&key=${API_KEY}`;

  const response = await fetch(url, {
    method: "POST",
    body: form
  });
  const imageResponse: any = await response.json();

suman313 avatar Oct 01 '23 17:10 suman313

Hi, @suman313 right we already have image picker that convert image to base64 and sends it to the server. But we want to be able to encrypt it with await chatInstance.encrypt(<base64 image>).send() . Also, we do not want to use ImageBB to store images, the image should not be stored anywhere in that aspect.

But I guess there can be some issue on receiver side as websocket has a limit on payload size - but we'll deal with it separately.

muke1908 avatar Oct 02 '23 07:10 muke1908