Skip to Content
API referenceSIWX ReactSrcComponentsisSessionMatchingTarget()

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


isSessionMatchingTarget()

isSessionMatchingTarget(session, targetAddress, targetChainId?): boolean

Defined in: packages/siwx-core/dist/index.d.ts:322

Validates whether a SIWX session matches a target wallet address and optional chainId. Handles EVM case-insensitivity, Solana case-sensitivity, and CAIP-10/CAIP-2 normalization.

Parameters

session

SiwxSessionLike | null | undefined

Active SIWX session or parsed message

targetAddress

string

Target account address (plain or CAIP-10)

targetChainId?

string | number

Target chain reference or CAIP-2 identifier

Returns

boolean

True if the session matches the target address and chainId; false otherwise.

Example

const isValid = isSessionMatchingTarget(session, '0x123...', 1);
Last updated on