39 lines
1.8 KiB
TypeScript
39 lines
1.8 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.cookieString]
|
|
* @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, cookieString, }: {
|
|
request?: http.IncomingMessage & {
|
|
[x: string]: any;
|
|
};
|
|
req?: http.IncomingMessage & {
|
|
[x: string]: any;
|
|
};
|
|
cookieString?: string;
|
|
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");
|