module Roda::RodaPlugins::RouteCsrf::InstanceMethods

def csrf_token(path=nil, method=('POST' if path))

method as the second argument.
be assumed. To generate a token for a non-POST request method, pass the
argument. By default, it a path is provided, the POST request method will
The value of the csrf token. For a path specific token, provide a path
def csrf_token(path=nil, method=('POST' if path))
  token = SecureRandom.random_bytes(31)
  token << csrf_hmac(token, method, path)
  [token].pack("m0")
end