Skip to Content

verifyStatelessDemoSession()

verifyStatelessDemoSession(token, secret, policy?): Promise<SiwxSession | null>

Defined in: siwx-server/src/server.ts:210 

Verifies a token created by signStatelessDemoSession: checks the HMAC signature with Web Crypto, the token version and mode, and its expiry (with policy.clockSkewSeconds, 60 seconds by default).

Only expectedDomain and allowedChainIds (exact match) of the policy are applied; other policy fields are ignored because they were checked when the token was issued.

Parameters

token

string | null | undefined

The token from the session cookie.

secret

string

The secret the token was signed with.

policy?

SiwxVerificationPolicy

Optional policy to check against the token.

Returns

Promise<SiwxSession | null>

The session, or null if the token is missing, malformed, tampered, expired or rejected by the policy. Never throws.

Last updated on