namespace StellaOps.Scanner.Sources.Services;
///
/// Credential types supported by the resolver.
///
public enum CredentialType
{
None,
BearerToken,
BasicAuth,
SshKey,
AwsCredentials,
GcpServiceAccount,
AzureServicePrincipal,
GitHubApp
}
///
/// Resolved credential from the credential store.
///
public sealed record ResolvedCredential
{
public required CredentialType Type { get; init; }
public string? Token { get; init; }
public string? Username { get; init; }
public string? Password { get; init; }
public string? PrivateKey { get; init; }
public string? Passphrase { get; init; }
public IReadOnlyDictionary? Properties { get; init; }
public DateTimeOffset? ExpiresAt { get; init; }
}
///
/// Interface for resolving credentials from the credential store.
/// Credentials are stored externally and referenced by AuthRef.
///
public interface ICredentialResolver
{
///
/// Resolves credentials by AuthRef.
///
/// Reference to the credential in the store (e.g., "vault://secrets/registry-auth")
/// Cancellation token
/// Resolved credential or null if not found
Task ResolveAsync(string authRef, CancellationToken ct = default);
///
/// Checks if a credential reference is valid (exists and is accessible).
///
Task ValidateRefAsync(string authRef, CancellationToken ct = default);
}