lib/doorkeeper/secret_storing/base.rb in doorkeeper-5.1.0.rc2 vs lib/doorkeeper/secret_storing/base.rb in doorkeeper-5.1.0

- old
+ new

@@ -1,38 +1,39 @@ +# frozen_string_literal: true + module Doorkeeper module SecretStoring - ## # Base class for secret storing, including common helpers class Base ## # Return the value to be stored by the database # used for looking up a database value. # @param plain_secret The plain secret input / generated - def self.transform_secret(plain_secret) + def self.transform_secret(_plain_secret) raise NotImplementedError end ## # Transform and store the given secret attribute => value # pair used for safely storing the attribute # @param resource The model instance being modified # @param attribute The secret attribute # @param plain_secret The plain secret input / generated def self.store_secret(resource, attribute, plain_secret) - transformed_value = self.transform_secret plain_secret - resource.public_send :"#{attribute}=", transformed_value + transformed_value = transform_secret(plain_secret) + resource.public_send(:"#{attribute}=", transformed_value) transformed_value end ## # Return the restored value from the database # @param resource The resource instance to act on # @param attribute The secret attribute to restore # as retrieved from the database. - def self.restore_secret(resource, attribute) + def self.restore_secret(_resource, _attribute) raise NotImplementedError end ## # Determines whether this strategy supports restoring @@ -58,6 +59,6 @@ transformed_input = transform_secret(input) ActiveSupport::SecurityUtils.secure_compare transformed_input, stored end end end -end \ No newline at end of file +end