ssxserver

Home > @spruceid/ssx-server > 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 and works with various middleware libraries to add authentication and metrics to your server.

Signature:

export declare class SSXServer extends EventEmitter 

Extends: EventEmitter

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.

() => SessionOptions

Gets Express Session config params to configure the session.

(data: SSXLogFields) => Promise<boolean>

Registers a new event to the API

(siwe: Partial<SiweMessage> | string, signature: string, daoLogin: boolean, resolveEns: boolean | SSXEnsResolveOptions, nonce: string) => Promise<{ success: boolean; error: SiweError; session: Partial<SessionData>; }>

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

(destroySession?: () => Promise<any>) => Promise<boolean>

Logs out the user by deleting the session. Currently this is a no-op.

ethers.providers.BaseProvider

EthersJS provider.

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

ENS data supported by SSX.

RequestHandler

Session is a configured instance of express-session middleware.

Last updated