9 lines · 368 B
import { env } from "cloudflare:workers";
import { encryptSecret } from "./crypto";
import { badRequest } from "./errors";

export async function encryptRepoSecret(value: string): Promise<{ ciphertext: string; iv: string }> {
  if (!env.SECRETS_KEY) throw badRequest("SECRETS_KEY is not configured on this instance");
  return encryptSecret(env.SECRETS_KEY, value);
}