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
sharedContextunderSharedContext.Keys.daVinciVerificationUriCompleteKeyand consumed during thestartphase ofOidcModule. Passingnilclears any previously stored value, so a subsequent plainstart()does not include auser_codeparameter.Declaration
Swift
func start(_ configure: @Sendable (inout DaVinciOptions) -> Void) async -> NodeParameters
configureClosure that populates a
DaVinciOptionswith caller inputs.Return Value
The first
Nodeproduced by the DaVinci flow. -
Method to create a DaVinci instance.
Declaration
Swift
public static func createDaVinci(block: @Sendable (DaVinciConfig) -> Void = {_ in }) -> DaVinciParameters
blockThe 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 (includingserverUrl,realm, andcookie, which are Journey-specific) are silently ignored for forward compatibility.Declaration
Swift
public static func createDaVinci(json: [String : Any]) -> Result<DaVinci, Error>Parameters
jsonA
[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()AsynchronousRetrieve the user. This method is now Deprecated. Please call
daVinciUser()directly Callinguser()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()AsynchronousRetrieve 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.
View on GitHub