hasRightAt method

bool hasRightAt(
  1. Authentication auth,
  2. String right,
  3. int height
)

Implementation

bool hasRightAt(Authentication auth, String right, int height) {
  _ensureHeightIsKnown(height);

  final rightHistories = _data.rights[right] ?? [];
  for (final rightHistory in rightHistories) {
    final idx = _getKeyIdx(rightHistory.keyLink);
    final keyData = _data.keys[idx];

    if (!_isKeyValidAt(keyData, height)) {
      continue;
    }

    if (!isSameAuthentication(_keys[idx], auth)) {
      continue;
    }

    return _isRightValidAt(rightHistory.history, height);
  }

  return false;
}