aboutsummaryrefslogtreecommitdiff
path: root/docker/crupest-api/CrupestApi/CrupestApi.Secrets/ISecretsService.cs
blob: b5de43655039c3600f401b9ab92950bf9dada642 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
namespace CrupestApi.Secrets;

public interface ISecretsService
{
    Task<SecretInfo?> GetSecretAsync(string secret);

    Task<List<SecretInfo>> GetSecretListAsync(bool includeExpired = false, bool includeRevoked = false);

    Task<List<SecretInfo>> GetSecretListByKeyAsync(string key, bool includeExpired = false, bool includeRevoked = false);

    Task VerifySecretAsync(string? key, string? secret);

    // Check if "secret" query param exists and is only one. Then check the secret is valid for given key.
    // If check fails, will throw a VerifySecretException with proper message that can be send to client.
    Task VerifySecretForHttpRequestAsync(HttpRequest request, string? key = null, string queryKey = "secret");

    Task<SecretInfo> CreateSecretAsync(string key, string description, DateTime? expireTime = null);

    Task RevokeSecretAsync(string secret);

    // Throw SecretNotExistException if request secret does not exist.
    Task<SecretInfo> ModifySecretAsync(string secret, SecretModifyRequest modifyRequest);
}