callProofCallback function

Future<void> callProofCallback(
  1. String sessionId,
  2. Proof proof
)

Implementation

Future<void> callProofCallback(String sessionId, Proof proof) async {
  try {
    final response = await http.post(
        Uri.parse('${Constants.DEFAULT_RECLAIM_CALLBACK_URL}$sessionId'),
        headers: {'Content-Type': 'application/json'},
        body: jsonEncode(proof.toJson()));

    final res = json.decode(response.body);

    if (response.statusCode != 200) {
      throw Exception('Error with sessionId: $sessionId');
    }

    return res;
  } catch (err) {
    logger.e(err);
  }
}