isBlockedByMultihash method

bool isBlockedByMultihash(
  1. String multihash
)

Returns true if the multihash string is blocked.

Implementation

bool isBlockedByMultihash(String multihash) {
  if (!_config.enableDenylist) return false;
  final mh = _tryDecodeMultihash(multihash);
  if (mh != null) {
    final hexStr = _multihashHex(mh);
    if (_snapshot.multihashHexes.contains(hexStr)) {
      return true;
    }
    if (_snapshot.hashedMultihashes.isNotEmpty &&
        _snapshot.hashedMultihashes.contains(
          hex.encode(_sha256MultihashBytes(_b58Multihash(mh))),
        )) {
      return true;
    }
    if (_evalPathRules(_snapshot.ipfsPathRules[hexStr], '') == true) {
      return true;
    }
  }
  return _snapshot.cidStrings.contains(multihash);
}