From 55df2275991779910a7d1503dbc05b3f4b97615e Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 21 Jan 2026 11:04:43 +0100 Subject: [PATCH] Added Documentation for the API Key authentication system --- documentation.md | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/documentation.md b/documentation.md index f4a7d13..15f8bee 100644 --- a/documentation.md +++ b/documentation.md @@ -5,7 +5,8 @@ 2. [How it works](#how-it-works) 3. [Modules](#modules) 4. [IPC](#ipc) -5. [UI](#ui) +5. [Authentication](#authentication) +6. [UI](#ui) ## How to run the Software If you read the readme file, you will see the basic setup command in order to run the program. @@ -18,13 +19,9 @@ Next up you need to set up the .env file. The file must contain your keys for the modules you want to use. The .env file looks like this: ``` -ASSEMBLYAI_API_KEY=wefhjhjakeghjkahejkghjkaegh -GOOGLE_API_KEY=wefhjhjakeghjkahejkghjkaegh -SAIA_API_KEY=wefhjhjakeghjkahejkghjkaegh +auth_username=wefhjhjakeghjkahejkghjkaegh +auth_password=wefhjhjakeghjkahejkghjkaegh ``` -Note that if you write your module in the same format we did, then you will only need to supply the api keys to the individual services you will actually use. -If you dont want to use Assembly AI, you can for example just leave this row out of your .env, and the program will just work fine. -Only issue will be that it will throw an error if you do run the Assembly AI module anyways. Once that is done, you can run the command `npm start` to actually start the program. Alternatively you can double click the start.bat if you are on Windows for example. @@ -116,6 +113,43 @@ As for the rest of the fields, they are pretty self explanatory except `document This is the minimum required setup for the currently implemented pipeline to work. You can always add fields to it, but dont remove the ones from above. +## Authentication +Our Software uses a custom API key management System. +This system itself is proprietary, and will as such not be delivered with the software. +The way it works is simply via a HTTP request. +In the current version, the main reads the username and password for authentication from the .env file, and then uses these in the header for the HTTP request. +``` + hostname: "keyserver.dommymommy.xyz", // The URL to the key server + port: 443, // The Port of the + path: "/v1/auth", // The API Endpoint + method: "GET", + headers: { + "Content-Type": "application/json", // The content type should be JSON + "username": un, // the Username used to authenticate + "password": pw // The password used to authenticate + } +``` +### The Important bit of this whole setup +Once the HTTP request is made, it will return a JSON object with the API keys as fields. +One such output could look like this: +```json +{ + "ASSEMBLYAI_API_KEY": "eajgjkhgahghahegoikh", + "GOOGLE_API_KEY": "eajgjkhgahghahegoikh", + "SAIA_API_KEY": "eajgjkhgahghahegoikh" +} +``` +The key for each entry is being used to store the key in memory. +Specifically under `process.env` +So, if everything in this request worked out, we will have: +```js +process.env.ASSEMBLYAI_API_KEY +process.env.GOOGLE_API_KEY +process.env.SAIA_API_KEY +``` +These variables are accessible anywhere in the code and contain the API Keys, so make sure you dont add some untrusted modules that could steal these API Keys. + + ## UI The UI has a simple, self-explanatory design, in white and blue. For easy handling and understanding, the UI is using 6 steps to guide the user through the process and offers a help page