Esempio n. 1
0
        public async Task <(bool success, HashSet <KeyInfo> data)> FindKeyAsync(Shared.Models.CreateKey keyInfo)
        {
            var blobClient = new BlobClient(_connectionString, _containerName, GetBlobName(keyInfo));

            if (await blobClient.ExistsAsync())
            {
                var result = await blobClient.DownloadAsync();

                using (var reader = new StreamReader(result.Value.Content))
                {
                    string json = await reader.ReadToEndAsync();

                    return(true, JsonConvert.DeserializeObject <HashSet <KeyInfo> >(json));
                }
            }

            return(false, Enumerable.Empty <KeyInfo>().ToHashSet());
        }
Esempio n. 2
0
 private string GetBlobName(Shared.Models.CreateKey key) => $"{key.Product}/{key.Email}.json";