datasquirel/users/user-auth.d.ts
Benjamin Toby 7bd4b2fe65 Updates
2024-12-08 09:58:57 +01:00

37 lines
1.7 KiB
TypeScript

export = userAuth;
/**
* Authenticate User from request
* ==============================================================================
* @description This Function takes in a request object and returns a user object
* with the user's data
*
* @param {Object} params - Arg
* @param {http.IncomingMessage & Object<string, any>} [params.request] - Http request object
* @param {http.IncomingMessage & Object<string, any>} [params.req] - Http request object
* @param {string} [params.encryptedUserString] - Encrypted user string to use instead of getting from cookie header
* @param {string} [params.encryptionKey] - Encryption Key: alt env: DSQL_ENCRYPTION_PASSWORD
* @param {string} [params.encryptionSalt] - Encryption Salt: alt env: DSQL_ENCRYPTION_SALT
* @param {("deep" | "normal")} [params.level] - Optional. "Deep" value indicates an extra layer of security
* @param {string} [params.database] - Database Name (slug)
* @param {string | number} [params.dsqlUserId] - alt env: DSQL_API_USER_ID
* @param {number} [params.expiry] - Expiry time in milliseconds
*
* @returns { import("../package-shared/types").AuthenticatedUser }
*/
declare function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, dsqlUserId, encryptedUserString, expiry, }: {
request?: http.IncomingMessage & {
[x: string]: any;
};
req?: http.IncomingMessage & {
[x: string]: any;
};
encryptedUserString?: string;
encryptionKey?: string;
encryptionSalt?: string;
level?: ("deep" | "normal");
database?: string;
dsqlUserId?: string | number;
expiry?: number;
}): import("../package-shared/types").AuthenticatedUser;
import http = require("http");