SSX Server API Reference

Home > @spruceid/ssx-server

ssx-server package



SSX-Server is a server-side library made to work with the SSX client libraries. SSX-Server is the base class that takes in a configuration object and works with various middleware libraries to add authentication and metrics to your server.



Enum of supported networks for Alchemy.

Enum of supported networks for Ankr.

Enum of supported networks for Etherscan.

Available SSX Log Types.

Enum of supported networks for Infura.

Enum of supported networks for Pocket.

Enum of supported EthersJS providers.



Configuration interface for cookies issued by ssx-server

ENS data supported by SSX.

ENS options supported by SSX.

Allowed fields for an SSX Log.

Configuration interface for ssx-server

SSX web3 configuration settings.

Server endpoints configuration.

SSX Session Store configuration settings



Type-Guard for SSXAnkrProvider.

Type-Guard for SSXCustomProvider.

Type-Guard for SSXPocketProvider.

This middleware function can be used to protect an Express route with SSX authentication. It will check for ssx.verified and if it is set, the route will be allowed to proceed. If it is not set, the route will redirect or return a 401 Unauthorized response, based on the value of the redirect property.

This middleware function has two key functions: 1. It provides 3 endpoints for the client to hit: /ssx-nonce, /ssx-login, and /ssx-logout. These endpoints are used to authenticate the SIWE message and issue sessions. 2. It provides a middleware function that can be used to authenticate session. The middleware then exposes the authenticated session's data via the req.ssx property.

This middleware function does the following: 1. Checks for a ssx-session cookie and if it exists, it will manage and set the session on the request object. 2. Adds a ssx field to the request object with SSX authentication information in the object. 3. It adds a nonce, login, and logout route to the server

This function returns another function that can take an event listen as a parameter and calls it with the updated request object if none of the ssx routes are hit.

Type Aliases

Type AliasDescription

Alchemy provider settings.

Ankr provider settings.

Cloudflare provider settings.

Custom provider settings.

Etherscan provider settings.

SSX Express Session Store Provider settings.

Generic provider settings.

Infura provider settings.

Infura provider project settings.

SSX Metrics Provider settings.

Pocket provider settings.

SSX Redis Session Store Provider settings.

Supported provider types.

Last updated