/** * SSH Keys API Client */ import { apiClient } from './serverClient'; export interface SSHKeyResponse { has_key: boolean; public_key?: string; fingerprint?: string; } export interface SSHKeyGenerateResponse { public_key: string; fingerprint?: string; message: string; } export interface SSHKeyTestRequest { repo_url: string; } export interface SSHKeyTestResponse { success: boolean; message: string; output?: string; } /** * 生成新的SSH密钥对 */ export const generateSSHKey = async (): Promise => { const response = await apiClient.post('/ssh-keys/generate'); return response.data; }; /** * 获取当前用户的SSH公钥 */ export const getSSHKey = async (): Promise => { const response = await apiClient.get('/ssh-keys/'); return response.data; }; /** * 删除SSH密钥 */ export const deleteSSHKey = async (): Promise<{ message: string }> => { const response = await apiClient.delete<{ message: string }>('/ssh-keys/'); return response.data; }; /** * 测试SSH密钥 */ export const testSSHKey = async (repoUrl: string): Promise => { const response = await apiClient.post('/ssh-keys/test', { repo_url: repoUrl }); return response.data; };