Implement api_key generation.