resolve method

  1. @override
Future<AttestationResponse?> resolve({
  1. required String attestationId,
})
override

Implementation

@override
Future<AttestationResponse?> resolve({required String attestationId}) async {
  try {
    final uri = Uri.parse('$_verifyUrl/attestation/$attestationId');
    final response = await _httpClient.get(uri).timeout(Duration(seconds: 5));
    if (response.statusCode == 404 || response.body.isEmpty) {
      throw AttestationNotFound(
        code: 404,
        message: 'Attestion for this dapp could not be found',
      );
    }
    if (response.statusCode != 200) {
      throw Exception('Attestation response error: ${response.statusCode}');
    }
    return AttestationResponse.fromJson(jsonDecode(response.body));
  } catch (e) {
    if (e is! AttestationNotFound) {
      _core.logger.e('[$runtimeType] resolve $e');
    }
    rethrow;
  }
}