diff options
Diffstat (limited to 'lib/archive_validator/author_private_key_validator.rb')
-rw-r--r-- | lib/archive_validator/author_private_key_validator.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/archive_validator/author_private_key_validator.rb b/lib/archive_validator/author_private_key_validator.rb new file mode 100644 index 000000000..7a4c747e3 --- /dev/null +++ b/lib/archive_validator/author_private_key_validator.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class ArchiveValidator + class AuthorPrivateKeyValidator < BaseValidator + include Diaspora::Logging + + def validate + 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 "Archive author couldn't be fetched (old home pod is down?), will continue with data"\ + " import only" + end + end +end |