RetroShare / RSNewWebUI

30 stars 20 forks source link

Add option to create identities #5

Closed rottencandy closed 4 years ago

rottencandy commented 4 years ago

Currently does not have option to set the user avatar. How should the image for avatar be passed to rsIdentity/createIdentity?

csoler commented 4 years ago

use the RsGxsImage structure, passing the avatar in unsigned char binary format, were the data is the png file.

rottencandy commented 4 years ago

@csoler I tried all the methods stated in the FileReader API: https://developer.mozilla.org/en-US/docs/Web/API/FileReader

But whatever data format I send to the json API, it doesn't seem to recognize the image.

Should the data be b64 encoded? Should the data be sent as an array? I have only tried sending as string so far. Or by unsigned char, does it expect 8-bit data array(uint8_t)?

G10h4ck commented 4 years ago

RsGxsImage in JSON is an object like this {"mData":"PNG image binary data represented as base64 string"} this is how we deal with binary stuff in JSON API, anyway in this specific case I would not bother with this right now because we already talked that we are gonna change that so the image is not be embedded directly in the identity, and instead put the hash of the image to retrieve it via file trasfer