-
-
Save Ruxton/7d762520dd74fab87f07 to your computer and use it in GitHub Desktop.
Basic idea to transfer users between pods on D*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moving human@diaspora.pod.a to human@diaspora.pod.b | |
1. User logs into human@diaspora.pod.a | |
2. Click settings | |
3. Scroll down | |
4. Click "Move to another pod" | |
5. User is presented with a download of their private key (and maybe serialized profile) | |
6. User visits to diaspora.pod.b | |
7. User clicks "Moving from another pod" | |
8. User submits a form with their old d* ID, a new username for this pod, a password and the download from pod.a | |
9. pod.b attempts validate the key is correct for the old d* person (fetches the person if they're not on pod) | |
10. pod.b creates a user for the person with the supplied details | |
11. pod.b sends a SignedUserMove to pod.a | |
12. pod.a receives the SignedUserMove and federates it to all the users contacts | |
13. pod.a updates the person with pod.b D* ID & deletes the user | |
14. User should now be able to login to pod.b and pods will receive an update | |
NOTES: | |
* GUID of the person will remain the same | |
* there's an issue of what happens when a pod doesn't receive the federated SignedUserMove | |
* Admins shouldn't be allowed to move, they need to dethrone first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SignedUserMove | |
include Diaspora::Federated::Base | |
include Diaspora::Encryptable | |
xml_name :signed_user_move | |
xml_attr :sender_handle | |
xml_attr :sender_guid | |
xml_attr :target_handle | |
xml_attr :sender_signature | |
# xml_attr :sender_private_key | |
attr_accessor :target_handle, | |
:sender, | |
:sender_signature | |
def author | |
@sender | |
end | |
def sender_handle | |
@sender.diaspora_handle | |
end | |
def sender_handle=(handle) | |
@sender = Person.find_by_diaspora_handle(handle) | |
end | |
def sender_guid | |
@sender.guid | |
end | |
def guid | |
sender_guid | |
end | |
def signable_accessors | |
accessors = self.class.roxml_attrs.collect do |definition| | |
definition.accessor | |
end | |
accessors - ['sender_signature', 'sender_handle'] | |
end | |
def self.build(sender,target_handle) | |
signed_user_move = SignedUserMove.new | |
signed_user_move.sender = sender | |
signed_user_move.target_handle = target_handle | |
signed_user_move.sender_signature = signed_user_move.sign_with_key(sender.encryption_key) | |
signed_user_move | |
end | |
def perform | |
person = Person.find_by_guid(sender_guid) | |
person.owner.build({diaspora_handle: target_handle}) | |
person.valid? | |
raise person.errors.inspect | |
end | |
def receive(recipient,sender) | |
if sender_signature_valid? | |
self.perform | |
end | |
return | |
end | |
def sender_signature_valid? | |
verify_signature(self.sender_signature, self.sender.person) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment