Skip to Content
API referenceSIWX ServerSrcComponentsgetSiwxServerSession()

API Reference — @tuwaio/siwx (CAIP-122 Authentication Layer)


getSiwxServerSession()

getSiwxServerSession(options): Promise<SiwxSession | null>

Defined in: packages/siwx-server/src/server.ts:434 

Resolves and verifies an active SIWX session strictly on the server side. Supports both durable session stores and stateless HMAC-signed demo cookies.

Parameters

options

GetSiwxServerSessionOptions

Configuration including cookieSource, sessionStore or signingSecret, and optional policy.

Returns

Promise<SiwxSession | null>

The verified SiwxSession object, or null if invalid, expired, or absent.

Example

// In Next.js Server Actions: import { cookies } from 'next/headers'; import { getSiwxServerSession } from '@tuwaio/siwx-server'; import { sessionStore } from '@/lib/authStores'; const session = await getSiwxServerSession({ cookieSource: await cookies(), sessionStore, });
Last updated on