0
0
Fork 0

Misc coverage improvements for validators (#23928)

This commit is contained in:
Matt Jankowski 2023-03-04 11:00:00 -05:00 committed by GitHub
parent 2f606ba122
commit c40d5e5a8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 3 deletions

View file

@ -6,7 +6,7 @@ class Ed25519KeyValidator < ActiveModel::EachValidator
key = Base64.decode64(value)
record.errors[attribute] << I18n.t('crypto.errors.invalid_key') unless verified?(key)
record.errors.add(attribute, I18n.t('crypto.errors.invalid_key')) unless verified?(key)
end
private

View file

@ -8,7 +8,7 @@ class Ed25519SignatureValidator < ActiveModel::EachValidator
signature = Base64.decode64(value)
message = option_to_value(record, :message)
record.errors[attribute] << I18n.t('crypto.errors.invalid_signature') unless verified?(verify_key, signature, message)
record.errors.add(attribute, I18n.t('crypto.errors.invalid_signature')) unless verified?(verify_key, signature, message)
end
private