Group: GNU Social P2P/Design/End2End
(friend request) |
|||
Line 4: | Line 4: | ||
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: | ||
+ | |||
+ | put("/mail/sent/$seq", { id: $id }) | ||
put("/mail/message/$id", | put("/mail/message/$id", | ||
Line 19: | Line 26: | ||
) | ) | ||
− | + | set_permission_keys("/mail/message/$id", $friend_dkeys, push = true) | |
− | |||
− | |||
− | |||
− | |||
=== Receive Message === | === Receive Message === | ||
Line 35: | Line 38: | ||
put("/mail/inbox/$seq", { path: "/mounts/mail/$friend_id/mail/message/$id"}) | put("/mail/inbox/$seq", { path: "/mounts/mail/$friend_id/mail/message/$id"}) | ||
− | and notifies user. | + | and notifies the user. |
=== Add Blog Post === | === Add Blog Post === | ||
Line 56: | Line 59: | ||
) | ) | ||
− | + | set_permission_keys(..., $friend_dkeys, push = true) | |
− | |||
− | |||
− | |||
=== Friend Request === | === Friend Request === | ||
Line 67: | Line 67: | ||
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) | |
On the receiving side, the following event fires: | On the receiving side, the following event fires: | ||
Line 74: | Line 75: | ||
on_receive("/public/friend/request/$id") | on_receive("/public/friend/request/$id") | ||
− | And the UI performs: | + | And the recipient UI performs: |
get("/public/friend/request/$id") | get("/public/friend/request/$id") | ||
Line 80: | Line 81: | ||
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 }) | ||
Line 92: | Line 93: | ||
and the UI performs: | and the UI performs: | ||
− | |||
mount(...) | mount(...) |
Revision as of 18:21, 31 May 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:
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)
Receive Message
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"):
the UI sticks a pointer to the new message in the local inbox:
put("/mail/inbox/$seq", { path: "/mounts/mail/$friend_id/mail/message/$id"})
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)
On the receiving side, the following event fires:
on_receive("/public/friend/request/$id")
And the recipient UI 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 }) mount(...)
On the requester side, the following event fires:
on_receive("/public/friend/accept/$id1")
and the UI performs:
mount(...)