auth method
Authenticates with the device using the provided password.
This method is called automatically during the connection process if the device requires authentication.
Throws ZKErrorResponse if authentication fails.
Implementation
Future<void> auth() async {
final key = makeCommandKey(password, sessionId);
final response = await sendCommand(
CMD_AUTH,
commandString: key,
bypassConnectionCheck: true,
);
final responseHeader = parseHeader(response);
final responseCode = responseHeader[0];
if (responseCode != CMD_ACK_OK) {
throw ZKErrorResponse("Authentication failed with code: $responseCode");
}
}