Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async codecs #13

Closed
christianbundy opened this issue Sep 14, 2018 · 3 comments
Closed

Async codecs #13

christianbundy opened this issue Sep 14, 2018 · 3 comments

Comments

@christianbundy
Copy link
Member

I've been playing around with the unboxing code from secure-scuttlebutt and trying to implement some async unboxing code, but it looks like both the encoder and decoder need to be synchronous functions. Is it possible to use async functions for encode and decode, or would that be reasonable for me to [attempt to] implement?

Thanks!

@dominictarr
Copy link
Collaborator

Something like this would be really cool, because it leads towards private-groups... but I'm not sure wether that's the best way to implement them.

I am pretty sure though, that the next step is adding support for passing a decryption key link along with a link to an encrypted message... probably want to do that the same as secret blobs: ssbc/ssb-ref#15 (and other issues starting out from there)

And also, figuring out exactly what the format for encrypted messages will be. That's the part with the highest technical barrier. hmm.

@christianbundy
Copy link
Member Author

christianbundy commented Sep 18, 2018

My goal was actually to start prototyping a blob content representation (like "content": "&sbBmsB7XWvmIzkBzreYcuzPpLtpeCMDIs6n/OJGSC1U=.sha256") rather than enc/dec, but from reading through the SSB code my intuition is that this may be like private messages, which need to be unboxed before they can be indexed. The problem is that multiblob's methods seem to be asynchronous will callbacks, but flumelog-offset expects a synchronous function without an option of using a callback.

I'm sure there are more high-performance ways of implementing off-chain messages, but I was hoping I'd be able to prototype it and get a better feel for the ergonomics (and deep-dive some SSB code).

Is there a better way of going about this?

@christianbundy
Copy link
Member Author

christianbundy commented Sep 18, 2018

FWIW, here's my current implementation, which works using fs.readFileSync():

ssbc/ssb-db@400d561#diff-e91c0d50d79d0bc8fced372dd077f906R72

It's basically just a hacky and synchronous implementation of multiblob.get(), but I wanted to reach out for feedback if there's a simpler way to prototype this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants