Skip to main content

Built and signed on GitHub Actions

A collection of useful utilities for Byteminds PH

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (0.1.4)
function createAndSetSession
createAndSetSession(
lucia: Lucia,
userId: string,
cookies: Cookies,
): Promise<void>

Creates a new session for a user and sets the session cookie in the provided cookies object.

Examples

import type { Actions, PageServerLoad } from "./$types"; import { lucia } from "$lib/server/auth"; import * as mod from "@jhenbert/byteminds-util";

export const actions: Actions = { login: async ({ request, url, cookies }) => {

//some of your code

await mod.luciaCreateAndSetSession(lucia, existingUser.id, cookies); },

Parameters

lucia: Lucia
  • An instance of the Lucia authentication library.
userId: string
  • The unique identifier of the user for whom the session is being created.
cookies: Cookies
  • An object representing the cookies to be set in the HTTP response.

Return Type

Promise<void>
  • A promise that resolves when the session and cookie have been successfully created and set.

Add Package

deno add jsr:@jhenbert/byteminds-util

Import symbol

import { createAndSetSession } from "@jhenbert/byteminds-util";

---- OR ----

Import directly with a jsr specifier

import { createAndSetSession } from "jsr:@jhenbert/byteminds-util";

Add Package

npx jsr add @jhenbert/byteminds-util

Import symbol

import { createAndSetSession } from "@jhenbert/byteminds-util";

Add Package

yarn dlx jsr add @jhenbert/byteminds-util

Import symbol

import { createAndSetSession } from "@jhenbert/byteminds-util";

Add Package

pnpm dlx jsr add @jhenbert/byteminds-util

Import symbol

import { createAndSetSession } from "@jhenbert/byteminds-util";

Add Package

bunx jsr add @jhenbert/byteminds-util

Import symbol

import { createAndSetSession } from "@jhenbert/byteminds-util";