module JWT::Algos::HmacRbNaClFixed

def sign(algorithm, msg, key)

def sign(algorithm, msg, key)
  key ||= ''
  raise JWT::DecodeError, 'HMAC key expected to be a String' unless key.is_a?(String)
  if (hmac = resolve_algorithm(algorithm)) && key.bytesize <= hmac.key_bytes
    hmac.auth(padded_key_bytes(key, hmac.key_bytes), msg.encode('binary'))
  else
    Hmac.sign(algorithm, msg, key)
  end
end