Group: GNU Social P2P/Design/End2End
(friend request) |
|||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | < [[ | + | < [[Group:GNU Social P2P/Design]] |
== End to End Examples == | == End to End Examples == | ||
Values in curly braces are JSON encoded and encrypted. | 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 === | === Send Message === | ||
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/message/$id", | put("/mail/message/$id", | ||
| Line 19: | Line 29: | ||
) | ) | ||
| − | + | 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 29: | 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( | + | on_receive(): |
| − | the | + | the Agent sticks a pointer to the new message in the local inbox: |
| − | put("/mail/inbox/$seq", { path: " | + | put("/mail/inbox/$seq", { path: "/mail/$friend_id/mail/message/$id"}) |
| + | TODO | ||
| − | and notifies user. | + | and notifies the user. |
=== Add Blog Post === | === Add Blog Post === | ||
| − | + | This is a blog post style message, not addressed to a particular friend: | |
put("/blog/body/$id", | put("/blog/body/$id", | ||
| Line 56: | Line 68: | ||
) | ) | ||
| − | + | set_permission_keys(..., $friend_dkeys, push = true) | |
| − | |||
| − | |||
| − | |||
=== Friend Request === | === Friend Request === | ||
| Line 67: | Line 76: | ||
The requesting party obtains the route and pubkey for the potential friend. It then performs the following actions: | 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 }) | 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 the receiving side, the following event fires: | ||
| Line 74: | Line 88: | ||
on_receive("/public/friend/request/$id") | on_receive("/public/friend/request/$id") | ||
| − | And the | + | And the recipient Agent performs: |
get("/public/friend/request/$id") | get("/public/friend/request/$id") | ||
| Line 80: | Line 94: | ||
The request is presented to the receiving human, and if accepted: | The request is presented to the receiving human, and if accepted: | ||
| − | put("/public/friend/accept/$id1", { id: $ | + | 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 }) | put("/friend/$requester_id", { route: $requester_route, name: $requester_name, pubkey: $requester_pubkey }) | ||
| − | |||
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") | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 23:11, 20 November 2010
Contents
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")