Added enterprise key prefix to SecretId for better distinction

This commit is contained in:
Thorsten Sommer 2026-02-07 18:02:39 +01:00
parent c985858894
commit cb6ab7a116
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
4 changed files with 13 additions and 6 deletions

View File

@ -43,7 +43,7 @@ public sealed record EmbeddingProvider(
/// <inheritdoc />
[JsonIgnore]
public string SecretId => this.Id;
public string SecretId => this.IsEnterpriseConfiguration ? $"{ISecretId.ENTERPRISE_KEY_PREFIX}::{this.UsedLLMProvider.ToName()}" : this.UsedLLMProvider.ToName();
/// <inheritdoc />
[JsonIgnore]
@ -124,7 +124,7 @@ public sealed record EmbeddingProvider(
{
// Queue the API key for storage in the OS keyring:
PendingEnterpriseApiKeys.Add(new(
id.ToString(),
$"{ISecretId.ENTERPRISE_KEY_PREFIX}::{usedLLMProvider.ToName()}",
name,
decryptedApiKey,
SecretStoreType.EMBEDDING_PROVIDER));

View File

@ -71,7 +71,7 @@ public sealed record Provider(
/// <inheritdoc />
[JsonIgnore]
public string SecretId => this.Id;
public string SecretId => this.IsEnterpriseConfiguration ? $"{ISecretId.ENTERPRISE_KEY_PREFIX}::{this.UsedLLMProvider.ToName()}" : this.UsedLLMProvider.ToName();
/// <inheritdoc />
[JsonIgnore]
@ -181,7 +181,7 @@ public sealed record Provider(
{
// Queue the API key for storage in the OS keyring:
PendingEnterpriseApiKeys.Add(new(
id.ToString(),
$"{ISecretId.ENTERPRISE_KEY_PREFIX}::{usedLLMProvider.ToName()}",
instanceName,
decryptedApiKey,
SecretStoreType.LLM_PROVIDER));

View File

@ -43,7 +43,7 @@ public sealed record TranscriptionProvider(
/// <inheritdoc />
[JsonIgnore]
public string SecretId => this.Id;
public string SecretId => this.IsEnterpriseConfiguration ? $"{ISecretId.ENTERPRISE_KEY_PREFIX}::{this.UsedLLMProvider.ToName()}" : this.UsedLLMProvider.ToName();
/// <inheritdoc />
[JsonIgnore]
@ -124,7 +124,7 @@ public sealed record TranscriptionProvider(
{
// Queue the API key for storage in the OS keyring:
PendingEnterpriseApiKeys.Add(new(
id.ToString(),
$"{ISecretId.ENTERPRISE_KEY_PREFIX}::{usedLLMProvider.ToName()}",
name,
decryptedApiKey,
SecretStoreType.TRANSCRIPTION_PROVIDER));

View File

@ -5,6 +5,13 @@ namespace AIStudio.Tools;
/// </summary>
public interface ISecretId
{
/// <summary>
/// Prefix used for secrets imported from enterprise configuration plugins.
/// This helps distinguish enterprise-managed keys from user-added keys
/// in the OS keyring.
/// </summary>
public const string ENTERPRISE_KEY_PREFIX = "config-plugin";
/// <summary>
/// The unique ID of the secret.
/// </summary>