Spaces:
Runtime error
Runtime error
File size: 954 Bytes
c020c98 8830402 c020c98 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import { BetterSqlite3Adapter } from "@lucia-auth/adapter-sqlite";
import { Lucia,TimeSpan } from "lucia";
import { getDB } from "./db.js";
import dotenv from "dotenv";
dotenv.config();
const db = getDB();
const adapter = new BetterSqlite3Adapter(db,{user:"users",session:"sessions"});
export const lucia = new Lucia(adapter, {
sessionExpiresIn:new TimeSpan(10000,"m"),
sessionCookie: {
// expires:false,
attributes: {
// set to `true` when using HTTPS
// secure: process.env.NODE_ENV === "production"
secure: true,
sameSite: "none",
}
},
getUserAttributes:(attributes)=>{
return {
username:attributes.username,
};
}
})
declare module "lucia" {
interface Register {
Lucia:typeof lucia;
DatabaseUserAttributes: RegisteredDatabaseUserAttributes;
}
}
interface DatabaseUserAttributes{
username:string;
} |