Group: GNU Social P2P/Design/End2End

From LibrePlanet
Jump to: navigation, search

< User:Miron2/Social_Design

End to End Examples

Values in curly braces are JSON encoded and encrypted.

Send Message

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

for each recipient:

 set_control_key("/mail/message/$id", "/friend/$friend_id")
 send($friend, "/mail/message/$id")

Receive Message

The following fires when a send is received on the remote side:

on_receive("/mounts/mail/$friend_id/mail/message/$id"):

stick a pointer in the local inbox:

$value = get($key)
put("/mail/inbox/$seq", { key: $key})

and notify user.

Add Blog Post

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_control_key(..., "/tag/work")

for each friend that is able to read /tag/work:

send($friend, "/blog/$blog_id/post/$seq")