IamUtil.pairLocalOpenAsync() Overload 1

DESCRIPTION

Perform Local Open pairing asynchronously, requesting the specified username.

The specified AsyncIamResultReceiver closure is invoked with IamError.OK upon successful completion or with an error if an error occurs. See the pairLocalOpen() function for details about possible error codes.

DECLARATION

static public func pairLocalOpenAsync(
            connection: Connection,
            desiredUsername: String,
            closure: @escaping AsyncIamResultReceiver)

PARAMETERS

connection:
An established connection to the device this client should be paired with
desiredUsername:
Assign this username on the device if available (pairing fails with .USERNAME_EXISTS if not)
closure:
Invoked when the pairing attempt succeeds or fails.

Overload 2

DESCRIPTION

Perform Local Open pairing asynchronously, requesting the specified username.

Uses Swift concurrency and is therefore only available on iOS 13 and above.

Local open pairing uses the trusted local network (LAN) pairing mechanism. No password is required for pairing and no invitation is needed, anybody on the LAN can initiate pairing.

Read more here: https://docs.nabto.com/developer/guides/concepts/iam/pairing.html#open-local

DECLARATION

static public func pairLocalOpenAsync(
        connection: Connection,
        desiredUsername: String
    ) async throws

PARAMETERS

connection:
An established connection to the device this client should be paired with
desiredUsername:
Assign this username on the device if available (pairing fails with .USERNAME_EXISTS if not)

THROWS ERRORS

USERNAME_EXISTS:
if desiredUsername is already in use on the device
INVALID_INPUT:
if desiredUsername is not valid as per https://docs.nabto.com/developer/api-reference/coap/iam/post-users.html#request
BLOCKED_BY_DEVICE_CONFIGURATION:
if the device configuration does not support local open pairing (the IAM:PairingLocalOpen action is not set for the Unpaired role or the device does not support the pairing mode at all)
PAIRING_MODE_DISABLED:
if the pairing mode is configured on the device but is disabled at runtime
IAM_NOT_SUPPORTED:
if Nabto Edge IAM is not supported by the device