resolve static method

RevokeResolution resolve({
  1. required List<Map<String, dynamic>> matches,
  2. required String? currentKeyId,
  3. required bool force,
})

Implementation

static RevokeResolution resolve({
  required List<Map<String, dynamic>> matches,
  required String? currentKeyId,
  required bool force,
}) {
  if (matches.isEmpty) {
    return const RevokeResolution._(RevokeDecision.noMatch);
  }
  if (matches.length > 1) {
    return RevokeResolution._(RevokeDecision.ambiguous, matches: matches);
  }
  final match = matches.single;
  if (match['id'] == currentKeyId && !force) {
    return RevokeResolution._(RevokeDecision.inUse, match: match);
  }
  return RevokeResolution._(RevokeDecision.proceed, match: match);
}