verifyConfigIntegrity static method

Future<bool> verifyConfigIntegrity()

Verify configuration integrity

Implementation

static Future<bool> verifyConfigIntegrity() async {
  try {
    final backendUrl = await getBackendUrl();
    final apiKey = await getApiKey();
    final merchantInfo = await getMerchantInfo();
    final storedHash = await _storage.read(key: _configHashKey);

    if (backendUrl == null || apiKey == null || merchantInfo == null || storedHash == null) {
      return false;
    }

    final merchantInfoJson = jsonEncode(merchantInfo);
    final expectedHash = _createConfigHash(backendUrl, apiKey, merchantInfoJson);

    return storedHash == expectedHash;
  } catch (e) {
    return false;
  }
}