make rest.checkTokenFn a type for unit testing