Group: GNU Social P2P/Design/End2End

From LibrePlanet
Jump to: navigation, search
m (End to End Examples)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
< [[User:Miron2/Social_Design]]
+
< [[Group:GNU Social P2P/Design]]
  
 
== End to End Examples ==
 
== End to End Examples ==
Line 14: Line 14:
  
 
An e-mail style message can be sent to a friend in the following fashion:
 
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/sent/$seq", { id: $id })
Line 28: Line 30:
  
 
  set_permission_keys("/mail/message/$id", $friend_dkeys, push = true)
 
  set_permission_keys("/mail/message/$id", $friend_dkeys, push = true)
 +
 +
Agent to Remote Core:
 +
 +
enqueue({ path: "/mail/sent/$seq"})
 +
TODO
  
 
=== Receive Message ===
 
=== Receive Message ===
Line 33: Line 40:
 
On the receiving side, the following event fires when the ''send'' from the previous section is received:
 
On the receiving side, the following event fires when the ''send'' from the previous section is received:
  
  on_receive("/mounts/mail/$friend_id/mail/message/$id"):
+
  on_receive():
  
the UI sticks a pointer to the new message in the local inbox:
+
the Agent sticks a pointer to the new message in the local inbox:
  
  put("/mail/inbox/$seq", { path: "/mounts/mail/$friend_id/mail/message/$id"})
+
  put("/mail/inbox/$seq", { path: "/mail/$friend_id/mail/message/$id"})
 +
TODO
  
 
and notifies the user.
 
and notifies the user.
Line 43: Line 51:
 
=== Add Blog Post ===
 
=== Add Blog Post ===
  
This is a blog post style message, not addressed to a particular friend:
+
This is a blog post style message, not addressed to a particular friend:
  
 
  put("/blog/body/$id",
 
  put("/blog/body/$id",
Line 71: Line 79:
 
  put("/public/friend/request/$id", { id: $requester_id, route: $requester_route, name: $requester_name, pubkey: $requester_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)
 
  set_permission_keys(..., [ $recipient_dkey ], push = true)
 +
 +
Then enqueue on the friend's Core:
 +
 +
enqueue()
  
 
On the receiving side, the following event fires:
 
On the receiving side, the following event fires:
Line 76: Line 88:
 
  on_receive("/public/friend/request/$id")
 
  on_receive("/public/friend/request/$id")
  
And the recipient UI performs:
+
And the recipient Agent performs:
  
 
  get("/public/friend/request/$id")
 
  get("/public/friend/request/$id")
Line 86: Line 98:
 
   
 
   
 
  put("/friend/$requester_id", { route: $requester_route, name: $requester_name, pubkey: $requester_pubkey })
 
  put("/friend/$requester_id", { route: $requester_route, name: $requester_name, pubkey: $requester_pubkey })
mount(...)
 
  
 
On the requester side, the following event fires:
 
On the requester side, the following event fires:
  
 
  on_receive("/public/friend/accept/$id1")
 
  on_receive("/public/friend/accept/$id1")
 
and the UI performs:
 
 
mount(...)
 

Latest revision as of 23:11, 20 November 2010

< 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")