9 lines
476 B
TypeScript
9 lines
476 B
TypeScript
import crypto from "node:crypto";
|
|
import type { WebhookConfig } from "../config.js";
|
|
import type { PromptSession } from "./prompt.js";
|
|
|
|
export async function configureGenericWebhook(prompt: PromptSession, existing: WebhookConfig): Promise<WebhookConfig> {
|
|
const answer = await prompt.askSecret("Webhook secret (leave blank to generate)", Boolean(existing.secret));
|
|
return { type: "webhook", secret: answer || existing.secret || crypto.randomBytes(24).toString("hex") };
|
|
}
|