std::random_device is not guaranteed to be non-deterministic. And std::minstd_rand is weak. One solution is to invoke random_device for every key generation. Another solution is to use a more secure PRNG such as one based on RC4 or ChaCha20. Or a combination of these solutions.
It should also be possible for the user to either seed a secure PRNG through a new API, or to set a custom key generation function.