diff --git a/src/lib/server/services/bootstrap-challenge.ts b/src/lib/server/services/bootstrap-challenge.ts index ba95aeb..ae88a79 100644 --- a/src/lib/server/services/bootstrap-challenge.ts +++ b/src/lib/server/services/bootstrap-challenge.ts @@ -1,6 +1,6 @@ import { createHash } from "node:crypto"; -export const NEW_CLIENT_BOOTSTRAP_DIFFICULTY = 4; +export const NEW_CLIENT_BOOTSTRAP_DIFFICULTY = 5; export function createBootstrapBinding(input: { tenantId: string; diff --git a/src/routes/api/tenants/[id]/appointments/[appointmentId]/+server.ts b/src/routes/api/tenants/[id]/appointments/[appointmentId]/+server.ts index 507e1ea..db25a0a 100644 --- a/src/routes/api/tenants/[id]/appointments/[appointmentId]/+server.ts +++ b/src/routes/api/tenants/[id]/appointments/[appointmentId]/+server.ts @@ -1,12 +1,6 @@ import { json } from "@sveltejs/kit"; import { AppointmentService } from "$lib/server/services/appointment-service"; -import { - BackendError, - InternalError, - logError, - NotFoundError, - ValidationError, -} from "$lib/server/utils/errors"; +import { BackendError, InternalError, logError, ValidationError } from "$lib/server/utils/errors"; import type { RequestHandler } from "@sveltejs/kit"; import { registerOpenAPIRoute } from "$lib/server/openapi"; import logger from "$lib/logger"; diff --git a/src/routes/api/tenants/[id]/appointments/bootstrap-challenge/__tests__/bootstrap-challenge-api.test.ts b/src/routes/api/tenants/[id]/appointments/bootstrap-challenge/__tests__/bootstrap-challenge-api.test.ts index 78399fe..472003f 100644 --- a/src/routes/api/tenants/[id]/appointments/bootstrap-challenge/__tests__/bootstrap-challenge-api.test.ts +++ b/src/routes/api/tenants/[id]/appointments/bootstrap-challenge/__tests__/bootstrap-challenge-api.test.ts @@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import type { RequestEvent } from "@sveltejs/kit"; import { POST } from "../+server"; +import { NEW_CLIENT_BOOTSTRAP_DIFFICULTY } from "$lib/server/services/bootstrap-challenge"; vi.mock("$lib/logger", () => ({ logger: { @@ -60,7 +61,7 @@ describe("Bootstrap Challenge API", () => { expect(response.status).toBe(200); expect(data.challengeId).toBeTypeOf("string"); expect(data.nonce).toBeTypeOf("string"); - expect(data.difficulty).toBe(4); + expect(data.difficulty).toBe(NEW_CLIENT_BOOTSTRAP_DIFFICULTY); expect(challengeStore.store).toHaveBeenCalledOnce(); }); diff --git a/src/routes/api/tenants/[id]/appointments/bootstrap-verify/__tests__/bootstrap-verify-api.test.ts b/src/routes/api/tenants/[id]/appointments/bootstrap-verify/__tests__/bootstrap-verify-api.test.ts index 51b07f0..1fdf287 100644 --- a/src/routes/api/tenants/[id]/appointments/bootstrap-verify/__tests__/bootstrap-verify-api.test.ts +++ b/src/routes/api/tenants/[id]/appointments/bootstrap-verify/__tests__/bootstrap-verify-api.test.ts @@ -2,7 +2,10 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import type { RequestEvent } from "@sveltejs/kit"; import { POST } from "../+server"; -import { createBootstrapPowDigest } from "$lib/server/services/bootstrap-challenge"; +import { + createBootstrapPowDigest, + NEW_CLIENT_BOOTSTRAP_DIFFICULTY, +} from "$lib/server/services/bootstrap-challenge"; vi.mock("$lib/logger", () => ({ logger: { @@ -70,7 +73,7 @@ describe("Bootstrap Verify API", () => { counter, }); - if (digest.startsWith("0000")) { + if (digest.startsWith("0".repeat(NEW_CLIENT_BOOTSTRAP_DIFFICULTY))) { return counter; } }