mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-10-01 13:14:50 +02:00
Changed difficulty from 4 to 5.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
+2
-1
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
+5
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user