Socket
Socket
Sign inDemoInstall

@spruceid/ssx-server

Package Overview
Dependencies
146
Maintainers
8
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @spruceid/ssx-server

SSX Server is a server-side library made to work with the SSX client libraries. SSX-Server provides authentication and session management, which can be enabled via an ExpressJS middleware or using the methods provided on the SSXServer class.


Version published
Weekly downloads
15
increased by15.38%
Maintainers
8
Created
Weekly downloads
 

Readme

Source

ssx-server

SSX Server is a server-side library made to work with the SSX client libraries. SSX-Server provides authentication and session management, which can be enabled via an ExpressJS middleware or using the methods provided on the SSXServer class.

Full documentation for the SSX-Server SDK can be found at docs.ssx.id.

Quickstart

You can add SSX to your server from npm:

yarn add @spruceid/ssx-server
# or
npm install @spruceid/ssx-server
# or
pnpm add @spruceid/ssx-server

Note: Looking for SSX support for other servers besides Express? Check out Configuring SSX on other Servers.

On your server, you'll need to create an instance of ssx-server and pass it to an Express middleware layer, as seen below. ssx-server doesn't require configuration parameters to use, however it's recommended to have the following variables set:

import express from 'express';
import { SSXServer, SSXExpressMiddleware } from '@spruceid/ssx-server';

const ssx = new SSXServer({
  signingKey: process.env.SSX_SIGNING_KEY,
  provider: {
    rpc: {
      service: 'infura',
      network: 'homestead',
      apiKey: process.env.INFURA_API_KEY ?? '',
    },
    metrics: {
      service: 'ssx',
      apiKey: process.env.SSX_API_TOKEN ?? '',
    },
  },
});

const app = express();

app.use(SSXExpressMiddleware(ssx));
app.listen(3001, () => {
  console.log(`⚡️[server]: Server is running at http://localhost:${3001}`);
});

FAQs

Last updated on 08 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc