@withstudiocms/auth-kit
Version:
Utilities for managing authentication
23 lines (22 loc) • 961 B
TypeScript
import { Effect } from '@withstudiocms/effect';
import type { SessionConfig } from '../types.js';
/**
* The default configuration for user sessions.
*
* @remarks
* - `expTime` sets the session expiration time in milliseconds (default: 14 days).
* - `cookieName` specifies the name of the cookie used to store the session.
*
* @example
* // Use the default session configuration
* app.useSession(defaultSessionConfig);
*/
export declare const defaultSessionConfig: SessionConfig;
/**
* Generates a session ID by hashing the provided token using SHA-256 and encoding it in hexadecimal format.
*/
export declare const makeSessionId: (token: string) => Effect.Effect.AsEffect<Effect.Effect<string, import("../errors.js").SessionError, never>>;
/**
* Generates a new expiration date for a session.
*/
export declare const makeExpirationDate: (expTime: number) => Effect.Effect.AsEffect<Effect.Effect<Date, import("../errors.js").SessionError, never>>;