Skip to main content
Reown Docs

SIWX Custom Usage

1 min read

The Sign In With X feature enables decentralized applications to authenticate users seamlessly across multiple blockchain networks, such as Ethereum, Polygon or Solana. The user can connect and then sign a message with their account to prove ownership of the account.

SIWX Custom Implementation#

SIWX is developed to work as a plugin system for AppKit and to enable correctly it you need to fulfill the expected interface within the createAppKit function.

SIWXConfig interface#

This is the interface that you need to implement to create your own SIWX feature.

All the typings used are exposed by @reown/appkit-react-native package. You may check the source code here.

Full Detailed Interfaces

Constraints#

You are able to implement the SIWXConfig in the way you would like, but some constraints MUST be followed to make sure that AppKit can interact with it correctly and it will work as expected:

createMessage#

This method will be called to create a new message to be signed by the user.

  • The message MUST be unique and contain all the necessary information to verify the user's identity.

addSession#

This method will be called to store a new single session.

  • This method MUST verify if the session is valid and store it in the storage successfully.

revokeSession#

This method will be called to revoke all the sessions stored for a specific chain and address.

  • This method MUST delete all the sessions stored for the specific chain and address successfully.

setSessions#

This method will be called to replace all the sessions in the storage with the new ones.

  • This method MUST verify all the sessions before storing them in the storage;
  • This method MUST replace all the sessions in the storage with the new ones successfully otherwise it MUST throw an error.

getSessions#

This method will be called to get all the sessions stored for a specific chain and address.

  • This method MUST return only sessions that are verified and valid;
  • This method MUST NOT return expired sessions.

Example#

Here is an example of how you can implement use your SIWXConfig interface: