Add project files.

This commit is contained in:
Sergio Matias Urquin
2025-04-29 18:39:57 -06:00
parent 116793710f
commit 6358f5f199
110 changed files with 4484 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
using Azure.Security.KeyVault.Secrets;
using Core.Blueprint.DAL.Infrastructure.Contracts;
using Core.Blueprint.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.Blueprint.DAL.Infrastructure.Repository
{
public class SecretRepository : ISecretRepository
{
private readonly SecretClient _client;
public SecretRepository(SecretClient client)
{
_client = client;
}
public async Task<Secret> GetSecret(string secretName, CancellationToken cancellationToken)
{
var ret = await _client.GetSecretAsync(secretName, cancellationToken: cancellationToken);
return new Secret() { Value = ret.Value?.Value };
}
public async Task SetSecret(string secretName, string secretValue, CancellationToken cancellationToken)
{
await _client.SetSecretAsync(new KeyVaultSecret(secretName, secretValue), cancellationToken: cancellationToken);
}
public async Task RemoveSecret(string secretName, CancellationToken cancellationToken)
{
await _client.StartDeleteSecretAsync(secretName, cancellationToken: cancellationToken);
}
}
}