module Roda::RodaPlugins::HmacPaths::RequestMethods

def hmac_path_valid?(root, path, hmac, opts=OPTS)

Determine whether the provided hmac matches.
def hmac_path_valid?(root, path, hmac, opts=OPTS)
  if Rack::Utils.secure_compare(scope.hmac_path_hmac(root, path, opts), hmac)
    true
  elsif old_secret = roda_class.opts[:hmac_paths_old_secret]
    opts = opts.dup
    opts[:secret] = old_secret
    Rack::Utils.secure_compare(scope.hmac_path_hmac(root, path, opts), hmac)
  else
    false
  end
end