Journey

public extension Journey
  • Creates a Journey instance with sensible defaults and optional customization.

    This configures:

    • Logging and timeout
    • Default headers via CustomHeader.config
    • Node transformation, session management, and OIDC support modules
    • Callback registrations for common Journey callbacks

    Declaration

    Swift

    static func createJourney(block: @Sendable (JourneyConfig) -> Void = {_ in }) -> Journey

    Parameters

    block

    An optional configuration closure to customize JourneyConfig and modules.

    Return Value

    A configured Journey.

  • start(_:configure:) Asynchronous

    Starts a Journey by name with optional options configuration.

    Declaration

    Swift

    func start(_ journeyName: String, configure: @Sendable (inout Options) -> Void = { _ in }) async -> Node

    Parameters

    journeyName

    The name of the Journey (auth tree) to start.

    configure

    Optional closure to modify Options before starting.

    Return Value

    The first Node returned by the Journey start.

  • resume(_:configure:) Asynchronous

    Resumes a Journey from a suspended URI with optional options configuration.

    Declaration

    Swift

    func resume(_ uri: URL, configure: @Sendable (inout Options) -> Void = { _ in }) async -> Node

    Parameters

    uri

    The resume URI containing the suspendedId parameter.

    configure

    Optional closure to modify Options before resuming.

    Return Value

    The next Node returned by the Journey resume, or a FailureNode if URI is invalid.

  • journeySignOff() Asynchronous

    Signs off the Journey session and performs any configured cleanup.

    Declaration

    Swift

    func journeySignOff() async -> Result<Void, Error>

    Return Value

    .success(()) on success or .failure(Error) if sign-off fails.

  • journeyUser() Asynchronous

    Returns the current authenticated user for this Journey, if available.

    This will:

    • Initialize the Journey if needed
    • Return a cached user if present
    • If a session exists, prepare and cache a UserDelegate backed by OidcUser

    Declaration

    Swift

    public func journeyUser() async -> User?

    Return Value

    A User if available, otherwise nil.