Connection.passwordAuthenticateAsync() Overload 1
DESCRIPTION
Do an asynchronous password authentication exchange with a device.
Password authenticate the client and the device. The password authentication is bidirectional and based on PAKE, such that both the client and the device learns that the other end knows the password, without revealing the password to the other end.
A specific use case for the password authentication is to prove the identity of a device which identity is not already known, e.g. in a pairing scenario.
The specified AsyncStatusReceiver closure is invoked with an error if an error occurs, see the passwordAuthenticate() function for details about error codes.
DECLARATION
public func passwordAuthenticateAsync(username: String, password: String, closure: @escaping AsyncStatusReceiver)
PARAMETERS
- username:
- The username (note: use the empty string if using for Password Open Pairing, see https://docs.nabto.com/developer/guides/iam/pairing.html)
- password:
- The password (typically the open (global) or invite (per-user) pairing password)
- closure:
- Invoked when authentication is completed or an error occurs
Overload 2
DESCRIPTION
Do an asynchronous password authentication exchange with a device.
Password authenticate the client and the device. The password authentication is bidirectional and based on PAKE, such that both the client and the device learns that the other end knows the password, without revealing the password to the other end.
A specific use case for the password authentication is to prove the identity of a device which identity is not already known, e.g. in a pairing scenario.
DECLARATION
public func passwordAuthenticateAsync(username: String, password: String) async throws
PARAMETERS
- username:
- The username (note: use the empty string if using for Password Open Pairing, see https://docs.nabto.com/developer/guides/iam/pairing.html)
- password:
- The password (typically the open (global) or invite (per-user) pairing password)
THROWS ERRORS
- UNAUTHORIZED:
- if the username or password is invalid
- NOT_FOUND:
- if the password authentication feature is not available on the device
- NOT_CONNECTED:
- if the connection is not open
- OPERATION_IN_PROGRESS:
- if a password authentication request is already in progress on the connection
- TOO_MANY_REQUESTS:
- if too many password attempts has been made
- STOPPED:
- if the client is stopped