Currently, the deposit server requires the Slug header, so the client generates one when needed.
However, as @douardda pointed out to me, the SWORD specification says it is optional:
The client MAY supply a Slug header providing a suggested identifier for the deposited content
and
Server implementations MUST adopt the behaviour and requirements in Section 9.7 of [AtomPub] with respect to the Slug header.
and from the AtomPub spec:
Slug is an HTTP entity-header whose presence in a POST to a Collection constitutes a request by the client to [...]
which implies optionally as well.
So we should make the server accept the absence of a Slug header and generate a slug on its own if it is missing. And then, we can remove the slug generation from the client, as it won't be needed anymore.