This commit is contained in:
@@ -69,9 +69,27 @@ export interface EmailSettings {
|
||||
use_tls: boolean;
|
||||
}
|
||||
|
||||
export interface SecretsSettings {
|
||||
read_token_set: boolean;
|
||||
rotated_at?: string;
|
||||
}
|
||||
|
||||
export interface Settings {
|
||||
alerts: AlertSettings;
|
||||
email: EmailSettings;
|
||||
secrets: SecretsSettings;
|
||||
}
|
||||
|
||||
export interface SecretGroupSummary {
|
||||
group: string;
|
||||
key_count: number;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface Secret {
|
||||
group: string;
|
||||
key: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface NewServerResponse {
|
||||
@@ -191,6 +209,50 @@ export const api = {
|
||||
});
|
||||
},
|
||||
|
||||
rotateSecretsToken(): Promise<{ token: string }> {
|
||||
return request<{ token: string }>("/settings/secrets-token", { method: "POST" });
|
||||
},
|
||||
|
||||
// Secrets
|
||||
listSecretGroups(): Promise<SecretGroupSummary[]> {
|
||||
return request<SecretGroupSummary[]>("/secrets");
|
||||
},
|
||||
|
||||
createSecretGroup(group: string, values: Record<string, string>): Promise<{ group: string }> {
|
||||
return request<{ group: string }>("/secrets", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ group, values }),
|
||||
});
|
||||
},
|
||||
|
||||
getSecretGroup(group: string): Promise<{ group: string; secrets: Secret[] }> {
|
||||
return request<{ group: string; secrets: Secret[] }>(`/secrets/${encodeURIComponent(group)}`);
|
||||
},
|
||||
|
||||
putSecrets(group: string, values: Record<string, string>): Promise<{ saved: boolean }> {
|
||||
return request<{ saved: boolean }>(`/secrets/${encodeURIComponent(group)}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(values),
|
||||
});
|
||||
},
|
||||
|
||||
revealSecret(group: string, key: string): Promise<{ value: string }> {
|
||||
return request<{ value: string }>(`/secrets/${encodeURIComponent(group)}/reveal`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ key }),
|
||||
});
|
||||
},
|
||||
|
||||
deleteSecret(group: string, key: string): Promise<void> {
|
||||
return request<void>(`/secrets/${encodeURIComponent(group)}/${encodeURIComponent(key)}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
},
|
||||
|
||||
deleteSecretGroup(group: string): Promise<void> {
|
||||
return request<void>(`/secrets/${encodeURIComponent(group)}`, { method: "DELETE" });
|
||||
},
|
||||
|
||||
// Keys
|
||||
listKeys(): Promise<Key[]> {
|
||||
return request<Key[]>("/keys");
|
||||
|
||||
Reference in New Issue
Block a user