Add uniqueness test and --use-generated key