Class: ArchiveValidator::AuthorPrivateKeyValidator

Inherits:
BaseValidator
  • Object
show all
Includes:
Diaspora::Logging
Defined in:
lib/archive_validator/author_private_key_validator.rb

Instance Attribute Summary

Attributes inherited from BaseValidator

#archive_hash

Instance Method Summary collapse

Methods inherited from BaseValidator

#initialize, #messages, #valid?

Methods included from ArchiveImporter::ArchiveHelper

#archive_author_diaspora_id, #contact_groups, #contacts, #others_relayables, #person, #post_subscriptions, #posts, #private_key, #relayables, #serialized_private_key

Constructor Details

This class inherits a constructor from ArchiveValidator::BaseValidator

Instance Method Details

#validateObject


7
8
9
10
11
12
13
14
15
# File 'lib/archive_validator/author_private_key_validator.rb', line 7

def validate
  return if person.nil?
  return if person.public_key.export == private_key.public_key.export

  messages.push("Private key in the archive doesn't match the known key of #{person.diaspora_handle}")
rescue DiasporaFederation::Discovery::DiscoveryError
  logger.info "#{self}: Archive author couldn't be fetched (old home pod is down?), will continue with data"\
    " import only"
end