Refactor getKeys to permissions module