answerChallenge method

  1. @override
String answerChallenge(
  1. String? challenge
)
override

Process the challenge sent by the server and return a String response

Implementation

@override
String answerChallenge(String? challenge) {
  // Encode as a able
  TypeEncoder encoder = TypeEncoder();
  encoder.writeFieldTable({"LOGIN": userName, "PASSWORD": password});

  // The spec defines the challenge response as a string (with its own length as a prefix). We
  // need to skip the table length from our response so the length does not get written twice
  Uint8List res = encoder.writer.joinChunks();
  return String.fromCharCodes(Uint8List.view(res.buffer, 4));
}