Class: DiasporaFederation::Entities::AccountMigration

Inherits:
DiasporaFederation::Entity show all
Includes:
Signable
Defined in:
lib/diaspora_federation/entities/account_migration.rb,
lib/diaspora_federation/entities/account_migration/signable.rb

Overview

This entity is sent when a person changes their diaspora* ID (e.g. when a user migration from one to another pod happens).

Defined Under Namespace

Modules: Signable Classes: PrivateKeyNotFound

Constant Summary

Constants included from Signable

Signable::DIGEST

Constants inherited from DiasporaFederation::Entity

DiasporaFederation::Entity::ENTITY_NAME_REGEX, DiasporaFederation::Entity::INVALID_XML_REGEX

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Signable

#signature_data, #unique_migration_descriptor

Methods included from Signable

#sign_with_key, #signature_data

Methods included from Logging

included

Methods inherited from DiasporaFederation::Entity

class_name, entity_class, entity_name, from_json, from_xml, #initialize, #to_h, #to_json, #to_xml

Methods included from PropertiesDSL

#class_props, #default_values, #entity, #missing_props, #optional_props, #property, #resolv_aliases

Constructor Details

This class inherits a constructor from DiasporaFederation::Entity

Instance Attribute Details

#authorString (readonly)

Sender of the AccountMigration message. Usually it is the old diaspora* ID of the person who changes their ID. This property is also allowed to be the new diaspora* ID, which is equal to the author of the included profile.

Returns:

  • (String)

    author diaspora* ID

See Also:



18
# File 'lib/diaspora_federation/entities/account_migration.rb', line 18

property :author, :string

#old_identityString (readonly)

Returns diaspora* ID of the old person identity.

Returns:

  • (String)

    diaspora* ID of the old person identity



36
# File 'lib/diaspora_federation/entities/account_migration.rb', line 36

property :old_identity, :string, default: nil

#profilePerson (readonly)

Holds new updated profile of a person, including diaspora* ID

Returns:

  • (Person)

    person new data



23
# File 'lib/diaspora_federation/entities/account_migration.rb', line 23

entity :profile, Entities::Profile

#remote_photo_pathString (readonly)

The url to the path of the photos on the new pod. Can be empty if photos weren’t migrated.

Returns:

  • (String)

    remote photo path



41
# File 'lib/diaspora_federation/entities/account_migration.rb', line 41

property :remote_photo_path, :string, optional: true

#signatureString (readonly)

Signature that validates original and target diaspora* IDs with the private key of the second identity, other than the entity author. So if the author is the old identity then this signature is made with the new identity key, and vice versa.

Returns:

  • (String)

    signature



30
# File 'lib/diaspora_federation/entities/account_migration.rb', line 30

property :signature, :string, default: nil

Class Method Details

.from_hash(*args) ⇒ Object

Calls super and additionally does signature verification for the instantiated entity.



70
71
72
# File 'lib/diaspora_federation/entities/account_migration.rb', line 70

def self.from_hash(*args)
  super.tap(&:verify_signature)
end

Instance Method Details

#new_identityString

Returns diaspora* ID of the new person identity.

Returns:

  • (String)

    diaspora* ID of the new person identity



53
54
55
# File 'lib/diaspora_federation/entities/account_migration.rb', line 53

def new_identity
  profile&.author
end

#verify_signatureObject

Shortcut for calling super method with sensible arguments



63
64
65
# File 'lib/diaspora_federation/entities/account_migration.rb', line 63

def verify_signature
  super(signer_id, :signature)
end