@formancy/server 0.11.0 → 0.12.0

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.
@@ -267,17 +267,18 @@ async function accessRoutes(app, { deps, requires, audit }) {
267
267
  error: "invalid_access",
268
268
  message: "allowedOrigins must be an array of strings, or absent for no allowlist."
269
269
  });
270
+ const allowed = origins;
270
271
  if (!(await setFormAccess(deps, {
271
272
  path,
272
273
  submit,
273
- ...origins === void 0 ? {} : { allowedOrigins: origins }
274
+ ...allowed === void 0 ? {} : { allowedOrigins: allowed }
274
275
  })).ok) return reply.code(404).send({ error: "unknown_form" });
275
276
  await audit(request, {
276
277
  action: "form.access.changed",
277
278
  subject: path,
278
279
  detail: {
279
280
  submit,
280
- allowedOrigins: origins === void 0 ? "unchanged" : origins.join(" ")
281
+ allowedOrigins: allowed === void 0 ? "unchanged" : allowed.join(" ")
281
282
  }
282
283
  });
283
284
  return reply.code(204).send();
@@ -508,7 +509,7 @@ async function submissionRoutes(app, { deps, challengeSecret, limit, actorOf })
508
509
  if (challengeSecret === void 0) return reply.code(404).send({ error: "challenge_not_enabled" });
509
510
  const { path } = request.params;
510
511
  if (await deps.storage.getFormByPath(path) === void 0) return reply.code(404).send({ error: "unknown_form" });
511
- return reply.send(await mintChallenge({
512
+ return reply.send(mintChallenge({
512
513
  secret: challengeSecret,
513
514
  nowSeconds: Math.floor(new Date(deps.nowIso()).getTime() / 1e3)
514
515
  }));
@@ -587,7 +588,7 @@ async function checkChallenge(deps, challengeSecret, request) {
587
588
  message: "The challenge header is not base64 JSON."
588
589
  };
589
590
  const nowSeconds = Math.floor(new Date(deps.nowIso()).getTime() / 1e3);
590
- const verified = await verifySolution(challengeSecret, solution, nowSeconds);
591
+ const verified = verifySolution(challengeSecret, solution, nowSeconds);
591
592
  if (!verified.ok) return {
592
593
  error: `challenge_${verified.reason}`,
593
594
  message: "The challenge was not solved. Ask for a new one and try again."
@@ -2419,4 +2420,4 @@ function createCompleter(settings, fetch) {
2419
2420
  //#endregion
2420
2421
  export { SUBMISSION_TOKEN_HEADER as _, createLocalFileStore as a, createPostgresStorage as c, LOG_LEVELS as d, createServerLog as f, SCHEMA_HASH_HEADER as g, maxFileBytesFrom as h, startFileCollector as i, bootstrapSchema as l, workerLog as m, MODEL_PROVIDERS as n, sha256 as o, databaseNotices as p, modelSettings as r, createPostgresRateLimitStore as s, createCompleter as t, createApp as u };
2421
2422
 
2422
- //# sourceMappingURL=completers-Cjn4y1ZH.mjs.map
2423
+ //# sourceMappingURL=completers-DWLA1A-r.mjs.map