-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Use generic encrypted payloads #108
Conversation
thanks for putting up this pr @hackergrrl! started looking at this a bit late so feedback may not be of the utmost quality at this stage, some thoughts follow regardless:
some more thoughts re the private message usecase: i think it makes sense to start with only supporting 1-1 PMs atm; there's a lot more work that needs to happen for 1-many PMs to be deployed (in cli, in desktop, in cabal-client). additionally, i think there's a good case to make for the UX of 1-1 PMs being fairly well-understood by folx and users of chat apps in general, so starting there feels like a nice incremental step instead of a giant leap :3 1-many PMs with the secret box caveats and constraints (e.g. better make the max #recpts small as a tradeoff to make message overhead more reasonable) makes less sense, especially when thinking about how to communicate them to users of apps, than having a generic secret channel mechanism and using that for "group PMs" a lot of words to say "let's keep |
Ok, take a look at the latest changes.
My only concern with this approach is that private and public messages,
after decryption, will look *identical*. I worry that there could be
an exploit some day if we aren't careful where someone makes a channel
with your public key to spoof a PM channel or something.
|
thanks for the patch @hackergrrl! regarding your concern: yup! totally valid. in my current cabal-client code i've taken some precautions wrt validation. for instance making sure nobody can create/join a channel if it conforms to the pub key regex && if there's a user known with that id—it probably needs to be stricter. this validation also doesn't help if you are building ontop of cabal-core directly of course. i was thinking in bed earlier re the problems of having exactly the same structure as regular messages, and thought that maybe we can add a smol bit of metadata to private messages like |
Yes, I'm very in favour of a `private: true` field as a precaution.
|
@hackergrrl added the metadata (and am using it in my cabal-client code :) also pushed the cabal-core fix i had locally for making sure the ready event fires when all indexes have been successfully loaded (and not only the sync ones)—hope that's not terribly out of scope, just felt a bit easier to do that since it was already in my working code |
Great. A last nice thing would be to update the |
@hackergrrl thanks for the nudge! i'll get that done next week 😊 |
also add some clarifiying comments to the pm tests
@hackergrrl alright, there we go! |
@hackergrrl do you have any further comments? if not, i will go ahead and merge this + issue a new release (as i guess a new major? bc we changed the private messages api) |
@cblgh No comments! |
Hey @cblgh, this is per our earlier discussion! Here is my new proposal for the structure of private messages & encrypted messages in general:
private/chat
, just usetext/chat
so existing logic can be more easily reused).'type: "encrypted"
on ciphertext payloads. This means encrypted messages won't affect any existing views, since it's a type unknown to them. Views can opt-in to supporting encrypted messages as needed.cipher_type
key on the ciphertext message, since we didn't have a clear decision on the pros/cons of that. However, we can add later /wo breaking backwards compatibility.1:1 private text message format
It's just the same as regular chat message, but encrypted, and the inner payload has a
recipients
key instead ofchannel
key.Does this sound good to you? I kinda suspect that as you're implementing you'll discover any holes in this design. 😈