diff --git a/server/api/v1/client/http/chunk.get.ts b/server/api/v1/client/http/chunk.get.ts deleted file mode 100644 index be3618e..0000000 --- a/server/api/v1/client/http/chunk.get.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineClientEventHandler } from "~/server/internal/clients/event-handler"; - -export default defineClientEventHandler(async (h3) => { - const query = getQuery(h3); - - const gameId = query.game; - const versionName = query.version; - const chunkId = query.chunk; -}); diff --git a/server/api/v1/client/http/fetch.get.ts b/server/api/v1/client/http/fetch.get.ts deleted file mode 100644 index 812cf1b..0000000 --- a/server/api/v1/client/http/fetch.get.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineClientEventHandler } from "~/server/internal/clients/event-handler"; - -export default defineClientEventHandler(async (h3) => { - const query = getQuery(h3); - const clientId = query.id?.toString(); - if (!clientId) - throw createError({ - statusCode: 400, - statusMessage: "Missing id in query", - }); - - const certificate = await h3.context.ca.fetchClientCertificate(clientId); - if (!certificate) { - // Either it doesn't exist or it's blacklisted - throw createError({ - statusCode: 401, - statusMessage: "Invalid or blacklisted clientId", - }); - } - - return { - certificate: certificate.cert, - }; -}); diff --git a/server/api/v1/client/metadata/endpoints.get.ts b/server/api/v1/client/metadata/endpoints.get.ts deleted file mode 100644 index 781dbfd..0000000 --- a/server/api/v1/client/metadata/endpoints.get.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { defineClientEventHandler } from "~/server/internal/clients/event-handler"; - -export default defineClientEventHandler(async (h3) => { - -}); \ No newline at end of file diff --git a/server/internal/clients/store.ts b/server/internal/clients/store.ts deleted file mode 100644 index 483108a..0000000 --- a/server/internal/clients/store.ts +++ /dev/null @@ -1,35 +0,0 @@ -import path from "path"; -import fs from "fs"; -import { CertificateBundle } from "./ca"; - -export type CertificateStore = { - store(name: string, data: CertificateBundle): Promise; - fetch(name: string): Promise; - blacklistCertificate(name: string): Promise; - checkBlacklistCertificate(name: string): Promise; -}; - -export const fsCertificateStore = (base: string) => { - const blacklist = path.join(base, ".blacklist"); - fs.mkdirSync(blacklist, { recursive: true }); - const store: CertificateStore = { - async store(name: string, data: CertificateBundle) { - const filepath = path.join(base, name); - fs.writeFileSync(filepath, JSON.stringify(data)); - }, - async fetch(name: string) { - const filepath = path.join(base, name); - if (!fs.existsSync(filepath)) return undefined; - return JSON.parse(fs.readFileSync(filepath, "utf-8")); - }, - async blacklistCertificate(name: string) { - const filepath = path.join(blacklist, name); - fs.writeFileSync(filepath, Buffer.from([])); - }, - async checkBlacklistCertificate(name: string): Promise { - const filepath = path.join(blacklist, name); - return fs.existsSync(filepath); - }, - }; - return store; -};