bb-plane-fork/live/src/ce/lib/authentication.ts
Aaryan Khandelwal 5840b40d96
[WEB-1116] chore: live server code splitting (#5508)
* chore: live server code splitting

* chore: update import paths

* chore: update bebel path alias

* fix: document types type

* chore: updated error messages
2024-09-03 17:03:50 +05:30

17 lines
No EOL
528 B
TypeScript

import { ConnectionConfiguration } from "@hocuspocus/server";
// types
import { TDocumentTypes } from "@/core/types/common.js";
type TArgs = {
connection: ConnectionConfiguration
cookie: string | undefined;
params: URLSearchParams;
}
export const authenticateUser = (args: TArgs): Promise<void> => {
const { params } = args;
const documentType = params.get("documentType")?.toString() as
| TDocumentTypes
| undefined;
throw Error(`Authentication failed: Invalid document type ${documentType} provided.`);
}