chore(backend): добавить поддержку ACME и управление сертификатами

This commit is contained in:
Denozordec committed 2026-05-12 20:00:25 +07:00
1 parent bfceb07a23
commit d62d212c86
21 files changed
+2183 -301

No files matched your search

+27
View File
@@ -431,6 +431,33 @@ export class MikrotikClient {
return this.post<Array<Record<string, string>>>("/tool/bandwidth-test", body, 30_000)
}
async getCertificates(): Promise<Array<Record<string, string | undefined>>> {
const raw = await this.get<unknown>("/certificate")
if (!Array.isArray(raw)) return []
return raw.filter((row): row is Record<string, string | undefined> => row != null && typeof row === "object")
}
async uploadTextFile(fileName: string, contents: string, timeoutMs = 30_000): Promise<void> {
await this.post("/file", { name: fileName, contents }, timeoutMs)
}
async importCertificate(params: {
fileName: string
name: string
trusted?: boolean
trustStore?: string
passphrase?: string
}): Promise<unknown> {
const body: Record<string, string> = {
"file-name": params.fileName,
name: params.name,
trusted: params.trusted === false ? "no" : "yes",
}
if (params.trustStore?.trim()) body["trust-store"] = params.trustStore.trim()
if (params.passphrase?.trim()) body.passphrase = params.passphrase.trim()
return this.post("/certificate/import", body, 60_000)
}
async exportConfigScript(): Promise<string> {
const raw = await this.post<unknown>("/console/export", {}, 30_000)