DaVinci

public extension DaVinci
  • start(_:) Asynchronous

    Starts the DaVinci flow after applying caller-supplied device-flow inputs.

    Use this overload when the current device is acting as the approving device in an RFC 8628 Device Authorization Grant flow:

    let node = await daVinci.start { options in
        options.verificationUriComplete = URL(string: verificationUriCompleteString)
    }
    

    The supplied URL is stored in sharedContext under SharedContext.Keys.daVinciVerificationUriCompleteKey and consumed during the start phase of OidcModule. Passing nil clears any previously stored value, so a subsequent plain start() does not include a user_code parameter.

    Declaration

    Swift

    func start(_ configure: @Sendable (inout DaVinciOptions) -> Void) async -> Node

    Parameters

    configure

    Closure that populates a DaVinciOptions with caller inputs.

    Return Value

    The first Node produced by the DaVinci flow.

  • Method to create a DaVinci instance.

    Declaration

    Swift

    public static func createDaVinci(block: @Sendable (DaVinciConfig) -> Void = {_ in }) -> DaVinci

    Parameters

    block

    The configuration block.

    Return Value

    The DaVinci instance.

  • Creates a DaVinci instance from a JSON dictionary.

    This factory parses and validates a platform-neutral JSON configuration and delegates to createDaVinci(block:) with the extracted values. Unknown fields (including serverUrl, realm, and cookie, which are Journey-specific) are silently ignored for forward compatibility.

    Declaration

    Swift

    public static func createDaVinci(json: [String : Any]) -> Result<DaVinci, Error>

    Parameters

    json

    A [String: Any] dictionary conforming to the unified SDK configuration schema (see design doc for field reference).

    Return Value

    .success(DaVinci) on valid input, .failure(JsonConfigError) if a required field is absent or a field has the wrong type.

  • user() Asynchronous

    Retrieve the user. This method is now Deprecated. Please call daVinciUser() directly Calling user() instead might cause issues when both DaVinci and the Journey module is used If cookies are available, it prepares a new user and returns it. If no user is found and no cookies are available, it returns nil.

    Declaration

    Swift

    @available(*, deprecated)
    public func user() async -> User?

    Return Value

    The user if found, otherwise nil.

  • daVinciUser() Asynchronous

    Retrieve the user. If cookies are available, it prepares a new user and returns it. If no user is found and no cookies are available, it returns nil.

    Declaration

    Swift

    public func daVinciUser() async -> User?

    Return Value

    The user if found, otherwise nil.