Skip to Content
API referenceSIWX ReactSrcInterfacesUseSiwxSignInOptions

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


UseSiwxSignInOptions

Defined in: packages/siwx-react/src/hooks.ts:15 

Options for the useSiwx hook’s signIn function.

Properties

fields

fields: Omit<SiwxMessageFields, "version" | "nonce" | "issuedAt"> & object

Defined in: packages/siwx-react/src/hooks.ts:39 

The fields to build the CAIP-122 message with. nonce and issuedAt are auto-generated if not provided.

Type Declaration

issuedAt?

optional issuedAt?: string

nonce?

optional nonce?: string


onError?

optional onError?: (error) => void

Defined in: packages/siwx-react/src/hooks.ts:56 

Optional callback triggered if signing or verification fails.

Parameters

error

string

The error message string.

Returns

void


onSuccess?

optional onSuccess?: (session) => void

Defined in: packages/siwx-react/src/hooks.ts:49 

Optional callback triggered immediately after successful authentication.

Parameters

session

SiwxClientSession

The authenticated client session object.

Returns

void


signer

signer: (message) => Promise<string>

Defined in: packages/siwx-react/src/hooks.ts:23 

A function that accepts the formatted CAIP-122 message string and returns the signature. This is where you integrate with your wallet connector (e.g., satellite, wagmi, gill).

Parameters

message

string

The formatted CAIP-122 message ready for signing.

Returns

Promise<string>

A promise resolving to the hex/base58-encoded signature string.


verifier

verifier: (payload) => Promise<SiwxClientSession | null>

Defined in: packages/siwx-react/src/hooks.ts:33 

A function that submits the { message, signature } payload to your backend for verification and issues a session (cookie/JWT). The function should return the parsed session on success.

Parameters

payload

The message and signature to submit.

message

string

signature

string

Returns

Promise<SiwxClientSession | null>

A promise resolving to the session, or throwing/returning null on failure.

Last updated on