An API for generating keys