2
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/secret_token_migration/active_support/message_verifier.rb', line 2
def verify(signed_message)
raise InvalidSignature if signed_message.blank?
data, digest = signed_message.split("--")
if data.present? && digest.present? && secure_compare(digest, generate_digest(data))
@serializer.load(::Base64.decode64(data))
elsif data.present? && digest.present? && @deprecated_secret && secure_compare(digest, generate_deprecated_digest(data))
ActiveSupport::Notifications.instrument("deprecated_secret.active_support")
@serializer.load(::Base64.decode64(data))
else
raise InvalidSignature
end
end
|