module RbNaCl::Util

def check_hmac_key(string, description)

Parameters:
  • description (String) -- Description of the string (used in the error)
  • string (#to_str) -- The input string

Raises:
  • (RbNaCl::LengthError) - If the string is empty
  • (ArgumentError) - If we cannot convert to a string with #to_str
def check_hmac_key(string, description)
  check_string_validation(string)
  string = string.to_str
  if string.bytesize.zero?
    raise LengthError,
          "#{description} was #{string.bytesize} bytes (Expected more than 0)",
          caller
  end
  string
end