ssbc / ssb-blobs

blob gossiping ssb-subprotocol
MIT License
12 stars 11 forks source link

why does blobs.add return `undefined` for the hash? #25

Closed nichoth closed 4 years ago

nichoth commented 4 years ago

Trying to add an 'avatar' type image in sbot. https://github.com/nichoth/eventual/blob/master/src/subscribe.js#L41

image

christianbundy commented 4 years ago

Sorry, I don't think I understand. What's the problem you're facing, or maybe what do you expect to happen instead?

nichoth commented 4 years ago

yes, so there should be two possible outputs, either err is equal to something, or err is null and hash is valid. this is something else -- no error but hash is not a valid hash. I ended up getting around this by taking the hash in the client as a separate function call. I think this is about making the behavior the same as the documentation.

christianbundy commented 4 years ago

Hmm, that's very strange. I just tested locally and it looks like it's giving me what I expect, but I'm using blobs.add(hash, cb). :thinking:

nichoth commented 4 years ago

ok, so it looks like you are also getting the hash as a separate step, and the blobs.add call returns what was passed in. Looking at the docs https://scuttlebot.io/apis/scuttlebot/blobs.html this is what it says should happen. I'm not sure why I was confused when I opened this, thanks for looking.