func (h *Handler) AuthClient(product, productPassword,
	clientKey, clientPassword string) error {
	logger := h.logger.Add("method", "AuthClient",
		"product", product, "clientKey", clientKey)

	logger.Info("session auth request")

	prod, err := h.checkProductPassword(logger, product, productPassword)
	if err != nil {
		return err
	}

	ch, err := h.findClientChannel(logger, prod, clientKey, false)
	if err != nil {
		return err
	}

	err = data.ValidatePassword(
		ch.Password, clientPassword, string(ch.Salt))
	if err != nil {
		logger.Warn("failed to validate client password: " +
			err.Error())
		return ErrBadClientPassword
	}

	return nil
}
func (h *Handler) AuthClient(product, productPassword,
	clientKey, clientPassword string) error {
	logger := h.logger.Add("method", "AuthClient",
		"product", product, "clientKey", clientKey)

	logger.Info("session auth request")

	prod, err := h.checkProductPassword(logger, product, productPassword)
	if err != nil {
		return err
	}

	ch, err := h.findClientChannel(logger, prod, clientKey, false)
	if err != nil {
		return err
	}

	err = data.ValidatePassword(
		ch.Password, clientPassword, string(ch.Salt))
	if err != nil {
		logger.Warn("failed to validate client password: " +
			err.Error())
		return ErrBadClientPassword
	}

	return nil
}
// AuthClient verifies password for a given client key.