public Task <ICollection <JsonWebKey> > GetByAlgorithmAsync(Use use, AllAlg algorithm, KeyOperations[] operations) { ICollection <JsonWebKey> result = _jsonWebKeys .Where(j => j.Use == use && j.Alg == algorithm && operations.All(op => j.KeyOps.Contains(op))) .Select(j => j.Copy()).ToList(); return(Task.FromResult(result)); }
private async Task <JsonWebKey> GetJsonWebKey(AllAlg alg, KeyOperations operation, Use use) { JsonWebKey result = null; var jsonWebKeys = await _jsonWebKeyRepository.GetByAlgorithmAsync( use, alg, new[] { operation }); if (jsonWebKeys != null && jsonWebKeys.Any()) { result = jsonWebKeys.First(); } return(result); }