Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 1x 1x 3x 3x 3x 1x 1x 3x 3x 3x 3x 3x 3x 3x 2x 2x 3x 3x 3x 3x 3x 3x 2x 1x 1x 1x 1x | import { apiClient } from './config'
import { isTauri, invokeCommand } from './utils'
import type { Secret } from '@/types/generated/Secret'
import { API_ENDPOINTS } from '@/constants'
// List all secrets (returns keys only, not values)
export async function listSecrets(): Promise<Secret[]> {
if (isTauri()) {
return invokeCommand<Secret[]>('list_secrets')
}
const response = await apiClient.get<Secret[]>(API_ENDPOINTS.SECRET.LIST)
return response.data
}
export async function createSecret(key: string, value: string, description?: string): Promise<Secret> {
if (isTauri()) {
return invokeCommand<Secret>('create_secret', { key, value, description })
}
const response = await apiClient.post<Secret>(API_ENDPOINTS.SECRET.CREATE, {
key,
value,
description
})
return response.data
}
export async function updateSecret(key: string, value: string, description?: string): Promise<void> {
if (isTauri()) {
await invokeCommand('update_secret', { key, value, description })
return
}
await apiClient.put(API_ENDPOINTS.SECRET.UPDATE(key), {
value,
description
})
}
export async function deleteSecret(key: string): Promise<void> {
if (isTauri()) {
await invokeCommand('delete_secret', { key })
return
}
await apiClient.delete(API_ENDPOINTS.SECRET.DELETE(key))
} |