add support for userKey as a function