ssxserver

Home > @spruceid/ssx-serverless > SSXServer

SSXServer class

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 to add authentication and metrics to your server.

Signature:

export declare class SSXServer 

Constructors

ConstructorModifiersDescription

Constructs a new instance of the SSXServer class

Properties

PropertyModifiersTypeDescription

() => string

Generates a nonce for use in the SSX client libraries. Nonce is a random string that is used to prevent replay attacks. Wraps the generateNonce function from the SIWE library.

(getNonceOpts?: { sessionKey?: any; generateUpdateValue?: (nonce: string) => any; generateCreateValue?: (nonce: string) => any; createOpts?: Record<string, any>; updateOpts?: Record<string, any>; }) => Promise<{ nonce: string; dbResult: any; }>

Generates a nonce and stores it in the current session if a sessionKey is provided or creates a new one if not.

(data: SSXLogFields) => Promise<boolean>

Registers a new event to the API.

(sessionKey: any, getSSXDataFromSession?: (session: any) => SSXSessionData) => Promise<SSXSessionData>

Returns the SSXSessionData if a the session still exists and is valid.

ethers.providers.BaseProvider

EthersJS provider.

(address: string, resolveEnsOpts?: SSXEnsResolveOptions) => Promise<SSXEnsData>

ENS data supported by SSX.

Definition of CRUD functions for sessions.

(siwe: Partial<SiweMessage> | string, signature: string, sessionKey: any, signInOpts: { daoLogin?: boolean; resolveEnsDomain?: boolean; resolveEnsAvatar?: boolean; retrieveOpts?: Record<string, any>; generateUpdateValue?: (sessionData: SSXSessionData) => any; updateOpts?: Record<string, any>; }) => Promise<SSXSessionData>

Verifies the SIWE message, signature, and nonce for a sign-in request. If the message is verified, a session token is generated and returned.

<T>(sessionKey: any, deleteOpts?: Record<string, any>) => Promise<T>

Calls the delete function to delete the user's session.

Last updated