IamUtil.pairPasswordOpenAsync() Overload 1
DESCRIPTION
Perform Password Open pairing asynchronously.
The specified AsyncIamResultReceiver closure is invoked with IamError.OK upon successful completion or with an error if an error occurs. See the pairPasswordOpen()
function for details about possible error codes.
DECLARATION
static public func pairPasswordOpenAsync(
connection: Connection,
desiredUsername: String,
password: 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)
password:
- the common (not user-specific) password to allow pairing using Password Open pairing
closure:
- Invoked when the pairing attempt succeeds or fails.
Overload 2
DESCRIPTION
Perform Password Open pairing asynchronously.
Uses Swift concurrency and is therefore only available on iOS 13 and above.
DECLARATION
static public func pairPasswordOpenAsync(
connection: Connection,
desiredUsername: String,
password: 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)
password:
- the common (not user-specific) password to allow pairing using Password Open pairing
THROWS ERRORS
USERNAME_EXISTS:
- if desiredUsername is already in use on the device
AUTHENTICATION_ERROR:
- if the open pairing password was invalid for the device
INVALID_INPUT:
- if desiredUsername is not valid as per https://docs.nabto.com/developer/api-reference/coap/iam/post-users.html#request
INITIAL_USER_ALREADY_PAIRED:
- if the initial user was already paired
BLOCKED_BY_DEVICE_CONFIGURATION:
- if the device configuration does not support local open pairing (the
IAM:PairingPasswordOpen
action is not set for the Unpaired role or the device does not support the pairing mode at all) TOO_MANY_WRONG_PASSWORD_ATTEMPTS:
- if the client has attempted to authenticate too many times with a wrong password (try again after 10 seconds)
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