datasquirel/users/user-auth.d.ts

37 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-11-08 15:44:31 +00:00
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
2024-12-08 08:58:57 +00:00
* @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
2024-11-08 15:44:31 +00:00
* @param {("deep" | "normal")} [params.level] - Optional. "Deep" value indicates an extra layer of security
2024-12-08 08:58:57 +00:00
* @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
2024-11-08 15:44:31 +00:00
*
* @returns { import("../package-shared/types").AuthenticatedUser }
*/
2024-12-08 08:58:57 +00:00
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;
2024-11-08 15:44:31 +00:00
level?: ("deep" | "normal");
2024-12-08 08:58:57 +00:00
database?: string;
dsqlUserId?: string | number;
expiry?: number;
2024-11-08 15:44:31 +00:00
}): import("../package-shared/types").AuthenticatedUser;
import http = require("http");