Refactor ID generators to use `async with` syntax.