generate_key expects a callback