# calculateChallengeResponse method

Future <String> calculateChallengeResponse(

1. String base64Challenge

)

## Implementation

    Future<String> calculateChallengeResponse(String base64Challenge) async {
      final challengeString = utf8.decode(base64.decode(base64Challenge));
      final challenge = parseKeyValue(challengeString);
      final clientFinalMessageBare = 'c=biws,r=${challenge['r']!}';

      final saltedPassword = await calculateSaltedPassword(
        challenge['s']!,
        int.parse(challenge['i']!),
      );
      final clientKey = await calculateClientKey(saltedPassword);
      final storedKey = (await _hash.hash(clientKey)).bytes;
      final authMessage =
          '$initialMessageNoGS2,$challengeString,$clientFinalMessageBare';
      final clientSignature =
          await calculateClientSignature(authMessage, storedKey);
      final clientProof = calculateClientProof(clientKey, clientSignature);
      final serverKey = await calculateServerKey(saltedPassword);
      _serverSignature =
          base64.encode(await calculateServerSignature(authMessage, serverKey));

      return '$clientFinalMessageBare,p=${base64.encode(clientProof)}';
    }