Extract out wrapUserProvidedKey for clarity