Group: GNU Social P2P/Design/End2End

From LibrePlanet
< Group:GNU Social P2P‎ | Design
Revision as of 23:11, 20 November 2010 by Miron2 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

< Group:GNU Social P2P/Design

End to End Examples

Values in curly braces are JSON encoded and encrypted.

Glossary:

pubkey - a friend's public key

dkey - a path/friend specific decryption key. It is a generated symmetric key specific to a path and encrypted with a friend's pubkey.

Send Message

An e-mail style message can be sent to a friend in the following fashion:

Agent to Local Core:

put("/mail/sent/$seq", { id: $id })
put("/mail/message/$id", 
 {
   sender: $sender,
   recipients: $recipients,
   headers: $headers,
   body: $body,
   signature: $signature
 }
)
set_permission_keys("/mail/message/$id", $friend_dkeys, push = true)

Agent to Remote Core:

enqueue({ path: "/mail/sent/$seq"})
TODO

Receive Message

On the receiving side, the following event fires when the send from the previous section is received:

on_receive():

the Agent sticks a pointer to the new message in the local inbox:

put("/mail/inbox/$seq", { path: "/mail/$friend_id/mail/message/$id"})
TODO

and notifies the user.

Add Blog Post

This is a blog post style message, not addressed to a particular friend:

put("/blog/body/$id",
 {
   content: $content
 }
)
put("/blog/blog/$blog_id/post/$seq",
 {
   author: $author,
   meta: $meta,
   body_id: $id,
   blog_id: $blog_id,
 }
)
set_permission_keys(..., $friend_dkeys, push = true)

Friend Request

The path "/public" is always mounted by default and is writable by anybody.

The requesting party obtains the route and pubkey for the potential friend. It then performs the following actions:

put("/friend/$recipient_id", { route: $recipient_route, name: $recipient_name, pubkey: $recipient_pubkey })
put("/public/friend/request/$id", { id: $requester_id, route: $requester_route, name: $requester_name, pubkey: $requester_pubkey })
set_permission_keys(..., [ $recipient_dkey ], push = true)

Then enqueue on the friend's Core:

enqueue()

On the receiving side, the following event fires:

on_receive("/public/friend/request/$id")

And the recipient Agent performs:

get("/public/friend/request/$id")

The request is presented to the receiving human, and if accepted:

put("/public/friend/accept/$id1", { id: $recipient_id, route: $recipient_route, name: $recipient`_name })
set_permission_keys(..., [ $requester_dkey ], push = true)

put("/friend/$requester_id", { route: $requester_route, name: $requester_name, pubkey: $requester_pubkey })

On the requester side, the following event fires:

on_receive("/public/friend/accept/$id1")