@odla-ai/chapter 0.43.0 → 0.43.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4465,6 +4465,13 @@ async function startGiftIntent(db, input) {
4465
4465
  };
4466
4466
  }
4467
4467
 
4468
+ // src/stripe-webhook-secret.ts
4469
+ async function resolveStripeWebhookSecret(db, runtime) {
4470
+ const scoped = await getVaultSecret(db, stripeWebhookSecretName(runtime));
4471
+ if (scoped || !runtime) return scoped;
4472
+ return getVaultSecret(db, "stripe_webhook_secret");
4473
+ }
4474
+
4468
4475
  // src/payments-route-support.ts
4469
4476
  var paymentErrorCode = (error) => error && typeof error === "object" && typeof error.code === "string" ? error.code : "unknown";
4470
4477
  function paymentLineItems(group) {
@@ -4673,7 +4680,7 @@ async function startSubscription(req, env, ctx) {
4673
4680
  }
4674
4681
  async function ingestWebhook(req, env, ctx) {
4675
4682
  const db = ctx.makeDb(env);
4676
- const webhookSecret = await getVaultSecret(db, stripeWebhookSecretName(env.ODLA_RUNTIME));
4683
+ const webhookSecret = await resolveStripeWebhookSecret(db, env.ODLA_RUNTIME);
4677
4684
  if (!webhookSecret) return json({ error: "webhook not configured" }, 503);
4678
4685
  const rawBody = await req.text();
4679
4686
  const ingest = await createStripeProvider({ webhookSecret }).ingestWebhook(rawBody, req.headers.get("stripe-signature") ?? "");
@@ -7127,9 +7134,10 @@ async function verifySource(req, db, ctx) {
7127
7134
  return null;
7128
7135
  }
7129
7136
  var handleBuilderLibraryControl = async (req, url, env, ctx) => {
7130
- if (req.method !== "POST" || url.pathname !== BUILDER_LIBRARY_CONTROL_PATH) return null;
7137
+ if (url.pathname !== BUILDER_LIBRARY_CONTROL_PATH) return null;
7131
7138
  const settings = ctx.chapter.builderLibrary;
7132
7139
  if (!settings) return json({ error: "not found" }, 404);
7140
+ if (req.method !== "POST") return json({ error: "unauthorized" }, 401);
7133
7141
  const db = ctx.makeDb(env);
7134
7142
  const verified = await verifySource(req, db, ctx);
7135
7143
  if (!verified) return json({ error: "unauthorized" }, 401);