Interfaces
These types can be imported from lucia.
import type { Adapter } from "lucia";
Adapter#
See Database adapter API.
Auth#
See Auth.
AuthRequest#
See AuthRequest.
Configuration#
See configuration.
Cookie#
type Cookie = {
	name: string;
	value: string;
	attributes: CookieAttributes;
	serialize: () => string;
};
Properties#
| property | type | description | 
|---|---|---|
name | string | Cookie name | 
value | string | Cookie value | 
attributes | CookieAttributes | Cookie attributes | 
type CookieAttributes = Partial<{
	domain: string;
	encode: (value: string) => string;
	expires: Date;
	httpOnly: boolean;
	maxAge: number;
	path: string;
	priority: "low" | "medium" | "high";
	sameSite: true | false | "lax" | "strict" | "none";
	secure: boolean;
}>;
serialize()#
Serializes the cookie into a Set-Cookie HTTP response header value.
const serialize: () => string;
Env#
type Env = "DEV" | "PROD";
InitializeAdapter#
type InitializeAdapter<_Adapter> => (LuciaError: LuciaErrorConstructor) => _Adapter
Key#
type Key = {
	userId: string;
	providerId: string;
	providerUserId: string;
	passwordDefined: boolean;
};
Properties#
| name | type | description | 
|---|---|---|
providerId | string | Provider id | 
providerUserId | string | Provider user id | 
userId | string | User id of linked user | 
passwordDefined | boolean | true if holds a password | 
KeySchema#
type KeySchema = {
	id: string;
	hashed_password: string | null;
	user_id: string;
};
LuciaErrorConstructor#
Constructor for LuciaError.
const LuciaErrorConstructor: (message: string) => LuciaError;
LuciaRequest#
type LuciaRequest = {
	method: string;
	url: string;
	headers: {
		origin: string | null;
		cookie: string | null;
		authorization: string | null;
	};
	storedSessionCookie?: string | null;
};
Properties#
Optional property storedSessionCookie is for frameworks with APIs to directly read and set cookies.
| property | type | optional | description | 
|---|---|---|---|
method | string | Request url (case insensitive) | |
url | string | Full request url (e.g. http://localhost:3000/pathname) | |
headers.origin | string | null | Origin header value | |
headers.cookie | string | null | Cookie header value | |
headers.authorization | string | null | Authorization header value | |
storedSessionCookie | string | null | ✓ | Session cookie value | 
Middleware#
See Middleware API.
RequestContext#
See Middleware API.
Session#
type Session = {
	user: User;
	sessionId: string;
	activePeriodExpiresAt: Date;
	idlePeriodExpiresAt: Date;
	state: "idle" | "active";
	fresh: boolean;
} & ReturnType<_Configuration["getSessionAttributes"]>;
Properties#
ReturnType<_Configuration["getSessionAttributes"]> represents the return type of getSessionAttributes() configuration.
| name | type | description | 
|---|---|---|
activePeriodExpiresAt | Date | Time of the active period expiration | 
idlePeriodExpiresAt | Date | Time of the idle period expiration | 
fresh | boolean | true if the session was newly created or reset | 
sessionId | string | Session id | 
state | "active" | "idle" | Session state | 
user | User | User of the session | 
SessionAdapter#
See Database adapter API.
SessionSchema#
type SessionSchema = {
	id: string;
	active_expires: number;
	idle_expires: number;
	user_id: string;
} & Lucia.DatabaseSessionAttributes;
User#
type User = {
	userId: string;
} & ReturnType<_Configuration["getUserAttributes"]>;
Properties#
ReturnType<_Configuration["getUserAttributes"]> represents the return type of getUserAttributes() configuration.
| name | type | description | 
|---|---|---|
userId | string | User id | 
UserAdapter#
See Database adapter API.
UserSchema#
type UserSchema = {
	id: string;
} & Lucia.DatabaseUserAttributes;