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

View File

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

View File

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

View File

@ -5,6 +5,13 @@ namespace AIStudio.Tools;
/// </summary> /// </summary>
public interface ISecretId 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> /// <summary>
/// The unique ID of the secret. /// The unique ID of the secret.
/// </summary> /// </summary>